#ifndef _ECOFLDRIVER_H_
#define _ECOFLDRIVER_H_

#include "StreamSerialDriver.h"
#include "DataLogWriter.h"
#include "DoubleData.h"
#include "FloatData.h"
#include "IntegerData.h"
#include "ShortData.h"

#define EcoflLogName "ecofl"

/*
CLASS 
ecoflLog

DESCRIPTION
Logs ECO-FL sensor data through the DataLogWriter interface.

To use this class, instantiate an instance within a ecoflDriver object
and periodically invoke the write() method:

AUTHOR
Hans Thomas
*/
class ecoflLog : public DataLogWriter {

public:

  ///////////////////////////////////////////////////////////////////
  // Constructor
  // [input] fileFormat: Specifies either DataLog::AsciiFormat or 
  //         DataLog::BinaryFormat.
  ecoflLog(DataLog::FileFormat fileFormat); 

  ~ecoflLog();

  IntegerData *_Chl_Ref, *_Chl_Sig, *_Thermistor;

protected:

  ///////////////////////////////////////////////////////////////////
  // Set values in record array elements. This virtual method is called
  // by DataLogWriter::write()
  virtual void setFields();

};



/*
CLASS 
ecoflDriver

DESCRIPTION
Device Driver for Wetlabs ECO-FL CDOM

AUTHOR
Hans Thomas
*/
class ecoflDriver : public StreamSerialDriver {

public:

  ecoflDriver(SerialDevice *device, Boolean verbose);

  ~ecoflDriver();

protected:

  ////////////////////////////////////////////////////////////////////
  // Initialize device
  virtual DeviceIF::Status initialize();

  ////////////////////////////////////////////////////////////////////
  // Process device data
  virtual DeviceIF::Status processRecord(unsigned char *record, 
					 int nRecordBytes);

  ecoflLog *_log;
  Boolean _verbose;
};

#endif
