#ifndef _BIOLUMEDRIVER_H
#define _BIOLUMEDRIVER_H

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

#define BiolumeLogName "biolume"

/*
CLASS 
BiolumeLog

DESCRIPTION
Logs biolume sensor data through the DataLogWriter interface.

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

AUTHOR
Tom O'Reilly
*/
class BiolumeLog : public DataLogWriter {

public:

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

  ~BiolumeLog();

  struct Data {

    Data();

    FloatData depth;
    FloatData pmt;
    ShortData flowRate;
    FloatData temperature;

  } data;


protected:

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

};



/*
CLASS 
BiolumeDriver

DESCRIPTION
Device Driver for UCSB's bioluminescense sensor

AUTHOR
Tom O'Reilly
*/
class BiolumeDriver : public StreamSerialDriver {

public:

  BiolumeDriver(SerialDevice *device, Boolean verbose);

  ~BiolumeDriver();

protected:

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

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

  BiolumeLog *_log;
  Boolean _verbose;
};

#endif
