/****************************************************************************/
/* Copyright (c) 2000 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  : Simulate the velocity measurement from the RDI DVL            */
/* Filename : SimulatedDvlSide.h                                                */
/* Author   : McEwen, following O'Reilly's template.                        */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 04/03/2001                                                    */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/
#ifndef _SimulatedDvlSide_H
#define _SimulatedDvlSide_H
#include "DvlSideIF_SK.h"
#include "SimulatorIF.h"
#include "DvlSideLog.h"
//
// Believe it or not, there are two of these.  Here we need dvl/Dvl.h, not 
// Navigation/Dvl.h
//#include "dvl/Dvl.h"   
//
// I can't make it work; there are inexplicable link errors.  So I'll repeat
// stuff from dvl/Dvl.h and dvl/Dvl.cc here and in SimulatedDvlSide.cc.

#define NXE 4
#define NUM_BEAMS 4
#define NBYTES 2

class SimulatedDvlSide : public DvlSideIF_SK {

friend class DvlSideLog;

public:

  SimulatedDvlSide();
  ~SimulatedDvlSide();

protected:
  //
  // Copy the Dvl data array defined in taskIF/DvlIF.idl.
  //
  typedef DvlSideIF::Data Data;
  //
  // Boilerplate methods:
  //
  virtual void name(DeviceIF::Name name);
  virtual void serialNumber(DeviceIF::Name id);
  virtual DeviceIF::Status initialize();
  virtual DeviceIF::Status powerOn();
  virtual DeviceIF::Status powerOff();
  virtual DeviceIF::Status dataLoggingOn();
  virtual DeviceIF::Status dataLoggingOff();
  virtual DeviceIF::Status status();

  virtual DeviceIF::Status get(Data *data, Boolean *newData);

  virtual int spawnAuxTasks();

  Data data;

  long waterStatus[1];                         /* Init this to the outpt arry*/
  long bottomStatus[1];                        /* Init this to the outpt arry*/
  long rawRange[NUM_BEAMS][NBYTES];            /* raw DVL range in centimetrs*/
  double bottomTrackVelocity[NXE];             /* 4 element vector           */
  double waterMassVelocity[NXE];               /* 4 element vector           */
  double dvlPingTime[1];                 
  double dvlRange[1];                    
  double dvlTemp[1];
  double dvlPitch[1];
  double dvlRoll[1];
  double dvlHeading[1];
  int    count[1];                             /* Counts bisection steps     */
  double beamRange[NUM_BEAMS];                 /* Four Dvl beams             */
  double offset_B[3];                          /* Dist frm B orgn to Dvl     */
  double los_B[NUM_BEAMS][3];                  /* Dvl Beam los unit vectors  */

  SimulatorIF *_simulator;
  //Dvl *_dvl;
  DvlSideLog *m_log;

};

#endif
