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

#ifndef __UsblIF_H
#define __UsblIF_H

#include "TaskInterface.h"

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

#define UsblIFServerName "UsblIFServer"

class UsblIF : public InstrumentIF {

  friend class UsblIF_SK;

  public:

  
  enum UsblDataStatus {
    Undefined,
    AllGood,
    RangeOnly,
    Stale
  };

  
  typedef char String32[32];
  
  UsblIF(const char *name, int timeout = 10);

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

  ~UsblIF();

  /////////////////////////////////////////////////////////
  // Return true if device is ready to go, otherwise false
  Boolean ready();

  /////////////////////////////////////////////////////////
  // Get all Data from USBL Simultaneously
  // Range, X, Y, and Z reading from transceiver
  // Turn-around time from request to response in milliseconds
  // Timestamp of last successful reading
  // Status of data (see UsblDataStatus enum)
  //
  DeviceIF::Status get_range_data(float *range, float *x, float *y, float *z, short *turnAroundTime, TimeIF::TimeSpec *sampleTime, UsblIF::UsblDataStatus *status);

  DeviceIF::Status set_beacon(UsblIF::String32 newBeaconName);

  DeviceIF::Status start();

  DeviceIF::Status stop();

  
  protected:

  // Message codes for each method
  enum UsblIFMsgCode {
    ReadyMsgCode = 8,
    Get_range_dataMsgCode,
    Set_beaconMsgCode,
    StartMsgCode,
    StopMsgCode
  };

  // Define message structure for each method
  struct ReadyMsg : Request, Reply {
    Boolean returnVal;
  
  } _readyMsg;

  struct Get_range_dataMsg : Request, Reply {
    DeviceIF::Status returnVal;
    float range;
    float x;
    float y;
    float z;
    short turnAroundTime;
    TimeIF::TimeSpec sampleTime;
    UsblIF::UsblDataStatus status;
  
  } _get_range_dataMsg;

  struct Set_beaconMsg : Request, Reply {
    DeviceIF::Status returnVal;
    UsblIF::String32 newBeaconName;
  
  } _set_beaconMsg;

  struct StartMsg : Request, Reply {
    DeviceIF::Status returnVal;
  
  } _startMsg;

  struct StopMsg : Request, Reply {
    DeviceIF::Status returnVal;
  
  } _stopMsg;

};

#endif

