Digi XBee(R) ANSI C Host Library
pxbee_ota_client.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2019 Digi International Inc.,
3  * All rights not expressly granted are reserved.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
7  * You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * Digi International Inc., 9350 Excelsior Blvd., Suite 700, Hopkins, MN 55343
10  * ===========================================================================
11  */
12 
22 #ifndef PXBEE_OTA_CLIENT_H
23 #define PXBEE_OTA_CLIENT_H
24 
25 #include "xbee/platform.h"
26 #include "xbee/xmodem.h"
27 #include "wpan/aps.h"
28 #include "xbee/cbuf.h"
30 
32 
33 #define PXBEE_OTA_MAX_AUTH_LENGTH 64
34 
36 typedef struct pxbee_ota_t {
40  #define PXBEE_OTA_FLAG_APS_ENCRYPT 0x0001
42 
43  union {
47  } rxbuf;
49 
51  uint8_t auth_data[PXBEE_OTA_MAX_AUTH_LENGTH];
53 } pxbee_ota_t;
54 
76 
99 int _pxbee_ota_transparent_rx( const wpan_envelope_t FAR *envelope,
100  void FAR *context);
101 
112 #define PXBEE_OTA_DATA_CLIENT_CLUST_ENTRY(ota, flags) \
113  { DIGI_CLUST_SERIAL, _pxbee_ota_transparent_rx, ota, \
114  WPAN_CLUST_FLAG_INOUT | WPAN_CLUST_FLAG_NOT_ZCL | flags }
115 
116 // client cluster used to kick off OTA updates
117 // flag should be WPAN_CLUST_FLAG_NONE or WPAN_CLUST_FLAG_ENCRYPT
118 #define PXBEE_OTA_CMD_CLIENT_CLUST_ENTRY(handler, context, flag) \
119  { DIGI_CLUST_PROG_XBEE_OTA_UPD, handler, \
120  context, (flag) | WPAN_CLUST_FLAG_CLIENT | WPAN_CLUST_FLAG_NOT_ZCL }
121 
123 
124 // If compiling in Dynamic C, automatically #use the appropriate C file.
125 #ifdef __DC__
126  #use "pxbee_ota_client.c"
127 #endif
128 
129 #endif // PXBEE_OTA_CLIENT_H defined
130 
Structure used to track the state of an Xmodem send.
Definition: xmodem.h:114
#define FAR
On platforms with "far" pointers, define to the proper keyword; empty definition if not required...
Definition: platform.h:396
int _pxbee_ota_transparent_rx(const wpan_envelope_t FAR *envelope, void FAR *context)
Cluster handler for "Digi Transparent Serial" cluster.
Definition: pxbee_ota_client.c:47
#define XBEE_BEGIN_DECLS
Macro defined to.
Definition: platform.h:41
Common header for Hardware Abstraction Layer.
#define XBEE_CBUF_OVERHEAD
XBEE_CBUF_OVERHEAD is used when allocating memory for a circular buffer.
Definition: cbuf.h:65
Structure for tracking state of over-the-air update.
Definition: pxbee_ota_client.h:36
Makes use of xbee/serial.h API for sending and receiving serial data.
Support code for the "Digi Transparent Serial" cluster (cluster 0x0011 of endpoint 0xE8)...
addr64 target
network device to update
Definition: pxbee_ota_client.h:38
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. ...
Definition: pxbee_ota_client.c:157
unsigned short uint16_t
16-bit unsigned integer
Definition: platform_config.h:41
uint8_t raw[255+XBEE_CBUF_OVERHEAD]
buffer for xbee_cbuf_t structure and bytes received from target
Definition: pxbee_ota_client.h:46
unsigned char uint8_t
8-bit unsigned integer
Definition: platform_config.h:39
xbee_xmodem_state_t xbxm
track state of Xmodem transfer
Definition: pxbee_ota_client.h:48
Cluster/Endpoint layer for WPAN networks (ZigBee and DigiMesh).
wpan_dev_t * dev
local device to send updates through
Definition: pxbee_ota_client.h:37
uint16_t flags
combination of PXBEE_OTA_FLAG_* values
Definition: pxbee_ota_client.h:39
uint8_t auth_length
Number of bytes in auth_data.
Definition: pxbee_ota_client.h:52
Typedef used to hold a 64-bit IEEE address, represented as 8 bytes, 4 16-bit values or 2 32-bit value...
Definition: types.h:34
Circular buffer used by transparent serial cluster handler.
Definition: cbuf.h:31
xbee_cbuf_t cbuf
track state of circular buffer
Definition: pxbee_ota_client.h:44
The "envelope" is used to gather all necessary information about a given frame on the network...
Definition: aps.h:40
Structure used by the WPAN/ZigBee layers.
Definition: aps.h:390
uint8_t auth_data[PXBEE_OTA_MAX_AUTH_LENGTH]
Payload used to initiate update.
Definition: pxbee_ota_client.h:51