AnnotatorComm::ResponseMessage Class Reference

#include <ResponseMessage.h>

List of all members.

Public Member Functions

 ResponseMessage (vector< uint8_t > rsp)
ResponseMessage operator= (ResponseMessage const &rvalue)
uint16_t getId () const
uint8_t getResponse () const
uint8_t getStatus () const
string getStatusMessage () const throw (CommandDependentStatusException)
void resetParamPointer ()
int8_t getNextParamAsInt8 ()
uint8_t getNextParamAsUInt8 ()
int16_t getNextParamAsInt16 ()
uint16_t getNextParamAsUInt16 ()
int32_t getNextParamAsInt32 ()
uint32_t getNextParamAsUInt32 ()
int64_t getNextParamAsInt64 ()
uint64_t getNextParamAsUInt64 ()
uint8_t getChecksum () const
int getRespParamLen () const
vector< uint8_t > getParamBytes () const
vector< uint8_t > getBytes () const
void errorCheck () const throw (CommandChecksumFailedException, CommandDependentStatusException, CommandFailedException, CommandUnsupportedException, IOException)

Static Public Attributes

static const int HEADER_LEN = 6
static const int FOOTER_LEN = 2
static const int MSG_LEN_IDX = 1
static const int CMD_ID_IDX = 2
static const int RESPONSE_IDX = 4
static const int STATUS_IDX = 5
static const int CHECKSUM_RIDX = 2
static const uint8_t RESP_SUCCESS = 0x00
static const uint8_t RESP_FAILED = 0x01
static const uint8_t RESP_UNSUPPORTED = 0x02
static const uint8_t STATUS_UNSPECIFIED = 0x00
static const uint8_t STATUS_UNSUPPORTED = 0x01
static const uint8_t STATUS_INVALID_IN_CURRENT_CONFIG = 0x02


Detailed Description

ResponseMessage encapsulates the bytes of a response message and provides helpful methods for reading its values.

Definition at line 34 of file ResponseMessage.h.


Constructor & Destructor Documentation

AnnotatorComm::ResponseMessage::ResponseMessage ( vector< uint8_t >  rsp  ) 

Construct a ResponseMessage.

Parameters:
rsp response message bytes


Member Function Documentation

void AnnotatorComm::ResponseMessage::errorCheck (  )  const throw (CommandChecksumFailedException, CommandDependentStatusException, CommandFailedException, CommandUnsupportedException, IOException)

Error check the response. If a problem is encountered, an exception is thrown. All problems can generically be caught with an IOException, or finer granularity can be choosen from the throws list below.

Exceptions:
CommandChecksumFailedException thrown if the checksum failed
CommandDependentStatusException thrown on command dependent status code
CommandFailedException thrown on command failure
CommandUnsupportedException thrown on unsupported command
IOException thrown for all other I/O failures

vector<uint8_t> AnnotatorComm::ResponseMessage::getBytes (  )  const

Get the response message's bytes.

Returns:
reponse bytes

uint8_t AnnotatorComm::ResponseMessage::getChecksum (  )  const

Get the response checksum.

Returns:
checksum

uint16_t AnnotatorComm::ResponseMessage::getId (  )  const

Get the Command ID.

Returns:
Command ID

int16_t AnnotatorComm::ResponseMessage::getNextParamAsInt16 (  ) 

Get the next parameter as a signed 16-bit integer.

Returns:
parameter value

int32_t AnnotatorComm::ResponseMessage::getNextParamAsInt32 (  ) 

Get the next parameter as a signed 32-bit integer.

Returns:
parameter value

int64_t AnnotatorComm::ResponseMessage::getNextParamAsInt64 (  ) 

Get the next parameter as a signed 64-bit integer.

Returns:
parameter value

int8_t AnnotatorComm::ResponseMessage::getNextParamAsInt8 (  ) 

Get the next parameter as a signed 8-bit integer.

Returns:
parameter value

uint16_t AnnotatorComm::ResponseMessage::getNextParamAsUInt16 (  ) 

Get the next parameter as an unsigned 16-bit integer.

Returns:
parameter value

uint32_t AnnotatorComm::ResponseMessage::getNextParamAsUInt32 (  ) 

Get the next parameter as an unsigned 32-bit integer.

Returns:
parameter value

uint64_t AnnotatorComm::ResponseMessage::getNextParamAsUInt64 (  ) 

Get the next parameter as an unsigned 64-bit integer.

Returns:
parameter value

uint8_t AnnotatorComm::ResponseMessage::getNextParamAsUInt8 (  ) 

Get the next parameter as an unsigned 8-bit integer.

Returns:
parameter value

vector<uint8_t> AnnotatorComm::ResponseMessage::getParamBytes (  )  const

Get the response message's parameter bytes.

Returns:
parameter bytes

uint8_t AnnotatorComm::ResponseMessage::getResponse (  )  const

Get the response code.

Returns:
response code

int AnnotatorComm::ResponseMessage::getRespParamLen (  )  const

Get the length of the response parameter bytes.

Returns:
response parameter bytes length

uint8_t AnnotatorComm::ResponseMessage::getStatus (  )  const

Get the status code.

Returns:
status code

string AnnotatorComm::ResponseMessage::getStatusMessage (  )  const throw (CommandDependentStatusException)

Get the status message as a human readable string.

Returns:
status string
Exceptions:
CommandDependentStatusException thrown on command dependent status

ResponseMessage AnnotatorComm::ResponseMessage::operator= ( ResponseMessage const &  rvalue  ) 

Overload assignment operator.

Parameters:
rvalue right hand side

void AnnotatorComm::ResponseMessage::resetParamPointer (  ) 

Restart the parameter index.

See also:
getNextParamAsInt8()

getNextParamAsUInt8()

getNextParamAsInt16()

getNextParamAsUInt16()

getNextParamAsInt32()

getNextParamAsUInt32()

resetParamPointer()


Member Data Documentation

const int AnnotatorComm::ResponseMessage::CHECKSUM_RIDX = 2 [static]

Checksum reverse index

Definition at line 72 of file ResponseMessage.h.

const int AnnotatorComm::ResponseMessage::CMD_ID_IDX = 2 [static]

Command ID index

Definition at line 57 of file ResponseMessage.h.

const int AnnotatorComm::ResponseMessage::FOOTER_LEN = 2 [static]

Length of the footer in bytes

Definition at line 46 of file ResponseMessage.h.

const int AnnotatorComm::ResponseMessage::HEADER_LEN = 6 [static]

Length of the header in bytes

Definition at line 41 of file ResponseMessage.h.

const int AnnotatorComm::ResponseMessage::MSG_LEN_IDX = 1 [static]

Message length index

Definition at line 52 of file ResponseMessage.h.

const uint8_t AnnotatorComm::ResponseMessage::RESP_FAILED = 0x01 [static]

Response Code: Failed to execute (but the Command ID was valid), see Status Code for details

Definition at line 82 of file ResponseMessage.h.

const uint8_t AnnotatorComm::ResponseMessage::RESP_SUCCESS = 0x00 [static]

Response Code: Success

Definition at line 77 of file ResponseMessage.h.

const uint8_t AnnotatorComm::ResponseMessage::RESP_UNSUPPORTED = 0x02 [static]

Response Code: Unsupported Command ID

Definition at line 87 of file ResponseMessage.h.

const int AnnotatorComm::ResponseMessage::RESPONSE_IDX = 4 [static]

Response code index

Definition at line 62 of file ResponseMessage.h.

const int AnnotatorComm::ResponseMessage::STATUS_IDX = 5 [static]

Status code index

Definition at line 67 of file ResponseMessage.h.

const uint8_t AnnotatorComm::ResponseMessage::STATUS_INVALID_IN_CURRENT_CONFIG = 0x02 [static]

Status Code: Invalid command in the current configuration

Definition at line 102 of file ResponseMessage.h.

const uint8_t AnnotatorComm::ResponseMessage::STATUS_UNSPECIFIED = 0x00 [static]

Status Code: Unspecified failure

Definition at line 92 of file ResponseMessage.h.

const uint8_t AnnotatorComm::ResponseMessage::STATUS_UNSUPPORTED = 0x01 [static]

Status Code: Unsupported command or subcommand

Definition at line 97 of file ResponseMessage.h.


The documentation for this class was generated from the following file:
Generated on Thu Jul 27 11:05:04 2006 for libAnnotatorComm by  doxygen 1.4.7