/************************************************************************/
/* Copyright 1992 MBARI							*/
/************************************************************************/
/* $Header: rov.h,v 2.2 96/05/15 11:15:22 bobh Exp $			*/
/* Summary  : Include file for New ROV User Interface			*/
/* Filename : rov.h							*/
/* Author   : Bob Herlien (rah)						*/
/* Project  : New ROV							*/
/* $Revision: 2.2 $							*/
/* Created  : 05/04/92							*/
/************************************************************************/
/* Modification History:						*/
/* $Log:	rov.h,v $
 * Revision 2.2  96/05/15  11:15:22  11:15:22  bobh (Bob Herlien)
 * Still supporting proto during final vehicle build
 * 
 * Revision 1.8  94/08/19  17:20:12  17:20:12  hebo (Bob Herlien)
 * Interface to Unix version of Data Manager
 * 
 * Revision 1.7  94/03/21  14:15:07  14:15:07  hebo (Bob Herlien)
 * Misc bug fixes and enhancements
 * 
 * Revision 1.6  93/12/17  15:04:41  15:04:41  hebo (Bob Herlien)
 * December Wet Test
 * 
 * Revision 1.5  93/07/08  18:10:44  18:10:44  hebo (Bob Herlien)
 * Prior to Prototype Phase I testing
 * 
 * Revision 1.4  93/05/27  15:47:50  15:47:50  hebo (Bob Herlien)
 * Data Manager Interface
 * 
*/
/* 04mar92, rah, created						*/
/************************************************************************/

#ifndef INCrovh
#define INCrovh		1

#include "rdmif.h"

/* Debug Flags		*/
#define DBL_CLICK	1		/* Double click pwr switch for diags*/
#define PWR_DEBUG	2		/* Debug Power screen without HW*/
#define SILENCE_ALARMS	4		/* Silence all alarms at startup*/

#define PRINT_MALLOC_STATS	FALSE	/* TRUE to print stats on malloc()*/

typedef unsigned long	TimeOut;	/* Time in milliseconds		*/
typedef void	(*FuncPtr)();		/* Function pointer		*/

#ifndef STATUS
typedef int	STATUS;			/* VxWorks STATUS type		*/
#endif

#define NULLF	((FuncPtr)0)		/* NULL Function pointer	*/
#define NULLW	((Widget)0)		/* NULL Widget			*/
#define NULLWP	((Widget *)0)		/* NULL Widget ptr		*/
#define NULLR	((rovItem *)0)		/* NULL rovItem	ptr		*/
#define NULLSS	((SelectStatus *)0)	/* NULL SelectStatus ptr	*/

typedef struct				/*************************************/
{					/* Struct to hold App-wide resources**/
    char	*datamgr;		/* File name of Data Manager executabl*/
    TimeOut	vehicle_update;		/* Update rate for misc vehicle stuff*/
    TimeOut	alarm_update;		/* Update rate for misc vehicle stuff*/
    TimeOut	power_update;		/* Update rate for power levels      */
    TimeOut	pwrsetup_update;	/* Update rate for power setup dialog*/
    TimeOut	ibc_update;		/* Update rate for motors & IBCs     */
    TimeOut	graph_update;		/* Update rate for DM graphing	     */
    TimeOut	misc_update;		/* Scan rate for misc stuff	     */
    char	*dm_logdir;		/* Directory to log DM Items to	     */
    Position	alarm_xpos;		/* X Position of alarm popups	     */
    Position	alarm_ypos;		/* Y Position of alarm popups	     */
    Position	alarm_xinc;		/* X Increment for subsequent alarms */
    Position	alarm_yinc;		/* Y Increment for subsequent alarms */
    Pixel	select_bg;		/* Bg color for active screen button */
    Pixel	select_fg;		/* Fg color for active screen button */
    Pixel	alarmon_fg;		/* Fg color for alarm list when on   */
    Pixel	alarmon_bg;		/* Bg color for alarm list when on   */
    Pixel	connect_fg;		/* Fg color for DM connect list bad  */
    Pixel	connect_bg;		/* Bg color for DM connect list bad  */
    Pixel	pwron_bg;		/* Background color for pwr button on*/
    Pixel	pwron_fg;		/* Foreground color for pwr button on*/
    Pixel	pwroff_bg;		/* Backgnd color for pwr button off  */
    Pixel	pwroff_fg;		/* Foregnd color for pwr button off  */
    Pixel	nopwr_bg;		/* Bg color for unpowered pwr button */
    Pixel	nopwr_fg;		/* Fg color for unpowered pwr button */
    Pixel	pwrerr_bg;		/* Bg color for tripped pwr button   */
    Pixel	pwrerr_fg;		/* Fg color for tripped pwr button   */
    Pixel	joystick_warning;	/* State bg color for joystick gain  */
    Pixel	gf_current_bg;		/* Bg color for most recent gf current*/
    DWord	debug;			/* Debug flags			     */
    Boolean	ring_bell;		/* True to ring bell on alarm	     */
    char	*alarm_file;		/* File name of alarm log file	     */
    Boolean	log_alarms;		/* True to log alarms		     */
    Pixel	stateOK;		/* Bg color for State LED in OK state*/
    Pixel	stateBad;		/* Bg color for LED in dead state    */
    Pixel	inWater;		/* Bg color for Deploy LED in water  */
    Pixel	outOfWater;		/* Bg color for Deploy LED out of H20*/
    Pixel	releaseArmColor;	/* Bg color for release button armed */ 
    Pixel	pwrLimitColor;		/* Bar background color for pwr limit*/
} AppData, *AppDataPtr;			/*************************************/

typedef struct				/********************************/
{					/* Struct to describe DM Item	*/
    char	*dmname;		/* Data Mgr name		*/
    DM_Type	dmtype;			/* Type of Data Mgr item	*/
    DM_Num	dm_nels;		/* No. elements of type dmtype	*/
    MBool	consume_always;		/* FALSE to stop_cnsm on screen sw*/
    DM_Item	dmitem;			/* Data Manager item ID		*/
    Nat32	value;			/* Last value read		*/
    Widget	*widget;		/* Ptr to widget to update	*/
    Void	(*update)();		/* Update routine - read & display*/
    DWord	grpbit;			/* Group ID bit			*/
} rovItem;				/*********************************/

typedef struct				/********************************/
{					/* Struct to select a display screen*/
    Widget	last_button;		/* Last button depressed	*/
    Pixel	unselect_bg;		/* Background color for unselect*/
    Pixel	unselect_fg;		/* Foreground color for unselect*/
    struct sel_struct	*current;	/* Currently selected button	*/
} SelectStatus;				/*********************************/

typedef struct sel_struct		/********************************/
{					/* Struct to select a display screen*/
    void	(*select)();		/* Func to call when selecting	*/
    void	(*unselect)();		/* Func to call when unselecting*/
    Widget	*display;		/* Display widget to manage	*/
    SelectStatus *status;		/* SelectStatus for this screen	*/
    SelectStatus *subscreen;		/* Ptr to next level of Select	*/
    XtPointer	ptr1;			/* Misc pointer, app dependent	*/
    XtPointer	ptr2;			/* Misc pointer, app dependent	*/
} Select;				/*********************************/

typedef struct				/********************************/
{					/* Struct for XtTimerCallback	*/
    TimeOut	*timeout;		/* Timeout interval to update scr*/
    XtIntervalId tmoutId;		/* Timout ID from XtAppAddTimeout*/
    rovItem	**items;		/* Ptr to list of rovItem ptrs	*/
    DM_Group	grpId;			/* DM Group for rovItems	*/
    char	*idStr;			/* Screen Ident String		*/
    FuncPtr	extraFunc;		/* Additional function to call	*/
} TimeoutStruct;			/*********************************/

typedef union				/********************************/
{					/* Union for all types		*/
    Byte	c;			/* char or unsigned char	*/
    Nat16	nat16;			/* Nat16			*/
    Int16	int16;			/* Int16			*/
    Nat32	nat32;			/* Nat32			*/
    Int32	int32;			/* Int32			*/
    MBool	mbool;			/* MBool			*/
    Flt32	flt32;			/* Flt32			*/
    Flt64	flt64;			/* Flt64			*/
    char	*ptr;			/* Generic pointer		*/
} TypeUnion;				/********************************/

#endif /* INCrovh */
