#ifndef AardRemoteMessage_h
#define AardRemoteMessage_h

#include <vector>

class LibAard;

// Holds one complete message from the AardRemote.
//
class AardRemoteMessage {
   friend class LibAard;
public:

   AardRemoteMessage(unsigned short header);

   ~AardRemoteMessage();

      // Return the MSG_KIND from the message header word.
      //
   unsigned char
   MessageKind() const;

      // Return the MSG_LEN from the message header word (if this
      // is zero, the message was variable length and the actual
      // length is found by MessageBody().size()).
      //
   unsigned int
   MessageLength() const;

      // Return the function code from the 2nd byte of the message header.
      //
   unsigned int
   FunctionCode() const;

      // Return reference to the raw message data (array of unsigned
      // shorts which includes the header as the 1st short).
      //
   const std::vector<unsigned short> &
   MessageBody() const;

      // Print message description to stdout.
      //
   void
   DebugDump();

private:

   void
   Append(unsigned short newdata);

   std::vector<unsigned short> message;

   union {
      unsigned char b[2];
      unsigned int hdr;
   };
};

#endif // AardRemoteMessage_h
