28 #define SBP_OK_CALLBACK_EXECUTED 1
30 #define SBP_OK_CALLBACK_UNDEFINED 2
32 #define SBP_CALLBACK_ERROR -1
34 #define SBP_CRC_ERROR -2
36 #define SBP_SEND_ERROR -3
38 #define SBP_NULL_ERROR -4
40 #define SBP_WRITE_ERROR -5
42 #define SBP_READ_ERROR -6
45 #define SBP_SENDER_ID 0x42
93 s32 (*write)(
u8 *buff,
u32 n,
void* context));
void sbp_clear_callbacks(sbp_state_t *s)
Clear all registered callbacks.
void(* sbp_msg_callback_t)(u16 sender_id, u8 len, u8 msg[], void *context)
SBP callback function prototype definition.
s8 sbp_send_message(sbp_state_t *s, u16 msg_type, u16 sender_id, u8 len, u8 *payload, s32(*write)(u8 *buff, u32 n, void *context))
Send SBP messages.
u16 msg_type
Message ID associated with callback.
int8_t s8
Signed 8-bit integer.
sbp_msg_callbacks_node_t * sbp_msg_callbacks_head
s8 sbp_register_callback(sbp_state_t *s, u16 msg_type, sbp_msg_callback_t cb, void *context, sbp_msg_callbacks_node_t *node)
Register a callback for a message type.
uint8_t u8
Unsigned 8-bit integer.
s8 sbp_remove_callback(sbp_state_t *s, sbp_msg_callbacks_node_t *node)
Remove a registered callback.
s8 sbp_process_payload(sbp_state_t *s, u16 sender_id, u16 msg_type, u8 msg_len, u8 payload[])
Directly process a SBP message.
void sbp_state_set_io_context(sbp_state_t *s, void *context)
Set a context to pass to all function pointer calls made by sbp functions This helper function sets a...
State structure for processing SBP messages.
uint16_t u16
Unsigned 16-bit integer.
uint32_t u32
Unsigned 32-bit integer.
struct sbp_msg_callbacks_node sbp_msg_callbacks_node_t
SBP callback node.
void sbp_state_init(sbp_state_t *s)
Initialize an sbp_state_t struct before use.
sbp_msg_callback_t cb
Pointer to callback function.
s8 sbp_process(sbp_state_t *s, s32(*read)(u8 *buff, u32 n, void *context))
Read and process SBP messages.
int32_t s32
Signed 32-bit integer.
void * context
Pointer to a context.
struct sbp_msg_callbacks_node * next
Pointer to next node in list.