#ifndef _WHOIUAM_H
#define _WHOIUAM_H

#include "StreamSerialDriver.h"
#include "NavigationIF.h"
#include "FuelCellIF.h"
#include "StringMessage.h"
#include "StringMsgHandler.h"

#define UAM_TelemetryRequestMnem "MSG"
#define UAM_DiagnosticMnem "TX"
#define UAM_TimeoutMnem "timeout"
#define UAM_MaxMessageBytes 50

/*
CLASS
WhoiUam

DESCRIPTION
Driver for WHOI UAM ("Underwater Acoustic Modem"). 

Note that this class contains an instance of an ExternalMsgHandler.
This allows us to de-couple the specifics of reading and writing
messages (this class) from the way in which messages are actually
handled (the ExternalMsgHandler interface).

AUTHOR
Tom O'Reilly
*/

class WhoiUam : public StreamSerialDriver {

public:

  WhoiUam(const char *name, SerialDevice *device,
	  StringMsgHandler *handler, char acousticTokenDelimiter);

  ~WhoiUam();

protected:

  virtual DeviceIF::Status initialize();

  virtual void handleReadTimeout();

  virtual DeviceIF::Status processRecord(unsigned char *record, 
					 int nRecordBytes);
  
  StringMsgHandler *_handler;

  StringMessage *_inputMessage;

  StringMessages _outputMessages;
};

#endif
