
/* ---------------------------------------------------------------------- */ 
/* PrivateMessages.h                                                      */ 
/*                                                                        */ 
/* Copyright (c) 1998 - 2000, 2002, 2004, 2005, 2008  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.              */ 
/*                                                                        */ 
/* This file contains the Private message formats.                        */ 
/* ---------------------------------------------------------------------- */ 

#pragma once

#ifndef __PRIVATE_MESSAGES_H__
#define __PRIVATE_MESSAGES_H__


/* ---------------------------------------------------------------------- */ 

#include "SonarMessages.h"
#include "messageOffsets.h"


/* ---------------------------------------------------------------------- */ 

#define PING_DATA_SIZE       (4096)
#define FILTER_DATA_SIZE     (4096)


/* ---------------------------------------------------------------------- */ 
/* Message Types                                                          */ 
/* ---------------------------------------------------------------------- */ 

/* sonarMessage field indicates the type of data to follow.               */ 

typedef enum
{
  /* -------------------------------------------------------------------- */ 
  /* System level commands.                                               */ 
  /* For the following messages, the channel is ignored                   */ 
  /* -------------------------------------------------------------------- */ 

  /* No message defined yet (No Data)                                     */ 
  PRIVATE_MESSAGE_NONE = MESSAGE_OFFSET_PRIVATE,           

  /* Get additional version information (SonarMessageStringType)          */ 
  PRIVATE_MESSAGE_SYSTEM_VERSION, 

  /* Get Hardware Configuration (SonarMessageStringType)                  */ 
  PRIVATE_MESSAGE_HARDWARE_CONFIGURATION, 

  /* Run specified diagnostic and return status (SonarMessageDiagType)    */ 
  /* Use SONAR_COMMAND_GET command in header to execute the message.      */ 
  /* Pinging should be turned off before a diagnostic is run.             */ 
  PRIVATE_MESSAGE_SYSTEM_DIAG,

  /* Restart System                                                       */ 
  PRIVATE_MESSAGE_SYSTEM_RESTART,

  /* Shutdown System                                                      */ 
  /* Accepts a (SonarMessageLongType), which can have any of the          */ 
  /* following values: 0: Exit sonar program only, 1: Shutdown, 2: Reboot */ 
  PRIVATE_MESSAGE_SYSTEM_SHUTDOWN,
  
  /* Change the time by reading the system time.                          */ 
  /* This message is used in an FS-SB configuration.  It is sent by the   */ 
  /* FS-IU to notify the FS-DW that a set time has occurred and the FS-DW */ 
  /* should now read the system clock.  (TimeSyncInfoType)                */ 
  PRIVATE_MESSAGE_TIME_SYNC,

  /* Trigger the sonar system at a future time.  Note that the systems    */ 
  /* must be time synced to trigger accurately, and 1/10 second or more   */ 
  /* time must be allowed for latency in the system before the trigger.   */ 
  /* Triggers for times which have already expired or which are too far   */ 
  /* into the future (more than 30 seconds) are ignored.  (TimestampType) */ 
  PRIVATE_MESSAGE_PING_TRIGGER_AT_TIME,

  /* Sonar uses the following protocal if public connection (third party  */ 
  /* topsides) are not allowed by the security settings:                  */ 
  /* (1) Sonar ignores all topside messages                               */ 
  /* (2) Topside sends VERIFY_TOPSIDE with a value of 0 (COMMAND_GET)     */ 
  /* (3) Sonar sends VERIFY_TOPSIDE with a value of SEED (random)         */ 
  /* (4) Topside sends VERIFY_TOPSIDE with a value of (COMMAND_SET)       */ 
  /*        OptionsCodeToValue(SEED, 1, 2)                                */ 
  /* (5) Sonar now accepts messages                                       */ 
  /* Accepts a parameter (SonarMessageLongType) as above.                 */ 
  PRIVATE_MESSAGE_VERIFY_TOPSIDE,


  /* -------------------------------------------------------------------- */ 
  /* Management of disk files                                             */ 
  /* For the following messages, the channel is ignored                   */ 
  /* -------------------------------------------------------------------- */ 

  /* Set the name of a file for IO operations (SonarMessageStringType)    */ 
  PRIVATE_MESSAGE_FILE_NAME = MESSAGE_OFFSET_PRIVATE_STORAGE,

  /* Create directory (SonarMessageStringType)                            */ 
  PRIVATE_MESSAGE_DIR_CREATE,  

  /* Directory information : Get file list.                               */ 
  /* Returns (SonarMessageFileInfoType) on a get.                         */ 
  PRIVATE_MESSAGE_FILE_LIST,   

  /* Delete file (SonarMessageStringType)                                 */ 
  PRIVATE_MESSAGE_FILE_DELETE,  

  /* Delete tree (SonarMessageStringType)                                 */ 
  PRIVATE_MESSAGE_TREE_DELETE,  

  /* Read on get an entire file - returns the raw file data               */ 
  /* Returns data with each get.  When return count is 0, file is read    */ 
  /* Write a file on a set.  Write completes with a 0 data size           */ 
  PRIVATE_MESSAGE_FILE_IO,

  /* Rename Set file to (SonarMessageStringType)                          */ 
  PRIVATE_MESSAGE_FILE_RENAME,  
  
  
  /* -------------------------------------------------------------------- */ 
  /* System Logging                                                       */ 
  /* -------------------------------------------------------------------- */ 

  /* System Log Data Message (DiagnosticMessageLogDataType)               */ 
  PRIVATE_MESSAGE_LOG_DATA = MESSAGE_OFFSET_PRIVATE_LOG,   

  /* System Log Text Message (SonarMessageStringType)                     */ 
  PRIVATE_MESSAGE_LOG_TEXT,   

  /* System Logging Periodicity in seconds (SonarMessageLongType)         */ 
  PRIVATE_MESSAGE_LOG_PERIOD,    

  /* Enable Logging to Disk (SonarMessageLongType - 0 => off)             */ 
  PRIVATE_MESSAGE_LOG_DISK,
 
  /* Enable Network Logging (SonarMessageLongType - 0 => off)             */ 
  PRIVATE_MESSAGE_LOG_NETWORK,


  /* -------------------------------------------------------------------- */ 
  /* Diagnostic Terminal                                                  */ 
  /* -------------------------------------------------------------------- */ 

  /* This message is obsolete                                             */ 
  /* Diagnostic Terminal Data Message (SonarMessageStringType)            */ 
  PRIVATE_MESSAGE_TERMINAL_DATA = MESSAGE_OFFSET_PRIVATE_DIAG,   

  /* If supported by the configuration, enables output of power amp       */ 
  /* feedback diagnostic data on channel 0.  This will allow a display of */ 
  /* power amp feedback on the normal sonar displays.                     */ 
  /* (SonarMessageLongType).  Applied on a per subsystem basis.           */ 
  PRIVATE_MESSAGE_DIAG_PAFEEDBACK_ONCHANNEL0,
  
  /* -------------------------------------------------------------------- */ 
  /* Sonar Return Data                                                    */ 
  /* -------------------------------------------------------------------- */ 

  /* Type of data (SonarMessageLongType) from                             */ 
  /* SegyDataType::SegyDataFormatType - allows selection of all types     */ 
  PRIVATE_MESSAGE_DATA_TYPE = MESSAGE_OFFSET_PRIVATE_DATA,           
  
  /* Sonar return data packet (SonarReturnType)                           */ 
  PRIVATE_SONAR_RETURN_DATA,
  
  /* Sonar return parameter data (SonarReturnParametersType)              */ 
  PRIVATE_SONAR_RETURN_PARAMETERS,

  /* Raw from dsp card data (InternalDspFrameType)                        */ 
  PRIVATE_SONAR_DSP_DATA,


  /* -------------------------------------------------------------------- */ 
  /* Processing of data                                                   */ 
  /* -------------------------------------------------------------------- */ 

  /* DC Artifact removal,                                                 */ 
  /* 0 = Off, -1 = entire ping, -2 = automatically determined by sonar    */ 
  /* based on ping characteristics, number > 0 = specified number of      */ 
  /* milliseconds (SonarMessageLongType)                                  */ 
  /* Subsystem must be valid.                                             */ 
  PRIVATE_MESSAGE_PROCESSING_DC_REMOVAL = MESSAGE_OFFSET_PRIVATE_PROCESSING,

  
  /* -------------------------------------------------------------------- */ 
  /* Management of pulses                                                 */ 
  /* -------------------------------------------------------------------- */ 

  /* Generate and store an outgoing pulse, matched filter pair in a named */ 
  /* file (SonarMessagePingType)                                          */ 
  PRIVATE_MESSAGE_PING_STORE = MESSAGE_OFFSET_PRIVATE_PULSE,    

  /* Download an outgoing pulse, matched filter pair                      */ 
  /* (SonarMessageDownloadPingType)                                       */ 
  PRIVATE_MESSAGE_DOWNLOAD_PING,    

  /* Download and store an outgoing pulse, matched filter pair in a       */ 
  /* named file (SonarMessageDownloadStorePingType)                       */ 
  PRIVATE_MESSAGE_DOWNLOAD_PING_STORE,    
                              
  /* DAC rate in Hz (SonarMessageLongType) (Nominally 200000)             */ 
  PRIVATE_MESSAGE_PING_DAC_RATE,

  /* Select channels to output ping on (Bit 0 = Channel 0,                */ 
  /* Bit 1 = Channel 1) (SonarMessageLongType) (Normally 1)               */ 
  PRIVATE_MESSAGE_PING_DAC_CHANNELS,

  /* Changes on a get, queries on a set, the pulse frequency shift which  */ 
  /* is stored in the PulseCal.pcf file.  (SonarMessageLongType)          */ 
  /* The frequency shift is in hertz and can be either positive or        */ 
  /* negative.  This is specific to a subsystem.                          */ 
  PRIVATE_MESSAGE_MODIFY_CENTER_FREQUENCY,

  /* -------------------------------------------------------------------- */ 
  /* ADC Control                                                          */ 
  /* -------------------------------------------------------------------- */ 

  /* DAC -> ADC decimation (SonarMessageLongType). Actual Rate =          */ 
  /* DAC_RATE/ADC_DECIMATE. A value less than 3 at a DAC_RATE of 200000   */ 
  /* will always cause overflow                                           */ 
  PRIVATE_MESSAGE_ADC_DECIMATE = MESSAGE_OFFSET_PRIVATE_ADC,

  /* Select channels to receive datan (Bit 0 = Channel 0,                 */ 
  /* Bit 1 = Channel 1) (SonarMessageLongType) (Normally 1)               */ 
  PRIVATE_MESSAGE_ADC_CHANNELS, 


  /* -------------------------------------------------------------------- */ 
  /* Digital IO                                                           */ 
  /* -------------------------------------------------------------------- */ 

  /* Set the options for controlling the DIO on the DSP card.  Bit 0:     */ 
  /* use analog card, Bit1: Keep power amp on when pinging; Bit2:         */ 
  /* Keep power amp on when sonar off (SonarMessageLongType)              */ 
  PRIVATE_MESSAGE_DIO_OPTIONS = MESSAGE_OFFSET_PRIVATE_DIO,

  /* -------------------------------------------------------------------- */ 
  /* Nav Data                                                             */ 
  /* -------------------------------------------------------------------- */ 

  /* Unparsed message RS232 Data from a NAV Source.                       */ 
  /* Format is the same as serial port data DEV_SERIAL_DATA (DEVDataType) */ 
  /* PRIVATE_MESSAGE_NAV_DATA = MESSAGE_OFFSET_NAV,                       */ 


  /* -------------------------------------------------------------------- */ 
  /* ACI / DCI Interface                                                  */ 
  /* -------------------------------------------------------------------- */ 

  /* 272TD frequency select (SonarMessageLongType). 0 - low, 1 - high     */ 
  PRIVATE_MESSAGE_272_FREQUENCY = MESSAGE_OFFSET_PRIVATE_ACIDCI,

  /* 272TD frequency test signal (SonarMessageLongType). 0 - off, 1 - on  */ 
  PRIVATE_MESSAGE_272_TEST,

  /* DF1000 Responder period (SonarMessageLongType) - in milliseconds     */ 
  PRIVATE_MESSAGE_DF1000_RESPONDER,

  /* DF1000 Data Link (SonarMessageLongType).  0 - off, 1 - on            */ 
  PRIVATE_MESSAGE_DF1000_DATALINK,

  /* DF1000 frequency select (SonarMessageLongType).                      */ 
  /* 0 - none, 1 - low, 2 - high, 3 low and high                          */ 
  PRIVATE_MESSAGE_DF1000_FREQUENCY,

  /* ACI/DCI status (ACIDCIStatusReturnType)                              */ 
  PRIVATE_MESSAGE_ACIDCI_STATUS,


  /* -------------------------------------------------------------------- */ 
  /* Responder Interface                                                  */ 
  /* -------------------------------------------------------------------- */ 

  /* repsonder control (ResponderControlType)                             */ 
  PRIVATE_MESSAGE_RESPONDER_CONTROL = MESSAGE_OFFSET_RESPONDER,


  /* -------------------------------------------------------------------- */ 
  /* Remote supervisor Interface                                          */ 
  /* -------------------------------------------------------------------- */ 

  /* status (RemoteStatusReturnType)                                      */ 
  PRIVATE_MESSAGE_REMOTE_STATUS  = MESSAGE_OFFSET_REMOTE_SUPERVISOR,

  /* fish power - (SonarMessageLongType)                                  */ 
  /*   1 - on                                                             */ 
  /*   0 - off                                                            */ 
  PRIVATE_MESSAGE_REMOTE_POWER,

  /* Trigger polarity - (SonarMessageLongType)                            */ 
  /*  -1 - negative polarity                                              */ 
  /*   0 - any                                                            */ 
  /*   1 - positive polarity                                              */  
  PRIVATE_MESSAGE_REMOTE_POLARITY,

  /* status LED identification (RemoteLEDIdMessageType)                   */ 
  PRIVATE_MESSAGE_REMOTE_LED_IDS,


  /* -------------------------------------------------------------------- */ 
  /* Remote security Interface                                            */ 
  /* -------------------------------------------------------------------- */ 

  /* password options - (SonarMessageLongType)                            */ 
  /* bit field of active options.                                         */ 
  /* bit  0: Discover 3100                                            (1) */ 
  /* bit  1: Discover sidescan                                        (2) */ 
  /* bit  2: Discover sub-bottom                                      (4) */ 
  PRIVATE_MESSAGE_PASSWORD_OPTIONS  = MESSAGE_OFFSET_PASSWORD,

} PrivateMessageType;


/* ---------------------------------------------------------------------- */ 
/* Diagnostic Selection Type for PRIVATE_MESSAGE_SYSTEM_DIAG              */ 
/* ---------------------------------------------------------------------- */ 

typedef enum
{
  /* Send a ping out to the specified transducer.  User should hear sound */ 
  /* on transducer (eg one beep), etc if power amp is on.                 */ 
  /* Returns 0 on success or the following bits on errors                 */ 
  /*31: Test not run (eg file not found).                                 */ 
  DIAGNOSTIC_ID_TRANSDUCER = 0,

  /* Send a signal out of the power amp and verify feedback on ADC channel*/ 
  /* Returns 0 on success.  Returns the following bits set on errors:     */ 
  /* 0: AAC : Ambient DC voltage too high,                                */ 
  /*    SIB : Ambient DC voltage too high.                                */ 
  /* 1: AAC : Ambient sdev too high,                                      */ 
  /*    SIB : Ambient sdev too high.                                      */ 
  /* 2: AAC : Signal sdev out of range.                                   */ 
  /*    SIB : Amp on RMS Power too low                                    */ 
  /* 4: FSIC : Amp off volts not V48 +- 2                                 */ 
  /* 5: FSIC : Amp on volts not (V48 / 2) +- 2                            */ 
  /* 6: FSIC : Amp on RMS Power too low                                   */ 
  /*31: Test not run.                                                     */ 
  /* NOTE: For the SIB systems, multiple channels may be diagnosed with   */ 
  /*    a single diagnostic.  Bits 0-3 are for the first channel tested   */ 
  /*    and subsequent groups of 4 bits are for adjacent channels         */ 
  /*    as defined in the AnalogDeviceInfo.ini file.                      */ 
  /* ******************************************************************** */ 
  /* Returns the following information for SIB Card (Diagnostic Text):    */ 
  /* Value 0:  Status bits again                                          */ 
  /* Value 1:  Mean amp on in counts                                      */ 
  /* Value 2:  Stddev amp on pinging  in counts (24-bit ADC)              */ 
  /* Value 3:  Mean amp off (counts)                                      */ 
  /* Value 4:  Stddev amp off not pinging (counts)                        */ 
  /* Value 5:  Mean amp on not pinging (counts)                           */ 
  /* Value 6:  Stddev amp on not pinging (counts)                         */ 
  /* Value 7:  0                                                          */ 
  /* ******************************************************************** */ 
  /* Returns the following information for FSIC Card (Diagnostic Text):   */ 
  /* Value 0:  Status bits again                                          */ 
  /* Value 1:  Stddev amp on pinging  in millivolts                       */ 
  /* Value 2:  Mean amp on in milli-volts                                 */ 
  /* Value 3:  Stddev amp off not pinging (mv)                            */ 
  /* Value 4:  Mean amp off (mv)                                          */ 
  /* Value 5:  Stddev amp on not pinging (mv)                             */ 
  /* Value 6:  Mean amp on not pinging (mv)                               */ 
  /* Value 7:  48 Volt power in milli-volts                               */ 
  /* ******************************************************************** */ 
  /* Returns the following information for AAC Card (Diagnostic Text):    */ 
  /* Value 0:  Status bits again                                          */ 
  /* Value 1:  variance when pinging * 1e3                                */ 
  /* Value 2:  variance when not pinging * 1e9                            */ 
  /* Value 3:  mean volts when not pinging * 1e6                          */ 
  /* Value 4-7:Unused (0)                                                 */ 
  DIAGNOSTIC_POWERAMP_FEEDBACK,

  /* Verify that the analog card is attached to DSP.  Returns 0 on success*/ 
  /* Returns the following bits set on errors:                            */ 
  /*                                                                      */ 
  /* For FSIC or AAC Cards                                                */ 
  /* 0: Analog Card Version # wrong,                                      */ 
  /* 1: BNCs cannot be pulled low                                         */ 
  /* 2: BNCs cannot be set high                                           */ 
  /* 3: PCI Bus Mastering Transfer Error.                                 */ 
  /* 8: FSIC Ram Size Detect Failed.                                      */ 
  /* 9: FSIC Pulse Ram Stuck Bit.                                         */ 
  /*10: FSIC BNCs cannot be pulled low.                                   */ 
  /*31: Test not run.                                                     */ 
  /*                                                                      */ 
  /* For SIB Cards                                                        */ 
  /* 0: Pulse Memory Bad Data                                             */ 
  /* 1: Data Memory Bad Data                                              */ 
  /* 2: Pulse Memory Bad Address                                          */ 
  /* 3: Data Memory Bad Address                                           */ 
  /* 4: Data Memory Size Bad with 1 Chip                                  */ 
  /* 5: Data Memory Size Bad with 2 Chips                                 */ 
  /* 6: Data Memory Size Bad 1 versus 2 Chips                             */ 
  /* 7: Data Memory Size does not match expected value                    */ 
  /* 8: Pulse Memory Size Bad                                             */ 
  /* 9: Pulse Memory Size does not match expected value                   */ 
  /*10: Transfer Rate Test Failed                                         */ 
  /*11: Transfer Rate Test Failed #2                                      */ 
  /*12: Status Record Bad                                                 */ 
  /*13: Transfer Rate Too Slow (Not UltraATA)                             */ 
  /*14-21: Serial Stream Diags Failed (8 streams)                         */ 
  /*22: No ATAPI Device                                                   */ 
  /*23: Clock Bad                                                         */ 
  /*31: Test not run.                                                     */ 
  /* ******************************************************************** */ 
  /* Returns the following information for FSIC Card (Diagnostic Text):   */ 
  /* Value 0:  Status bits again                                          */ 
  /* Value 1:  Version number register.                                   */ 
  /* Value 2:  BNCs when pulled low at there native CSR bit positions.    */ 
  /* Value 3:  -1 if no error, 256 + index on pulse memory error          */ 
  /* Value 4:  0 if no error, or the bit pattern on pulse memory error    */ 
  /* Value 5-7:Unused (0)                                                 */ 
  /* ******************************************************************** */ 
  /* Returns the following information for AAC Card (Diagnostic Text):    */ 
  /* Value 0:  Status bits again                                          */ 
  /* Value 1:  Version Number register                                    */ 
  /* Value 2:  BNCs when pulled low                                       */ 
  /* Value 3:  BNCs when floating high.                                   */ 
  /* Value 4-7:Unused (0)                                                 */ 
  DIAGNOSTIC_ANALOGCARD_VERIFY,

  /* Verify that health monitoring sensors are within their expected range*/ 
  /* For the ATAPI Card based systems,                                    */ 
  /* the actual sensors checked are defined in the file                   */ 
  /* AnalogDeviceInfo.ini and based on the post keyword.                  */ 
  /* For each ADC that fails diagnostic, one bit is set in the return     */ 
  /* status, where bit 0 is for ADC0, bit 1 for ADC1, etc                 */ 
  /* Returns the following informaiton (Diagnostic Text Field)            */ 
  /* ******************************************************************** */ 
  /* Value 0: Status bits again                                           */ 
  /* Value 1: ADC0 value eng units but * 1000 (integer)                   */ 
  /* Value 2: ADC1 value eng units * 1000                                 */ 
  /* Value 3: ADC2 value eng units * 1000                                 */ 
  /* Value 4: ADC3 value eng units * 1000                                 */ 
  /* Value 5: ADC4 value eng units * 1000                                 */ 
  /* Value 6: ADC5 value eng units * 1000                                 */ 
  /* Value 7: ADC6 value eng units * 1000                                 */ 
  DIAGNOSTIC_HEALTHMONITORSENSORS_CHECK,

  /* ******************************************************************** */ 
  /* NOTE:                                                                */ 
  /* For non-ATAPI based (older version electronics), this diagnostic     */ 
  /* only checks the 48 volt power and the return values are interpreted  */ 
  /* as follows.                                                          */ 
  /* This above used to be the 48 volt power check and                    */ 
  /* had the following meaning.                                           */ 
  /* Verify that the 48 volt power is within its expected range.          */ 
  /* Returns the following bits set on errors:                            */ 
  /* 0: Voltage is too low                                                */ 
  /* 1: Voltage is too high.                                              */ 
  /* 2: Voltage reading timed out (serialADC problem)                     */ 
  /*31: Test not run.                                                     */ 
  /* ******************************************************************** */ 
  /* Returns the following information (Diagnostic Text Field):           */ 
  /* Value 0:  Status bits again                                          */ 
  /* Value 1:  48 Volt reading in millivolts                              */ 
  /* Value 2:  Last reading from ADC Converter in counts.                 */ 
  /* Value 3-7:Unused (0)                                                 */ 
  /* DIAGNOSTIC_48VOLTPOWER_CHECK,                                        */ 

  /* Verify that the internal ambient temperature sensor is operational   */ 
  /* 0: Reading is too low                                                */ 
  /* 1: Reading is too high.                                              */ 
  /* 2: Reading timed out (serialADC problem)                             */ 
  /*31: Test not run.                                                     */ 
  /* ******************************************************************** */ 
  /* Returns the following information (Diagnostic Text Field):           */ 
  /* Value 0:  Status bits again                                          */ 
  /* Value 1:  Ambient reading in milli Degrees C                         */ 
  /* Value 2:  Last reading from ADC Converter in counts.                 */ 
  /* Value 3-7:Unused (0)                                                 */ 
  DIAGNOSTIC_AMBIENTTEMP_CHECK,

  /* Send out a port pulse only, then a stbd pulse only, then both.       */ 
  /* This can be used to test port stbd wiring and power amp operation    */ 
  /* The diagnostic never fails.  The operator must look at the waterfall */ 
  /* and verify that the pattern matches the expected behavior.           */ 
  DIAGNOSTIC_PORT_STBD_POWERAMP_CHECK,

  /* Number of diagnostic  selections                                     */ 
  DIAGNOSTIC_NUM_SELECTIONS,

} DiagnosticSelectionType;


/* ---------------------------------------------------------------------- */ 
/* Message Data Structures                                                */ 
/* ---------------------------------------------------------------------- */ 
/* The data component of the messages varies with the PrivateMessage as   */      
/* defined by the structures below.                                       */ 
/* ---------------------------------------------------------------------- */ 

/* ---------------------------------------------------------------------- */ 
/* Structure for PRIVATE_MESSAGE_SYSTEM_DIAG                              */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /* Choose a diagnostic from DiagnosticSelectionType above               */ 
  unsigned long int      diagnosticSelection;

  /* Diagnostic returns status information here (0 => success)            */ 
  long int               diagnosticStatus;

  /* Optional descriptive string of error returned here                   */ 
  SonarMessageStringType diagnosticText;

}  SonarMessageDiagType;


/* ---------------------------------------------------------------------- */ 
/* Structure for PRIVATE_MESSAGE_DOWNLOAD_PING                            */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  long int pingParameters[PING_DATA_SIZE];
  long int filterParameters[FILTER_DATA_SIZE];

}  SonarMessageDownloadPingType;


/* ---------------------------------------------------------------------- */ 
/* Structure for PRIVATE_MESSAGE_DOWNLOAD_PING_STORE                      */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  char     fileName[FILE_NAME_SIZE];
  long int pingParameters[PING_DATA_SIZE];
  long int filterParameters[FILTER_DATA_SIZE];

}  SonarMessageDownloadStorePingType;


/* ---------------------------------------------------------------------- */ 
/* Structure for PRIVATE_MESSAGE_LOG_DATA                                 */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  int  waterTemp;
  int  ambientTemp;
  int  humidity;
  int  powerSupply;

}  DiagnosticMessageLogDataType;


/* ---------------------------------------------------------------------- */ 
/* Structure for PRIVATE_MESSAGE_DATA_TYPE                                */ 
/* ---------------------------------------------------------------------- */ 

typedef enum
{
  DATA_FORMAT_ENVELOPE,
  DATA_FORMAT_ANALYTIC,
  DATA_FORMAT_RAW,
  DATA_FORMAT_REAL

}  DataFormatType;


/* ---------------------------------------------------------------------- */ 
/*  Data Message Header.                                                  */ 
/*                                                                        */ 
/*  Each data record has a common 16 byte sub-header, the content of      */ 
/*  which is defined below.  This should be the first item in all data    */ 
/*  message headers.                                                      */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /*  0 -  1 : Subsystem (1 .. n)                                         */ 
  unsigned short int  subsystemNum;     

  /*  2 -  3 : Channel (1 .. n)                                           */ 
  short int           channelNum;     
  
  /*  4 - 11 : Timestamp                                                  */ 
  TimestampType       timestamp;    
 
  /* 12      : Sequence number (0 - 255)                                  */ 
  unsigned char       sequenceNumber;    
 
  /* 13      : Compression type                                           */ 
  unsigned char       compressionType;    

  /* 14 - 15 : Reserved for future use                                    */ 
  short int           reserved;

}  DataMessageHeaderType; 


/* ---------------------------------------------------------------------- */ 
/*  Sonar return data.                                                    */ 
/*                                                                        */ 
/*  Each record has a 40 byte header, the content of which is defined     */ 
/*  below.  The structure is intended to efficiently transfer sonar       */ 
/*  information and is not compatible with any existent format.           */ 
/* ---------------------------------------------------------------------- */ 

typedef struct 
{
  /*  0 -  15 : Data Message Header                                       */ 
  DataMessageHeaderType   dataHeader;
  
  /* 16 - 19 : Ping number (increments with ping)                         */ 
  unsigned long int       pingNum;        

  /* 20      : 1 - N (Each ping starts with packet 1)                     */   
  unsigned char           packetNum;     

  /* 21      : DataFormatType                                             */ 
  /*           0 = 1 short per sample                                     */ 
  /*           1 = 2 shorts per sample, stored as real(1), imag(1),       */ 
  /*           2 = 1 short per sample - before matched filter             */ 
  /*           3 = 1 short per sample - real part analytic signal         */ 
  unsigned char           dataFormat;    

  /* 22 - 23 : -- defined as 2-N volts for lsb                            */ 
  short int               weightingFactor;

  /* 24 - 27 : Starting depth (window offset) in samples used for 1 / r   */ 
  /*           correction                                                 */ 
  unsigned long           startDepth;    

  /* 28 - 29 : Gain factor of ADC                                         */ 
  short int               ADCGain;       

  /* 30 - 31 : Maximum absolute value for ADC samples for this packet     */ 
  unsigned short int      ADCMax;        

  /* 32 - 35 : Samples in this trace                                      */ 
  unsigned long int       samples;

  /* 36 - 39 : Sample interval in ns of stored data **                    */ 
  unsigned long int       sampleInterval;

  /* Data area begins here.                                               */ 
  /* Starting at byte 36, has this.samples points in it.                  */ 
  /* short int data[];                                                    */ 

} SonarReturnType;


/* ---------------------------------------------------------------------- */ 
/* Message Data Structures                                                */ 
/* ---------------------------------------------------------------------- */ 

/* The data component of the messages varies with the storageMessage as   */ 
/* defined by the structures below.                                       */ 

/* Find First / Next for sonar data files                                 */ 
typedef struct
{
  /* File name - no directory permitted (null =>last file)                */ 
  char           fileName[FILE_NAME_SIZE];  

  /* ????                                                                 */ 
  TimestampType  creationTime;

  /* Size of file in bytes                                                */ 
  long int       bytes;     

} SonarMessageFileInfoType;


/* ----------------------------------------------------------------------- */ 
/* This is the structure of data returned from the DSP to PC or the info   */ 
/* returned after match filtering.                                         */ 
/* ----------------------------------------------------------------------- */ 

typedef struct
{
  /* Channel and system that data applies to (channel is 8 lsbs, subsystem */ 
  /* is next 8 bits.                                                       */ 
  long   itemID;

  /* Fromat of data (eg processed or raw).  As defined in SegyDefs.h       */ 
  long   data_type;

  /* Gain used for data collection.                                        */ 
  long   gain;

  /* Maximum ADC value for buffer.                                         */ 
  long   adc_max;

  /* Current ping number.                                                  */ 
  long   ping_no;

  /* Sample offset in samples from start of ping                           */ 
  long   sampleOffset;

  /* Scale factor for data                                                 */ 
  float  scale; 
  
  /* Extra information - tailored for specific applications                */ 
  long   extraInfo; 

  /* Samples to process - max of 4096 words or 2048 floats                 */ 
  long   samples;

  /* Sample counter - indicates absolute sample number at start of ping.   */ 
  /* This is an incrementing counter which is not reset on each ping.      */ 
  long   sampleCounter;

  /* The returned data (packed as 2 shorts to an int)                      */ 
  /* long data[];                                                          */ 

} InternalDspFrameType;


/* ---------------------------------------------------------------------- */ 
/* ACI / DCI Status Message                                               */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /* IO Model                                                             */ 
  long    ioModel;

  /* serial control port                                                  */ 
  long    comPort;

  /* Digital acq device: 0: USR, 1: DT301                                 */ 
  long    device;

  /* Interface reset count                                                */ 
  long    resetCount;

  /* Record size change count                                             */ 
  long    sizeChangeCount;

  /* Messages sent                                                        */ 
  long    msgCnt;

  /* Ping number                                                          */ 
  long    ping;

  /* ACI Status                                                           */ 
  char    aciStatus[64];

  /* USB Connection extablished                                           */  
  long    bUsbConnected;

  /* USB Connection enabled                                               */ 
  long    bUsbEnabled;

  /* Enqueue failure statistics                                           */ 
  long    queueOverflows;

} ACIDCIStatusReturnType;


/* ---------------------------------------------------------------------- */ 
/* Responder Control Structure                                            */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /* Control Flags - Indicate which control fields are valid              */ 
  /* If the corresponding bit is set the field is valid                   */ 
  /* Bit  0 : onOff                                                       */ 
  /* Bit  1 : triggerMode                                                 */ 
  /* Bit  2 : couplingInfo                                                */ 
  /* Bit  3 : triggerRate                                                 */ 
  /* Bit  4 : pulseLength                                                 */ 
  /* Bit  5 : pulseCenterFrequency                                        */ 
  /* Bit  6 : pulseBandwidth                                              */ 
  /* Bit  7 : pulsePowerLevel                                             */ 
  /* Bit  8 : pulseType                                                   */ 
  long    controlFlags;

  /* On\Off - 0 = Off, 1 = On                                             */ 
  long    onOff;

  /* Trigger mode                                                         */ 
  /* 0 for internal, 1 for external, 2 for coupled.                       */ 
  long    triggerMode;

  /* Coupling parameters for external and coupled modes                   */ 
  SonarMessageCouplingParametersType couplingInfo;

  /* Trigger rate - internal trigger rate in Hz                           */ 
  float   triggerRate;

  /* Pulse length - outgoing pulse length in ms                           */ 
  float   pulseLength;

  /* Pulse center frequency - in KHz                                       */ 
  float   pulseCenterFrequency;

  /* Pulse bandwidth - in KHz                                             */ 
  float   pulseBandwidth;

  /* pulse power level - 1.0 = 100% power                                 */ 
  float   pulsePowerLevel;

  /* Pulse type - type of pulse to send                                   */ 
  /* 0 = tone                                                             */ 
  /* 1 = chirp                                                            */ 
  long    pulseType;

  /* reserved for future use                                              */ 
  long    reserved[22];

}  ResponderControlType;


/* ---------------------------------------------------------------------- */ 
/* remote status message                                                  */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /* model                                                                */ 
  /*   1 - 4200                                                           */ 
  long           model;

  /* fish power status                                                    */ 
  /*   1 - on                                                             */ 
  /*   0 - off                                                            */ 
  /*  -1 - off under current error                                        */ 
  /*  -2 - off over  current error                                        */ 
  long           fishPowerStatus;

  /* cable current in milliamps                                           */ 
  long           cableCurrent;

  /* internal temperature in degrees celsius                              */ 
  long           internalTemperature;

  /* LED states                                                           */ 
  unsigned long  LEDStates;

  /* trigger polarity                                                     */ 
  /*  -1 - negative polarity                                              */ 
  /*   0 - any                                                            */ 
  /*   1 - positive polarity                                              */  
  long           triggerPolarity;

  /* supervisor status                                                    */ 
  /* TBD                                                                  */ 
  unsigned long  supervisor;

  /* reserved for future use                                              */ 
  long           reserved[9];

} RemoteStatusReturnType;



/* ---------------------------------------------------------------------- */ 
/* remote status LED identifier message                                   */ 
/* ---------------------------------------------------------------------- */ 

/* ---------------------------------------------------------------------- */ 
/* RemoteLEDIdType                                                        */ 
/*                                                                        */ 
/* enumeration of known LEDs                                              */ 
/* ---------------------------------------------------------------------- */ 

typedef enum
{
  REMOTE_400V_POWER                         = 0,
  REMOTE_ADSL_LAN,
  REMOTE_ADSL_LINK,
  REMOTE_ADSL_POWER,
  REMOTE_ADSL_TX,
  REMOTE_ADSL_RX,
  REMOTE_BRIDGE_WLAN,
  REMOTE_BRIDGE_LAN,
  REMOTE_BRIDGE_DIAG,
  REMOTE_BRIDGE_POWER,

} RemoteLEDIdType;

 
/* ---------------------------------------------------------------------- */ 
/* LEDIdEntryType                                                         */ 
/*                                                                        */ 
/* associates an ID and label to an LED status entry                      */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /* position in LEDStates (0 - 15)                                       */ 
  long           position;

  /* LED ID (RemoteLEDIdType)                                             */ 
  long           ledid;

  /* display text                                                         */ 
  char           displayText[4];

} LEDIdEntryType;


/* ---------------------------------------------------------------------- */ 
/* RemoteLEDIdMessageType                                                 */ 
/*                                                                        */ 
/* container for LEDIdEntryType entries                                   */  
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /* number of valid identifier entries                                   */ 
  long           entryCount;

  /* LED identifer information                                            */ 
  LEDIdEntryType LEDIdTable[16];

} RemoteLEDIdMessageType;


/* ---------------------------------------------------------------------- */ 

#endif  /* Not __PRIVATE_MESSAGES_H__ */ 


/* ---------------------------------------------------------------------- */ 
/*                       end PrivateMessages.h                            */ 
/* ---------------------------------------------------------------------- */ 

