![]() |
Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the source code of this file.
Data Structures | |
struct | rtcm3_msg_callbacks_node |
RTCM3 callback node. More... | |
struct | msg_state_t |
Typedefs | |
typedef void(* | rtcm3_msg_callback_t) (u8 len, u8 msg[]) |
RTCM3 callback function prototype definition. | |
typedef struct rtcm3_msg_callbacks_node | rtcm3_msg_callbacks_node_t |
RTCM3 callback node. | |
Functions | |
s8 | rtcm3_register_callback (msg_state_t *s, u16 msg_type, rtcm3_msg_callback_t cb, rtcm3_msg_callbacks_node_t *node) |
Register a callback for a message type. | |
void | rtcm3_clear_callbacks (msg_state_t *s) |
Clear all registered callbacks. | |
rtcm3_msg_callbacks_node_t * | rtcm3_find_callback (msg_state_t *s, u16 msg_type) |
Find the callback function associated with a message type. | |
void | msg_state_init (msg_state_t *s) |
Initialize an msg_state_t struct before use. | |
s8 | rtcm3_process (msg_state_t *s, unsigned char buff) |
Read and process RTCM3 messages. | |
s8 | ubx_process (msg_state_t *s, unsigned char buff) |
unsigned int | RTCMgetbitu (unsigned char *, int, int) |
int | RTCMgetbits (unsigned char *, int, int) |
static double | RTCMgetbits_38 (unsigned char *, int) |
Variables | |
int | rd_msg_len = 0 |
int | rd_msg_len1 = 0 |
int | byteIndex = 0 |
int | checksumCounter = 0 |
int | rawIndex = 0 |
struct rtcm3_msg_callbacks_node |
RTCM3 callback node.
Forms a linked list of callbacks.
Data Fields | ||
---|---|---|
rtcm3_msg_callback_t | cb | Pointer to callback function. |
u16 | msg_type | Message ID associated with callback. |
struct rtcm3_msg_callbacks_node * | next | Pointer to next node in list. |
struct msg_state_t |
#define RTCM_CALLBACK_ERROR -1 |
#define RTCM_CRC_ERROR -2 |
#define RTCM_NULL_ERROR -4 |
#define RTCM_OK_CALLBACK_EXECUTED 1 |
#define RTCM_OK_CALLBACK_UNDEFINED 2 |
#define RTCM_SEND_ERROR -3 |
#define UBX_NAV_SVIN_Active | ( | _ubx_payload | ) | (uint8_t)(*((uint8_t*)_ubx_payload+37)) |
#define UBX_NAV_SVIN_dur | ( | _ubx_payload | ) | (uint32_t)(*((uint8_t*)_ubx_payload+8)|*((uint8_t*)_ubx_payload+1+8)<<8|((uint32_t)*((uint8_t*)_ubx_payload+2+8))<<16|((uint32_t)*((uint8_t*)_ubx_payload+3+8))<<24) |
#define UBX_NAV_SVIN_ITOW | ( | _ubx_payload | ) | (uint32_t)(*((uint8_t*)_ubx_payload+4)|*((uint8_t*)_ubx_payload+1+4)<<8|((uint32_t)*((uint8_t*)_ubx_payload+2+4))<<16|((uint32_t)*((uint8_t*)_ubx_payload+3+4))<<24) |
#define UBX_NAV_SVIN_meanACC | ( | _ubx_payload | ) | (uint32_t)(*((uint8_t*)_ubx_payload+28)|*((uint8_t*)_ubx_payload+1+28)<<8|((uint32_t)*((uint8_t*)_ubx_payload+2+28))<<16|((uint32_t)*((uint8_t*)_ubx_payload+3+28))<<24) |
#define UBX_NAV_SVIN_meanX | ( | _ubx_payload | ) | (int32_t)(*((uint8_t*)_ubx_payload+12)|*((uint8_t*)_ubx_payload+1+12)<<8|((int32_t)*((uint8_t*)_ubx_payload+2+12))<<16|((int32_t)*((uint8_t*)_ubx_payload+3+12))<<24) |
#define UBX_NAV_SVIN_meanXHP | ( | _ubx_payload | ) | (int8_t)(*((uint8_t*)_ubx_payload+24)) |
#define UBX_NAV_SVIN_meanY | ( | _ubx_payload | ) | (int32_t)(*((uint8_t*)_ubx_payload+16)|*((uint8_t*)_ubx_payload+1+16)<<8|((int32_t)*((uint8_t*)_ubx_payload+2+16))<<16|((int32_t)*((uint8_t*)_ubx_payload+3+16))<<24) |
#define UBX_NAV_SVIN_meanYHP | ( | _ubx_payload | ) | (int8_t)(*((uint8_t*)_ubx_payload+25)) |
#define UBX_NAV_SVIN_meanZ | ( | _ubx_payload | ) | (int32_t)(*((uint8_t*)_ubx_payload+20)|*((uint8_t*)_ubx_payload+1+20)<<8|((int32_t)*((uint8_t*)_ubx_payload+2+20))<<16|((int32_t)*((uint8_t*)_ubx_payload+3+20))<<24) |
#define UBX_NAV_SVIN_meanZHP | ( | _ubx_payload | ) | (int8_t)(*((uint8_t*)_ubx_payload+26)) |
#define UBX_NAV_SVIN_OBS | ( | _ubx_payload | ) | (uint32_t)(*((uint8_t*)_ubx_payload+32)|*((uint8_t*)_ubx_payload+1+32)<<8|((uint32_t)*((uint8_t*)_ubx_payload+2+32))<<16|((uint32_t)*((uint8_t*)_ubx_payload+3+32))<<24) |
#define UBX_NAV_SVIN_RES1 | ( | _ubx_payload | ) | (uint8_t)(*((uint8_t*)_ubx_payload+1)) |
#define UBX_NAV_SVIN_RES2 | ( | _ubx_payload | ) | (uint16_t)(*((uint8_t*)_ubx_payload+2)|*((uint8_t*)_ubx_payload+1+2)<<8) |
#define UBX_NAV_SVIN_RES3 | ( | _ubx_payload | ) | (uint8_t)(*((uint8_t*)_ubx_payload+27)) |
#define UBX_NAV_SVIN_RES4 | ( | _ubx_payload | ) | (uint16_t)(*((uint8_t*)_ubx_payload+38)|*((uint8_t*)_ubx_payload+1+38)<<8) |
#define UBX_NAV_SVIN_Valid | ( | _ubx_payload | ) | (uint8_t)(*((uint8_t*)_ubx_payload+36)) |
#define UBX_NAV_SVIN_VERSION | ( | _ubx_payload | ) | (uint8_t)(*((uint8_t*)_ubx_payload+0)) |
RTCM3 callback node.
Forms a linked list of callbacks.
void msg_state_init | ( | msg_state_t * | s | ) |
Initialize an msg_state_t struct before use.
This resets the entire state, including all callbacks. Remember to use this function to initialize the state before calling rtcm3_process() for the first time.
s | State structure |
Definition at line 254 of file rtcm3.h.
References NO_CLASS, rtcm3_clear_callbacks(), s, and UNINIT.
void rtcm3_clear_callbacks | ( | msg_state_t * | s | ) |
Clear all registered callbacks.
This is probably only useful for testing but who knows!
Definition at line 210 of file rtcm3.h.
References s.
Referenced by msg_state_init().
rtcm3_msg_callbacks_node_t * rtcm3_find_callback | ( | msg_state_t * | s, |
u16 | msg_type | ||
) |
Find the callback function associated with a message type.
Searches through the list of registered callbacks to find the callback associated with the passed message type.
msg_type | Message type to find callback for |
NULL
if callback not found for that message type. Definition at line 224 of file rtcm3.h.
Referenced by rtcm3_process(), rtcm3_register_callback(), and ubx_process().
s8 rtcm3_process | ( | msg_state_t * | s, |
unsigned char | buff | ||
) |
Read and process RTCM3 messages.
Reads bytes from an input source using the provided read
function, decodes the RTCM3.
When an RTCM3 message is successfully received then the list of callbacks is searched for a callback corresponding to the received message type. If a callback is found then it is called with the ID of the sender, the message length and the message payload data buffer as arguments.
read
with n > 0 (aka it will attempt to always read something)The supplied read
function must have the prototype:
where n
is the number of bytes requested and buff
is the buffer into which to write the received data, and context
is the arbitrary pointer set by rtcm3_state_set_io_context
. The function should return the number of bytes successfully written into buff
which may be between 0 and n
inclusive, but must never be greater than n
.
Note that rtcm3_process
may not read all available bytes from the read
function so the caller should loop until all bytes available from the input source have been consumed.
s | State structure |
read | Function pointer to a function that reads n bytes from the input source into buff and returns the number of bytes successfully read. |
RTCM_OK
(0) if successful but no complete message yet, RTCM_OK_CALLBACK_EXECUTED
(1) if message decoded and callback executed, RTCM_OK_CALLBACK_UNDEFINED
(2) if message decoded with no associated callback, and RTCM_CRC_ERROR
(-2) if a CRC error has occurred. Thus can check for >0 to ensure good processing. Definition at line 308 of file rtcm3.h.
References buff, byteIndex, checksumCounter, foo, NO_CLASS, rawIndex, rd_msg_len, rd_msg_len1, READ_CHECKSUM, READ_LENGTH, READ_MESSAGE, READ_RESERVED, rtcm3_find_callback(), RTCM3_MSG_1005, RTCM3_MSG_1077, RTCM3_MSG_1087, RTCM3_MSG_1230, RTCM3_MSG_4072, RTCM3_PREAMBLE, RTCM_CLASS, RTCM_OK, RTCM_OK_CALLBACK_EXECUTED, RTCM_OK_CALLBACK_UNDEFINED, RTCMgetbitu(), s, and UNINIT.
s8 rtcm3_register_callback | ( | msg_state_t * | s, |
u16 | msg_type, | ||
rtcm3_msg_callback_t | cb, | ||
rtcm3_msg_callbacks_node_t * | node | ||
) |
Register a callback for a message type.
Register a callback that is called when a message with type msg_type is received.
msg_type | Message type associated with callback |
cb | Pointer to message callback function |
context | Pointer to context for callback function |
node | Statically allocated rtcm3_msg_callbacks_node_t struct |
RTCM_OK
(0) if successful, RTCM_CALLBACK_ERROR
if callback was already registered for that message type. Definition at line 159 of file rtcm3.h.
References foo, rtcm3_msg_callbacks_node::next, p, rtcm3_find_callback(), RTCM_CALLBACK_ERROR, RTCM_NULL_ERROR, RTCM_OK, and s.
Definition at line 503 of file rtcm3.h.
References buff, foo, and RTCMgetbitu().
Referenced by RTCMgetbits_38().
Definition at line 510 of file rtcm3.h.
References buff, RTCMgetbits(), and RTCMgetbitu().
Definition at line 495 of file rtcm3.h.
Referenced by rtcm3_process(), RTCMgetbits(), and RTCMgetbits_38().
s8 ubx_process | ( | msg_state_t * | s, |
unsigned char | buff | ||
) |
Definition at line 403 of file rtcm3.h.
References buff, foo, GOT_CHECKSUM1, GOT_CLASS, GOT_ID, GOT_LEN1, GOT_LEN2, GOT_PAYLOAD, GOT_SYNC1, GOT_SYNC2, GPS_UBX_ERR_CHECKSUM, GPS_UBX_ERR_MSG_TOO_LONG, GPS_UBX_ERR_OUT_OF_SYNC, GPS_UBX_ERR_UNEXPECTED, GPS_UBX_MAX_PAYLOAD, NO_CLASS, rtcm3_find_callback(), RTCM_OK, RTCM_OK_CALLBACK_EXECUTED, RTCM_OK_CALLBACK_UNDEFINED, s, UBX_CLASS, UBX_PREAMBLE1, UBX_PREAMBLE2, and UNINIT.
int byteIndex = 0 |
Definition at line 144 of file rtcm3.h.
Referenced by rtcm3_process().
int checksumCounter = 0 |
Definition at line 145 of file rtcm3.h.
Referenced by rtcm3_process().
int rawIndex = 0 |
Definition at line 146 of file rtcm3.h.
Referenced by rtcm3_process().
int rd_msg_len = 0 |
Definition at line 142 of file rtcm3.h.
Referenced by rtcm3_process().
int rd_msg_len1 = 0 |
Definition at line 143 of file rtcm3.h.
Referenced by rtcm3_process().