XBee Firmware Library  1.6.0
Files | Data Structures | Typedefs | Functions | Variables
Node Discovery

Files

file  discovery.h
 
file  xbee_discovery.c
 

Data Structures

struct  xbee_node_id_t
 parsed Node ID in host-byte-order and fixed length fields More...
 

Typedefs

typedef PACKED_STRUCT xbee_frame_node_id_t
 format of 0x95 frames received from XBee More...
 
typedef PACKED_STRUCT xbee_node_id1_t
 ATMY value [0xFFFE on DigiMesh]. More...
 
typedef PACKED_STRUCT xbee_node_id2_t
 ATMP value [0xFFFE on DigiMesh]. More...
 
typedef struct xbee_node_id_t xbee_node_id_t
 parsed Node ID in host-byte-order and fixed length fields More...
 

Functions

int _xbee_disc_parse_and_pass (xbee_dev_t *xbee, const void FAR *node_data, int length)
 
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. More...
 
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 ID handlers. More...
 
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 Node ID message. More...
 
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 identification" (ATNI) string. More...
 
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. More...
 
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. More...
 
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 ATAO != 0. More...
 
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. More...
 
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. More...
 

Variables

uint32_t device_id_be
 ATDD of remote device [optional field enabled with ATNO on DigiMesh]. More...
 
uint8_t device_type
 one of XBEE_ND_DEVICE_* macro values More...
 
uint8_t device_type
 one of XBEE_ND_DEVICE_TYPE_COORD, _ROUTER or _ENDDEV More...
 
addr64 ieee_addr_be
 
addr64 ieee_addr_be
 ATSH and ATSL. More...
 
addr64 ieee_address_be
 
uint16_t manufacturer_be
 Manufacturer ID (0x101E) More...
 
uint16_t network_addr
 ATMY value. More...
 
uint16_t network_address_be
 
xbee_node_id1_t node_data
 variable-length data, parsed with xbee_disc_nd_parse() More...
 
char node_info [XBEE_DISC_MAX_NODEID_LEN+1]
 null-terminated ATNI value (variable length) More...
 
char node_info [XBEE_DISC_MAX_NODEID_LEN+1]
 ATNI value (variable length, null-terminated) More...
 
uint8_t options
 
uint16_t parent_addr
 
uint16_t profile_be
 Digi Profile ID (0xC105) More...
 
uint8_t rssi
 RSSI of packet [optional field enabled with ATNO on DigiMesh]. More...
 
uint8_t source_event
 event that generated the ND frame More...
 

Detailed Description

This layer manages ATND responses and 0x95 frames related to proprietary (XBee-only) node discovery methods used in ZigBee firmware (not supported in Smart Energy firmware builds).

Typedef Documentation

Initial value:
{
uint8_t frame_type
unsigned char uint8_t
A unsigned char variable 8 bits.
Definition: types.h:43

format of 0x95 frames received from XBee

XBEE_FRAME_NODE_ID (0x95)

Initial value:
{
uint16_t network_addr_be
unsigned int uint16_t
An unsigned integer variable 16 bits.
Definition: types.h:46

ATMY value [0xFFFE on DigiMesh].

Initial value:
{
uint16_t parent_addr_be
unsigned int uint16_t
An unsigned integer variable 16 bits.
Definition: types.h:46

ATMP value [0xFFFE on DigiMesh].

parsed Node ID in host-byte-order and fixed length fields

Function Documentation

int _xbee_disc_parse_and_pass ( xbee_dev_t xbee,
const void FAR *  node_data,
int  length 
)
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.

Parameters
[in]xbeeXBee device to monitor
[in]fnfunction to receive parsed Node ID messages
Return values
0function assigned
-EINVALinvalid parameter passed to function
-ENOSPCcan't assign handler to device
See also
xbee_disc_remove_node_id_handler
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 ID handlers.

This function parses the frame and then passes an xbee_node_id_t structure on to Node ID handlers configured with xbee_disc_add_node_id_handler(). If the ATND command fails or returns a timeout, it passes a NULL xbee_node_id_t to the functions.

Do not call this function directly, it should be included in the XBee Frame Handlers table by using the macro XBEE_FRAME_HANDLE_ATND_RESPONSE.

See the function help for xbee_frame_handler_fn() for full documentation on this function's API.

See also
XBEE_FRAME_HANDLE_ATND_RESPONSE, xbee_disc_nodeid_frame_handler, xbee_disc_nodeid_cluster_handler
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 Node ID message.

Parameters
[in]device_typethe device_type field from a Node ID message
Returns
pointer to a string describing the type, or "???" if device_type is invalid
See also
xbee_node_id_t
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 identification" (ATNI) string.

Responses from remote nodes are parsed and then passed on to Node ID handlers configured with xbee_disc_add_node_id_handler().

Parameters
[in]xbeeXBee device to use as the target
[in]identifierthe ATNI (node identification) string of a device on the network, or NULL to discover all devices
Return values
0command sent
-EINVALan invalid parameter was passed to the function
-EBUSYtransmit serial buffer is full, or XBee is not accepting serial data (deasserting /CTS signal).
See also
xbee_disc_add_node_id_handler, xbee_disc_remove_node_id_handler
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.

Parameters
[out]parsedbuffer to hold parsed Node ID message
[in]sourcesource of Node ID message, starting with the 16-bit network address
[in]source_lengthnumber of bytes in source of Node ID message
Return values
0Node ID message parsed and stored in /a parsed
-EINVALinvalid parameter passed to function
-EBADMSGerror parsing Node ID message
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.

Parameters
[in]nipointer to an xbee_node_id_t structure
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 ATAO != 0.

This function parses the frame and then passes an xbee_node_id_t structure on to Node ID handlers configured with xbee_disc_add_node_id_handler().

Do not call this function directly, it should be included in the Cluster table of the Digi Data endpoint by using the macro XBEE_DISC_DIGI_DATA_CLUSTER_ENTRY.

Hosts communicating to XBee modules running with ATAO set to zero do not need to use this handler.

See the function help for wpan_aps_handler_fn() for full documentation on this function's API.

See also
XBEE_DISC_DIGI_DATA_CLUSTER_ENTRY, xbee_disc_nodeid_frame_handler, xbee_disc_atnd_response_handler
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.

These frames are sent to the host when ATAO is set to 0 and a remote node:

  • Has ATD0 set to 1, and someone presses the commissioning button once.
  • Has ATJN set to 1, and has joined the network.

This function parses a the frame and then passes an xbee_node_id_t structure on to Node ID handlers configured with xbee_disc_add_node_id_handler().

Do not call this function directly, it should be included in the XBee Frame Handlers table by using the macro XBEE_FRAME_HANDLE_AO0_NODEID. Hosts communicating to XBee modules running with ATAO set to a non-zero value do not need to use this handler.

See the function help for xbee_frame_handler_fn() for full documentation on this function's API.

See also
xbee_disc_nodeid_cluster_handler, xbee_disc_atnd_response_handler
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.

Parameters
[in]xbeeXBee device to monitor
[in]fnfunction to receive parsed Node ID messages
Return values
0function removed
-EINVALinvalid parameter passed to function
-ENOENTfunction isn't assigned to this XBee module
See also
xbee_disc_remove_node_id_handler

Variable Documentation

uint32_t device_id_be

ATDD of remote device [optional field enabled with ATNO on DigiMesh].

uint8_t device_type

one of XBEE_ND_DEVICE_* macro values

uint8_t device_type

one of XBEE_ND_DEVICE_TYPE_COORD, _ROUTER or _ENDDEV

addr64 ieee_addr_be

ATSH and ATSL

addr64 ieee_addr_be

ATSH and ATSL.

addr64 ieee_address_be
uint16_t manufacturer_be

Manufacturer ID (0x101E)

uint16_t network_addr

ATMY value.

uint16_t network_address_be
xbee_node_id1_t node_data

variable-length data, parsed with xbee_disc_nd_parse()

char node_info[XBEE_DISC_MAX_NODEID_LEN+1]

null-terminated ATNI value (variable length)

char node_info[XBEE_DISC_MAX_NODEID_LEN+1]

ATNI value (variable length, null-terminated)

uint8_t options
uint16_t parent_addr

ATMP

uint16_t profile_be

Digi Profile ID (0xC105)

uint8_t rssi

RSSI of packet [optional field enabled with ATNO on DigiMesh].

uint8_t source_event

event that generated the ND frame