Digi XBee(R) ANSI C Host Library
wpan.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2013 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. 11001 Bren Road East, Minnetonka, MN 55343
10  * =======================================================================
11  */
12 
20 #ifndef __XBEE_WPAN_H
21 #define __XBEE_WPAN_H
22 
23 #include "xbee/device.h"
24 #include "wpan/types.h"
25 #include "xbee/delivery_status.h"
26 
28 
31 typedef XBEE_PACKED(xbee_frame_receive_t, {
32  uint8_t frame_type;
33  addr64 ieee_address;
34  uint16_t network_address_be;
35  uint8_t options;
36  uint8_t payload[1];
38 
39 
42 typedef XBEE_PACKED(xbee_frame_receive_explicit_t, {
43  uint8_t frame_type;
44  addr64 ieee_address;
45  uint16_t network_address_be;
46  uint8_t source_endpoint;
47  uint8_t dest_endpoint;
48  uint16_t cluster_id_be;
49  uint16_t profile_id_be;
50  uint8_t options;
51  uint8_t payload[1];
53 
54 int xbee_wpan_init( xbee_dev_t *xbee,
55  const wpan_endpoint_table_entry_t *ep_table);
56 
57 #define XBEE_FRAME_HANDLE_RX_EXPLICIT \
58  { XBEE_FRAME_RECEIVE_EXPLICIT, 0, _xbee_handle_receive_explicit, NULL }
59 
60 int _xbee_handle_receive_explicit( xbee_dev_t *xbee, const void FAR *raw,
61  uint16_t length, void FAR *context);
62 
71 typedef XBEE_PACKED(xbee_header_transmit_t, {
72  uint8_t frame_type;
73  uint8_t frame_id;
74  addr64 ieee_address;
75  uint16_t network_address_be;
76  uint8_t broadcast_radius;
77  uint8_t options;
79 
82 typedef XBEE_PACKED(xbee_header_transmit_explicit_t, {
83  uint8_t frame_type;
84  uint8_t frame_id;
85  addr64 ieee_address;
86  uint16_t network_address_be;
87  uint8_t source_endpoint;
88  uint8_t dest_endpoint;
89  uint16_t cluster_id_be;
90  uint16_t profile_id_be;
91  uint8_t broadcast_radius;
92  uint8_t options;
94 
100 #define XBEE_TX_OPT_DISABLE_ACK (1<<0)
102 #define XBEE_TX_OPT_DISABLE_ROUTE_DISC (1<<1)
104 #define XBEE_TX_OPT_ENABLE_UNICAST_NACK (1<<2)
106 #define XBEE_TX_OPT_ENABLE_UNICAST_TRACE (1<<3)
108 #define XBEE_TX_OPT_SEND_ENCRYPTED (1<<4)
110 #define XBEE_TX_OPT_APS_ENCRYPT (1<<5)
112 #define XBEE_TX_OPT_EXTENDED_TIMEOUT (1<<6)
114 #define XBEE_TX_OPT_MODE_POINT_MULTIPOINT (1<<6)
116 #define XBEE_TX_OPT_MODE_REPEATER (2<<6)
118 #define XBEE_TX_OPT_MODE_DIGIMESH (3<<6)
120 
122 typedef XBEE_PACKED(xbee_frame_transmit_status_t, {
123  uint8_t frame_type;
124  uint8_t frame_id;
125  uint16_t network_address_be;
126  uint8_t retries; // # of application Tx retries
127  uint8_t delivery;
128  uint8_t discovery; // bitfield
130 
135  #define XBEE_TX_DISCOVERY_NONE 0x00
137 
139  #define XBEE_TX_DISCOVERY_ADDRESS 0x01
140 
142  #define XBEE_TX_DISCOVERY_ROUTE 0x02
143 
145  #define XBEE_TX_DISCOVERY_EXTENDED_TIMEOUT 0x40
146 
159  const void FAR *frame, uint16_t length, void FAR *context);
160 
161 #define XBEE_FRAME_HANDLE_TRANSMIT_STATUS \
162  { XBEE_FRAME_TRANSMIT_STATUS, 0, _xbee_handle_transmit_status, NULL }
163 
175  const void FAR *frame, uint16_t length, void FAR *context);
176 
181 #define XBEE_FRAME_TRANSMIT_STATUS_DEBUG \
182  { XBEE_FRAME_TRANSMIT_STATUS, 0, xbee_frame_dump_transmit_status, NULL }
183 
185 
186 // If compiling in Dynamic C, automatically #use the appropriate C file.
187 #ifdef __DC__
188  #use "xbee_wpan.c"
189 #endif
190 
191 #endif
192 
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
#define XBEE_BEGIN_DECLS
Macro defined to.
Definition: platform.h:41
int _xbee_handle_transmit_status(xbee_dev_t *xbee, const void FAR *frame, uint16_t length, void FAR *context)
Definition: xbee_wpan.c:203
Format of XBee API frame type 0x91 (XBEE_FRAME_RECEIVE_EXPLICIT); received from XBee by host...
Definition: wpan.h:52
< XBEE_FRAME_TRANSMIT_STATUS (0x8B)
Definition: wpan.h:129
Format of XBee API frame type 0x11 (XBEE_FRAME_TRANSMIT_EXPLICIT); sent from host to XBee...
Definition: wpan.h:93
unsigned short uint16_t
16-bit unsigned integer
Definition: platform_config.h:41
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.
Definition: xbee_wpan.c:182
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 deb...
Definition: xbee_wpan.c:220
unsigned char uint8_t
8-bit unsigned integer
Definition: platform_config.h:39
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 furth...
Definition: xbee_wpan.c:54
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
Definition: device.h:361
Format of XBee API frame type 0x10 (XBEE_FRAME_TRANSMIT); sent from host to XBee. ...
Definition: wpan.h:78
#define XBEE_END_DECLS
Macro defined to.
Definition: platform.h:42
Information on each endpoint on this device.
Definition: aps.h:252
Format of XBee API frame type 0x90 (XBEE_FRAME_RECEIVE); received from XBee by host.
Definition: wpan.h:37