/****************************************************************************/
/* Copyright (c) 2005 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : VehicleDriver.h                                           */
/* Author   : rsm
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 9/5/2006                                                      */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/
#ifndef _VEHICLEDRIVER_H
#define _VEHICLEDRIVER_H
#include "PeriodicTask.h"
#include "Attributes.h"
#include "SerialDevice.h"
#include "UsblIF.h"
#include "VehicleOutput.h"
#include "VehicleCommand.h"
//#include "VehicleLog.h"

const int MAX_LW = 5;
const double DEFAULT_ESV = 1485.;
const unsigned VehiclePollPeriod = 1000;  //millisec.


class VehicleDriver : public PeriodicTask {

// friend class VehicleLog;

   public:
      VehicleDriver(SerialDevice *serialDevice, 
		 char *configfile = "vehicle.cfg");
      ~VehicleDriver();


   ////////////////////////////////////////////////////////////////////
   // Read device data
   //
   virtual void callback();


   protected:
      SerialDevice   *_device;
//    VehicleLog     *_log;
      VehicleOutput  *_output;
      VehicleCommand *_command;
      char *_config;
      char  _response[600];
      unsigned _timeout;
      long  _period;
      char *_beacon;
      char  _interrogation[32];
      char  _cmd[128];
      
      //
      // Output
      //

      //
      // Config attributes
      //
      
      Attributes _attributes;
      
      void init();
      void loadConfigFile(const char* file);
      void reportCfgAttributes();
      void createCfgAttributes();
      int  getrs();
      
   private:
};

#endif
