Class Reader
Defined in File serialization.hpp
Class Documentation
-
class Reader
Decodes byte messages into u-blox ROS messages.
Public Types
-
using iterator = const uint8_t*
Public Functions
-
inline Reader(const uint8_t *data, uint32_t count, const Options &options = Options())
- Parameters:
data – a buffer containing u-blox messages
count – the size of the buffer
options – A struct containing the parameters sync_a and sync_b which represent the sync bytes indicating the beginning of the message
-
inline iterator search()
Search the buffer for the beginning of the next u-blox message.
- Returns:
a pointer to the start of the next u-blox message
-
inline bool found()
Has a u-blox message been found in the buffer?
- Returns:
true if A message with the correct header & length has been found
-
inline iterator next()
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.
-
inline iterator pos()
Get the current position in the read buffer.
- Returns:
the current position of the read buffer
-
inline uint8_t classId()
-
inline uint8_t messageId()
-
inline uint32_t length()
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
-
inline const uint8_t *data()
-
inline uint16_t checksum()
Get the checksum of the u-blox message.
- Returns:
the checksum of the u-blox message
-
template<typename T>
inline bool read(T &message, bool search = false) Decode the given message.
- Parameters:
message – the output message
search – whether or not to skip to the next message in the buffer
-
template<typename T>
inline bool hasType() 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
-
inline bool isMessage(uint8_t class_id, uint8_t message_id)
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
-
inline const std::string &getExtraData() const
-
using iterator = const uint8_t*