/****************************************************************************/
/* Copyright (c) 2005 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : EchoSounderLog.h                                                */
/* Author   :                                                               */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 11/15/2005                                                    *1
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/
#ifndef _ECHOSOUNDERLOG_H
#define _ECHOSOUNDERLOG_H

#include "DataLogWriter.h"
#include "DataLog.h"
#include "DoubleData.h"
#include "CharData.h"
#include "ShortData.h"
#include "StringData.h"
#include "FloatData.h"
#include "TimeTag.h"

class EchoSounderDriver;
class SimulatedEchoSounder;

#define EchoSounderLogName "echoSounder"

/*
CLASS 
EchoSounderLog

DESCRIPTION
Logs transceiver data through the DataLogWriter interface.

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

  EchoSounderLog *log = new EchoSounderLog(this);

  [...other stuff...]

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

</pre>
AUTHOR
Rich Henthorn, Rob McEwen
*/
class EchoSounderLog : public DataLogWriter {

public:

  ///////////////////////////////////////////////////////////////////
  // Constructor
  EchoSounderLog(EchoSounderDriver *driver, 
		 DataLog::FileFormat format, 
		 Boolean profile=True); 
  EchoSounderLog(SimulatedEchoSounder *driver, 
		 DataLog::FileFormat format,
		 Boolean profile=True); 

  ~EchoSounderLog();

  unsigned int _nf;

protected:

  ///////////////////////////////////////////////////////////////////
  // Initialization process here instead of inside constructor.
  void init();

  ///////////////////////////////////////////////////////////////////
  // 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 EchoSounderDriver
  // object.
  EchoSounderDriver *_driver;
  SimulatedEchoSounder   *_simDriver;

  ///////////////////////////////////////////////////////////////////
  // Data to log

  ShortData   *_ESstatus;
  ShortData   *_EStrain;
  ShortData   *_ESrange;
  //ShortData *_ESraw[EchoSounderIF::EchoArraySize];
  //CharData  *_ESraw[500];
  ShortData   *_ESraw[500];
  ShortData   *_ESaskTime;
  ShortData   *_ESansTime;
  FloatData   *_ESsimGrazing;


private:

  long _ansTime;
  long _askTime;
  Boolean _profile;
  //char _echoData[EchoSounderIF::EchoArraySize+1];
  //char _echoData[501];
};

#endif
