puzzlebox
Loading...
Searching...
No Matches

Functions for directly creating serialized message buffers. More...

Detailed Description

Functions

void pb_send_reply (const pb_msg_t *msg, const pb_buf_t *reply)
 Utility function for replying to a message.
 
pb_buf_t pb_send_read_req (uint8_t propid)
 Create a serialized PROP REQ message.
 
pb_buf_t pb_send_read_res (uint8_t propid, const uint8_t *value, size_t size)
 Create a serialized PROP RES message.
 
pb_buf_t pb_send_write_req (uint8_t propid, const uint8_t *value, size_t size)
 Create a serialized PROP SET message.
 
pb_buf_t pb_send_state_req ()
 Create a serialized STATE REQ message.
 
pb_buf_t pb_send_state_res ()
 Create a serialized STATE RES message.
 
pb_buf_t pb_send_state_set (pb_global_state_t state)
 Create a serialized STATE SET message.
 
pb_buf_t pb_send_magic_req ()
 Create a serialized MAGIC REQ message.
 
pb_buf_t pb_send_magic_res ()
 Create a serialized MAGIC RES message.
 

Function Documentation

◆ pb_send_magic_req()

pb_buf_t pb_send_magic_req ( )

The magic string is equal to pb_cmd_magic_req.

Returns
Message buffer
Note
The buffer returned by this function must be free'd with pb_buf_free().

◆ pb_send_magic_res()

pb_buf_t pb_send_magic_res ( )

The magic string is equal to pb_cmd_magic_res.

Returns
Message buffer
Note
The buffer returned by this function must be free'd with pb_buf_free().

◆ pb_send_read_req()

pb_buf_t pb_send_read_req ( uint8_t propid)
Parameters
propidProperty ID to request
Returns
Message buffer
Note
The buffer returned by this function must be free'd with pb_buf_free().

◆ pb_send_read_res()

pb_buf_t pb_send_read_res ( uint8_t propid,
const uint8_t * value,
size_t size )
Parameters
propidRequested property ID
valuePointer to structured data in property
sizeSize of value
Returns
Message buffer
Note
The buffer returned by this function must be free'd with pb_buf_free().

◆ pb_send_reply()

void pb_send_reply ( const pb_msg_t * msg,
const pb_buf_t * reply )
Parameters
msgMessage to reply to
replyData to send as reply

This function uses pb_i2c_send() to send reply to msg->sender.

◆ pb_send_state_req()

pb_buf_t pb_send_state_req ( )

The current module's state is obtained using pb_hook_mod_state_read().

Returns
Message buffer
Note
The buffer returned by this function must be free'd with pb_buf_free().

◆ pb_send_state_res()

pb_buf_t pb_send_state_res ( )

The current module's state is obtained using pb_hook_mod_state_read().

Returns
Message buffer
Note
The buffer returned by this function must be free'd with pb_buf_free().

◆ pb_send_state_set()

pb_buf_t pb_send_state_set ( pb_global_state_t state)
Parameters
stateRequested new state
Returns
Message buffer
Note
The buffer returned by this function must be free'd with pb_buf_free().

◆ pb_send_write_req()

pb_buf_t pb_send_write_req ( uint8_t propid,
const uint8_t * value,
size_t size )
Parameters
propidProperty ID to write
valuePointer to data to write to property
sizeSize of value
Returns
Message buffer
Note
The buffer returned by this function must be free'd with pb_buf_free().