/****************************************************************************/
/* Copyright (c) 2003 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : FastCat.h                                                     */
/* Author   :                                                               */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 09/17/2003                                                    */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/
#ifndef _FastCat_H
#define _FastCat_H

#include "StreamSerialDriver.h"
#include "FastCatOutput.h"

/*
CLASS 
FastCat

DESCRIPTION
FastCat Device Driver Interface

AUTHOR
Rich Henthorn

*/

class FastCat : public StreamSerialDriver {

  friend class FastCatLog;
public:
  
  /////////////////////////////////////////////////////////
  // Default Constructor, not used...
  FastCat();

  /////////////////////////////////////////////////////////
  // overloaded Constructor
  FastCat(SerialDevice *interface, Boolean verbose = False);

  ///////////////////////////////////////////////////////
  //destructor
  virtual  ~FastCat();


protected:

  FastCatLog *_log;
  Boolean _verbose;
  
  float _range;
  Boolean _valid;

  FastCatOutput *_output;
  SerialDevice *_device;
  
  //////////////////////////////////////////////////////////////// 
  // initialization function
  virtual DeviceIF::Status initialize();

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

  virtual DeviceIF::Status readRecord(unsigned char *record,
				      int maxRecordBytes,
				      const char *recordTerminator,
				      unsigned readTimeout,
				      int *nBytesRead);

  double calcTemp(unsigned long tempCounts);
  double calcPres(unsigned long presCounts, double temp);
  double calcCond(double condFreq, double temp, double pressure);
  double calcSalinity(double conductivity, // S/m * 10 (see PSS 1978 notes)
		      double temp,         // degrees C
		      double pressure);    // decibars

};

#endif
