Garmin Fleet Management Controller  2.19.0
MessageId Class Reference

Encapsulation of a message ID. More...

#include <MessageId.h>

Public Member Functions

 MessageId ()
 Default constructor. More...
 
 MessageId (const MessageId &aRightSide)
 Copy constructor. More...
 
 MessageId (const uint8 aIdSize, const uint8 *aId)
 Construct message ID from raw binary ID and length. More...
 
 MessageId (const CString &aCString, codepage_type aCodePage)
 Construct message ID from displayable string. More...
 
const uint8getId () const
 Return a reference to the bytes of the message ID. More...
 
uint8 getIdSize () const
 Return the size of the message ID. More...
 
bool operator< (const MessageId &aRightSide) const
 Less-than operator. More...
 
const MessageIdoperator= (const MessageId &aRightSide)
 Assignment operator. More...
 
bool operator== (const MessageId &aRightSide) const
 Equality operator. More...
 
CString toCString (codepage_type aCodePage) const
 CString representation of the message ID. More...
 

Private Attributes

uint8 mId [16]
 The message ID. More...
 
uint8 mIdSize
 Number of significant bytes of mId. More...
 

Detailed Description

Encapsulation of a message ID.

Encapsulates a message ID (0-16 bytes of binary data), and provides methods to compare and copy message IDs, and convert the ID to and from a string representation.

Since
Protocol A602

Definition at line 26 of file MessageId.h.

Constructor & Destructor Documentation

MessageId::MessageId ( )

Default constructor.

Construct a message ID with size zero.

Definition at line 18 of file MessageId.cpp.

Referenced by MessageId().

MessageId::MessageId ( const MessageId aRightSide)

Copy constructor.

Parameters
aRightSideThe MessageId to construct a copy of.

Definition at line 27 of file MessageId.cpp.

References MessageId(), mId, and mIdSize.

MessageId::MessageId ( const uint8  aIdSize,
const uint8 aId 
)

Construct message ID from raw binary ID and length.

Parameters
aIdSizeThe length of the message ID in bytes. If this is greater than 16, a length of 16 will be used.
aIdThe binary message ID.

Definition at line 43 of file MessageId.cpp.

References MessageId(), mId, mIdSize, and minval.

MessageId::MessageId ( const CString &  aCString,
codepage_type  aCodePage 
)

Construct message ID from displayable string.

Parameters
aCStringThe displayable representation of the string. If this begins with "0x" then the rest of the string will be interpreted as hexadecimal, otherwise the string will be converted to the specified codepage.
aCodePageThe code page to use (ASCII or Unicode)

Definition at line 61 of file MessageId.cpp.

References mId, mIdSize, minval, and UTIL_hex_to_uint8().

Member Function Documentation

const uint8 * MessageId::getId ( ) const

Return a reference to the bytes of the message ID.

Returns
Pointer to the message ID bytes. This pointer is valid for the lifetime of the MessageID object.

Definition at line 144 of file MessageId.cpp.

References mId.

Referenced by FmiApplicationLayer::beginA611LongTextMessage(), FmiApplicationLayer::sendA602TextMessage(), FmiApplicationLayer::sendA604TextMessage(), FmiApplicationLayer::sendCannedResponseTextMessage(), FmiApplicationLayer::sendMessageDeleteRequest(), FmiApplicationLayer::sendTextMessageStatusRequest(), and InboxListItem::writeToStream().

bool MessageId::operator< ( const MessageId aRightSide) const

Less-than operator.

Less-than operator for sorting purposes. A message ID is considered less than another if the mIdSize is smaller or if the mId array itself is smaller in a strict binary comparison.

Parameters
aRightSideThe right hand side of the expression.

Definition at line 90 of file MessageId.cpp.

References mId, and mIdSize.

const MessageId & MessageId::operator= ( const MessageId aRightSide)

Assignment operator.

Parameters
aRightSideThe right hand side of the assignment expression.

Definition at line 105 of file MessageId.cpp.

References mId, mIdSize, and minval.

bool MessageId::operator== ( const MessageId aRightSide) const

Equality operator.

Equality operator for comparison purposes. A message ID is considered equal to another if both the mIdSize and the significant bytes of the mId array itself are binary equal.

Parameters
aRightSideThe right hand side of the expression.

Definition at line 126 of file MessageId.cpp.

References mId, and mIdSize.

CString MessageId::toCString ( codepage_type  aCodePage) const

CString representation of the message ID.

Returns a CString representation of the message ID. If the string consists exclusively of printable characters, the resulting string will interpret the message ID as text. Otherwise, the resulting string will be "0x" followed by the message ID in hexadecimal.

Parameters
aCodePageThe code page to convert from.

Definition at line 167 of file MessageId.cpp.

References mId, mIdSize, UTIL_data_is_printable(), and UTIL_uint8_to_hex().

Referenced by getIdSize(), CFmiPcAppDlg::OnEventLongTextMsgError(), CFmiPcAppDlg::OnEventOpenTextMsgError(), CTxtMsgFromClient::OnInitDialog(), CTxtMsgAckDlg::OnInitDialog(), and CTxtMsgStatusDlg::OnInitDialog().

Member Data Documentation

uint8 MessageId::mId[16]
private

The message ID.

Definition at line 70 of file MessageId.h.

Referenced by getId(), MessageId(), operator<(), operator=(), operator==(), and toCString().

uint8 MessageId::mIdSize
private

Number of significant bytes of mId.

Definition at line 71 of file MessageId.h.

Referenced by getIdSize(), MessageId(), operator<(), operator=(), operator==(), and toCString().


The documentation for this class was generated from the following files: