Telemetry Linux - Message Parsing APIs¶
Note
These APIs are used internally in the Linux implementation of Telemetry for message parsing
-
bool
telemetry_parse_msg_type
(const uint8_t *buffer, uint32_t buffer_size, telemetry_message_type *msg_type)¶ Parses out the message type from an encoded message.
- Return
- bool true if successful, otherwise false
- Parameters
buffer
: buffer with encoded messagebuffer_size
: size of buffermsg_type
: parsed out type of message
-
int
telemetry_encode_packet_msg
(uint8_t *buffer, const telemetry_packet *pkt)¶ Attempts to encode a telemetry_packet.
- Return
- int 0 if successful, otherwise negative error code
- Parameters
buffer
: buffer to store encoded packet inpkt
: telemetry_packet to encode
-
bool
telemetry_parse_packet_msg
(const uint8_t *buffer, uint32_t buffer_size, telemetry_packet *packet)¶ Attempt to parse telemetry_packet from buffer.
- Return
- bool true if successful, otherwise false
- Parameters
buffer
: buffer storing packet databuffer_size
: size of bufferpacket
: telemetry_packet to store data in
-
int
telemetry_encode_subscribe_msg
(uint8_t *buffer, const uint16_t *topic_id)¶ Attempts to encode a subscribe message.
- Return
- int 0 if successful, otherwise negative error code
- Parameters
buffer
: buffer to store encoded packet intopic_id
: topic ID for subscribing
-
bool
telemetry_parse_subscribe_msg
(const uint8_t *buffer, uint32_t buffer_size, uint16_t *topic_id)¶ Attempt to parse a subscribe message.
- Return
- bool true if successful, otherwise false
- Parameters
buffer
: buffer storing packet databuffer_size
: size of buffertopic_id
: topic ID read from message
-
int
telemetry_encode_unsubscribe_msg
(uint8_t *buffer, const uint16_t *topic_id)¶ Attempts to encode an unsubscribe message.
- Return
- int 0 if successful, otherwise negative error code
- Parameters
buffer
: buffer to store encoded packet intopic_id
: topic ID to encode in message
-
bool
telemetry_parse_unsubscribe_msg
(const uint8_t *buffer, uint32_t buffer_size, uint16_t *topic_id)¶ Attempt to parse an unsubscribe message.
- Return
- bool true if successful, otherwise false
- Parameters
buffer
: buffer storing packet databuffer_size
: size of buffertopic_id
: topic ID read from message
-
int
telemetry_encode_disconnect_msg
(uint8_t *buffer)¶ Attempts to encode disconnect message.
- Return
- int 0 if successful, otherwise negative error code
- Parameters
buffer
: buffer to store encoded packet in
-
int
start_encode_msg
(CborEncoder *encoder, CborEncoder *container, uint8_t *buffer, uint32_t buffer_size, uint8_t num_elements, telemetry_message_type message_type)¶ Sets up the structures for encoding a message.
- Return
- int 0 if successful, otherwise negative error
- Parameters
encoder
: Master CBOR encodercontainer
: CBOR container for mapbuffer
: buffer to store end data inbuffer_size
: size of buffernum_elements
: number of elements in the message mapmessage_type
: message type to be encoded
-
int
end_encode_msg
(uint8_t *buffer, CborEncoder *encoder, CborEncoder *container)¶ Finishing the CBOR encoding process.
- Return
- int 0 if successful, otherwise negative error code
- Parameters
buffer
: buffer for storing serialized dataencoder
: CBOR encodercontainer
: CBOR map container