#ifndef _OCR507_H
#define _OCR507_H

#include "StreamSerialDriver.h"
#include "DataLogWriter.h"
#include "StringData.h"
#include "IntegerData.h"
#include "ShortData.h"

#define OCR507LogName "OCR507"
#define NUM_OCR_CHANNELS (7)
/*
CLASS 
OCR507Log

DESCRIPTION
Logs biolume sensor data through the DataLogWriter interface.

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

AUTHOR
Hans Thomas
*/
class OCR507Log : public DataLogWriter {

public:

  ///////////////////////////////////////////////////////////////////
  // Constructor
  // [input] fileFormat: Specifies either DataLog::AsciiFormat or 
  //         DataLog::BinaryFormat.
  OCR507Log(const char *filename, DataLog::FileFormat fileFormat); 

  ~OCR507Log();

  IntegerData *_ChannelData[7];
  IntegerData *_VinSense, *_IntTemp;
  IntegerData *_frameCounter;

protected:

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

};



/*
CLASS 
OCR507Driver

DESCRIPTION
Device Driver for Satlantic OCR507 Series Instruments

AUTHOR
Hans Thomas
*/
class OCR507Driver : public StreamSerialDriver {

public:

  OCR507Driver(SerialDevice *device, Boolean verbose);

  ~OCR507Driver();

protected:

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

  ////////////////////////////////////////////////////////////////////
  // Process device data
  virtual DeviceIF::Status readRecord(unsigned char *record, int maxRecordBytes,
				      const char *recordTerminator,
				      unsigned readTimeout, int *nBytesRead);
  virtual DeviceIF::Status processRecord(unsigned char *record, 
					 int nRecordBytes);

  OCR507Log *_log;
  Boolean _verbose;
};

#endif
