#ifndef _Dvl_H
#define _Dvl_H

#include "NavSensor.h"
#include "DvlIF.h"
#include "NavigationIF.h"

// Dummy value for now...
#define MaxDvlFixDepth 0.1
//
#define BAD_BEAM_RANGE 0
#define NUM_BEAMS 4
#define MIN_GOOD_HITS (4)
/*
CLASS 
Dvl

DESCRIPTION
Dvl NavSensor

AUTHOR
Tom O'Reilly
*/
class Dvl : public NavSensor {

public:

  Dvl(const char *name, NavSensors *sensors, int maxBad = 3);

  Boolean Dvl::newData();

  /////////////////////////////////////////////////////////////////////
  // Latest Dvl fix
  DvlIF::Data data;

  /////////////////////////////////////////////////////////////////////
  //
  // Compute the altitude:
  //
  double Dvl::altitude(NavigationIF::Attitude *attitude);

  //Altitude corresponding to each beam, assuming a planar level bottom.
  double h[4];

protected:

  virtual TaskInterface *createTaskIF(int timeout);

  virtual DeviceIF::Status readTaskIF(Boolean *valid, 
				      TimeIF::TimeSpec *sampleTime);

	DvlIF *_DvlIF;

	Boolean m_newData;
	double m_lastPingTime;
        unsigned int _consecGoodHits[4];
};


#endif

