Class Writer

Class Documentation

class Writer

Encodes a u-blox ROS message as a byte array.

Public Types

using iterator = uint8_t*

Public Functions

inline Writer(uint8_t *data, uint32_t size, const Options &options = Options())

Construct a Writer with the given buffer.

Parameters:
  • data – a buffer for messages

  • size – the size of the buffer

  • options – options representing the message sync chars, etc.

template<typename T>
inline bool write(const T &message, uint8_t class_id = T::CLASS_ID, uint8_t message_id = T::MESSAGE_ID)

Encode the u-blox message.

Parameters:
  • message – the message to encode

  • class_id – the u-blox class ID, defaults to the message CLASS_ID

  • message_id – the u-blox message ID, defaults to the message MESSAGE_ID

Returns:

true if the message was encoded correctly, false otherwise

inline bool write(const uint8_t *message, uint32_t length, uint8_t class_id, uint8_t message_id)

Wrap the encoded message payload with a header and checksum and add it to the buffer.

Parameters:
  • message – the encoded message payload (no header or checksum)

  • length – the length of the message payload

  • class_id – the u-blox class ID

  • message_id – the u-blox message ID

Returns:

true if the message was encoded correctly, false otherwise

inline iterator end()