70 #ifndef XBEE_DISCOVERY_H 71 #define XBEE_DISCOVERY_H 80 #define XBEE_DISC_MAX_NODEID_LEN 20 94 #define XBEE_ND_DEVICE_TYPE_COORD 0 95 #define XBEE_ND_DEVICE_TYPE_ROUTER 1 96 #define XBEE_ND_DEVICE_TYPE_ENDDEV 2 99 #define XBEE_ND_SOURCE_EVENT_NONE 0 100 #define XBEE_ND_SOURCE_EVENT_PUSHBUTTON 1 101 #define XBEE_ND_SOURCE_EVENT_JOINED 2 102 #define XBEE_ND_SOURCE_EVENT_POWER_CYCLE 3 200 #define XBEE_DISC_DIGI_DATA_CLUSTER_ENTRY \ 201 { DIGI_CLUST_NODEID_MESSAGE, xbee_disc_nodeid_cluster_handler, NULL, \ 202 WPAN_CLUST_FLAG_INPUT | WPAN_CLUST_FLAG_NOT_ZCL} 226 #define XBEE_FRAME_HANDLE_ATND_RESPONSE \ 227 { XBEE_FRAME_LOCAL_AT_RESPONSE, 0, xbee_disc_atnd_response_handler, NULL } 255 #define XBEE_FRAME_HANDLE_AO0_NODEID \ 256 { XBEE_FRAME_NODE_ID, 0, xbee_disc_nodeid_frame_handler, NULL } 312 #use "xbee_discovery.c" unsigned long uint32_t
32-bit unsigned integer
Definition: platform_config.h:43
WPAN datatypes and support functions, valid for ZigBee and DigiMesh.
#define FAR
On platforms with "far" pointers, define to the proper keyword; empty definition if not required...
Definition: platform.h:396
uint16_t parent_addr
ATMP.
Definition: discovery.h:129
#define XBEE_BEGIN_DECLS
Macro defined to.
Definition: platform.h:41
int xbee_disc_remove_node_id_handler(xbee_dev_t *xbee, xbee_disc_node_id_fn fn)
Remove a function registered to receive parsed Node ID messages on a given XBee device.
Definition: xbee_discovery.c:142
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
int xbee_disc_nodeid_cluster_handler(const wpan_envelope_t FAR *envelope, void FAR *context)
Process messages sent to the Node ID Message cluster (0x0095) of the Digi Data endpoint (0xE8) when A...
Definition: xbee_discovery.c:200
char node_info[XBEE_DISC_MAX_NODEID_LEN+1]
ATNI value (variable length, null-terminated)
Definition: discovery.h:133
format of 0x95 frames received from XBee
Definition: discovery.h:123
int xbee_disc_nd_parse(xbee_node_id_t FAR *parsed, const void FAR *source, int source_length)
Parse a Node Discovery response and store it in an xbee_node_id_t structure.
Definition: xbee_discovery.c:39
void xbee_disc_node_id_dump(const xbee_node_id_t FAR *ni)
Debugging function used to dump an xbee_node_id_t structure to stdout.
Definition: xbee_discovery.c:105
int xbee_disc_discover_nodes(xbee_dev_t *xbee, const char *identifier)
Send an ATND command to the XBee, initiating node discovery for all nodes or a specific node's "node ...
Definition: xbee_discovery.c:280
int xbee_disc_add_node_id_handler(xbee_dev_t *xbee, xbee_disc_node_id_fn fn)
Designate a function to receive parsed Node ID messages on a given XBee device.
Definition: xbee_discovery.c:122
int xbee_disc_atnd_response_handler(xbee_dev_t *xbee, const void FAR *raw, uint16_t length, void FAR *context)
Process AT Command Response frames (type 0x88), looking for ATND responses to parse and pass to Node ...
Definition: xbee_discovery.c:220
#define XBEE_DISC_MAX_NODEID_LEN
Maximum length of a Node ID string (ATNI value) (excludes null terminator).
Definition: discovery.h:80
int xbee_disc_nodeid_frame_handler(xbee_dev_t *xbee, const void FAR *raw, uint16_t length, void FAR *context)
Process Node Identification frames (type 0x95), sent when ATAO = 0.
Definition: xbee_discovery.c:260
unsigned short uint16_t
16-bit unsigned integer
Definition: platform_config.h:41
addr64 ieee_addr_be
ATSH and ATSL.
Definition: discovery.h:127
unsigned char uint8_t
8-bit unsigned integer
Definition: platform_config.h:39
< ATMP value [0xFFFE on DigiMesh]
Definition: discovery.h:112
parsed Node ID in host-byte-order and fixed length fields
Definition: discovery.h:126
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
uint16_t network_addr
ATMY value.
Definition: discovery.h:128
uint8_t device_type
one of XBEE_ND_DEVICE_TYPE_COORD, _ROUTER or _ENDDEV
Definition: discovery.h:131
#define XBEE_END_DECLS
Macro defined to.
Definition: platform.h:42
const char * xbee_disc_device_type_str(uint8_t device_type)
Return a string ("Coord", "Router", "EndDev", or "???") description for the "Device Type" field of a ...
Definition: xbee_discovery.c:89
The "envelope" is used to gather all necessary information about a given frame on the network...
Definition: aps.h:40
< ATMY value [0xFFFE on DigiMesh] ATSH and ATSL null-terminated ATNI value (variable length) ...
Definition: discovery.h:87