RTCMFramer Class
Frame and validate incoming RTCM 3 messages. More...
Declaration
Included Headers
Public Member Typedefs Index
| using | MessageCallback = void(*)(uint16_t, const void *, size_t) |
Enumerations Index
| enum class | State { ... } |
Public Constructors Index
| RTCMFramer ()=default | |
|
Construct a framer instance with no buffer allocated. More... | |
| RTCMFramer (const RTCMFramer &)=delete | |
| RTCMFramer (RTCMFramer &&)=delete | |
| RTCMFramer (size_t capacity_bytes) | |
|
Construct a framer instance with an internally allocated buffer. More... | |
| RTCMFramer (void *buffer, size_t capacity_bytes) | |
|
Construct a framer instance with a user-specified buffer. More... | |
Public Destructor Index
| ~RTCMFramer () | |
Public Operators Index
| RTCMFramer & | operator= (const RTCMFramer &)=delete |
| RTCMFramer & | operator= (RTCMFramer &&)=delete |
Public Member Functions Index
| uint32_t | GetNumDecodedMessages () const |
|
Get the number of decoded messages. More... | |
| uint32_t | GetNumErrors () const |
|
Get the number of preamble synchronizations that resulted in errors. More... | |
| size_t | OnData (const uint8_t *buffer, size_t length_bytes) |
|
Process incoming data. More... | |
| void | Reset () |
|
Reset the framer and discard all pending data. More... | |
| void | SetBuffer (void *buffer, size_t capacity_bytes) |
|
Set the buffer to use for message framing. More... | |
| void | SetMessageCallback (MessageCallback callback) |
|
Specify a function to be called when a message is framed. More... | |
| void | WarnOnError (bool enabled) |
|
Enable/disable warnings for CRC and "message too large" failures. More... | |
Private Member Functions Index
| void | ClearManagedBuffer () |
| int32_t | OnByte (bool quiet) |
|
Process a single byte. More... | |
| uint32_t | Resync () |
|
Perform a resynchronization operation starting at buffer_[1]. More... | |
Private Member Attributes Index
Description
Frame and validate incoming RTCM 3 messages.
This class locates and validates RTCM 3 messages within a stream of binary data. Data may be stored in an internally allocated buffer, or in an external buffer supplied by the user.
The callback function provided to SetMessageCallback() will be called each time a complete message is received. Any messages that do not pass the CRC check, or that are too big to be stored in the data buffer, will be discarded.
Example usage:
Definition at line 39 of file rtcm_framer.h.
Public Member Typedefs
MessageCallback
|
Definition at line 41 of file rtcm_framer.h.
Enumerations
State
| strong |
Definition at line 147 of file rtcm_framer.h.
Public Constructors
RTCMFramer()
| default |
Construct a framer instance with no buffer allocated.
You must call SetBuffer() to assign a buffer, otherwise all incoming data will be discarded.
Definition at line 50 of file rtcm_framer.h.
RTCMFramer()
| delete |
Definition at line 75 of file rtcm_framer.h.
RTCMFramer()
| delete |
Definition at line 76 of file rtcm_framer.h.
RTCMFramer()
| inline explicit |
Construct a framer instance with an internally allocated buffer.
- Parameters
-
capacity_bytes The maximum framing buffer capacity (in bytes).
Definition at line 57 of file rtcm_framer.h.
RTCMFramer()
Construct a framer instance with a user-specified buffer.
- Postcondition
buffer must exist for the lifetime of this instance.
- Parameters
-
buffer The framing buffer to use. Set to nullptr to allocate a buffer internally.
capacity_bytes The maximum framing buffer capacity (in bytes).
Declaration at line 70 of file rtcm_framer.h, definition at line 176 of file rtcm_framer.cc.
Public Destructor
~RTCMFramer()
|
Declaration at line 72 of file rtcm_framer.h, definition at line 190 of file rtcm_framer.cc.
Public Operators
operator=()
| delete |
Definition at line 77 of file rtcm_framer.h.
operator=()
| delete |
Definition at line 78 of file rtcm_framer.h.
Public Member Functions
GetNumDecodedMessages()
| inline |
Get the number of decoded messages.
- Returns
The number of RTCM messages successfully decoded.
Definition at line 133 of file rtcm_framer.h.
GetNumErrors()
| inline |
Get the number of preamble synchronizations that resulted in errors.
This is not an accurate count of failed messages since the RTCM preamble is not unique and may appear anywhere in the data stream, but gives an approximate count.
- Returns
The number of length or CRC failures found in decoding so far.
Definition at line 144 of file rtcm_framer.h.
OnData()
Process incoming data.
- Parameters
-
buffer A buffer containing data to be framed.
length_bytes The number of bytes to be framed.
- Returns
The total size of all valid, complete messages, or 0 if no messages were completed.
Declaration at line 126 of file rtcm_framer.h, definition at line 237 of file rtcm_framer.cc.
Reset()
|
Reset the framer and discard all pending data.
Declaration at line 115 of file rtcm_framer.h, definition at line 228 of file rtcm_framer.cc.
SetBuffer()
Set the buffer to use for message framing.
- Postcondition
buffer must exist for the lifetime of this instance.
- Parameters
-
buffer The framing buffer to use. Set to nullptr to allocate a buffer internally.
capacity_bytes The maximum framing buffer capacity (in bytes).
Declaration at line 90 of file rtcm_framer.h, definition at line 193 of file rtcm_framer.cc.
SetMessageCallback()
| inline |
Specify a function to be called when a message is framed.
- Parameters
-
callback The function to be called with the message header and a pointer to the message payload.
Definition at line 110 of file rtcm_framer.h.
WarnOnError()
| inline |
Enable/disable warnings for CRC and "message too large" failures.
This is typically used when the incoming stream has multiple types of binary content (e.g., interleaved FusionEngine and RTCM messages), and the RTCM message preamble is expected to appear in the non-RTCM content occasionally.
- Parameters
-
enabled If true, issue warnings on errors.
Definition at line 102 of file rtcm_framer.h.
Private Member Functions
ClearManagedBuffer()
|
Free the buffer_ if it's being managed internally.
Declaration at line 191 of file rtcm_framer.h, definition at line 527 of file rtcm_framer.cc.
OnByte()
|
Process a single byte.
- Precondition
The byte must be located at buffer_[next_byte_index_ - 1].
- Parameters
-
quiet If true, suppress failure warning messages.
- Returns
The total size of all valid, complete messages, 0 if no messages were completed, or <0 CRC or "message too large" error.
Declaration at line 178 of file rtcm_framer.h, definition at line 277 of file rtcm_framer.cc.
Resync()
|
Perform a resynchronization operation starting at buffer_[1].
- Returns
The total size of all valid, complete messages, or 0 if no messages were completed.
Declaration at line 186 of file rtcm_framer.h, definition at line 430 of file rtcm_framer.cc.
Private Member Attributes
buffer_
|
Definition at line 157 of file rtcm_framer.h.
callback_
|
Definition at line 153 of file rtcm_framer.h.
capacity_bytes_
|
Definition at line 158 of file rtcm_framer.h.
current_message_size_
|
Definition at line 162 of file rtcm_framer.h.
decoded_msg_count_
|
Definition at line 165 of file rtcm_framer.h.
error_count_
|
Definition at line 164 of file rtcm_framer.h.
is_buffer_managed_
|
Definition at line 156 of file rtcm_framer.h.
next_byte_index_
|
Definition at line 161 of file rtcm_framer.h.
state_
|
Definition at line 160 of file rtcm_framer.h.
warn_on_error_
|
Definition at line 155 of file rtcm_framer.h.
The documentation for this class was generated from the following files:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.