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

#ifndef __DvlIF_H
#define __DvlIF_H

#include "TaskInterface.h"

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

#define DvlIFServerName "DvlIFServer"

class DvlIF : public InstrumentIF {

  friend class DvlIF_SK;

  public:

  // Forward declarations of public structures
  struct Data;
  
  
  typedef double Vector[4];
  
  // x, y, z, error
  struct Data {
    TimeIF::TimeSpec sampleTime;
    //
    // m/s wrto the bottom, in SNAME standard ship coordinates.  The 4th 
    // component is the least-squares error.  No coordinate transformation
    // is done on this component.
    //
    DvlIF::Vector bottomTrackVelocity;
    //
    // Bitmap showing good/bad correlation and good/bad echo intensity for
    // each of the 4 beams.
    //
    long bottomStatus;
    //
    // m/s wrto a water layer, in SNAME standard ship coordinates.  The 4th 
    // component is the least-squares error.  No coordinate transformation
    // is done on this component.
    //
    // The distance and thickness of the water layer are set in 
    // Dvl::initialize().
    //
    DvlIF::Vector waterMassVelocity;
    //
    // Bitmap showing good/bad correlation and good/bad echo intensity for
    // each of the 4 beams.
    //
    long waterStatus;
    //
    // Time at which the ping was sent, in seconds.  This counter starts
    // from zero when the instrument begins pinging. (Check this)
    //
    double pingTime;
    //
    // Range to the bottom, meters.  It's cos(30) times the average of the 4
    // beam ranges.
    //
    double range;
    //
    // DVL temp in Deg C.
    //
    double temp;
    //
    // Bitmap.  Nonzero means that the DVL reported a bad velocity by setting
    // a component to -32768.
    //
    double pitch;
    //
    // DVL tilt sensor pitch, Degrees.
    //
    double roll;
    //
    // DVL tilt sensor roll, Degrees.
    //
    double heading;
    double beam1;
    double beam2;
    double beam3;
    double beam4;
    double spdsnd;
    double toping;
    //
    // DVL compass heading, Degrees.
    //
    long dataStatus;
    //
    // Bad communication flag.  I would rather this be a Boolean, or even
    // an int, but apparently idl accepts neither.
    //
    // Some examples of causes of bad communications are a checksum failure, or
    // a timeout by readNChars().
    //
    long badComms;
  };
  DvlIF(const char *name, int timeout = 10);

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

  ~DvlIF();

  /////////////////////////////////////////////////////////
  // Get data from instrument
  // [output] Data: Gps data
  DeviceIF::Status get(DvlIF::Data *data, Boolean *newData);

  
  protected:

  // Message codes for each method
  enum DvlIFMsgCode {
    GetMsgCode = 8
  };

  // Define message structure for each method
  struct GetMsg : Request, Reply {
    DeviceIF::Status returnVal;
    DvlIF::Data data;
    Boolean newData;
  
  } _getMsg;

};

#endif

