38 #define XBEE_DEV_FLAG_NONE 0x0000 41 #ifndef XBEE_DEV_MAX_DISPATCH_PER_TICK 42 #define XBEE_DEV_MAX_DISPATCH_PER_TICK 5 145 #define XBEE_RX_OPT_ACKNOWLEDGED 0x01 150 #define XBEE_RX_OPT_BROADCAST 0x02 153 #define XBEE_RX_OPT_SENT_ENCRYPTED 0x10 156 #define XBEE_RX_OPT_APS_ENCRYPT 0x20 159 #define XBEE_RX_OPT_FROM_END_DEVICE 0x40 // appeared in ZB 2x7x 162 #define XBEE_RX_OPT_MODE_MASK 0xC0 165 #define XBEE_RX_OPT_MODE_NONE (0) 168 #define XBEE_RX_OPT_MODE_POINT_MULTIPOINT (1<<6) 171 #define XBEE_RX_OPT_MODE_REPEATER (2<<6) 174 #define XBEE_RX_OPT_MODE_DIGIMESH (3<<6) 178 #ifndef XBEE_MAX_RFPAYLOAD 179 #if XBEE_CELLULAR_ENABLED 180 #define XBEE_MAX_RFPAYLOAD 1500 181 #elif XBEE_WIFI_ENABLED 182 #define XBEE_MAX_RFPAYLOAD 1400 184 #define XBEE_MAX_RFPAYLOAD 256 190 #define XBEE_MAX_RX_FRAME_LEN (XBEE_MAX_RFPAYLOAD + 18) 194 #define XBEE_MAX_TX_FRAME_LEN (XBEE_MAX_RFPAYLOAD + 20) 197 #define XBEE_MAX_FRAME_LEN XBEE_MAX_RX_FRAME_LEN 253 const void FAR *frame,
298 typedef struct xbee_dispatch_table_entry {
384 #define XBEE_HARDWARE_MASK 0xFF00 385 #define XBEE_HARDWARE_S1 0x1700 386 #define XBEE_HARDWARE_S1_PRO 0x1800 387 #define XBEE_HARDWARE_S2 0x1900 388 #define XBEE_HARDWARE_S2_PRO 0x1A00 389 #define XBEE_HARDWARE_900_PRO 0x1B00 390 #define XBEE_HARDWARE_868_PRO 0x1D00 391 #define XBEE_HARDWARE_S2B_PRO 0x1E00 392 #define XBEE_HARDWARE_S2C_PRO 0x2100 393 #define XBEE_HARDWARE_S2C 0x2200 394 #define XBEE_HARDWARE_S3B 0x2300 // XBee 900HP 395 #define XBEE_HARDWARE_S8 0x2400 396 #define XBEE_HARDWARE_S6B 0x2700 // XBee Wi-Fi 397 #define XBEE_HARDWARE_CELL_CAT1_VZW 0x4000 398 #define XBEE_HARDWARE_XB3_MICRO 0x4100 399 #define XBEE_HARDWARE_XB3_TH 0x4200 400 #define XBEE_HARDWARE_CELL_3G 0x4400 409 #define XBEE_HW_SERIES_MASK 0xFF00 410 #define XBEE_HW_SERIES_WIFI_S6 0x0600 411 #define XBEE_HW_SERIES_CELLULAR 0x0B00 412 #define XBEE_HW_SERIES_XBEE3_RF 0x0C00 421 #define XBEE_PROTOCOL_MASK 0xF000 423 #define XBEE_PROTOCOL_ZNET 0x1000 424 #define XBEE_PROTOCOL_ZB 0x2000 425 #define XBEE_PROTOCOL_SMARTENERGY 0x3000 426 #define XBEE_PROTOCOL_ZB_S2C 0x4000 427 #define XBEE_PROTOCOL_SE_S2C 0x5000 429 #define XBEE_PROTOCOL_MESHLESS 0x1000 430 #define XBEE_PROTOCOL_DIGIMESH 0x8000 432 #define XBEE_PROTOCOL_XB3_ZIGBEE 0x1000 433 #define XBEE_PROTOCOL_XB3_802_15_4 0x2000 434 #define XBEE_PROTOCOL_XB3_DIGIMESH 0x3000 436 #define XBEE_NODETYPE_MASK 0x0F00 437 #define XBEE_NODETYPE_COORD 0x0100 438 #define XBEE_NODETYPE_ROUTER 0x0300 439 #define XBEE_NODETYPE_ENDDEV 0x0900 457 #ifdef XBEE_DEVICE_ENABLE_ATMODE 493 #if BYTE_ORDER == BIG_ENDIAN 494 #define XBEE_DEV_STACK_VERSION_ADDR(x) ((uint8_t *)&(x).firmware_version + 3) 496 #define XBEE_DEV_STACK_VERSION_ADDR(x) ((uint8_t *)&(x).firmware_version) 508 #define XBEE_FRAME_TABLE_END { 0xFF, 0, NULL, NULL } 516 #define XBEE_DEV_DUMP_FLAG_NONE 0x0000 517 #ifndef XBEE_DEV_DUMP_FLAG_DEFAULT 518 #define XBEE_DEV_DUMP_FLAG_DEFAULT XBEE_DEV_DUMP_FLAG_NONE 528 #define XBEE_WRITE_FLAG_NONE 0x0000 537 uint_fast8_t initial);
554 #define XBEE_MODEM_STATUS_HW_RESET 0x00 556 #define XBEE_MODEM_STATUS_WATCHDOG 0x01 558 #define XBEE_MODEM_STATUS_JOINED 0x02 560 #define XBEE_MODEM_STATUS_DISASSOC 0x03 562 #define XBEE_MODEM_STATUS_IP_CONFIG_ERROR 0x04 564 #define XBEE_MODEM_STATUS_COORD_START 0x06 566 #define XBEE_MODEM_STATUS_NETWORK_KEY_UPDATED 0x07 568 #define XBEE_MODEM_STATUS_WOKE_UP 0x0B 570 #define XBEE_MODEM_STATUS_SLEEPING 0x0C 572 #define XBEE_MODEM_STATUS_OVERVOLTAGE 0x0D 574 #define XBEE_MODEM_STATUS_CLOUD_CONNECTED 0x0E 576 #define XBEE_MODEM_STATUS_CLOUD_DISCONNECTED 0x0F 578 #define XBEE_MODEM_STATUS_KEY_ESTABLISHED 0x10 580 #define XBEE_MODEM_STATUS_CONFIG_CHANGE_IN_JOIN 0x11 582 #define XBEE_MODEM_STATUS_SS_ESTABLISHED 0x3B 584 #define XBEE_MODEM_STATUS_SS_ENDED 0x3C 586 #define XBEE_MODEM_STATUS_SS_AUTH_FAILED 0x3D 588 #define XBEE_MODEM_STATUS_STACK_ERROR 0x80 609 #define XBEE_FRAME_MODEM_STATUS_DEBUG \ 610 { XBEE_FRAME_MODEM_STATUS, 0, xbee_frame_dump_modem_status, NULL } 619 #endif // #ifdef __XBEE_DEVICE unsigned long uint32_t
32-bit unsigned integer
Definition: platform_config.h:43
Node Type is End Device.
Definition: device.h:327
uint32_t firmware_version
Value of XBee module's VR register (4-bytes on some devices)
Definition: device.h:416
int xbee_dev_init(xbee_dev_t *xbee, const xbee_serial_t *serport, xbee_is_awake_fn is_awake, xbee_reset_fn reset)
Initialize the XBee device structure and open a serial connection to a local, serially-attached XBee ...
Definition: xbee_device.c:125
void xbee_dev_dump_settings(xbee_dev_t *xbee, uint16_t flags)
Print information to stdout about the XBee device.
Definition: xbee_device.c:229
WPAN datatypes and support functions, valid for ZigBee and DigiMesh.
Frame notifying trust center that a device has attempted to join, rejoin or leave the network...
Definition: device.h:138
#define FAR
On platforms with "far" pointers, define to the proper keyword; empty definition if not required...
Definition: platform.h:396
Firmware is ZNet.
Definition: device.h:328
wpan_dev_t wpan_dev
Generic WPAN device required by the Zigbee Networking layers of the API.
Definition: device.h:364
Data received for specific endpoint/cluster (see xbee_wpan.c), when ATAO is non-zero.
Definition: device.h:103
Node Type is Router.
Definition: device.h:326
Definition: platform_config.h:71
command mode, can send AT commands to XBee
Definition: device.h:344
#define XBEE_BEGIN_DECLS
Macro defined to.
Definition: platform.h:41
Information on device authenticated on Smart Energy network.
Definition: device.h:126
query is in progress
Definition: device.h:321
xbee_disc_node_id_fn node_id_handler
Optional function to receive parsed Node ID messages.
Definition: device.h:376
void(* xbee_disc_node_id_fn)(struct xbee_dev_t *xbee, const struct xbee_node_id_t *rec)
Function to process parsed Node ID messages.
Definition: device.h:294
sent a command and now waiting for a response
Definition: device.h:348
const xbee_dispatch_table_entry_t xbee_frame_handlers[]
Static table used for dispatching frames.
Current modem status (see xbee_frame_modem_status_t).
Definition: device.h:84
xbee_serial_t serport
Platform-specific structure required by xbee_serial.c.
Definition: device.h:367
waiting for initial 0x7E
Definition: device.h:308
Queue an AT command for batch processing on the local device.
Definition: device.h:57
xbee_is_awake_fn is_awake
Optional function to read AWAKE pin.
Definition: device.h:373
Node Type is Coordinator.
Definition: device.h:325
querying timed out or error
Definition: device.h:319
Route Information Frame, sent for DigiMesh unicast transmissions with NACK or Trace Route Enable tran...
Definition: device.h:91
Data received on the transparent serial cluster, when ATAO is set to 0.
Definition: device.h:99
wait for guard-time ms before sending +++
Definition: device.h:345
Current mode of the XBee device (e.g., boot loader, API, command).
Definition: device.h:467
started querying device
Definition: device.h:317
int(* xbee_is_awake_fn)(struct xbee_dev_t *xbee)
Function to check the XBee device's AWAKE pin to see if it is awake.
Definition: device.h:267
Haven't started communicating with XBee yet.
Definition: device.h:337
Frame sent in response to Register Joining Device frame (XBEE_FRAME_REG_JOINING_DEV).
Definition: device.h:133
waiting for MSB of length (first byte)
Definition: device.h:309
receiving frame and/or trailing checksum
Definition: device.h:311
xbee_dev_mode
Definition: device.h:336
void xbee_dev_flowcontrol(xbee_dev_t *xbee, bool_t enabled)
Control whether xbee_frame_write() checks the XBee CTS signal before sending frames.
Definition: xbee_device.c:189
xbee_reset_fn reset
Optional function to control reset pin.
Definition: device.h:370
uint8_t frame_type
if 0, match all frames of this type
Definition: device.h:299
int xbee_dev_tick(xbee_dev_t *xbee)
Check for newly received frames on an XBee device and dispatch them to registered frame handlers...
Definition: xbee_device.c:313
#define XBEE_MAX_FRAME_LEN
Deprecated legacy macro, use XBEE_MAX_RX_FRAME_LEN instead.
Definition: device.h:197
uint16_t hardware_version
Value of XBee module's HV register.
Definition: device.h:379
Register Joining Device (add device to trust center's key table) [Smart Energy, coordinator].
Definition: device.h:76
Create Source Route (used with many-to-one routing) [ZigBee].
Definition: device.h:72
unsigned short uint16_t
16-bit unsigned integer
Definition: platform_config.h:41
uint8_t xbee_next_frame_id(xbee_dev_t *xbee)
Increment and return current frame ID for a given XBee device.
Definition: xbee_device.c:61
uint16_t hardware_series
Value of XBee module's HS register.
Definition: device.h:404
void _xbee_dispatch_table_dump(const xbee_dev_t *xbee)
Definition: xbee_device.c:354
querying completed
Definition: device.h:318
[ZigBee, not Smart Energy]
Definition: device.h:106
XBee is in the bootloader, not running firmware.
Definition: device.h:338
Route records received in response to a Route Request. [ZigBee].
Definition: device.h:122
Many-to-One Route Request Indicator [ZigBee].
Definition: device.h:129
in xbee_dev_tick
Definition: device.h:323
int _xbee_frame_dispatch(xbee_dev_t *xbee, const void FAR *frame, uint16_t length)
Function called by _xbee_frame_load() to dispatch any frames read.
Definition: xbee_device.c:894
Platform-specific layer provieds a consistent serial API to upper layers of the driver.
unsigned char uint8_t
8-bit unsigned integer
Definition: platform_config.h:39
Output when a node receives an address update frame and modifies its DH/DL registers.
Definition: device.h:95
int _xbee_frame_load(xbee_dev_t *xbee)
Check XBee's serial buffer for complete frames and pass them off to the dispatcher.
Definition: xbee_device.c:629
xbee_frame_type
Possible values for the frame_type field of frames sent to and from the XBee module.
Definition: device.h:50
uint16_t bytes_in_frame
bytes in frame being read; does not include checksum byte
Definition: device.h:472
Check CTS before sending.
Definition: device.h:333
Firmware is DigiMesh.
Definition: device.h:330
wait guard-time ms for "OK\r" before command mode
Definition: device.h:346
Cluster/Endpoint layer for WPAN networks (ZigBee and DigiMesh).
Send an AT Command to the local device (see xbee_atcmd.c, xbee_header_at_request_t).
Definition: device.h:53
Firmware is ZigBee.
Definition: device.h:329
void(* xbee_reset_fn)(struct xbee_dev_t *xbee, bool_t asserted)
Function to toggle the /RESET pin to the XBee device.
Definition: device.h:276
uint16_t bytes_read
bytes read so far
Definition: device.h:475
waiting for OK response to ATCN command
Definition: device.h:347
waiting for LSB of length (second byte)
Definition: device.h:310
Response from remote device to AT Command (see xbee_atcmd.c, xbee_cmd_response_t).
Definition: device.h:116
XBee is using API firmware.
Definition: device.h:342
xbee_cmd_init called
Definition: device.h:316
Send an AT command to a remote device on the network (see xbee_atcmd.c, xbee_header_at_request_t).
Definition: device.h:69
parsed Node ID in host-byte-order and fixed length fields
Definition: discovery.h:126
Over-the-Air Firmware Update Status [ZigBee, not Smart Energy].
Definition: device.h:119
xbee_dev_flags
Definition: device.h:314
int xbee_dev_reset(xbee_dev_t *xbee)
Toggles the reset line of the XBee device.
Definition: xbee_device.c:258
Send data to a default endpoint and cluster on a remote device.
Definition: device.h:61
int xbee_frame_write(xbee_dev_t *xbee, const void FAR *header, uint16_t headerlen, const void FAR *data, uint16_t datalen, uint16_t flags)
Copies a frame into the transmit serial buffer to send to an XBee module.
Definition: xbee_device.c:494
[ZigBee, DigiMesh, not Smart Energy]
Definition: device.h:112
Response from local device to AT Command (see xbee_atcmd.c, xbee_cmd_response_t). ...
Definition: device.h:80
uint8_t frame_id
last frame_id used for sending
Definition: device.h:445
< XBEE_FRAME_MODEM_STATUS (0x8A) See XBEE_MODEM_STATUS_*
Definition: device.h:548
uint8_t frame_id
if 0, match all frames of this identifier
Definition: device.h:300
[ZigBee, not Smart Energy]
Definition: device.h:109
Frame sent upon completion of a Transmit Request. [DigiMesh, ZigBee].
Definition: device.h:87
idle mode, data sent is passed to remote XBee
Definition: device.h:343
#define XBEE_END_DECLS
Macro defined to.
Definition: platform.h:42
xbee_dev_rx_state
Definition: device.h:307
uint8_t _xbee_checksum(const void FAR *bytes, uint16_t length, uint_fast8_t initial)
Calculate the checksum for an XBee frame.
Definition: xbee_device.c:424
int(* xbee_frame_handler_fn)(struct xbee_dev_t *xbee, const void FAR *frame, uint16_t length, void FAR *context)
Standard API for an XBee frame handler in xbee_frame_handlers global.
Definition: device.h:251
int bool_t
Variable that can hold 0 or 1, may be an int for speed purporses or uint8_t for size optimization...
Definition: platform_config.h:51
Structure used by the WPAN/ZigBee layers.
Definition: aps.h:390
Send data to a specific endpoint and cluster on a remote device (see xbee_wpan.c).
Definition: device.h:65
need to re-query device
Definition: device.h:320
int xbee_frame_dump_modem_status(xbee_dev_t *xbee, const void FAR *frame, uint16_t length, void FAR *context)
Frame handler for 0x8A (XBEE_FRAME_MODEM_STATUS) frames – dumps modem status to STDOUT for debugging...
Definition: xbee_device.c:960