#ifndef _ACOUSTICTELEMETRY_H
#define _ACOUSTICTELEMETRY_H

#include <time.h>
#include "Exception.h"
#include "FixedFieldStringMessage.h"
#include "IntegerData.h"
#include "AcousticMessage.h"

/*
CLASS 
AcousticTelemetry

DESCRIPTION
Encodes and decodes vehicle telemetry data, transmitted
via acoustic modem.

AUTHOR
Tom O'Reilly
*/
class AcousticTelemetry : public FixedFieldStringMessage {

public:

  ///////////////////////////////////////////////////////////////////
  // Constructor
  AcousticTelemetry(int maxPacketBytes);

  virtual ~AcousticTelemetry();

  
  ///////////////////////////////////////////////////////////////////
  // Set telemetry Type in buffer, then call virtual encode() method
  void encodeData(AcousticMessage::Type cmd, short sequenceNo);

  ///////////////////////////////////////////////////////////////////
  // Call virtual decode() method, return telemetry Type.
  AcousticMessage::Type decodeData();

  ///////////////////////////////////////////////////////////////////
  // Time-epoch; allows us to encode UTC seconds in fewer characters
  static const time_t AuvEpoch;

  static const int TimeTagFieldLength;
  static const int TypeFieldLength;
  static const int SequenceNoFieldLength;

  struct Data {
    AcousticMessage::Type type;
    int sequenceNo;
    time_t timeTag;
  } data;

protected:

  ///////////////////////////////////////////////////////////////////
  // Encode this object's telemetry data structure, place into this 
  // object's encoded buffer.
  virtual void encode() = 0;

  ///////////////////////////////////////////////////////////////////
  // Decode this object's encoded buffer, place into this object's
  // telemetry data structure
  virtual void decode() = 0;

  ///////////////////////////////////////////////////////////////////
  // Generate time-tag value for packet
  int timeTag();

  IntegerData _integerData;
};





#endif

