/*
********************************************************
Copyright 2000 MBARI.
MBARI Proprietary Information. All rights reserved.
NOTE: This file is automatically generated.
DO NOT MODIFY.
********************************************************
*/

#ifndef __EdgetechFSDWIF_H
#define __EdgetechFSDWIF_H

#include "TaskInterface.h"

#include "InstrumentIF.h"
#include "TimeIF.h"

#define EdgetechFSDWIFServerName "EdgetechFSDWIFServer"

class EdgetechFSDWIF : public InstrumentIF {

  friend class EdgetechFSDWIF_SK;

  public:

  // Forward declarations of public structures
  struct sCompositeSituation;
  struct sSituation;
  struct sPressureRecord;
  struct sAltitudeRecord;
  
  enum EdgetechFSDWSonarSystems {
    PLC = -1,
    Dummy1,
    Dummy2,
    SubBottom,
    SideScanLow,
    SideScanHigh,
    SideScanBoth,
    EdgetechAll
  };

  enum COMPFLG {
    COMPFLG_TIMEVALID = 1,
    COMPFLG_LONGVALID = 2,
    COMPFLG_LATVALID = 4,
    COMPFLG_DEPTHVALID = 8,
    COMPFLG_ALTVALID = 16,
    COMPFLG_HEAVEVALID = 32,
    COMPFLG_V1V2VALID = 64,
    COMPFLG_VDOWNVALID = 128,
    COMPFLG_PITCHVALID = 256,
    COMPFLG_ROLLVALID = 512,
    COMPFLG_HEADVALID = 1024,
    COMPFLG_SSPEEDVALID = 2048,
    COMPFLG_TEMPVALID = 4096
  };

  enum SITFLG {
    SITFLG_TIMEVALID = 1,
    SITFLG_LATVALID = 2,
    SITFLG_LONGVALID = 4,
    SITFLG_DEPTHVALID = 8,
    SITFLG_HEADVALID = 16,
    SITFLG_PITCHVALID = 32,
    SITFLG_ROLLVALID = 64,
    SITFLG_XPOSVALID = 128,
    SITFLG_YPOSVALID = 256,
    SITFLG_ZPOSVALID = 512,
    SITFLG_XVELVALID = 1024,
    SITFLG_YVELVALID = 2048,
    SITFLG_ZVELVALID = 4096,
    SITFLG_NVELVALID = 8192,
    SITFLG_EVELVALID = 16384,
    SITFLG_DVELVALID = 32768,
    SITFLG_XANGVALID = 65536,
    SITFLG_YANGVALID = 131072,
    SITFLG_ZANGVALID = 262144,
    SITFLG_XACCVALID = 524288,
    SITFLG_YACCVALID = 1048576,
    SITFLG_ZACCVALID = 2097152,
    SITFLG_LATSTDVALID = 4194304,
    SITFLG_LONSTDVALID = 8388608,
    SITFLG_DEPSTDVALID = 16777216,
    SITFLG_HDGSTDVALID = 33554432,
    SITFLG_PITSTDVALID = 67108864,
    SITFLG_ROLLSTDVALID = 134217728
  };

  enum PRESSFLG {
    PRESSFLG_PRESSVALID = 1,
    PRESSFLG_TEMPVALID = 2,
    PRESSFLG_SALINVALID = 4,
    PRESSFLG_CONDVALID = 8,
    PRESSFLG_SSPEEDVALID = 16,
    PRESSFLG_DEPTHVALID = 32
  };

  enum ALTFLG {
    ALTFLG_ALTPRESENT = 1,
    ALTFLG_FWDVELPRESENT = 2,
    ALTFLG_CROSSTRKPRESENT = 4
  };

  
  typedef char String32[32];
  
  struct sCompositeSituation {
    long flags;
    unsigned char vDirections;
    TimeIF::TimeSpec timestamp;
    double latitudeD;
    double longitudeD;
    float depthM;
    float altitudeM;
    float heaveM;
    float velocity1MS;
    float velocity2MS;
    float velocityDownMS;
    float pitchD;
    float rollD;
    float headingD;
    float soundSpeedMS;
    float waterTempC;
  };
  struct sSituation {
    long flags;
    TimeIF::TimeSpec timestamp;
    double latitudeD;
    double longitudeD;
    double depthM;
    double headingD;
    double pitchD;
    double rollD;
    double xRelativePosM;
    double yRelativePosM;
    double zRelativePosM;
    double xVelocityMS;
    double yVelocityMS;
    double zVelocityMS;
    double northVelocityMS;
    double eastVelocityMS;
    double downVelocityMS;
    double xAngularRateDS;
    double yAngularRateDS;
    double zAngularRateDS;
    double xAccelerationMS;
    double yAccelerationMS;
    double zAccelerationMS;
    double latitudeStandardDeviationM;
    double longitudeStandardDeviationM;
    double depthStandardDeviationM;
    double headingStandardDeviationD;
    double pitchStandardDeviationD;
    double rollStandardDeviationD;
  };
  struct sPressureRecord {
    float pressurePSI;
    float tempC;
    float salPSU;
    float condSM;
    float sosMS;
    float depthM;
    long flags;
  };
  struct sAltitudeRecord {
    long flags;
    float altitudeM;
    float forwardVelocityMS;
    float crossTrackVelocityMS;
  };
  EdgetechFSDWIF(const char *name, int timeout = 10);

  EdgetechFSDWIF(const char *name, const char *serverName, int timeout = 10);

  ~EdgetechFSDWIF();

  // Start/stop payload sonar logging.
  DeviceIF::Status startEdgetechStorage(Boolean bUpdate);

  DeviceIF::Status stopEdgetechStorage(Boolean bUpdate);

  DeviceIF::Status startSubsystem(EdgetechFSDWIF::EdgetechFSDWSonarSystems sonarSystem, Boolean bUpdate);

  DeviceIF::Status stopSubsystem(EdgetechFSDWIF::EdgetechFSDWSonarSystems sonarSystem, Boolean bUpdate);

  DeviceIF::Status pingStatus(EdgetechFSDWIF::EdgetechFSDWSonarSystems sonarSystem, unsigned short *pingStatus, Boolean bUpdate);

  DeviceIF::Status setPulseFilename(EdgetechFSDWIF::EdgetechFSDWSonarSystems sonarSystem, EdgetechFSDWIF::String32 pulseFilename, Boolean bUpdate);

  DeviceIF::Status setPingRange(EdgetechFSDWIF::EdgetechFSDWSonarSystems sonarSystem, float pingRange, Boolean bUpdate);

  DeviceIF::Status setPingRate(EdgetechFSDWIF::EdgetechFSDWSonarSystems sonarSystem, float pingRate, Boolean bUpdate);

  DeviceIF::Status setPingPower(EdgetechFSDWIF::EdgetechFSDWSonarSystems sonarSystem, float pingPower, Boolean bUpdate);

  DeviceIF::Status setSBPGain(float gain, Boolean bUpdate);

  DeviceIF::Status setSBPDuration(float duration_milliseconds, Boolean bUpdate);

  DeviceIF::Status relaySituation(EdgetechFSDWIF::sSituation *compSituation);

  DeviceIF::Status relayCompositeSituation(EdgetechFSDWIF::sCompositeSituation *situation);

  DeviceIF::Status relayPressureRecord(EdgetechFSDWIF::sPressureRecord *pressureRecord);

  DeviceIF::Status relayAltitudeRecord(EdgetechFSDWIF::sAltitudeRecord *altitudeRecord);

  DeviceIF::Status setTime(Boolean bUpdate);

  DeviceIF::Status setVerboseMode(unsigned short flag);

  DeviceIF::Status getVersion();

  DeviceIF::Status getSonarStatus(EdgetechFSDWIF::EdgetechFSDWSonarSystems sonarSystem, Boolean bUpdate);

  //Status getModules();
  //Status getRunList();
  DeviceIF::Status sonarReboot();

  DeviceIF::Status sonarSystemReboot();

  DeviceIF::Status sonarShutdown();

  DeviceIF::Status sonarSystemShutdown();

  DeviceIF::Status sonarSystemPowerOn();

  DeviceIF::Status sonarSystemPowerOff();

  
  protected:

  // Message codes for each method
  enum EdgetechFSDWIFMsgCode {
    StartEdgetechStorageMsgCode = 8,
    StopEdgetechStorageMsgCode,
    StartSubsystemMsgCode,
    StopSubsystemMsgCode,
    PingStatusMsgCode,
    SetPulseFilenameMsgCode,
    SetPingRangeMsgCode,
    SetPingRateMsgCode,
    SetPingPowerMsgCode,
    SetSBPGainMsgCode,
    SetSBPDurationMsgCode,
    RelaySituationMsgCode,
    RelayCompositeSituationMsgCode,
    RelayPressureRecordMsgCode,
    RelayAltitudeRecordMsgCode,
    SetTimeMsgCode,
    SetVerboseModeMsgCode,
    GetVersionMsgCode,
    GetSonarStatusMsgCode,
    SonarRebootMsgCode,
    SonarSystemRebootMsgCode,
    SonarShutdownMsgCode,
    SonarSystemShutdownMsgCode,
    SonarSystemPowerOnMsgCode,
    SonarSystemPowerOffMsgCode
  };

  // Define message structure for each method
  struct StartEdgetechStorageMsg : Request, Reply {
    DeviceIF::Status returnVal;
    Boolean bUpdate;
  
  } _startEdgetechStorageMsg;

  struct StopEdgetechStorageMsg : Request, Reply {
    DeviceIF::Status returnVal;
    Boolean bUpdate;
  
  } _stopEdgetechStorageMsg;

  struct StartSubsystemMsg : Request, Reply {
    DeviceIF::Status returnVal;
    EdgetechFSDWIF::EdgetechFSDWSonarSystems sonarSystem;
    Boolean bUpdate;
  
  } _startSubsystemMsg;

  struct StopSubsystemMsg : Request, Reply {
    DeviceIF::Status returnVal;
    EdgetechFSDWIF::EdgetechFSDWSonarSystems sonarSystem;
    Boolean bUpdate;
  
  } _stopSubsystemMsg;

  struct PingStatusMsg : Request, Reply {
    DeviceIF::Status returnVal;
    EdgetechFSDWIF::EdgetechFSDWSonarSystems sonarSystem;
    unsigned short pingStatus;
    Boolean bUpdate;
  
  } _pingStatusMsg;

  struct SetPulseFilenameMsg : Request, Reply {
    DeviceIF::Status returnVal;
    EdgetechFSDWIF::EdgetechFSDWSonarSystems sonarSystem;
    EdgetechFSDWIF::String32 pulseFilename;
    Boolean bUpdate;
  
  } _setPulseFilenameMsg;

  struct SetPingRangeMsg : Request, Reply {
    DeviceIF::Status returnVal;
    EdgetechFSDWIF::EdgetechFSDWSonarSystems sonarSystem;
    float pingRange;
    Boolean bUpdate;
  
  } _setPingRangeMsg;

  struct SetPingRateMsg : Request, Reply {
    DeviceIF::Status returnVal;
    EdgetechFSDWIF::EdgetechFSDWSonarSystems sonarSystem;
    float pingRate;
    Boolean bUpdate;
  
  } _setPingRateMsg;

  struct SetPingPowerMsg : Request, Reply {
    DeviceIF::Status returnVal;
    EdgetechFSDWIF::EdgetechFSDWSonarSystems sonarSystem;
    float pingPower;
    Boolean bUpdate;
  
  } _setPingPowerMsg;

  struct SetSBPGainMsg : Request, Reply {
    DeviceIF::Status returnVal;
    float gain;
    Boolean bUpdate;
  
  } _setSBPGainMsg;

  struct SetSBPDurationMsg : Request, Reply {
    DeviceIF::Status returnVal;
    float duration_milliseconds;
    Boolean bUpdate;
  
  } _setSBPDurationMsg;

  struct RelaySituationMsg : Request, Reply {
    DeviceIF::Status returnVal;
    EdgetechFSDWIF::sSituation compSituation;
  
  } _relaySituationMsg;

  struct RelayCompositeSituationMsg : Request, Reply {
    DeviceIF::Status returnVal;
    EdgetechFSDWIF::sCompositeSituation situation;
  
  } _relayCompositeSituationMsg;

  struct RelayPressureRecordMsg : Request, Reply {
    DeviceIF::Status returnVal;
    EdgetechFSDWIF::sPressureRecord pressureRecord;
  
  } _relayPressureRecordMsg;

  struct RelayAltitudeRecordMsg : Request, Reply {
    DeviceIF::Status returnVal;
    EdgetechFSDWIF::sAltitudeRecord altitudeRecord;
  
  } _relayAltitudeRecordMsg;

  struct SetTimeMsg : Request, Reply {
    DeviceIF::Status returnVal;
    Boolean bUpdate;
  
  } _setTimeMsg;

  struct SetVerboseModeMsg : Request, Reply {
    DeviceIF::Status returnVal;
    unsigned short flag;
  
  } _setVerboseModeMsg;

  struct GetVersionMsg : Request, Reply {
    DeviceIF::Status returnVal;
  
  } _getVersionMsg;

  struct GetSonarStatusMsg : Request, Reply {
    DeviceIF::Status returnVal;
    EdgetechFSDWIF::EdgetechFSDWSonarSystems sonarSystem;
    Boolean bUpdate;
  
  } _getSonarStatusMsg;

  struct SonarRebootMsg : Request, Reply {
    DeviceIF::Status returnVal;
  
  } _sonarRebootMsg;

  struct SonarSystemRebootMsg : Request, Reply {
    DeviceIF::Status returnVal;
  
  } _sonarSystemRebootMsg;

  struct SonarShutdownMsg : Request, Reply {
    DeviceIF::Status returnVal;
  
  } _sonarShutdownMsg;

  struct SonarSystemShutdownMsg : Request, Reply {
    DeviceIF::Status returnVal;
  
  } _sonarSystemShutdownMsg;

  struct SonarSystemPowerOnMsg : Request, Reply {
    DeviceIF::Status returnVal;
  
  } _sonarSystemPowerOnMsg;

  struct SonarSystemPowerOffMsg : Request, Reply {
    DeviceIF::Status returnVal;
  
  } _sonarSystemPowerOffMsg;

};

#endif

