Digi XBee(R) ANSI C Host Library
Files | Data Structures | Macros | Functions
WPAN API implementation for XBee Device

Files

file  wpan.h
 
file  xbee_wpan.c
 Glue layer between XBee-specific code and general WPAN layer.
 

Data Structures

struct  xbee_frame_receive_t
 Format of XBee API frame type 0x90 (XBEE_FRAME_RECEIVE); received from XBee by host. More...
 
struct  xbee_frame_receive_explicit_t
 Format of XBee API frame type 0x91 (XBEE_FRAME_RECEIVE_EXPLICIT); received from XBee by host. More...
 
struct  xbee_header_transmit_t
 Format of XBee API frame type 0x10 (XBEE_FRAME_TRANSMIT); sent from host to XBee. More...
 
struct  xbee_header_transmit_explicit_t
 Format of XBee API frame type 0x11 (XBEE_FRAME_TRANSMIT_EXPLICIT); sent from host to XBee. More...
 
struct  xbee_frame_transmit_status_t
 < XBEE_FRAME_TRANSMIT_STATUS (0x8B) More...
 

Macros

#define XBEE_FRAME_HANDLE_RX_EXPLICIT   { XBEE_FRAME_RECEIVE_EXPLICIT, 0, _xbee_handle_receive_explicit, NULL }
 
#define XBEE_FRAME_HANDLE_TRANSMIT_STATUS   { XBEE_FRAME_TRANSMIT_STATUS, 0, _xbee_handle_transmit_status, NULL }
 
#define XBEE_FRAME_TRANSMIT_STATUS_DEBUG   { XBEE_FRAME_TRANSMIT_STATUS, 0, xbee_frame_dump_transmit_status, NULL }
 Add this macro to the list of XBee frame handlers to have transmit status frames dumped to STDOUT.
 
#define xbee_wpan_debug
 

Functions

int xbee_wpan_init (xbee_dev_t *xbee, const wpan_endpoint_table_entry_t *ep_table)
 Configure xbee_dev_t for APS-layer (endpoint/cluster) networking. More...
 
int _xbee_handle_receive_explicit (xbee_dev_t *xbee, const void FAR *raw, uint16_t length, void FAR *context)
 Process XBee "Receive Explicit" frames (type 0x91) and hand off to wpan_envelope_dispatch() for further processing. More...
 
int _xbee_handle_transmit_status (xbee_dev_t *xbee, const void FAR *frame, uint16_t length, void FAR *context)
 
int xbee_frame_dump_transmit_status (xbee_dev_t *xbee, const void FAR *frame, uint16_t length, void FAR *context)
 Frame handler for 0x8B (XBEE_FRAME_TRANSMIT_STATUS) frames – dumps transmit status to STDOUT for debugging purposes. More...
 
int _xbee_endpoint_send (const wpan_envelope_t FAR *envelope, uint16_t flags)
 
int _xbee_wpan_tick (wpan_dev_t *dev)
 

XBEE_TX_OPT_*

Options for options field of xbee_header_transmit_t and xbee_header_transmit_explicit_t.

#define XBEE_TX_OPT_DISABLE_ACK   (1<<0)
 XBee Transmit Option: Disable ACK [ZigBee and DigiMesh].
 
#define XBEE_TX_OPT_DISABLE_ROUTE_DISC   (1<<1)
 XBee Transmit Option: Disable Route Discovery [DigiMesh].
 
#define XBEE_TX_OPT_ENABLE_UNICAST_NACK   (1<<2)
 XBee Transmit Option: Enable Unicast NACK messages [DigiMesh].
 
#define XBEE_TX_OPT_ENABLE_UNICAST_TRACE   (1<<3)
 XBee Transmit Option: Enable Unicast Trace Route messages [DigiMesh].
 
#define XBEE_TX_OPT_SEND_ENCRYPTED   (1<<4)
 XBee Transmit Option: Send encrypted (over Secure Session) [XBee3].
 
#define XBEE_TX_OPT_APS_ENCRYPT   (1<<5)
 XBee Transmit Option: Enable APS encryption (if EE=1) [ZigBee].
 
#define XBEE_TX_OPT_EXTENDED_TIMEOUT   (1<<6)
 XBee Transmit Option: Use extended timeout for this destination. [ZigBee].
 
#define XBEE_TX_OPT_MODE_POINT_MULTIPOINT   (1<<6)
 XBee Transmit Option: Point-Multipoint [DigiMesh].
 
#define XBEE_TX_OPT_MODE_REPEATER   (2<<6)
 XBee Transmit Option: Repeater mode (directed broadcast) [DigiMesh].
 
#define XBEE_TX_OPT_MODE_DIGIMESH   (3<<6)
 XBee Transmit Option: DigiMesh (not available on 10k product) [DigiMesh].
 

XBEE_TX_DISCOVERY_*

Values for discovery member of xbee_frame_transmit_status_t.

#define XBEE_TX_DISCOVERY_NONE   0x00
 XBee Transmit Discovery Status: No Discovery Overhead [ZigBee, DigiMesh].
 
#define XBEE_TX_DISCOVERY_ADDRESS   0x01
 XBee Transmit Discovery Status: Address Discovery [ZigBee].
 
#define XBEE_TX_DISCOVERY_ROUTE   0x02
 XBee Transmit Discovery Status: Route Discovery [ZigBee, DigiMesh].
 
#define XBEE_TX_DISCOVERY_EXTENDED_TIMEOUT   0x40
 XBee Transmit Discovery Status: Extended Timeout Discovery [ZigBee].
 

Detailed Description

Function Documentation

int _xbee_endpoint_send ( const wpan_envelope_t FAR envelope,
uint16_t  flags 
)

Sends data to an endpoint/profile/cluster on a remote WPAN node. See wpan_endpoint_send_fn() for parameters and return values.

User code should use wpan_envelope_send() instead of calling this function directly.

References htobe16, WPAN_SEND_FLAG_ENCRYPTED, XBEE_FRAME_TRANSMIT_EXPLICIT, xbee_frame_write(), xbee_next_frame_id(), and XBEE_TX_OPT_APS_ENCRYPT.

Referenced by _xbee_handle_receive_explicit(), and xbee_wpan_init().

int _xbee_handle_receive_explicit ( xbee_dev_t xbee,
const void FAR raw,
uint16_t  length,
void FAR context 
)
int _xbee_handle_transmit_status ( xbee_dev_t xbee,
const void FAR frame,
uint16_t  length,
void FAR context 
)

Dummy frame handler for 0x8B (XBEE_FRAME_TRANSMIT_STATUS) frames. Placeholder until we integrate processing of those frames into the stack.

See also
xbee_frame_handler_fn()
Todo:
Figure out what needs to happen with these frames. Does atcmd layer need to pass errors down to callbacks? Registered endpoints? Tracked conversations?

References XBEE_UNUSED_PARAMETER.

int _xbee_wpan_tick ( wpan_dev_t dev)

Simple stub function for the wpan_dev_t object to map the generic "tick wpan_dev_t" call into a "tick xbee_dev_t" call.

Note that this works because the xbee_dev_t structure starts with a wpan_dev_t structure, so the wpan_dev_t address is the same as the xbee_dev_t address.

See wpan_tick_fn() for parameters and return value.

References xbee_dev_tick().

Referenced by xbee_wpan_init().

int xbee_frame_dump_transmit_status ( xbee_dev_t xbee,
const void FAR frame,
uint16_t  length,
void FAR context 
)

Frame handler for 0x8B (XBEE_FRAME_TRANSMIT_STATUS) frames – dumps transmit status to STDOUT for debugging purposes.

View the documentation of xbee_frame_handler_fn() for this function's parameters and return value.

See also
XBEE_FRAME_TRANSMIT_STATUS_DEBUG, xbee_frame_handler_fn()

References be16toh, FAR, and XBEE_UNUSED_PARAMETER.

int xbee_wpan_init ( xbee_dev_t xbee,
const wpan_endpoint_table_entry_t ep_table 
)

Configure xbee_dev_t for APS-layer (endpoint/cluster) networking.

If using this layer, be sure to call wpan_tick (instead of xbee_dev_tick) so it can manage the APS layers of the network stack.

Parameters
[in,out]xbeedevice to configure
[in]ep_tablepointer to an endpoint table to use with device
Return values
0success
-EINVALinvalid parameter passed to function

References _xbee_endpoint_send(), _xbee_wpan_tick(), EINVAL, wpan_dev_t::endpoint_send, wpan_dev_t::endpoint_table, wpan_dev_t::tick, and xbee_dev_t::wpan_dev.

Referenced by _sxa_io_process_response().