/* ----------------------------------------------------------------------- */ 
/* DeviceMessages.h                                                        */ 
/*                                                                         */ 
/* ----------------------------------------------------------------------- */ 
/*                                                                         */ 
/* (c) Copyright 1998 - 2001, 2003, 2005, 2007  EdgeTech Inc               */ 
/*                                                                         */ 
/* This file contains proprietary information, and trade secrets of        */ 
/* EdgeTech, and may not be disclosed or reproduced without the prior      */ 
/* written consent of EdgeTech.                                            */ 
/*                                                                         */ 
/* EdgeTech is not responsible for the consequences of the use or misuse   */ 
/* of this software, even if they result from defects in it.               */ 
/*                                                                         */ 
/* Messages for controlling attached devices                               */ 
/* ----------------------------------------------------------------------- */ 

#ifndef __DEVICE_MESSAGES_H__
#define __DEVICE_MESSAGES_H__


/* ----------------------------------------------------------------------- */ 
/* includes                                                                */ 
/* ----------------------------------------------------------------------- */ 

#include "SonarMessages.h"
#include "Subsystem.h"
#include "timestamp.h"


/* ----------------------------------------------------------------------- */ 
/* defines                                                                 */ 
/* ----------------------------------------------------------------------- */ 

#define NUM_ANALOG_IO_CHANNELS                (8)


/* ----------------------------------------------------------------------- */ 
/* A list of device messages                                               */ 
/* ----------------------------------------------------------------------- */ 

typedef enum
{
  /* Note: Use SONAR_MESSAGE_DATA_NETWORK, SONAR_MESSAGE_DATA_DISK to     */ 
  /* enable / disable data output on a device.                            */ 

  /* -------------------------------------------------------------------- */ 
  /* A Serial Port allows the reading and writing of data to a port.      */ 
  /* -------------------------------------------------------------------- */ 

  /* Read or write bytes of (raw) data to the port (DEVDataType)          */ 
  DEV_SERIAL_DATA = MESSAGE_OFFSET_DEV,

  /* Receives baud rate, etc - eg (DEVSerialParametersType)               */ 
  DEV_SERIAL_PARAMETERS,

  /* -------------------------------------------------------------------- */ 
  /* NMEA Data                                                            */ 
  /* -------------------------------------------------------------------- */ 

  /* Validated RS232 Data from a NMEA Source.                             */ 
  /* Format is the same as serial port data DEV_SERIAL_DATA (DEVDataType) */ 
  /* Each message is a single NMEA string excluding the <CR>/<LF>         */ 
  DEV_SERIAL_NMEA_DATA,

  /* Serial Break - (DEVDataType)                                         */ 
  DEV_SERIAL_BREAK,

  /* -------------------------------------------------------------------- */ 
  /* Generic device control - reserved for future expansion.              */ 
  /* -------------------------------------------------------------------- */ 

  /* Read or write bytes of data to the port (DEVDeviceDataType)          */ 
  DEV_DEVICE_DATA = MESSAGE_OFFSET_DEV_GENERIC,

  /* Receives device parameters.  Size is specific to device subsystem.   */ 
  DEV_DEVICE_PARAMETERS,

  /* Send a special command to the device (SonarMessageLongType)          */ 
  DEV_DEVICE_COMMAND,

  /* -------------------------------------------------------------------- */ 
  /* Special device messages                                              */ 
  /* -------------------------------------------------------------------- */ 
  /* A Pitch Roll Sensor Can Profile:                                     */ 
  /*   3 axis accelerometers,                                             */ 
  /*   3 axis rate gyros,                                                 */ 
  /*   Pitch, Roll                                                        */ 
  /*   Heave                                                              */ 
  /*   Heading                                                            */ 
  /* It is a serial device.                                               */ 
  /* -------------------------------------------------------------------- */ 

  /* Sends data of type (DEVDataType + PitchRollDataType)                 */ 
  DEV_PITCHROLL_DATA = MESSAGE_OFFSET_DEV_PITCHROLL,

  /* Calibrate Sensor.                                                    */ 
  /* Currently only the Crossbow DMU6 Pitch Roll uses to Calibrate its    */ 
  /*   Rate Gyros                                                         */ 
  DEV_PITCHROLL_CALIBRATE,

  /* Receives baud rate, etc. - e.g. (DeviceDMU6ParametersType)           */ 
  /* This is a special message which is retained for backward             */ 
  /* compatibility.  Not recommended for new systems.                     */ 
  DEV_PITCHROLL_DMU6_PARAMETERS,

  /* -------------------------------------------------------------------- */ 
  /* Low rate analog IO messages                                          */ 
  /* -------------------------------------------------------------------- */ 
  /* This is misc analog sampled data.  Not generally used.               */ 
  /* -------------------------------------------------------------------- */ 

  /* Sends data of type (DEVDataType + AnalogIOItemType) on a get         */ 
  DEV_ANALOGIO_DATA = MESSAGE_OFFSET_DEV_ANALOGIO,

  /* Set parameters for analog IO data (DeviceAnalogIOParametersType)     */ 
  DEV_ANALOGIO_PARAMETERS,

  /* Sends the Analog IO configuration information on a get               */ 
  /* (DEVAnalogIOConfigurationType)                                       */ 
  DEV_ANALOGIO_CONFIGURATION,

  /* -------------------------------------------------------------------- */ 
  /* A Pressure sensor reads pressure and optionally temp / salinity.     */ 
  /* -------------------------------------------------------------------- */ 

  /* Sends data of type (DEVDataType + DEVPressureType)                   */ 
  DEV_PRESSURE_DATA = MESSAGE_OFFSET_DEV_PRESSURE,

  /* Set the zero point of a pressure sensor.  This will cause the current*/ 
  /* reading to be set to 14.7 PSI after calibration, provided that the   */ 
  /* correction value is within a reasonable range (max correction is     */ 
  /* +- 14.7).  All data is corrected with this value and the correction  */ 
  /* value is saved in a reference file.  The message header channel      */ 
  /* is used to specify the specific sensor to calibrate and must be valid*/ 
  /* The subsystem should be set to DEVICE_SUBSYSTEM_SERIAL_PARSED        */ 
  /* A SONAR_COMMAND_SET accepts no parameters.                           */ 
  DEV_PRESSURE_ZERO,

  /* -------------------------------------------------------------------- */ 
  /* Altitude sensor                                                      */ 
  /* -------------------------------------------------------------------- */ 

  /* Altitude readings.  The message header is followed by                */ 
  /* (DEVDataType + DEVAltitudeType)                                      */ 
  DEV_ALTITUDE_DATA = MESSAGE_OFFSET_DEV_ALTITUDE,

  /* -------------------------------------------------------------------- */ 
  /* Dopler Velocity Log                                                  */ 
  /* -------------------------------------------------------------------- */ 

  /* DVL readings.  The message header is followed by                     */ 
  /* (DEVDataType + DEVDVLType)                                           */ 

  DEV_DVL_DATA = MESSAGE_OFFSET_DEV_DVL,

  /* -------------------------------------------------------------------- */ 
  /* Vehicle situation messages                                           */ 
  /* -------------------------------------------------------------------- */ 

  /* comprehensive situation message (DEVDataType + DEVSituationType)     */ 
  DEV_SITUATION_COMPREHENSIVE = MESSAGE_OFFSET_DEV_SITUATION,

  /* -------------------------------------------------------------------- */ 
  /* Cable counter messages                                               */ 
  /* -------------------------------------------------------------------- */ 

  
  /* Cable counter readings. (DEVDataType + DevCableCounterType)          */ 

  DEV_CABLE_COUNTER_DATA = MESSAGE_OFFSET_DEV_CABLEDEVS,

  /* -------------------------------------------------------------------- */ 
  /* Generic container messages                                           */ 
  /* -------------------------------------------------------------------- */ 

  /* Message contains an arbitrary other message, so the byte count should*/ 
  /* be exactly the size (including encapsulated header) of the contained */ 
  /* message.  This command is sent on the command socket.  The subsystem */ 
  /* and channel must be 0.  The sonarCommand field must be set to a SET  */ 
  /* or the message will be rejected / ignored.  If there is any timestamp*/ 
  /* in the message then it remains unmodified by the sonar and must be   */ 
  /* correctly stuffed to have consistent time stamp information          */ 
  SONAR_MESSAGE_CONTAINER =  MESSAGE_OFFSET_CONTAINER,

  /* When a container message is received two adjacent messages are sent  */ 
  /* to the appropriate data queues.  The first of these, is this         */ 
  /* TIMESTAMP message and the second is the contained message.  The      */ 
  /* timestamp message is the time of receipt by the sonar and is         */ 
  /* generally not used otherwise (other then to mark that the origin of  */ 
  /* the following message is external to the sonar.  This timestamp      */ 
  /* message includes only a DEVDataType structure with no data following */ 
  /* it.                                                                  */ 
  SONAR_MESSAGE_CONTAINER_TIMESTAMP,

  /* -------------------------------------------------------------------- */ 
  /* Add more device messages here                                        */ 
  /* -------------------------------------------------------------------- */ 

} DeviceMessagesType;


/* ---------------------------------------------------------------------- */ 
/* Special subsystem IDs for message headers.                             */ 
/* ---------------------------------------------------------------------- */ 

typedef enum
{
  /* Raw serial device messages                                           */ 
  /* This subsystem is used to control raw data IO.                       */ 
  DEVICE_SUBSYSTEM_SERIAL_RAW = SUBSYSTEM_OFFSET_DEVICE,

  /* Parsed Serial device messages.                                       */ 
  /* This subsystem is used to control parsed data io.                    */ 
  /* Note: The main difference between the RAW and PARSED subsystems is   */ 
  /*   that the SONAR_MESSAGE_DATA_ENABLE must be associated with the     */ 
  /*   correct subsystem number to select either / or both raw and        */ 
  /*   processed receipt of data.  Baud rate settings, etc should be sent */ 
  /*   via the raw subsystem.  Specific parser device commands, if any,   */ 
  /*   should be sent to the parsed subsystem.                            */ 
  DEVICE_SUBSYSTEM_SERIAL_PARSED,

  /* Analog IO (low rate IO) messages                                     */ 
  DEVICE_SUBSYSTEM_ANALOGIO,

} DeviceSubsystemType;


/* ---------------------------------------------------------------------- */ 
/* Understanding device data                                              */ 
/* ---------------------------------------------------------------------- */ 
/* Device data such as serial data ALWAYS consists of TWO parts:          */ 
/* 1) Overall Common Header of type DEVDataType                           */ 
/* 2) Device Specific Data (eg pitch roll readings or raw serial data)    */ 
/*                                                                        */ 
/* In addition: Device messages, as do all messages also contain a        */ 
/* standard message header.  Here are a few examples:                     */ 
/*                                                                        */ 
/* Pitch Roll: (SonarMessageHeaderType)(DEVDataType)(DEVPitchRollDataType)*/ 
/* Serial Data:(SonarMessageHeaderType)(DEVDataType)(Raw Serial Data)     */ 
/* Pressure:   (SonarMessageHeaderType)(DEVDataType)(DEVPressureType)     */ 
/* ---------------------------------------------------------------------- */ 

/* ---------------------------------------------------------------------- */ 
/* The common device header for device data being received.               */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /*  0 - 7 : Timestamp                                                   */ 
  TimestampType timestamp;    

  /* Message source: 1: Sonar, 2: ETSI, 3: Discover, 4: Sonar via a       */ 
  /* container message which follows.                                     */ 
  unsigned char messageSource;

  /* Reserved for future expansion.                                       */ 
  unsigned char reserved1;
  unsigned char reserved2[2];

  /* Begins at byte 12, This is serial port or other data.                */ 
  /* data[];                                                              */ 

} DEVDataType;


/* ---------------------------------------------------------------------- */ 
/* Parameters for a serial port                                           */ 
/* Note that .ini files are provided to set these parameters and messages */ 
/* are not normally needed to configure the ports.                        */  
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /* Parity 0: even, 1: odd, 2: none, 3: mark, 4: space                   */ 
  unsigned char  parity;

  /* Stop bits                                                            */ 
  unsigned char  stopBits;

  /* Non-zero to enable output to a topside via the network interface on  */ 
  /* the data socket.                                                     */ 
  unsigned char  enableNetworkOutput;

  /* Non-zero to enable output to a topside based RS232 port.             */ 
  unsigned char  enableTopsideSerialIO;

  /* Approximate Interval for polling port in bottle for input data in ms */ 
  unsigned short wetPortCheckInterval;

  /* Approximate Interval for polling port in topside for input data in ms*/ 
  unsigned short dryPortCheckInterval;

  /* Baud rate                                                            */ 
  unsigned long  baud;

  /* Reserved information for extended parsing of serial port data.  May  */ 
  /* be used to specify special parsing / EOL processing in the future    */ 
  /* releases.  Set to 0 for compatibility.                               */ 
  unsigned char  extendedParsingInfo;

  /* Data bits.                                                           */ 
  unsigned char  dataBits;

  /* Reserverd for future use (Round to 64 bytes).                        */ 
  unsigned char  reserved[50];

} DEVSerialParametersType;


/* ---------------------------------------------------------------------- */ 
/* Each analog IO data set is timestamped.  Up to NUM_ANALOG_IO_CHANNELS  */ 
/* values are reported.                                                   */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /* Decimation factor for reporting of analog IO data.                   */ 
  long int decimation;

} DeviceAnalogIOParametersType;


/* ---------------------------------------------------------------------- */ 
/* Analog IO channel configuration information                            */ 
/* ---------------------------------------------------------------------- */ 

/* Size of a short description                                            */ 
#define SHORT_DESCRIPTION_SIZE (20)

typedef struct
{
  /* description of the analog IO channel.                                */ 
  /* If the description is absent the channel will not contain valid data.*/ 
  SonarMessageShortStringType  description;

  /* Short description of item                                            */ 
  char shortDescription[SHORT_DESCRIPTION_SIZE];

  /* method of handling critical low threshold events.                    */ 
  /* 00 - No action required.                                             */ 
  /* 01 - Notify operator.                                                */ 
  /* 02 - Notify operator, require override to proceed.                   */ 
  /* 03 - Notify operator, shutdown sonar unless operator overrides.      */ 
  /* 04 = Notify operator, shutdown sonar immediately.                    */ 
  unsigned char                criticalityLowMethod;

  /* timeout value in seconds for critical low threshold event handling.  */ 
  /* The minimum amount of time necessary for threshold violation to be   */ 
  /* valid.                                                               */ 
  unsigned char                criticalityLowTimeout;

  /* method of handling critical high threshold events.                   */ 
  /* 00 - No action required.                                             */ 
  /* 01 - Notify operator.                                                */ 
  /* 02 - Notify operator, require override to proceed.                   */ 
  /* 03 - Notify operator, shutdown sonar unless operator overrides.      */ 
  /* 04 = Notify operator, shutdown sonar immediately.                    */ 
  unsigned char                criticalityHighMethod;

  /* timeout value in seconds for critical high threshold event handling. */ 
  /* The minimum amount of time necessary for threshold violation to be   */ 
  /* valid.                                                               */ 
  unsigned char                criticalityHighTimeout;

  /* supported device type enumerator                                     */ 
  /* 000 - Unsupported Device                                             */ 
  /* 001 - Water Teperature sensor                                        */ 
  /* 002 - Pressure sensor                                                */ 
  /* 003 - 48 Volt Power Supply sensor.                                   */ 
  /* 004 - Ambient Temperature sensor                                     */ 

  unsigned short               supportedDeviceType;

  /* base unit type enumerator                                            */ 
  /* 000 - Unknown units                                                  */ 
  /* 001 - degrees Celsius                                                */ 
  /* 002 - meters                                                         */ 
  /* 003 - pounds per square inch                                         */ 
  /* 004 - millibars                                                      */ 
  /* 005 - pascals                                                        */ 
  /* 006 - volts                                                          */ 
  /* 007 - amps                                                           */ 
  /* 008 - meters per second                                              */ 

  unsigned short               units;

  /* multiplicative gain to apply to the analog IO value.                 */ 

  float                        gain;

  /* addititve offset to apply to the analog IO value after gain applied. */ 
  float                        offset;

  /* critical low threshold value.                                        */ 
  float                        criticalLow;

  /* text associated with critical low threshold events                   */ 
  SonarMessageShortStringType  criticalLowMessage;

  /* low threshold value.                                                 */ 
  float                        warningLow;

  /* text associated with low threshold events                            */ 
  SonarMessageShortStringType  warningLowMessage;

  /* high threshold value.                                                */ 
  float                        warningHigh;

  /* text associated with high threshold events                           */ 
  SonarMessageShortStringType  warningHighMessage;

  /* critical high threshold value.                                       */ 
  float                        criticalHigh;

  /* text associated with critical high threshold events                  */ 
  SonarMessageShortStringType  criticalHighMessage;

  /* Minimum valid value.  If below the sensor is malfunctioning          */ 
  float minimumValid;

  /* Maximum valid value.  If above the sensor is malfunctioning          */ 
  float maximumValid;

  /* Include in sonar's power on self test for low rate io if non-zero    */ 
  unsigned char post;

  /* Reserved for future use                                              */ 
  unsigned char reservedChar;
  unsigned char reservedShort;

  /* reserved for future use                                              */ 
  unsigned long                reserved[7];

}  DEVAnalogIOChannelConfigurationType;


/* ---------------------------------------------------------------------- */ 
/* Analog IO configuration information                                    */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  DEVAnalogIOChannelConfigurationType  channelInfo[NUM_ANALOG_IO_CHANNELS];

}  DEVAnalogIOConfigurationType;


/* ---------------------------------------------------------------------- */ 
/* Each analog IO data set is timestamped.  Up to NUM_ANALOG_IO_CHANNELS  */ 
/* values are reported.                                                   */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /* Data for this sample                                                 */ 
  short int      data[NUM_ANALOG_IO_CHANNELS];

  /* Reserved for future use                                              */ 
  unsigned char  reserved[NUM_ANALOG_IO_CHANNELS];

} AnalogIOItemType;


/* ---------------------------------------------------------------------- */ 
/* The data structure for Crossbow DMU6 Parameters.                       */ 
/* Note that these can be set in the .ini file so no messages are required*/ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /* Calibration constant (0 - 255).  It takes approx that many seconds   */ 
  /* to calibrate the device                                              */ 
  int calFactor;

  /* Time constant (0 - 255).  Weigh the rate gyros with respect to the   */ 
  /* accelerometers for computing pitch and roll.                         */ 
  int timeConstant;

  /* Decimation factor.  Use a positive number to decimate with           */ 
  /* continuous sampling (1 => full rate of about 80 hz).  Use a negative */ 
  /* number for polled operation at that number of milliseconds per sample*/ 
  /* (-100 => 10 times per second)                                        */ 
  int decimation;

} DeviceDMU6ParametersType;


/* ---------------------------------------------------------------------- */ 
/* The data structure for Pitch roll data.                                */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /* Acceleration in x : Multiply by (20 * 1.5) / (32768) to get Gs       */ 
  short int      ax;

  /* Acceleration in y : Multiply by (20 * 1.5) / (32768) to get Gs       */ 
  short int      ay;

  /* Acceleration in x : Multiply by (20 * 1.5) / (32768) to get Gs       */ 
  short int      az;

  /* Rate Gyro in x : Multiply by (500 * 1.5) / (32768) to get Degrees/Sec*/ 
  short int      rx;

  /* Rate Gyro in y : Multiply by (500 * 1.5) / (32768) to get Degrees/Sec*/ 
  short int      ry;

  /* Rate Gyro in y : Multiply by (500 * 1.5) / (32768) to get Degrees/Sec*/ 
  short int      rz;

  /* Pitch - bow up is positive                                           */ 
  /* ((degrees / 180.0) * 32768.0) to maximize resolution                 */ 
  short int      pitch;

  /* Roll  - port up is positive                                          */ 
  /* ((degrees / 180.0) * 32768.0) to maximize resolution                 */ 
  short int      roll; 

  /* Temperature int units of 1/10 of a degree C.                         */ 
  /* Degrees C = (temperature / 10.0).                                    */ 
  /* There is difference between the original and new DMU6 (with DSP).    */ 
  /* Internally, the raw DMU6 is converted to C via the following formula */ 
  /* Old DMU6 : Degrees C = (temperature * 4 / 4096 - 1.375) / 0.0225     */ 
  /* New DMU6 : Degrees C = (temperature * 5 / 4096 - 1.375) / 0.0225     */ 
  short int      temperature;
  
  /* Device specific info.  This is device specific info provided for     */ 
  /* Diagnostic purposes.                                                 */ 
  /* For the Crossbow DMU, this is the internal counter which ticks at    */ 
  /* about 6.25 us                                                        */ 
  unsigned short devInfo;

  /* Estimated Heave in millimeters.                                      */ 
  short          heave;

  /* Heading in units of 0.01 Degrees (0..360)                            */ 
  unsigned short heading;

  /* Data valid flags:                                                    */ 
  /* Bit  0: ax                                                           */ 
  /* Bit  1: ay                                                           */ 
  /* Bit  2: az                                                           */ 
  /* Bit  3: rx                                                           */ 
  /* Bit  4: ry                                                           */ 
  /* Bit  5: rz                                                           */ 
  /* Bit  6: pitch                                                        */ 
  /* Bit  7: roll                                                         */ 
  /* Bit  8: heave                                                        */ 
  /* Bit  9: heading                                                      */ 
  /* Bit 10: temperature                                                  */ 
  /* Bit 11: devInfo                                                      */ 
  long int      flags;

  /* Reserved for future expansion.                                       */ 
  long int      reserved;

} PitchRollDataType;


/* ---------------------------------------------------------------------- */ 
/* The data structure for Pressure sensor readings.                       */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /* Pressure in PSI * 1000                                               */ 
  long int  pressure;

  /* Temperature in Degrees C * 1000.                                     */ 
  long int  temperature;

  /* Salinity in Parts Per Million.                                       */ 
  /* or PSU * 1000                                                        */ 
  long int  saltPPM;

  /* Data valid flags:                                                    */ 
  /* Bit 0: pressure                                                      */ 
  /* Bit 1: temp                                                          */ 
  /* Bit 2: saltPPM                                                       */ 
  /* Bit 3: conductivity                                                  */ 
  /* Bit 4: sound velocity                                                */ 
  long int  flags;

  /* Conductivity in micro-Siemens per cm                                 */ 
  long int  conductivity;

  /* Velocity of Sound in mm per second                                   */ 
  long      soundVelocity;

  /* Reserved for future information.                                     */ 
  long int  reserved[10];

} DEVPressureType;


/* ---------------------------------------------------------------------- */ 
/* The data structure for Dopler Velocity Log sensor readings.            */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /* Indicates which values are present.                                  */ 
  /* Bit 0 : X, Y Velocity present                                        */ 
  /* Bit 1 : 1 => Velocity in  ship coords, 0 => Earth coords.            */ 
  /* Bit 2 : Z (Vertical Velocity) present.                               */ 
  /* Bit 3 : X, Y Water Velocity present.                                 */ 
  /* Bit 4 : Z (Vertical Water Velocity) present.                         */ 
  /* Bit 5 : Distance to bottom present.                                  */ 
  /* Bit 6 : Heading present.                                             */ 
  /* Bit 7 : Pitch present.                                               */ 
  /* Bit 8 : Roll present.                                                */ 
  /* Bit 9 : Temperature present.                                         */ 
  /* Bit 10: Depth present.                                               */ 
  /* Bit 11: Salinity present.                                            */ 
  /* Bit 12: Sound velocity present.                                      */ 
  /* Bit 31: Error detected.                                              */ 
  /* rest  : Reserved, presently 0.                                       */ 
  unsigned long  flags;

  /* Distance to bottom in cm for up to 4 beams.                          */ 
  /* A 0 value indicates an invalid or non-existing reading.              */ 
  long           altitude[4];

  /* Velocity with respect to the bottom in mm / second                   */ 
  /* Positive => Starboard or East.                                       */ 
  /* -32768 indicates and invalid reading.                                */ 
  short          xVelocity;

  /* Positive => Forward or North                                         */ 
  short          yVelocity;

  /* Vertical velocity : Positive => Upward.                              */ 
  short          zVelocity;

  /* Velocity with respect to water layer in mm / second                  */ 
  short          xVelocityWater;
  short          yVelocityWater;
  short          zVelocityWater;

  /* Depth from depth sensor in deci-meters.                              */ 
  unsigned short depth;

  /* Pitch, roll -180 to 180 degrees * 100 (0.01 of a degree units)       */ 
  /* pitch - bow up is positive                                           */ 
  /* roll  - port up is positive                                          */ 
  short          pitch;
  short          roll;

  /* Heading : 0 to 360 degrees * 100 (0.01 of a degree units)            */ 
  unsigned short heading;

  /* Salinity in 1 part per thousand.                                     */ 
  unsigned short salinity;

  /* Temperature in degrees C * 100                                       */ 
  short          temperature;

  /* Velocity of Sound in meters per second                               */ 
  short          soundVelocity;

  /* Reserved for future expansion.                                       */ 
  short          reserved[7];

} DEVDVLType;

/* ---------------------------------------------------------------------- */ 
/* The data structure for Altitude sensor readings.                       */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /* Indicates which values are present.                                  */ 
  /* Bit 0 : Altitude present                                             */ 
  /* Bit 1 : Forward Velocity present.                                    */ 
  /* Bit 2 : Across Track Velocity present.                               */ 
  /* Rest  : Reserved, presently 0.                                       */ 
  long flags;

  /* Altitude in mm (or -1 if no valid reading - bottom detect failed)    */ 
  long altitude;

  /* Forward velocity in mm per second.                                   */ 
  long forwardVelocity;

  /* Cross track velocity in mm per second.                               */ 
  long crossTrackVelocity;

  /* Reserved for future expansion.                                       */ 
  long reserved[4];

} DEVAltitudeType;


/* ---------------------------------------------------------------------- */ 
/* The data structure for comprehensive situation information             */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /* validityFlags indicate which of the following fields are valid.      */ 
  /* If the corresponding bit is set the field is valid                   */ 
  /* Bit  0 : microsecondTimestamp                                        */ 
  /* Bit  1 : latitude                                                    */ 
  /* Bit  2 : longitude                                                   */ 
  /* Bit  3 : depth                                                       */ 
  /* Bit  4 : heading                                                     */ 
  /* Bit  5 : pitch                                                       */ 
  /* Bit  6 : roll                                                        */ 
  /* Bit  7 : XRelativePosition                                           */ 
  /* Bit  8 : YRelativePosition                                           */ 
  /* Bit  9 : ZRelativePosition                                           */ 
  /* Bit 10 : XVelocity                                                   */ 
  /* Bit 11 : YVelocity                                                   */ 
  /* Bit 12 : ZVelocity                                                   */ 
  /* Bit 13 : NorthVelocity                                               */ 
  /* Bit 14 : EastVelocity                                                */ 
  /* Bit 15 : downVelocity                                                */ 
  /* Bit 16 : XAngularRate                                                */ 
  /* Bit 17 : YAngularRate                                                */ 
  /* Bit 18 : ZAngularRate                                                */ 
  /* Bit 19 : XAcceleration                                               */ 
  /* Bit 20 : YAcceleration                                               */ 
  /* Bit 21 : ZAcceleration                                               */ 
  /* Bit 22 : latitudeStandardDeviation                                   */ 
  /* Bit 23 : longitudeStandardDeviation                                  */ 
  /* Bit 24 : depthStandardDeviation                                      */ 
  /* Bit 25 : headingStandardDeviation                                    */ 
  /* Bit 26 : pitchStandardDeviation                                      */ 
  /* Bit 27 : rollStandardDeviation                                       */ 
  /* Rest   : Reserved, presently 0.                                      */ 
  unsigned long int   validityFlags;

  /* Reserved for future expansion.                                       */ 
  unsigned char       reservedA[4];

  /* microsecond timestamp, us since 12:00:00 am GST, January 1, 1970     */ 
  ULARGE_INTEGER      microsecondTimestamp;  

  /* latitude in degrees, north is positive                               */ 
  double              latitude;

  /* longitude in degrees, east is positive                               */ 
  double              longitude;

  /* depth in meters                                                      */ 
  double              depth;

  /* heading in degrees                                                   */ 
  double              heading;

  /* pitch in degrees, bow up is positive                                 */ 
  double              pitch;

  /* roll in degrees, port up is positive                                 */ 
  double              roll;

  /* X, forward, relative position in meters, surge                       */ 
  double              XRelativePosition;

  /* Y, starboard, relative position in meters, sway                      */ 
  double              YRelativePosition;

  /* Z, downward, relative position in meters, heave                      */ 
  double              ZRelativePosition;

  /* X, forward, velocity in meters per second                            */ 
  double              XVelocity;

  /* Y, starboard, velocity in meters per second                          */ 
  double              YVelocity;

  /* Z, downward, velocity in meters per second                           */ 
  double              ZVelocity;

  /* North velocity in meters per second                                  */ 
  double              NorthVelocity;

  /* East velocity in meters per second                                   */ 
  double              EastVelocity;

  /* down velocity in meters per second                                   */ 
  double              downVelocity;

  /* X angular rate in degrees per second, port up is positive            */ 
  double              XAngularRate;

  /* Y angular rate in degrees per second, bow up is positive             */ 
  double              YAngularRate;

  /* Z angular rate in degrees per second, starboard is positive          */ 
  double              ZAngularRate;

  /* X, forward, acceleration in meters per second per second             */ 
  double              XAcceleration;

  /* Y, starboard, acceleration in meters per second per second           */ 
  double              YAcceleration;

  /* Z, downward, acceleration in meters per second per second            */ 
  double              ZAcceleration;

  /* latitude standard deviation in meters                                */ 
  double              latitudeStandardDeviation;

  /* longitude standard deviation in meters                               */ 
  double              longitudeStandardDeviation;

  /* depth standard deviation in meters                                   */ 
  double              depthStandardDeviation;

  /* heading standard deviation in degrees                                */ 
  double              headingStandardDeviation;  

  /* pitch standard deviation in degrees                                  */ 
  double              pitchStandardDeviation;

  /* roll standard deviation in degrees                                   */ 
  double              rollStandardDeviation;

  /* reserved for future use                                              */ 
  unsigned short      reserved[16];

}  DEVSituationType;

/* ---------------------------------------------------------------------- */ 
/* DevCableCounterType - cable counter data structure type                */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  float     cableLength;               /* cable length in meters          */ 
  float     cableSpeed;                /* cable speed in meters / second  */ 
  short int validCableLength;          /* flag for valid cable lenth value*/ 
  short int validCableSpeed;           /* flag for valid cable speed value*/ 
  short int cableError;                /* flag for counter reported error */ 

}  DevCableCounterType;


/* ---------------------------------------------------------------------- */ 

#endif  /* __DEVICE_MESSAGES_H__ */ 


/* ---------------------------------------------------------------------- */ 
/*                       end DeviceMessages.h                             */ 
/* ---------------------------------------------------------------------- */ 
