Digi XBee(R) ANSI C Host Library
|
Code for a device to send over-the-air firmware updates to a Programmable XBee.More...
Files | |
file | pxbee_ota_client.h |
file | pxbee_ota_client.c |
Support code for over-the-air (OTA) firmware updates of application code on Programmable XBee target. | |
Data Structures | |
struct | pxbee_ota_t |
Structure for tracking state of over-the-air update. More... | |
Macros | |
#define | PXBEE_OTA_MAX_AUTH_LENGTH 64 |
#define | PXBEE_OTA_DATA_CLIENT_CLUST_ENTRY(ota, flags) |
Macro for adding the OTA receive cluster (Digi Transparent Serial) to the cluster list for WPAN_ENDPOINT_DIGI_DATA. More... | |
#define | PXBEE_OTA_CMD_CLIENT_CLUST_ENTRY(handler, context, flag) |
Functions | |
int | pxbee_ota_init (pxbee_ota_t *ota, wpan_dev_t *dev, const addr64 *target) |
Initialize an pxbee_ota_t structure to send firmware updates to target using dev . More... | |
int | _pxbee_ota_transparent_rx (const wpan_envelope_t FAR *envelope, void FAR *context) |
Cluster handler for "Digi Transparent Serial" cluster. More... | |
int | _pxbee_ota_xmodem_read (void FAR *context, void FAR *buffer, int16_t bytes) |
int | _pxbee_ota_xmodem_write (void FAR *context, const void FAR *buffer, int16_t bytes) |
Code for a device to send over-the-air firmware updates to a Programmable XBee.
Support code for over-the-air (OTA) firmware updates of application code on Programmable XBee target.
#define PXBEE_OTA_CMD_CLIENT_CLUST_ENTRY | ( | handler, | |
context, | |||
flag | |||
) |
#define PXBEE_OTA_DATA_CLIENT_CLUST_ENTRY | ( | ota, | |
flags | |||
) |
Macro for adding the OTA receive cluster (Digi Transparent Serial) to the cluster list for WPAN_ENDPOINT_DIGI_DATA.
[in] | ota | pointer to an pxbee_ota_t structure for tracking update state |
[in] | flags | additional flags for the cluster; typically 0 or WPAN_CLUST_FLAG_ENCRYPT |
int _pxbee_ota_transparent_rx | ( | const wpan_envelope_t FAR * | envelope, |
void FAR * | context | ||
) |
Cluster handler for "Digi Transparent Serial" cluster.
Used in the cluster table of WPAN_ENDPOINT_DIGI_DATA (0xE8) for cluster DIGI_CLUST_SERIAL (0x0011).
This is a preliminary API and WILL change in a future release. This version is dedicated to processing responses in OTA (over-the-air) firmware updates and has not been generalized for other uses.
[in] | envelope | information about the frame (addresses, endpoint, profile, cluster, etc.) |
[in,out] | context | pointer to pxbee_ota_t structure |
0 | handled data |
!0 | some sort of error processing data |
References FAR, hex_dump(), HEX_DUMP_FLAG_TAB, and xbee_cbuf_put().
Function assigned to the stream.read
function pointer of an xbee_xmodem_state_t object. Reads data from the target specified in the pxbee_ota_t structure.
[in] | context | pxbee_ota_t structure |
[in,out] | buffer | buffer to store read data |
[in] | bytes | maximum number of bytes to write to buffer |
References EINVAL, FAR, and xbee_cbuf_get().
Referenced by pxbee_ota_init().
Function assigned to the stream.write
function pointer of an xbee_xmodem_state_t object. Sends data to the target specified in the pxbee_ota_t structure.
[in] | context | pxbee_ota_t structure |
[in,out] | buffer | source of data to send |
[in] | bytes | number of bytes to send |
References wpan_envelope_t::dev, EINVAL, FAR, wpan_envelope_t::length, wpan_envelope_t::payload, PXBEE_OTA_FLAG_APS_ENCRYPT, WPAN_CLUST_FLAG_ENCRYPT, wpan_envelope_create(), WPAN_NET_ADDR_UNDEFINED, and xbee_transparent_serial().
Referenced by pxbee_ota_init().
int pxbee_ota_init | ( | pxbee_ota_t * | ota, |
wpan_dev_t * | dev, | ||
const addr64 * | target | ||
) |
Initialize an pxbee_ota_t structure to send firmware updates to target
using dev
.
Calls xbee_xmodem_tx_init and xbee_xmodem_set_stream (therefore unnecessary to do so in main program).
Note that when performing OTA updates, you MUST use XBEE_XMODEM_FLAG_64 (64-byte xmodem blocks) if calling xbee_xmodem_tx_init directly.
Sends frames to the target to have it start the update cycle.
[in,out] | ota | state-tracking structure for sending update |
[in] | dev | device to use for sending update |
[in] | target | 64-bit address of target device |
0 | successfully initialized |
-EINVAL | invalid parameter passed in |
References _pxbee_ota_xmodem_read(), _pxbee_ota_xmodem_write(), pxbee_ota_t::auth_data, pxbee_ota_t::auth_length, pxbee_ota_t::cbuf, wpan_envelope_t::cluster_id, wpan_envelope_t::dest_endpoint, pxbee_ota_t::dev, DIGI_CLUST_PROG_XBEE_OTA_UPD, DIGI_CLUST_SERIAL, EINVAL, pxbee_ota_t::flags, wpan_envelope_t::length, wpan_envelope_t::payload, wpan_envelope_t::profile_id, PXBEE_OTA_FLAG_APS_ENCRYPT, wpan_envelope_t::source_endpoint, pxbee_ota_t::target, WPAN_CLUST_FLAG_ENCRYPT, WPAN_ENDPOINT_DIGI_DATA, wpan_envelope_create(), wpan_envelope_send(), WPAN_NET_ADDR_UNDEFINED, WPAN_PROFILE_DIGI, WPAN_SEND_FLAG_NONE, xbee_cbuf_init(), XBEE_XMODEM_FLAG_64, xbee_xmodem_set_stream(), xbee_xmodem_tx_init(), and pxbee_ota_t::xbxm.