#ifndef _BluefinBattLOG_H
#define _BluefinBattLOG_H

#include "DataLogWriter.h"
#include "DoubleData.h"
#include "IntegerData.h"

#include "Simulator.h"


class BluefinBatt;
//class Simulator;

#define BluefinBattLogName "bluefinBattlog"

/*
CLASS 
BluefinBattLog

DESCRIPTION
Logs BluefinBatt data through the DataLogWriter interface.

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

  BluefinBattLog *log = new BluefinBattLog(this, DataLog::AsciiFormat);

  [...other stuff...]

  // Log the data
  log->write();

</pre>
AUTHOR
Rich Henthorn
*/
class BluefinBattLog : public DataLogWriter {

public:

  ///////////////////////////////////////////////////////////////////
  // Constructor
  // [input] navigation: BluefinBatt object. The setFields() method
  //         accesses this object as the source of the logged data.
  // [input] fileFormat: Specifies either DataLog::AsciiFormat or 
  //         DataLog::BinaryFormat.
  BluefinBattLog(BluefinBatt *driver, DataLog::FileFormat fileFormat,
		 int number_of_batts); 
  BluefinBattLog(Simulator *driver, DataLog::FileFormat fileFormat,
		 int number_of_batts); 

  ~BluefinBattLog();

protected:

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

  ///////////////////////////////////////////////////////////////////
  // setFields() accesses the data to be logged from this BluefinBatt 
  // object.
  BluefinBatt *_driver;
  Simulator *_simDriver;

  int _numBatts;

  void init();

private:

  // Data from #q0 query
  struct battdata
  {
    DoubleData  *voltage;
    DoubleData  *current;
    DoubleData  *temp;
    DoubleData  *minvoltage;
    DoubleData  *maxvoltage;
    IntegerData *waterleak;
    DoubleData  *capacity;
    DoubleData  *depth;    // Read from DepthSensorIF server
  };

  struct battdata *_data;

};

#endif
