|
Paparazzi UAS v7.1_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 |
Macros | |
| #define | READ_RESERVED 1 |
| #define | READ_LENGTH 2 |
| #define | READ_MESSAGE 3 |
| #define | READ_CHECKSUM 4 |
| #define | RTCM3_PREAMBLE 0xD3 |
| #define | RTCM3_MSG_1005 0x69 |
| #define | RTCM3_MSG_4072 0x72 |
| #define | RTCM3_MSG_1077 0xB1 |
| #define | RTCM3_MSG_1087 0xBB |
| #define | RTCM3_MSG_1097 0xC5 |
| #define | RTCM3_MSG_1230 0xE6 |
| #define | UNINIT 0 |
| #define | GOT_SYNC1 1 |
| #define | GOT_SYNC2 2 |
| #define | GOT_CLASS 3 |
| #define | GOT_ID 4 |
| #define | GOT_LEN1 5 |
| #define | GOT_LEN2 6 |
| #define | GOT_PAYLOAD 7 |
| #define | GOT_CHECKSUM1 8 |
| #define | UBX_PREAMBLE1 0xB5 |
| #define | UBX_PREAMBLE2 0x62 |
| #define | UBX_NAV_SVIN 0x3B |
| #define | GPS_UBX_MAX_PAYLOAD 255 |
| #define | GPS_UBX_ERR_NONE 0 |
| #define | GPS_UBX_ERR_OVERRUN 1 |
| #define | GPS_UBX_ERR_MSG_TOO_LONG 2 |
| #define | GPS_UBX_ERR_CHECKSUM 3 |
| #define | GPS_UBX_ERR_UNEXPECTED 4 |
| #define | GPS_UBX_ERR_OUT_OF_SYNC 5 |
| #define | NO_CLASS 0 |
| #define | RTCM_CLASS 1 |
| #define | UBX_CLASS 2 |
| #define | UBX_NAV_SVIN_VERSION(_ubx_payload) |
| #define | UBX_NAV_SVIN_RES1(_ubx_payload) |
| #define | UBX_NAV_SVIN_RES2(_ubx_payload) |
| #define | UBX_NAV_SVIN_ITOW(_ubx_payload) |
| #define | UBX_NAV_SVIN_dur(_ubx_payload) |
| #define | UBX_NAV_SVIN_meanX(_ubx_payload) |
| #define | UBX_NAV_SVIN_meanY(_ubx_payload) |
| #define | UBX_NAV_SVIN_meanZ(_ubx_payload) |
| #define | UBX_NAV_SVIN_meanXHP(_ubx_payload) |
| #define | UBX_NAV_SVIN_meanYHP(_ubx_payload) |
| #define | UBX_NAV_SVIN_meanZHP(_ubx_payload) |
| #define | UBX_NAV_SVIN_RES3(_ubx_payload) |
| #define | UBX_NAV_SVIN_meanACC(_ubx_payload) |
| #define | UBX_NAV_SVIN_OBS(_ubx_payload) |
| #define | UBX_NAV_SVIN_Valid(_ubx_payload) |
| #define | UBX_NAV_SVIN_Active(_ubx_payload) |
| #define | UBX_NAV_SVIN_RES4(_ubx_payload) |
| #define | RTCM_OK 0 |
| Return value indicating success. | |
| #define | RTCM_OK_CALLBACK_EXECUTED 1 |
| Return value indicating message decoded and callback executed by rtcm3_process. | |
| #define | RTCM_OK_CALLBACK_UNDEFINED 2 |
| Return value indicating message decoded with no associated callback in rtcm3_process. | |
| #define | RTCM_CALLBACK_ERROR -1 |
| Return value indicating an error with the callback (function defined). | |
| #define | RTCM_CRC_ERROR -2 |
| Return value indicating a CRC error. | |
| #define | RTCM_SEND_ERROR -3 |
| Return value indicating an error occured whilst sending an RTCM3 message. | |
| #define | RTCM_NULL_ERROR -4 |
| Return value indicating an error occured because an argument was NULL. | |
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 NO_CLASS 0 |
Definition at line 51 of file rtcm3.h.
Referenced by msg_state_init(), rtcm3_process(), and ubx_process().
| #define READ_CHECKSUM 4 |
Definition at line 17 of file rtcm3.h.
Referenced by rtcm3_process().
| #define READ_LENGTH 2 |
Definition at line 15 of file rtcm3.h.
Referenced by rtcm3_process().
| #define READ_MESSAGE 3 |
Definition at line 16 of file rtcm3.h.
Referenced by rtcm3_process().
| #define READ_RESERVED 1 |
Definition at line 14 of file rtcm3.h.
Referenced by rtcm3_process().
| #define RTCM3_MSG_1005 0x69 |
Definition at line 20 of file rtcm3.h.
Referenced by rtcm3_process().
| #define RTCM3_MSG_1077 0xB1 |
Definition at line 22 of file rtcm3.h.
Referenced by rtcm3_process().
| #define RTCM3_MSG_1087 0xBB |
Definition at line 23 of file rtcm3.h.
Referenced by rtcm3_process().
| #define RTCM3_MSG_1097 0xC5 |
Definition at line 24 of file rtcm3.h.
Referenced by rtcm3_process().
| #define RTCM3_MSG_1230 0xE6 |
Definition at line 25 of file rtcm3.h.
Referenced by rtcm3_process().
| #define RTCM3_MSG_4072 0x72 |
Definition at line 21 of file rtcm3.h.
Referenced by rtcm3_process().
| #define RTCM3_PREAMBLE 0xD3 |
Definition at line 19 of file rtcm3.h.
Referenced by rtcm3_process().
| #define RTCM_CALLBACK_ERROR -1 |
Return value indicating an error with the callback (function defined).
Definition at line 86 of file rtcm3.h.
Referenced by rtcm3_register_callback().
| #define RTCM_CLASS 1 |
Definition at line 52 of file rtcm3.h.
Referenced by rtcm3_process().
| #define RTCM_CRC_ERROR -2 |
| #define RTCM_NULL_ERROR -4 |
Return value indicating an error occured because an argument was NULL.
Definition at line 92 of file rtcm3.h.
Referenced by rtcm3_register_callback().
| #define RTCM_OK 0 |
Return value indicating success.
Definition at line 80 of file rtcm3.h.
Referenced by rtcm3_process(), rtcm3_register_callback(), and ubx_process().
| #define RTCM_OK_CALLBACK_EXECUTED 1 |
Return value indicating message decoded and callback executed by rtcm3_process.
Definition at line 82 of file rtcm3.h.
Referenced by rtcm3_process(), and ubx_process().
| #define RTCM_OK_CALLBACK_UNDEFINED 2 |
Return value indicating message decoded with no associated callback in rtcm3_process.
Definition at line 84 of file rtcm3.h.
Referenced by rtcm3_process(), and ubx_process().
| #define RTCM_SEND_ERROR -3 |
| #define UBX_CLASS 2 |
Definition at line 53 of file rtcm3.h.
Referenced by ubx_process().
| #define UBX_NAV_SVIN_Active | ( | _ubx_payload | ) |
| #define UBX_NAV_SVIN_dur | ( | _ubx_payload | ) |
| #define UBX_NAV_SVIN_ITOW | ( | _ubx_payload | ) |
| #define UBX_NAV_SVIN_meanACC | ( | _ubx_payload | ) |
| #define UBX_NAV_SVIN_meanX | ( | _ubx_payload | ) |
| #define UBX_NAV_SVIN_meanXHP | ( | _ubx_payload | ) |
| #define UBX_NAV_SVIN_meanY | ( | _ubx_payload | ) |
| #define UBX_NAV_SVIN_meanYHP | ( | _ubx_payload | ) |
| #define UBX_NAV_SVIN_meanZ | ( | _ubx_payload | ) |
| #define UBX_NAV_SVIN_meanZHP | ( | _ubx_payload | ) |
| #define UBX_NAV_SVIN_OBS | ( | _ubx_payload | ) |
| #define UBX_NAV_SVIN_RES1 | ( | _ubx_payload | ) |
| #define UBX_NAV_SVIN_RES2 | ( | _ubx_payload | ) |
| #define UBX_NAV_SVIN_RES3 | ( | _ubx_payload | ) |
| #define UBX_NAV_SVIN_RES4 | ( | _ubx_payload | ) |
| #define UBX_NAV_SVIN_Valid | ( | _ubx_payload | ) |
| #define UBX_NAV_SVIN_VERSION | ( | _ubx_payload | ) |
| #define UBX_PREAMBLE1 0xB5 |
Definition at line 39 of file rtcm3.h.
Referenced by ubx_process().
| #define UBX_PREAMBLE2 0x62 |
Definition at line 40 of file rtcm3.h.
Referenced by ubx_process().
| typedef struct rtcm3_msg_callbacks_node rtcm3_msg_callbacks_node_t |
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 255 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 211 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 |
Definition at line 225 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.
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. |
Definition at line 309 of file rtcm3.h.
References byteIndex, rtcm3_msg_callbacks_node::cb, checksumCounter, 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_1097, 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 |
Definition at line 160 of file rtcm3.h.
References rtcm3_msg_callbacks_node::cb, rtcm3_msg_callbacks_node::msg_type, rtcm3_msg_callbacks_node::next, p, rtcm3_find_callback(), RTCM_CALLBACK_ERROR, RTCM_NULL_ERROR, RTCM_OK, and s.
| int RTCMgetbits | ( | unsigned char * | buff, |
| int | pos, | ||
| int | lenb ) |
Definition at line 505 of file rtcm3.h.
References RTCMgetbitu().
Referenced by RTCMgetbits_38().
|
static |
Definition at line 512 of file rtcm3.h.
References RTCMgetbits(), and RTCMgetbitu().
| unsigned int RTCMgetbitu | ( | unsigned char * | buff, |
| int | pos, | ||
| int | lenb ) |
Definition at line 497 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 405 of file rtcm3.h.
References rtcm3_msg_callbacks_node::cb, 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 145 of file rtcm3.h.
Referenced by rtcm3_process().
| int checksumCounter = 0 |
Definition at line 146 of file rtcm3.h.
Referenced by rtcm3_process().
| int rawIndex = 0 |
Definition at line 147 of file rtcm3.h.
Referenced by rtcm3_process().
| int rd_msg_len = 0 |
Definition at line 143 of file rtcm3.h.
Referenced by rtcm3_process().
| int rd_msg_len1 = 0 |
Definition at line 144 of file rtcm3.h.
Referenced by rtcm3_process().