Public Member Functions | Public Attributes | Private Attributes | List of all members
ublox::Reader Class Reference

Decodes byte messages into u-blox ROS messages. More...

#include <serialization.h>

Public Member Functions

uint16_t checksum ()
 Get the checksum of the u-blox message. More...
 
uint8_t classId ()
 
const uint8_t * data ()
 
iterator end ()
 
bool found ()
 Has a u-blox message been found in the buffer? More...
 
const std::string & getUnusedData () const
 
template<typename T >
bool hasType ()
 Can the given message type decode the current message in the buffer? More...
 
bool isMessage (uint8_t class_id, uint8_t message_id)
 Does the u-blox message have the given class and message ID? More...
 
uint32_t length ()
 Get the length of the u-blox message payload. More...
 
uint8_t messageId ()
 
iterator next ()
 Go to the start of the next message based on the received message length. More...
 
iterator pos ()
 Get the current position in the read buffer. More...
 
template<typename T >
bool read (typename boost::call_traits< T >::reference message, bool search=false)
 Decode the given message. More...
 
 Reader (const uint8_t *data, uint32_t count, const Options &options=Options())
 
iterator search ()
 Search the buffer for the beginning of the next u-blox message. More...
 

Public Attributes

const typedef uint8_t * iterator
 

Private Attributes

uint32_t count_
 the number of bytes in the buffer, //! decrement as the buffer is read More...
 
const uint8_t * data_
 The buffer of message bytes. More...
 
bool found_
 Whether or not a message has been found. More...
 
Options options_
 Options representing the sync char values, etc. More...
 
std::string unused_data_
 Unused data from the read buffer, contains nmea messages. More...
 

Detailed Description

Decodes byte messages into u-blox ROS messages.

Definition at line 172 of file serialization.h.

Constructor & Destructor Documentation

◆ Reader()

ublox::Reader::Reader ( const uint8_t *  data,
uint32_t  count,
const Options options = Options() 
)
inline
Parameters
dataa buffer containing u-blox messages
countthe size of the buffer
optionsA struct containing the parameters sync_a and sync_b
which represent the sync bytes indicating the beginning of the message

Definition at line 180 of file serialization.h.

Member Function Documentation

◆ checksum()

uint16_t ublox::Reader::checksum ( )
inline

Get the checksum of the u-blox message.

Returns
the checksum of the u-blox message

Definition at line 287 of file serialization.h.

◆ classId()

uint8_t ublox::Reader::classId ( )
inline

Definition at line 266 of file serialization.h.

◆ data()

const uint8_t* ublox::Reader::data ( )
inline

Definition at line 280 of file serialization.h.

◆ end()

iterator ublox::Reader::end ( )
inline

Definition at line 262 of file serialization.h.

◆ found()

bool ublox::Reader::found ( )
inline

Has a u-blox message been found in the buffer?

Returns
true if A message with the correct header & length has been found

Definition at line 222 of file serialization.h.

◆ getUnusedData()

const std::string& ublox::Reader::getUnusedData ( ) const
inline

Definition at line 337 of file serialization.h.

◆ hasType()

template<typename T >
bool ublox::Reader::hasType ( )
inline

Can the given message type decode the current message in the buffer?

Returns
whether the given message type can decode the current message in the buffer

Definition at line 322 of file serialization.h.

◆ isMessage()

bool ublox::Reader::isMessage ( uint8_t  class_id,
uint8_t  message_id 
)
inline

Does the u-blox message have the given class and message ID?

Returns
Whether or not the u-blox message has the given class and message ID

Definition at line 332 of file serialization.h.

◆ length()

uint32_t ublox::Reader::length ( )
inline

Get the length of the u-blox message payload.

Payload length does not include the header or checksum length. Determines the length from the header of the u-blox message.

Returns
the length of the message payload

Definition at line 276 of file serialization.h.

◆ messageId()

uint8_t ublox::Reader::messageId ( )
inline

Definition at line 267 of file serialization.h.

◆ next()

iterator ublox::Reader::next ( )
inline

Go to the start of the next message based on the received message length.

Warning: Does not go to the correct byte location if the received message length is incorrect. If this is the case, search must be called.

Definition at line 245 of file serialization.h.

◆ pos()

iterator ublox::Reader::pos ( )
inline

Get the current position in the read buffer.

Returns
the current position of the read buffer

Definition at line 258 of file serialization.h.

◆ read()

template<typename T >
bool ublox::Reader::read ( typename boost::call_traits< T >::reference  message,
bool  search = false 
)
inline

Decode the given message.

Parameters
messagethe output message
searchwhether or not to skip to the next message in the buffer

Definition at line 298 of file serialization.h.

◆ search()

iterator ublox::Reader::search ( )
inline

Search the buffer for the beginning of the next u-blox message.

Returns
a pointer to the start of the next u-blox message

Definition at line 193 of file serialization.h.

Member Data Documentation

◆ count_

uint32_t ublox::Reader::count_
private

the number of bytes in the buffer, //! decrement as the buffer is read

Definition at line 345 of file serialization.h.

◆ data_

const uint8_t* ublox::Reader::data_
private

The buffer of message bytes.

Definition at line 341 of file serialization.h.

◆ found_

bool ublox::Reader::found_
private

Whether or not a message has been found.

Definition at line 347 of file serialization.h.

◆ iterator

const typedef uint8_t* ublox::Reader::iterator

Definition at line 187 of file serialization.h.

◆ options_

Options ublox::Reader::options_
private

Options representing the sync char values, etc.

Definition at line 349 of file serialization.h.

◆ unused_data_

std::string ublox::Reader::unused_data_
private

Unused data from the read buffer, contains nmea messages.

Definition at line 343 of file serialization.h.


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


ublox_serialization
Author(s): Johannes Meyer
autogenerated on Wed Dec 7 2022 03:47:50