/************************************************************************/
/* Copyright 1992 MBARI							*/
/************************************************************************/
/* $Header: alarm.h,v 2.2 96/05/15 11:15:25 bobh Exp $			*/
/* Summary  : Include file for managing alarms in New ROV User Interface*/
/* Filename : alarm.h							*/
/* Author   : Bob Herlien (rah)						*/
/* Project  : New ROV							*/
/* $Revision: 2.2 $							*/
/* Created  : 11/07/92							*/
/************************************************************************/
/* Need to include "rov.h" before this include file			*/
/************************************************************************/

#ifndef INCalarmh
#define INCalarmh	1

#define MAX_ALARMS	10		/* Max number of alarm dialogs	*/

typedef MBool	(*BoolFuncPtr)();	/* Ptr to function returning MBool*/
#define NULLBF	((BoolFuncPtr)0)	/* Null BoolFuncPtr		*/
#define NULLAD	((alarmDialogStruct *)0)
#define NULLA	((alarmStruct *)0)
#define NULLACB	((alarmCallback *)0)

#define NUM_MOTOR_STATUS	8
#define NUM_IBC_ALARMS		3
#define NUM_GF_ALARMS		4
#define NUM_GF_TEST_ALARMS	3
#define NUM_GF_5V_TEST_ALARMS	4

typedef struct alarm_callback		/********************************/
{					/* Struct for Alarm Callback List*/
    struct alarm_callback *cb_next;	/* Link field for linked list	*/
    FuncPtr		cb_func;	/* Function to call		*/
    XtPointer		cb_data;	/* Client data			*/
} alarmCallback;			/********************************/

typedef struct				/********************************/
{					/* Describes each Dialog Widget	*/
    Widget		widget;		/* Dialog on the screen		*/
    struct alarm_struct	*alarm;		/* DM Alarm it's being used for	*/
} alarmDialogStruct;			/********************************/

typedef struct alarm_struct		/********************************/
{					/* Describes each possbl DM alarm*/
    struct alarm_struct *next;		/* For linked list		*/
    DM_Item		dmitem;		/* Data Manager Item ID		*/
    DWord		dmGroupBit;	/* Group ID Bit			*/
    Int32		dmValue;	/* Value of DM Item		*/
    char		*status;	/* String for current value	*/
    alarmDialogStruct	*dialog;	/* Dialog on the screen		*/
    MBool		silence;	/* Don't display dialog any more*/
} alarmStruct;				/********************************/

typedef struct				/********************************/
{					/* Can Descriptor for Alarms	*/
    char	*canDmName;		/* DM prefixe for can		*/
    char	*canAlarmName;		/* List of message strings prefixes*/
} alarmCan;				/********************************/

typedef struct				/********************************/
{					/* Alarm Item Descriptor	*/
    char	*dmName;		/* Name of DM item		*/
    char	*alarmString;		/* Message string		*/
    DM_Type	dmType;			/* Type of DM Item		*/
    BoolFuncPtr	alarmFunc;		/* Function to return alarm status*/
    Nat32	alarmParm;		/* Parm to pass to function	*/
} alarmItem;				/********************************/

typedef struct				/********************************/
{					/* Descriptor for DM Alarm Group*/
    alarmStruct	*alarms;		/* alarmStruct list		*/
    alarmCan	*alarmCans;		/* Cans to create alarms for	*/
    Nat32	nCanNames;		/* Number of cans		*/
    alarmItem	*alarmItems;		/* Alarm items			*/
    Nat32	nAlarmItems;		/* Number of alarmItems		*/
    DM_Group	groupId;		/* DMGroup ID			*/
    DWord	alarmsOn;		/* Alarm Bit vector		*/
    MBool	usePwrName;		/* TRUE to add "POWER."		*/
} alarmDesc;				/********************************/

#endif /* INCalarmh */
