libsbp  v2.4.7
sbp.h File Reference
#include "common.h"
Include dependency graph for sbp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sbp_msg_callbacks_node
 SBP callback node. More...
 
struct  sbp_state_t
 State structure for processing SBP messages. More...
 

Macros

#define SBP_OK   0
 Return value indicating success. More...
 
#define SBP_OK_CALLBACK_EXECUTED   1
 Return value indicating message decoded and callback executed by sbp_process. More...
 
#define SBP_OK_CALLBACK_UNDEFINED   2
 Return value indicating message decoded with no associated callback in sbp_process. More...
 
#define SBP_CALLBACK_ERROR   -1
 Return value indicating an error with the callback (function defined). More...
 
#define SBP_CRC_ERROR   -2
 Return value indicating a CRC error. More...
 
#define SBP_SEND_ERROR   -3
 Return value indicating an error occured whilst sending an SBP message. More...
 
#define SBP_NULL_ERROR   -4
 Return value indicating an error occured because an argument was NULL. More...
 
#define SBP_WRITE_ERROR   -5
 Return value indicating an error occured in the write() operation. More...
 
#define SBP_READ_ERROR   -6
 Return value indicating an error occured in the read() operation. More...
 
#define SBP_SENDER_ID   0x42
 Default sender ID. More...
 

Typedefs

typedef void(* sbp_msg_callback_t) (u16 sender_id, u8 len, u8 msg[], void *context)
 SBP callback function prototype definition. More...
 
typedef struct sbp_msg_callbacks_node sbp_msg_callbacks_node_t
 SBP callback node. More...
 

Functions

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. More...
 
s8 sbp_remove_callback (sbp_state_t *s, sbp_msg_callbacks_node_t *node)
 Remove a registered callback. More...
 
void sbp_clear_callbacks (sbp_state_t *s)
 Clear all registered callbacks. More...
 
void sbp_state_init (sbp_state_t *s)
 Initialize an sbp_state_t struct before use. More...
 
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 void* context pointer in sbp_state. More...
 
s8 sbp_process (sbp_state_t *s, s32(*read)(u8 *buff, u32 n, void *context))
 Read and process SBP messages. More...
 
s8 sbp_process_payload (sbp_state_t *s, u16 sender_id, u16 msg_type, u8 msg_len, u8 payload[])
 Directly process a SBP message. More...
 
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. More...