Brief description of class still missing. More...
#include <MessageClassIdHeader.h>
Public Types | |
| enum | { SynchronizationSize = 2, HeaderSize = 4, CheckSumSize = 2 } |
Public Member Functions | |
| void | bigEndianValues () |
| const char * | header () const |
| bool | isValid () const |
| bool | isValid (const FletcherChecksum &cksum, const char *payload=0, unsigned short payloadLength=0) const |
| unsigned int | lengthBigEndian () const |
| unsigned int | lengthLittleEndian () const |
| void | littleEndianValues () |
| unsigned char | messageClass () const |
| MessageClassIdHeader () | |
| MessageClassIdHeader (unsigned char msgClass, unsigned char msgId, unsigned int length) | |
| MessageClassIdHeader (const MessageClassIdHeader &o) | |
| unsigned char | messageId () const |
Protected Attributes | |
| union { | |
| char _bytes [HeaderSize] | |
| struct { | |
| unsigned short length | |
| unsigned char messageClass | |
| unsigned char messageId | |
| } _values | |
| }; | |
| unsigned char | _sync [2] |
Brief description of class still missing.
Full description of class still missing
| anonymous enum |
{SynchronizationSize=2, HeaderSize=4, CheckSumSize=2};
{}
| GpCoreTools::MessageClassIdHeader::MessageClassIdHeader | ( | unsigned char | msgClass, |
| unsigned char | msgId, | ||
| unsigned int | length | ||
| ) | [inline] |
| GpCoreTools::MessageClassIdHeader::MessageClassIdHeader | ( | const MessageClassIdHeader & | o | ) | [inline] |
| void GpCoreTools::MessageClassIdHeader::bigEndianValues | ( | ) | [inline] |
References _bytes, and GpCoreTools::ByteOrder::swap().
{
#if BYTE_ORDER==LITTLE_ENDIAN
ByteOrder::swap(_bytes[2], _bytes[3]);
#endif
}
| const char* GpCoreTools::MessageClassIdHeader::header | ( | ) | const [inline] |
Referenced by isValid(), and GpCoreTools::MessageClassIdOnly::MessageClassIdOnly().
{return _bytes;}
| bool GpCoreTools::MessageClassIdHeader::isValid | ( | ) | const [inline] |
Referenced by UbxBuffer::bytesAvailable(), and CubeBuffer::bytesAvailable().
| bool GpCoreTools::MessageClassIdHeader::isValid | ( | const FletcherChecksum & | cksum, |
| const char * | payload = 0, |
||
| unsigned short | payloadLength = 0 |
||
| ) | const [inline] |
References GpCoreTools::FletcherChecksum::a, GpCoreTools::FletcherChecksum::add(), GpCoreTools::FletcherChecksum::b, header(), HeaderSize, and GpCoreTools::Log::write().
{
FletcherChecksum mycs;
mycs.add(reinterpret_cast<const char *>(header()), HeaderSize);
if(payload) {
mycs.add(payload, payloadLength);
}
if(cksum==mycs) {
return true;
} else {
Log::write(5, "bad checksum 0x%02hhX 0x%02hhX (in message) instead of 0x%02hhX 0x%02hhX (computed)\n", cksum.a(), cksum.b(), mycs.a(), mycs.b());
return false;
}
}
| unsigned int GpCoreTools::MessageClassIdHeader::lengthBigEndian | ( | ) | const [inline] |
References GpCoreTools::ByteOrder::bigEndianToNative().
Referenced by CubeBuffer::bytesAvailable().
{return ByteOrder::bigEndianToNative(_values.length);}
| unsigned int GpCoreTools::MessageClassIdHeader::lengthLittleEndian | ( | ) | const [inline] |
References GpCoreTools::ByteOrder::littleEndianToNative().
Referenced by UbxBuffer::bytesAvailable().
{return ByteOrder::littleEndianToNative(_values.length);}
| void GpCoreTools::MessageClassIdHeader::littleEndianValues | ( | ) | [inline] |
References _bytes, and GpCoreTools::ByteOrder::swap().
{
#if BYTE_ORDER==BIG_ENDIAN
ByteOrder::swap(_bytes[2], _bytes[3]);
#endif
}
| unsigned char GpCoreTools::MessageClassIdHeader::messageClass | ( | ) | const [inline] |
{return _values.messageClass;}
| unsigned char GpCoreTools::MessageClassIdHeader::messageId | ( | ) | const [inline] |
{return _values.messageId;}
union { ... } [protected] |
Referenced by bigEndianValues(), and littleEndianValues().
unsigned char GpCoreTools::MessageClassIdHeader::_sync[2] [protected] |
Referenced by MessageClassIdHeader().
| struct { ... } GpCoreTools::MessageClassIdHeader::_values |
Referenced by MessageClassIdHeader().
| unsigned short GpCoreTools::MessageClassIdHeader::length |
Referenced by MessageClassIdHeader().
| unsigned char GpCoreTools::MessageClassIdHeader::messageClass |
Referenced by UbxBuffer::bytesAvailable(), and CubeBuffer::bytesAvailable().
| unsigned char GpCoreTools::MessageClassIdHeader::messageId |
Referenced by UbxBuffer::bytesAvailable(), and CubeBuffer::bytesAvailable().