Digi XBee(R) ANSI C Host Library
Data Structures | Macros | Typedefs | Enumerations | Functions

Cluster/Endpoint layer for WPAN networks (ZigBee and DigiMesh). More...

#include "wpan/types.h"

Go to the source code of this file.

Data Structures

struct  wpan_envelope_t
 The "envelope" is used to gather all necessary information about a given frame on the network. More...
 
struct  wpan_cluster_table_entry_t
 Information on each cluster associated with an endpoint. More...
 
struct  wpan_endpoint_table_entry_t
 Information on each endpoint on this device. More...
 
struct  wpan_dev_t
 Structure used by the WPAN/ZigBee layers. More...
 
struct  wpan_conversation_t
 Used to track conversations (outstanding requests) on an endpoint. More...
 
struct  wpan_ep_state_t
 Volatile part of an endpoint record used to track conversations (requests waiting for responses). More...
 

Macros

#define WPAN_ENVELOPE_CLUSTER_FLAGS   0x00FF
 mask of WPAN_CLUST_FLAG_* flags for the cluster tied to this envelope
 
#define WPAN_ENVELOPE_BROADCAST_ADDR   0x0100
 frame was received on a broadcast address
 
#define WPAN_ENVELOPE_BROADCAST_EP   0x0200
 frame was received on the broadcast endpoint (0xFF)
 
#define WPAN_ENVELOPE_RX_APS_ENCRYPT   0x0400
 frame was received with APS encryption
 
#define WPAN_CLUSTER_END_OF_LIST   0xFFFF
 Cluster ID used to mark the end of cluster_table in wpan_endpoint_table_entry_t. More...
 
#define WPAN_CLUST_ENTRY_LIST_END   { WPAN_CLUSTER_END_OF_LIST }
 Macro for a wpan_cluster_table_entry_t that can be used to mark the end of the table. More...
 
#define WPAN_FLAG_NONE   0x0000
 
#define WPAN_FLAG_JOINED   0x0001
 device has joined a network (but not necessarily authenticated)
 
#define WPAN_FLAG_AUTHENTICATED   0x0002
 device completed Key Establishment and can send APS encrypted frames
 
#define WPAN_FLAG_AUTHENTICATION_ENABLED   0x0004
 device has encryption enabled (EO non-zero)
 
#define WPAN_DEV_IS_JOINED(dev)   ((dev)->flags & WPAN_FLAG_JOINED)
 Macro to test whether a device has joined the network. More...
 
#define WPAN_DEV_IS_AUTHENTICATED(dev)   ((dev)->flags & WPAN_FLAG_AUTHENTICATED)
 Macro to test whether a device has authenticated with the trust center. More...
 
#define WPAN_ENDPOINT_END_OF_LIST   0xFF
 Endpoint ID used to mark the end of endpoint_table in wpan_dev_t.
 
#define WPAN_ENDPOINT_TABLE_END   { WPAN_ENDPOINT_END_OF_LIST }
 Macro for a wpan_endpoint_table_entry_t that can be used to mark the end of the table. More...
 
#define WPAN_APS_PROFILE_ANY   0xFFFF
 
#define WPAN_CONVERSATION_END   1
 end of conversation, no more responses expected
 
#define WPAN_CONVERSATION_CONTINUE   2
 leave conversation open, more responses are expected
 
#define WPAN_MAX_CONVERSATIONS   3
 Number of outstanding requests to track in a wpan_ep_state_t associated with an endpoint. More...
 
#define WPAN_CONVERSATION_TIMEOUT   30
 Default conversation recycle timeout (seconds)
 

Typedefs

typedef int(* wpan_aps_handler_fn) (const wpan_envelope_t FAR *envelope, void FAR *context)
 General handler used in the cluster table. More...
 
typedef int(* wpan_ep_handler_fn) (const wpan_envelope_t FAR *envelope, struct wpan_ep_state_t FAR *ep_state)
 General handler used in the endpoint table. More...
 
typedef int(* wpan_endpoint_send_fn) (const wpan_envelope_t FAR *envelope, uint16_t flags)
 Function called by the WPAN APS layer to send a frame out on the network. More...
 
typedef int(* _wpan_config_fn) (struct wpan_dev_t *dev,...)
 Function called by the WPAN APS layer to configure the underlying network device. More...
 
typedef int(* wpan_tick_fn) (struct wpan_dev_t *dev)
 Function called by the WPAN APS layer to have the underlying device read and dispatch frames. More...
 
typedef const wpan_endpoint_table_entry_t *(* wpan_endpoint_get_next_fn) (struct wpan_dev_t *dev, const wpan_endpoint_table_entry_t *ep)
 Custom function for walking the endpoint table. More...
 
typedef int(* wpan_response_fn) (struct wpan_conversation_t FAR *conversation, const wpan_envelope_t FAR *envelope)
 Handler registered with wpan_conversation_register() to process responses to outstanding requests. More...
 

Enumerations

enum  wpan_clust_digi {
  DIGI_CLUST_SLEEP_SYNC = 0x0009, DIGI_CLUST_SERIAL = 0x0011, DIGI_CLUST_LOOPBACK = 0x0012, DIGI_CLUST_ND_COMMAND = 0x0015,
  DIGI_CLUST_DN_COMMAND = 0x0016, DIGI_CLUST_REMOTE_COMMAND = 0x0021, DIGI_CLUST_NR_COMMAND = 0x0022, DIGI_CLUST_IODATA = 0x0092,
  DIGI_CLUST_WATCHPORT = 0x0094, DIGI_CLUST_NODEID_MESSAGE = 0x0095, DIGI_CLUST_DN_RESPONSE = 0x0096, DIGI_CLUST_REMOTE_RESPONSE = 0x00A1,
  DIGI_CLUST_NR_RESPONSE = 0x00A2, DIGI_CLUST_INDIRECT_ROUTE_ERR = 0x00B0, DIGI_CLUST_PROG_XBEE_OTA_UPD = 0x1000, DIGI_CLUST_NBRFWUPDATE = 0x71FE,
  DIGI_CLUST_REMFWUPDATE = 0x71FF, DIGI_CLUST_FWUPDATERESP = (int)0xF1FF
}
 Digi Data cluster IDs (endpoint WPAN_ENDPOINT_DIGI_DATA) More...
 

Functions

int wpan_tick (wpan_dev_t *dev)
 Calls the underlying hardware tick function to process received frames, and times out expired conversations. More...
 
const wpan_cluster_table_entry_twpan_cluster_match (uint16_t match, uint8_t mask, const wpan_cluster_table_entry_t *entry)
 Search a cluster table for a matching cluster ID. More...
 
const wpan_endpoint_table_entry_twpan_endpoint_get_next (wpan_dev_t *dev, const wpan_endpoint_table_entry_t *ep)
 Function used to walk a device's endpoint table. More...
 
const wpan_endpoint_table_entry_twpan_endpoint_match (wpan_dev_t *dev, uint8_t endpoint, uint16_t profile_id)
 Walk a device's endpoint table looking for a matching endpoint ID and profile ID. More...
 
const wpan_endpoint_table_entry_twpan_endpoint_of_envelope (const wpan_envelope_t *env)
 Look up the endpoint table entry for the source endpoint of an envelope. More...
 
const wpan_endpoint_table_entry_twpan_endpoint_of_cluster (wpan_dev_t *dev, uint16_t profile_id, uint16_t cluster_id, uint8_t mask)
 Walk a device's endpoint table looking for a matching profile ID and cluster ID. More...
 
void wpan_envelope_create (wpan_envelope_t *envelope, wpan_dev_t *dev, const addr64 FAR *ieee, uint16_t network_addr)
 Starting with a blank envelope, fill in the device, 64-bit IEEE address and 16-bit network address of the destination. More...
 
int wpan_envelope_reply (wpan_envelope_t FAR *reply, const wpan_envelope_t FAR *original)
 Create a reply envelope based on the envelope received from a remote node. More...
 
int wpan_envelope_send (const wpan_envelope_t FAR *envelope)
 Send a message to an endpoint using address and payload information stored in a wpan_envelope_t structure. More...
 
void wpan_envelope_dump (const wpan_envelope_t FAR *envelope)
 Debugging function to dump the contents of an envelope to stdout. More...
 
int wpan_conversation_register (wpan_ep_state_t FAR *state, wpan_response_fn handler, const void FAR *context, uint16_t timeout)
 Add a conversation to the table of tracked conversations. More...
 
int wpan_conversation_response (wpan_ep_state_t FAR *state, uint8_t transaction_id, const wpan_envelope_t FAR *envelope)
 Searches the endpoint's table of active conversations (outstanding requests waiting for responses) for a given transaction. More...
 
uint8_t wpan_endpoint_next_trans (const wpan_endpoint_table_entry_t *ep)
 Increment and return the endpoint's transaction ID counter. More...
 
int wpan_envelope_dispatch (wpan_envelope_t *envelope)
 Find the matching endpoint for the provided envelope and have it process the frame. More...
 
void wpan_conversation_delete (wpan_conversation_t FAR *conversation)
 Delete a conversation from an endpoint's conversation table. More...
 

ZigBee Stack Profile IDs (WPAN_STACK_PROFILE_*)

4-bit values used in ZigBee beacons

#define WPAN_STACK_PROFILE_PROPRIETARY   0x0
 Network Specific.
 
#define WPAN_STACK_PROFILE_ZIGBEE   0x1
 ZigBee (2006)
 
#define WPAN_STACK_PROFILE_ZIGBEE_PRO   0x2
 ZigBee PRO (2007)
 

Profile IDs

#define WPAN_PROFILE_ZDO   0x0000
 ZigBee Device Object (aka ZigBee Device Profile)
 
#define WPAN_PROFILE_SMART_ENERGY   0x0109
 Smart Energy Profile.
 
#define WPAN_PROFILE_DIGI   0xC105
 Digi International, mfg-specific.
 

Manufacturer IDs (WPAN_MANUFACTURER_*)

Contact the ZigBee Alliance to have a Manufacturer ID assigned to your company.

DO NOT use the Digi Manufacturer ID for your own manufacturer-specific profiles/clusters/attributes.

#define WPAN_MANUFACTURER_DIGI   0x101E
 Digi International (MaxStream)
 
#define WPAN_MANUFACTURER_DIGI2   0x1087
 Digi International.
 
#define WPAN_MANUFACTURER_TEST1   0xFFF1
 Test Vendor #1.
 
#define WPAN_MANUFACTURER_TEST2   0xFFF2
 Test Vendor #2.
 
#define WPAN_MANUFACTURER_TEST3   0xFFF3
 Test Vendor #3.
 

List of fixed endpoints (WPAN_ENDPOINT_*)

#define WPAN_ENDPOINT_ZDO   0x00
 ZigBee Device Object/Profile.
 
#define WPAN_ENDPOINT_DIGI_SE   0x5E
 Digi Smart Energy.
 
#define WPAN_ENDPOINT_DDO   0xE6
 Digi Device Objects.
 
#define WPAN_ENDPOINT_DIGI_DEVICE   WPAN_ENDPOINT_DDO
 
#define WPAN_ENDPOINT_DIGI_DATA   0xE8
 Digi Data.
 
#define WPAN_ENDPOINT_BROADCAST   0xFF
 Broadcast Endpoint.
 

WPAN_CLUST_FLAG_*

Values for flags field of wpan_cluster_table_entry_t.

#define WPAN_CLUST_FLAG_NONE   0x00
 no flags
 
#define WPAN_CLUST_FLAG_INPUT   0x01
 input/server cluster (typically receives requests)
 
#define WPAN_CLUST_FLAG_OUTPUT   0x02
 output/client cluster (typically receives responses)
 
#define WPAN_CLUST_FLAG_INOUT   0x03
 both client and server cluster
 
#define WPAN_CLUST_FLAG_SERVER   WPAN_CLUST_FLAG_INPUT
 alias name for input cluster (uses ZCL terminology)
 
#define WPAN_CLUST_FLAG_CLIENT   WPAN_CLUST_FLAG_OUTPUT
 alias name for output cluster (uses ZCL terminology)
 
#define WPAN_CLUST_FLAG_ENCRYPT   0x10
 Data sent or received by this cluster must be encrypted. More...
 
#define WPAN_CLUST_FLAG_ENCRYPT_UNICAST   0x20
 Unicast data sent or received by this cluster must be encrypted, but unencrypted broadcast frames are OK. More...
 
#define WPAN_CLUST_FLAG_NOT_ZCL   0x80
 this cluster is NOT using the ZigBee Cluster Library (ZCL)
 

WPAN_SEND_FLAG_*

Bitfields for flags parameter to a wpan_endpoint_send_fn().

#define WPAN_SEND_FLAG_NONE   0x0000
 no special behavior
 
#define WPAN_SEND_FLAG_ENCRYPTED   0x0001
 use APS layer encryption
 

Detailed Description

Cluster/Endpoint layer for WPAN networks (ZigBee and DigiMesh).