/* ---------------------------------------------------------------------- */ 
/* SystemMessages.h                                                       */ 
/* ---------------------------------------------------------------------- */ 
/*                                                                        */ 
/* Describes system level messages.                                       */ 
/*                                                                        */ 
/* ---------------------------------------------------------------------- */ 
/*                                                                        */ 
/* (c) Copyright 2004 - 2009, 2010   EdgeTech                             */ 
/*                                                                        */ 
/* 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.              */ 
/*                                                                        */ 
/* ---------------------------------------------------------------------- */ 

#ifndef __SYSTEM_MESSAGES_H__
#define __SYSTEM_MESSAGES_H__


/* ---------------------------------------------------------------------- */ 
/* Includes                                                               */ 
/* ---------------------------------------------------------------------- */ 

#include "SonarMessages.h"


/* ---------------------------------------------------------------------- */ 
/* sonarMessage field indicates the type of data to follow.               */ 
/* ---------------------------------------------------------------------- */ 

typedef enum
{

  /* -------------------------------------------------------------------- */ 
  /* Subsystem should be set to 0 and channel set to 0.                   */ 
  /* -------------------------------------------------------------------- */ 

  /* This message is sent on the data socket (unsolicited) when the system*/ 
  /* configuration setttings change, or can be queried with a GET on the  */ 
  /* command socket.  The returned data structure is                      */ 
  /* (SonarInformationType).                                              */ 
  /* This message provides both static (nonchangeable) configuration info */ 
  /* (eg SBSS versus FSSB major configuration type) as well as current    */ 
  /* configuration (eg pulse selection) to aid in automatic topside       */ 
  /* configuration as well as post mission diagnostic analysis.           */ 
  SYSTEM_MESSAGE_SONAR_CONFIGURATION_OLDFORMAT = MESSAGE_OFFSET_SYSTEM,

  /* This message is saved in jsf data files and is not present in the    */ 
  /* real time sonar data stream.  It might be present in a playback data */ 
  /* stream.  The returned data structure is (NavigationOffsetsType).     */ 
  /* The structure contains known fixed offsets to the navigation data.   */ 
  /* Navigation data is stored uncorrected, without the offsets applied.  */ 
  SYSTEM_MESSAGE_NAVIGATION_OFFSETS,

  /* This message is sent on the data socket (unsolicited) when the system*/ 
  /* configuration setttings change, or can be queried with a GET on the  */ 
  /* command socket.  The returned data structure is                      */ 
  /* (SonarInformationType).                                              */ 
  /* This message provides both static (nonchangeable) configuration info */ 
  /* (eg SBSS versus FSSB major configuration type) as well as current    */ 
  /* configuration (eg pulse selection) to aid in automatic topside       */ 
  /* configuration as well as post mission diagnostic analysis.           */ 
  SYSTEM_MESSAGE_SONAR_CONFIGURATION,

} SystemMessageType;


/* ---------------------------------------------------------------------- */ 
/* List of system types                                                   */ 
/* ---------------------------------------------------------------------- */ 

typedef enum
{
  SYSTEM_TYPE_UNKNOWN       =   0,  /* 0  : Non-standard configuration    */ 
  SYSTEM_TYPE_SIB_SBSS,             /* 1  : SIB SB SSL SSH                */ 
  SYSTEM_TYPE_FSIC_SBSS,            /* 2  : FSIC SB SSL SSH               */ 
  SYSTEM_TYPE_FSIC_MPX,             /* 3  : FSIC MPX                      */ 
  SYSTEM_TYPE_SIB_MPX,              /* 4  : SIB MPX                       */ 
  SYSTEM_TYPE_ADC64_FSSB,           /* 5  : ADC64 FSSB SB                 */ 
  SYSTEM_TYPE_SIB_SAS,              /* 6  : 12-Channel SAS                */ 
  SYSTEM_TYPE_SIB_FSSB,             /* 7  : SIB FSSB SB                   */ 
  SYSTEM_TYPE_SIB_SC,               /* 8  : SIB Sed Class SB              */ 
  SYSTEM_TYPE_ADC64_SC,             /* 9  : ADC64 Sed Class               */ 
  SYSTEM_TYPE_SIB_DIAG,             /* 10 : Diagnostic mode for SIB Cards */ 
  SYSTEM_TYPE_SIB_4200,             /* 11 : 4200 Fish                     */ 
  SYSTEM_TYPE_SIB_512W,             /* 12 : 512 W Fish Finder System      */ 
  SYSTEM_TYPE_SIB_4500DF,           /* 13 : 4500 Dynamic Focused System   */ 
  SYSTEM_TYPE_SIB_3100,             /* 14 : GeoPortable Subbottom         */ 
  SYSTEM_TYPE_SIB_WHOISE,           /* 15 : WHOI Special Eng 4 frequency  */ 
  SYSTEM_TYPE_SIB_SS,               /* 16 : Dual frequency sidescan.      */ 
  SYSTEM_TYPE_SIB_4200A,            /* 17 : 4200 w/ dual simultaneous mpx */ 
  SYSTEM_TYPE_SIB_4700,             /* 18 : 4700 Dynamic focus            */ 
  SYSTEM_TYPE_SIB_4150,             /* 19 : 4150 Dual frequency sidescan. */ 
  SYSTEM_TYPE_SIB_DUALNOSIMUL,      /* 20 : Dual Frequency not simultan.  */ 
  SYSTEM_TYPE_SIB_2200MP,           /* 21 : 2200-MP Dual MP SS w/ SB      */ 
  SYSTEM_TYPE_RESERVED0,            /* 22 : Reserved for backward comp.   */ 
  SYSTEM_TYPE_SIB_4600,             /* 23 : 4600 multipulse Bathymetry    */ 
  SYSTEM_TYPE_SIB_4200DF,           /* 24 : Single Frequency Dyn Focus.   */ 
  SYSTEM_TYPE_SAIB_4125,            /* 25 : SAIB 4125 Dual Frequency Sys  */ 
  SYSTEM_TYPE_SIB_SSHFDF,           /* 26 : Dual SS with DF on HF.        */ 
  SYSTEM_TYPE_SIB_4600_MONO,        /* 27 : 4600 monopulse Bathymetry     */ 
  SYSTEM_TYPE_SIB_SSHFDF3,          /* 28 : Dual SS with DF 3 Chan HF.    */ 
  SYSTEM_TYPE_SIB_4700FLIP,         /* 29 : Same as 4700, only DF freq    */ 
                                    /*      lower in cf - to help discover*/ 
  SYSTEM_TYPE_SIB_4200COUPLED,      /* 30 : 4200 mpx but coupled in mp    */ 
                                    /*      mode                          */ 

  SYSTEM_TYPE_560A          = 128,  /* 128: 272 (560A) Fish               */ 
  SYSTEM_TYPE_560D,                 /* 129: DF100 (560D) Fish             */ 
  SYSTEM_TYPE_DSC_SB,               /* 130: sub-bottom only               */ 
  SYSTEM_TYPE_DSC_SS,               /* 131: sidescan only                 */ 
  SYSTEM_TYPE_DSC_SSSB,             /* 132: combined sidescan/sub-bottom  */ 
  SYSTEM_TYPE_DSC_MPX,              /* 133: MP-X                          */ 
  SYSTEM_TYPE_DSC_4200,             /* 134: 4200                          */ 
  SYSTEM_TYPE_DSC_SAS,              /* 135: SAS                           */ 
  SYSTEM_TYPE_DSC_4150,             /* 136: 4150 Dual frequency sidescan  */ 
  SYSTEM_TYPE_DSC_4125,             /* 137: 4125 High frequency sidescan  */ 
  SYSTEM_TYPE_DSC_2200MP,           /* 138: 2200-MP Dual MP SS w/ SB      */ 
  SYSTEM_TYPE_DSC_4700,             /* 139: 4700                          */ 
  NUM_SYSTEM_TYPES,

} SystemEnumType;


/* ---------------------------------------------------------------------- */ 
/* SonarInformationType                                                   */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /* The system type configuration that the data was collected with.      */ 
  /* i.e. configurations are MPX, Subbottom, 4200. See SystemEnumType     */ 
  long systemType;

  /* Low rate io enabled option : 0 - disabled, not 0 - ????              */ 
  long lowRateIOEnabled;

  /* The version number ot the software that generated the data           */ 
  long versionNumber;

  /* Number of subsystems present in this message.                        */ 
  long numSubsystems;

  /* Number of serial port devices present in this message.               */ 
  long numSerialPorts;

  /* Serial number of system that collected the data                      */ 
  unsigned long serialNumber;

  /* Flags and options                                                    */ 
  /* Bit 0: Set if new SonarSubsystemInformationType follows, clear for   */ 
  /*        SonarSubsystemInformationOldType follows.                     */ 
  unsigned long flags;

  /* Reserved for future expansion.                                       */ 
  long reserved[9];

  /* Sonar subsystem information record(s) follow:                        */ 
  /* SonarSubsystemInformationType subInfo[numSubsystems];                */ 
  /* or SonarSubsystemInformationOldType subInfo[numSubsystems];          */ 

  /* Sonar serial information record(s) follow:                           */ 
  /* SonarSerialInformationType serialInfo[numSerialPorts];               */ 
} SonarInformationType;


/* ---------------------------------------------------------------------- */ 
/* Per subsystem information structure                                    */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{

  /* Subsystem number                                                     */ 
  long subSystem;

  /* subsystem on 0 - disabled 1 -  enabled                               */ 
  long sonarOn;

  /* Window information for this subsystem for channel 0                  */ 
  /* There are two values for network and disk windows.  These are the    */ 
  /* values for channel 0 only.                                           */ 
  /* Enables for data windows for up to the first 32 channels.            */ 
  SonarMessageWindowType networkWindowInfo;
  long networkWindowEnables;

  SonarMessageWindowType diskWindowInfo;
  long diskWindowEnables;

  /* Post processor mode mode                                             */ 
  /* For an MPX subsystem, this is 0 for disabled, 1 for fore arrays, 2   */ 
  /* for aft arrays and 3 for blended (focussed)                          */ 
  long postProcessorMode;

  /* Data type for channel 0.                                             */ 
  /* 0 for envelope, 1 for analytic and 2 for raw data.                   */ 
  long dataType;

  /* Bit flags                                                            */ 
  /* Bit 0 : Set if not all channels have the same network window         */ 
  /* Bit 1 : Set if not all channels have the same disk window.           */ 
  /* Bit 2 : Set if not all channels have the same data type.             */ 
  /* Bit 3 : Set if agc is disabled                                       */ 
  /* Bit 4 : Set if the rateOrRange is a range.  Clear for a rate         */ 
  /* Bit 5 : Set if the sonar data is basebanded.  Clear if decimated     */ 
  long flags;

  /* Ping rate in 1000 * hz or range in mM                                */ 
  long pingRateOrRange;

  /* Coupling parameters for external and coupled modes                   */ 
  SonarMessageCouplingParametersType couplingInfo;

  /* Trigger mode                                                         */ 
  /* 0 for internal, 1 for external, 2 for coupled.                       */ 
  long triggerMode;

  /* Direct path removal value.  This is used to remove the average direct*/ 
  /* path value before processing.                                        */ 
  /* 0 for disabled, positive value in ms, -1 for pulse length, -2 for    */ 
  /* pulse length if multipulse or disabled otherwise.                    */ 
  long dcRemoval;

  /* Direct path value used for signal meter calculation                  */ 
  /* Value is in samples, or -1 for pulse length, -N for N ms.            */ 
  long directPathValue;

  /* Transmit pulse gains for the first 4 transducers : this is the gain  */ 
  /* that can be set by an operator                                       */ 
  /* A value of 1000 indicated maximum (full power).                      */ 
  long transmitGains[4];

  /* Total transmit gains for the first 4 transducers : this is the       */ 
  /* composite of all gains (eg includes pulsecal values)                 */ 
  /* A value of 1000 indicated maximum (full power).                      */ 
  long totalTransmitGains[4];

  /* Adc gain value for up to 4 channels                                  */ 
  long adcGain[4];

  /* Currently selected pulse information                                 */ 
  SonarMessagePingType pulseInfo;

  /* Reserved for future expansion                                        */ 
  long reserved[10];

} SonarSubsystemInformationOldType;


/* ---------------------------------------------------------------------- */ 
/* Per subsystem information structure                                    */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{

  /* Subsystem number                                                     */ 
  long subSystem;

  /* subsystem on 0 - disabled 1 -  enabled                               */ 
  long sonarOn;

  /* Window information for this subsystem for channel 0                  */ 
  /* There are two values for network and disk windows.  These are the    */ 
  /* values for channel 0 only.                                           */ 
  /* Enables for data windows for up to the first 32 channels.            */ 
  SonarMessageWindowType networkWindowInfo;
  long networkWindowEnables;

  SonarMessageWindowType diskWindowInfo;
  long diskWindowEnables;

  /* Post processor mode mode                                             */ 
  /* For an MPX subsystem, this is 0 for disabled, 1 for fore arrays, 2   */ 
  /* for aft arrays and 3 for blended (focussed)                          */ 
  long postProcessorMode;

  /* Data type for channel 0.                                             */ 
  /* 0 for envelope, 1 for analytic and 2 for raw data.                   */ 
  long dataType;

  /* Bit flags                                                            */ 
  /* Bit 0 : Set if not all channels have the same network window         */ 
  /* Bit 1 : Set if not all channels have the same disk window.           */ 
  /* Bit 2 : Set if not all channels have the same data type.             */ 
  /* Bit 3 : Set if agc is disabled                                       */ 
  /* Bit 4 : Set if the rateOrRange is a range.  Clear for a rate         */ 
  long flags;

  /* Ping rate in 1000 * hz or range in mM                                */ 
  long pingRateOrRange;

  /* Coupling parameters for external and coupled modes                   */ 
  SonarMessageCouplingParametersType couplingInfo;

  /* Trigger mode                                                         */ 
  /* 0 for internal, 1 for external, 2 for coupled.                       */ 
  long triggerMode;

  /* Direct path removal value.  This is used to remove the average direct*/ 
  /* path value before processing.                                        */ 
  /* 0 for disabled, positive value in ms, -1 for pulse length, -2 for    */ 
  /* pulse length if multipulse or disabled otherwise.                    */ 
  long dcRemoval;

  /* Direct path value used for signal meter calculation                  */ 
  /* Value is in samples, or -1 for pulse length, -N for N ms.            */ 
  long directPathValue;

  /* Transmit pulse gains for the first 4 transducers : this is the gain  */ 
  /* that can be set by an operator                                       */ 
  /* A value of 1000 indicated maximum (full power).                      */ 
  long transmitGains[4];

  /* Total transmit gains for the first 4 transducers : this is the       */ 
  /* composite of all gains (eg includes pulsecal values)                 */ 
  /* A value of 1000 indicated maximum (full power).                      */ 
  long totalTransmitGains[4];

  /* Adc gain value for up to 4 channels                                  */ 
  long adcGain[4];

  /* Currently selected pulse information                                 */ 
  SonarMessagePingEnhancedType pulseInfo;

  /* Reserved for future expansion                                        */ 
  long reserved[10];

} SonarSubsystemInformationType;


/* ---------------------------------------------------------------------- */ 
/* Per serial port information structure                                  */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /* Logical channel for serial port                                      */ 
  long serialChannel;

  /* Actual local com port for channel                                    */ 
  long portNumber;

  /* Baud rate                                                            */ 
  long baudRate;

  /* Parser algorithm                                                     */ 
  /*  0: None - read and send up any data.                                */ 
  /*  1: Pitch/Roll in Simrad EM1000 format - This consists of 5 16-bit   */ 
  /*     words with values                                                */ 
  /*  2: Paroscientific Pressure Meter                                    */ 
  /*  3: Pitch/Roll in Simrad EM1000 format - Parser for TSS unit         */ 
  /*     (continuous transmission).                                       */ 
  /*  4: Parse NMEA and send specific messages.  Messages parsed are:     */ 
  /*     $SDDBT : Altitude from Simrad Mesotech 1007 or compatible        */ 
  /*     $PTNTHPR,x.x,a,x.x,a,x.x,a : Heading, Pitch, Roll from Honeywell */ 
  /*       HMR3000                                                        */ 
  /*       Note the x.x in above must be setup in units of degrees        */ 
  /*  5: Parse and send generic NMEA Strings                              */ 
  /*  6: RD Instruments Dopler Velocity Log (DVL) parsing                 */ 
  /*       (Model WH-N-nnnKHZ)                                            */ 
  /*  7: Octans Motion Sensor                                             */ 
  /*  8: Applied Microsystems Smart CTD                                   */ 
  /*  9: Valeport MiniSVS                                                 */ 
  /* 10: Seabird SBE50                                                    */ 
  /* 11: Seabird SBE49                                                    */ 
  /* 12: Falmouth Pressure Sensor                                         */ 
  long parser;

  /* Enable flags                                                         */ 
  /* Bit 0: send raw data                                                 */ 
  /* Bit 1: send parsed data                                              */ 
  long enabled;

  /* Reserved for future expansion.                                       */ 
  long reserved[11];

} SonarSerialInformationType;



/* ---------------------------------------------------------------------- */ 
/* NavigationOffsetsType definition                                       */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /* X Offset in meters                                                   */ 
  float    XOffset;

  /* Y Offset in meters                                                   */ 
  float    YOffset;

  /* Latitude Offset in degrees                                           */ 
  float    LatOffset;

  /* Longitude Offset in degrees                                          */ 
  float    LonOffset;

  /* Aft Offset in meters         fore is negative                        */ 
  float    AftOffset;

  /* Starboard Offset in meters   port is negative                        */ 
  float    StarboardOffset;

  /* Depth Offset in meters       up is negative                          */ 
  float    DepthOffset;

  /* Altitude Offset in meters    down is negative                        */ 
  float    AltitudeOffset;

  /* Heading Offset in degrees                                            */ 
  float    HeadingOffset;

  /* Pitch Offset in degrees      Nose up is positive                     */ 
  float    PitchOffset;

  /* Roll Offset in degrees       Port side up is positive                */ 
  float    RollOffset;

  /* Yaw Offset in degrees        Toward Port is negative                 */ 
  float    YawOffset;

  /* tow point elevation offset   up is positive                          */ 
  float    HeightOffset;

  /* reserved                                                             */ 
  float    Reserved[3];

}  NavigationOffsetsType;


#endif

/* ---------------------------------------------------------------------- */ 
/*                        end SystemMessages.h                            */ 
/* ---------------------------------------------------------------------- */ 


