XBee Firmware Library  1.6.0
Files | Data Structures | Typedefs | Enumerations | Enumerator | Functions | Variables

Files

file  aps.h
 
file  wpan_aps.c
 

Data Structures

struct  wpan_cluster_table_entry_t
 Information on each cluster associated with an endpoint. More...
 
struct  wpan_conversation_t
 Used to track conversations (outstanding requests) on an endpoint. More...
 
struct  wpan_dev_t
 
struct  wpan_endpoint_table_entry_t
 Information on each endpoint on this device. More...
 
struct  wpan_envelope_t
 
struct  wpan_ep_state_t
 

Typedefs

typedef int(* _wpan_config_fn) (struct wpan_dev_t *dev,...)
 
typedef int(* wpan_aps_handler_fn) (const wpan_envelope_t FAR *envelope, void FAR *context)
 General handler used in the cluster table. More...
 
typedef struct wpan_cluster_table_entry_t wpan_cluster_table_entry_t
 Information on each cluster associated with an endpoint. More...
 
typedef struct wpan_conversation_t wpan_conversation_t
 Used to track conversations (outstanding requests) on an endpoint. More...
 
typedef struct wpan_dev_t wpan_dev_t
 
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_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 struct wpan_endpoint_table_entry_t wpan_endpoint_table_entry_t
 Information on each endpoint on this device. More...
 
typedef XBEE_BEGIN_DECLS struct wpan_envelope_t wpan_envelope_t
 
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 struct wpan_ep_state_t wpan_ep_state_t
 
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...
 
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...
 

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

wpan_aps_debug int _wpan_endpoint_dispatch (wpan_envelope_t *envelope, const wpan_endpoint_table_entry_t *ep)
 
void _wpan_endpoint_expire_conversations (wpan_ep_state_t FAR *state)
 
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...
 
void wpan_conversation_delete (wpan_conversation_t FAR *conversation)
 Delete a conversation from an endpoint's conversation table. 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...
 
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...
 
uint8_t wpan_endpoint_next_trans (const wpan_endpoint_table_entry_t *ep)
 Increment and return the endpoint's transaction ID counter. 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...
 
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...
 
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. The profile ID, cluster ID, source/destination endpoints and envelope options are all be set to zero. 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_envelope_dump (const wpan_envelope_t FAR *envelope)
 Debugging function to dump the contents of an envelope to stdout. 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...
 
int wpan_tick (wpan_dev_t *dev)
 Calls the underlying hardware tick function to process received frames, and times out expired conversations. More...
 

Variables

wpan_address_t address
 IEEE/MAC and network addresses. More...
 
uint16_t cluster_id
 Cluster ID. More...
 
uint16_t cluster_id
 
const wpan_cluster_table_entry_tcluster_table
 
const void FAR * context
 
void FAR * context
 
wpan_conversation_t conversations [WPAN_MAX_CONVERSATIONS]
 
uint8_t dest_endpoint
 endpoint on recipient (dest) More...
 
struct wpan_dev_tdev
 interface received on/to send to More...
 
uint16_t device_id
 This endpoint's device ID. More...
 
uint8_t device_version
 Lower 4 bits are used, upper 4 are reserved and should be 0. More...
 
uint8_t endpoint
 Endpoint ID, 0 to 254. 255 (0xFF) is used as an end-of-table marker. More...
 
wpan_endpoint_get_next_fn endpoint_get_next
 walk endpoint table More...
 
wpan_endpoint_send_fn endpoint_send
 send frame to an endpoint More...
 
const wpan_endpoint_table_entry_tendpoint_table
 
struct wpan_ep_state_t FAR * ep_state
 
uint8_t flags
 flags that apply to this cluster, see WPAN_CLUST_FLAG_* macros More...
 
uint16_t flags
 
wpan_aps_handler_fn handler
 
wpan_ep_handler_fn handler
 
wpan_response_fn handler
 
addr64 ieee_address
 remote 64-bit address More...
 
uint8_t last_transaction
 
uint16_t length
 number of bytes in payload More...
 
uint16_t network_address
 remote 16-bit address More...
 
uint16_t options
 
const void FAR * payload
 contents of message More...
 
uint16_t payload
 max bytes in RF payload, need to refresh if encryption enabled/disabled More...
 
uint16_t profile_id
 Profile ID. More...
 
uint16_t profile_id
 
uint8_t source_endpoint
 endpoint on sender (source) More...
 
wpan_tick_fn tick
 read and dispatch frames More...
 
uint16_t timeout
 
uint8_t transaction_id
 

Detailed Description

Typedef Documentation

typedef int(* _wpan_config_fn) (struct wpan_dev_t *dev,...)
typedef int(* wpan_aps_handler_fn) (const wpan_envelope_t FAR *envelope, void FAR *context)

General handler used in the cluster table.

Dispatcher searches an endpoint's cluster table for a matching cluster, and hands the frame off to the cluster's handler.

If the cluster's handler is set to NULL, or the frame is for a cluster ID that does not appear in the table, the dispatcher hands the frame off to the endpoint's handler.

Parameters
[in]envelopeinformation about the frame (addresses, endpoint, profile, cluster, etc.)
[in,out]contextuser context (from cluster table)
Return values
0handled data
!0some sort of error processing data

Information on each cluster associated with an endpoint.

Used to track conversations (outstanding requests) on an endpoint.

typedef struct wpan_dev_t wpan_dev_t

Structure used by the WPAN/ZigBee layers. Contains information about the node (addresses, payload limit, capabilities) along with an endpoint list and function pointers to configure, tick and send packets through the underlying network interface.

This is the abstraction layer between a physical XBee (or some other piece of hardware or gateway/router/tunnel device) and the networking layers. Similar to a driver for an Ethernet NIC and the TCP/IP stack that runs on top of it.

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.

The application can define its own function to walk the endpoint table, possibly to support a dynamic table or a table where endpoints aren't always visible.

Parameters
[in]devdevice with endpoint table to walk
[in]epNULL to return first entry in table, or a pointer previously returned by this function to get the next entry
Return values
NULLdev is invalid or reached end of table
!NULLnext entry from table
See also
wpan_endpoint_match(), wpan_cluster_match(), wpan_endpoint_get_next()
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.

This is part of the glue that links the XBee layer with the WPAN/ZigBee layers.

Parameters
[in]envelopeinformation about the frame (addresses, endpoint, profile, cluster, payload, etc.)
[in]flagsflags related to sending, see WPAN_SEND_FLAG_* macros
  • #WPAN_SEND_FLAG_NONE: no special behavior
  • #WPAN_SEND_FLAG_ENCRYPTED: use APS layer encryption
Return values
0frame sent
!0error sending frame
-EMSGSIZEpayload is too large

Add support for a broadcast radius? Don't send Tx Status? Use frame ID 0?

come up with standard error codes for the following possible errors? outbound frame buffer is full, invalid data in envelope, payload is too big

Information on each endpoint on this device.

typedef XBEE_BEGIN_DECLS struct wpan_envelope_t wpan_envelope_t

The "envelope" is used to gather all necessary information about a given frame on the network. Note that all members of the structure are in host byte order.

The low byte of the options field is a copy of the cluster flags for the cluster that received the data. Use #WPAN_ENVELOPE_CLUSTER_FLAGS to mask off the byte, and then compare to the various WPAN_CLUST_FLAG_* macros.

On a DigiMesh network, the 16-bit network address is always set to WPAN_NET_ADDR_UNDEFINED (0xFFFE).

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.

If a cluster's handler is set to NULL, or the frame is for a cluster ID that does not appear in the table, the dispatcher hands the frame off to the endpoint's handler.

Parameters
[in]envelopeinformation about the frame (addresses, endpoint, profile, cluster, etc.)
[in,out]ep_statepointer to endpoint state structure
Return values
0handled data
!0some sort of error processing data

Volatile part of an endpoint record used to track conversations (requests waiting for responses).

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.

Parameters
[in]conversationPointer to entry in conversation table. Handler can use the pointer to access the context and transaction ID from the conversation, or request deletion of the conversation via wpan_conversation_delete(). Never NULL.
[in]envelopeenvelope with response or NULL if there was a timeout
Return values
WPAN_CONVERSATION_ENDend of conversation, no more responses expected
WPAN_CONVERSATION_CONTINUEleave conversation open, more responses are expected
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.

Parameters
[in]devdevice to tick
Returns
number of frames processed during the tick

Enumeration Type Documentation

Digi Data cluster IDs (endpoint #WPAN_ENDPOINT_DIGI_DATA)

Enumerator
DIGI_CLUST_SLEEP_SYNC 

DigiMesh Sleeping Router Sync.

DIGI_CLUST_SERIAL 

Serial data.

DIGI_CLUST_LOOPBACK 

Serial loopback transmit.

DIGI_CLUST_ND_COMMAND 

Digi ND Command.

DIGI_CLUST_DN_COMMAND 

Digi DN Command.

DIGI_CLUST_REMOTE_COMMAND 

Remote Command Request.

DIGI_CLUST_NR_COMMAND 

Digi NR Command.

DIGI_CLUST_IODATA 

Unsolicited I/O data sample.

DIGI_CLUST_WATCHPORT 

Unsolicited Watchport sensor.

DIGI_CLUST_NODEID_MESSAGE 

Node ID Message.

DIGI_CLUST_DN_RESPONSE 

Digi DN Response.

DIGI_CLUST_REMOTE_RESPONSE 

Digi Remote Command Response.

DIGI_CLUST_NR_RESPONSE 

Digi NR Response.

DIGI_CLUST_INDIRECT_ROUTE_ERR 
DIGI_CLUST_PROG_XBEE_OTA_UPD 

Start OTA update of PXBee App.

DIGI_CLUST_NBRFWUPDATE 

Neighbor FW update.

DIGI_CLUST_REMFWUPDATE 

Remote FW update.

DIGI_CLUST_FWUPDATERESP 

FW update response.

Function Documentation

wpan_aps_debug int _wpan_endpoint_dispatch ( wpan_envelope_t envelope,
const wpan_endpoint_table_entry_t ep 
)
wpan_aps_debug void _wpan_endpoint_expire_conversations ( wpan_ep_state_t FAR *  state)
wpan_aps_debug const wpan_cluster_table_entry_t * wpan_cluster_match ( uint16_t  match,
uint8_t  mask,
const wpan_cluster_table_entry_t entry 
)

Search a cluster table for a matching cluster ID.

Parameters
[in]matchID to match
[in]maskFlags to match against the flags member of the wpan_cluster_table_entry_t structure. If any flags match, the entry is returned. Typically one of
  • #WPAN_CLUST_FLAG_INPUT (or #WPAN_CLUST_FLAG_SERVER)
  • #WPAN_CLUST_FLAG_OUTPUT (or #WPAN_CLUST_FLAG_CLIENT)
[in]entrypointer to list of entries to search
@retval     NULL    \a entry is invalid or search reached
                                    #WPAN_CLUSTER_END_OF_LIST without finding a match.
@retval     !NULL   Pointer to matching entry from table.

@see wpan_endpoint_get_next(), wpan_endpoint_match()
wpan_aps_debug void wpan_conversation_delete ( wpan_conversation_t FAR *  conversation)

Delete a conversation from an endpoint's conversation table.

Parameters
[in,out]conversationconversation to delete
wpan_aps_debug 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.

Parameters
[in,out]stateendpoint state associated with sending endpoint
[in]handlerhandler to call when responses come back, or NULL to increment and return the endpoint's transaction ID
[in]contextpointer stored in conversation table and passed to callback handler
[in]timeoutnumber of seconds before generating timeout, or 0 for none
Return values
0-255transaction ID to use in sent frame
-EINVALstate is invalid (NULL)
-ENOSPCtable is full
See also
wpan_endpoint_next_trans
wpan_aps_debug 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.

Hands the response frame off to the handler registered to the conversation with wpan_conversation_register().

Parameters
[in]stateendpoint state (from endpoint table) or NULL to look it up using the envelope
[in]transaction_idtransaction ID from frame payload, used to look up conversation
[in]envelopeenvelope from response frame, passed to conversation's handler
Return values
-EINVALinvalid parameter passed to function, or conversation not found in table
0handler processed response
!0handler reported an error while processing response
wpan_aps_debug const wpan_endpoint_table_entry_t * wpan_endpoint_get_next ( wpan_dev_t dev,
const wpan_endpoint_table_entry_t ep 
)

Function used to walk a device's endpoint table.

For most devices, this will just walk the entries in dev->endpoint_table. For custom applications a function may dynamically return entries.

Use of this function is the only way to walk the endpoint table.

Parameters
[in]devdevice with endpoint table to walk
[in]epNULL to return first entry in table, or a pointer previously returned by this function to get the next entry
Return values
NULLdev is invalid or reached end of table
!NULLnext entry from table
See also
wpan_endpoint_match(), wpan_cluster_match()
wpan_aps_debug const wpan_endpoint_table_entry_t * wpan_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.

Used by the endpoint dispatcher and ZDO layer to describe available endpoints on this device.

Parameters
[in]devDevice with endpoint table to search.
[in]endpointEndpoint number to search for.
[in]profile_idProfile to match or WPAN_APS_PROFILE_ANY to search on endpoint number only.
Return values
NULLdev is invalid or reached end of table without finding a match
!NULLnext entry from table
See also
wpan_endpoint_of_cluster(), wpan_endpoint_get_next(), wpan_cluster_match(), wpan_endpoint_of_envelope()
wpan_aps_debug uint8_t wpan_endpoint_next_trans ( const wpan_endpoint_table_entry_t ep)

Increment and return the endpoint's transaction ID counter.

Parameters
[in]epentry from endpoint table
Return values
0-255current transaction ID for endpoint
wpan_aps_debug const wpan_endpoint_table_entry_t * wpan_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.

Used to find the correct endpoint to use for sending ZCL client requests.

Parameters
[in]devDevice with endpoint table to search.
[in]profile_idProfile to match or WPAN_APS_PROFILE_ANY to search on cluster ID only.
[in]cluster_idCluster ID to search for.
[in]maskFlags to match against the flags member of the wpan_cluster_table_entry_t structure. If any flags match, the entry is returned. Typically one of
  • #WPAN_CLUST_FLAG_INPUT (or #WPAN_CLUST_FLAG_SERVER)
  • #WPAN_CLUST_FLAG_OUTPUT (or #WPAN_CLUST_FLAG_CLIENT)
Return values
NULLdev is invalid or reached end of table without finding a match
!NULLmatching entry from table
See also
wpan_endpoint_match(), wpan_endpoint_get_next(), wpan_cluster_match()
wpan_aps_debug const wpan_endpoint_table_entry_t * wpan_endpoint_of_envelope ( const wpan_envelope_t env)

Look up the endpoint table entry for the source endpoint of an envelope.

Parameters
[in]envEnvelope for lookup. Uses env->source_endpoint and env->profile_id to find the endpoint table entry for env->dev.
Return values
NULLinvalid parameter, or reached end of table without finding a match
!NULLentry from table
See also
wpan_endpoint_of_cluster(), wpan_endpoint_get_next(), wpan_cluster_match(), wpan_endpoint_match()
wpan_aps_debug 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. The profile ID, cluster ID, source/destination endpoints and envelope options are all be set to zero.

Parameters
[out]envelopeenvelope to populate
[in]devdevice that will send this envelope
[in]ieee64-bit IEEE/MAC address of recipient or one of
  • #WPAN_IEEE_ADDR_COORDINATOR (send to coordinator)
  • #WPAN_IEEE_ADDR_BROADCAST (broadcast packet)
  • #WPAN_IEEE_ADDR_UNDEFINED (use network address only)
[in]network_addr16-bit network address of recipient or one of
  • #WPAN_NET_ADDR_COORDINATOR for the coordinator (use the coordinator's actual IEEE address for the ieee parameter).
  • #WPAN_NET_ADDR_BCAST_ALL_NODES (broadcast to all nodes)
  • #WPAN_NET_ADDR_BCAST_NOT_ASLEEP (broadcast to awake nodes)
  • #WPAN_NET_ADDR_BCAST_ROUTERS (broadcast to routers/coordinator)
  • #WPAN_NET_ADDR_UNDEFINED (use 64-bit address only)

When sending broadcast packets, use WPAN_IEEE_ADDR_BROADCAST and WPAN_NET_ADDR_UNDEFINED. Don't set both addresses to broadcast.

When using DigiMesh protocol, always set the network_addr to WPAN_NET_ADDR_UNDEFINED.

See also
wpan_envelope_reply()
wpan_aps_debug int wpan_envelope_dispatch ( wpan_envelope_t envelope)

Find the matching endpoint for the provided envelope and have it process the frame.

In the case of the broadcast endpoint (255), dispatches the frame to all endpoints matching the envelope's profile ID.

Looks up the destination endpoint and cluster ID in the device's endpoint table and passes envelope off to the cluster handler (if a matching cluster was found) or the endpoint handler.

Parameters
[in]envelopestructure containing all necessary information about message (endpoints, cluster, profile, etc.)
Return values
0successfully dispatched message
-ENOENTno handler for this endpoint/cluster
!0error dispatching messages
wpan_aps_debug void wpan_envelope_dump ( const wpan_envelope_t FAR *  envelope)

Debugging function to dump the contents of an envelope to stdout.

Displays all fields from the envelope, plus the contents of the payload

Parameters
[in]envelopeenvelope to dump
wpan_aps_debug 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.

Copies the interface, addresses, profile and cluster from the original envelope, and then swaps the source and destination endpoints.

Note that it may be necessary for the caller to change the cluster_id as well, after building the reply envelope. For example, ZDO responses set the high bit of the request's cluster ID.

Parameters
[out]replyBuffer for storing the reply envelope.
[in]originalOriginal envelope, received from a remote node, to base the reply on.
Return values
0addressed reply envelope
-EINVALeither parameter is NULL or they point to the same address
See also
wpan_envelope_create()
wpan_aps_debug 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.

Parameters
[in]envelopeenvelope of request to send
Return values
0request sent
!0error trying to send request
wpan_aps_debug int wpan_tick ( wpan_dev_t dev)

Calls the underlying hardware tick function to process received frames, and times out expired conversations.

Parameters
[in]devWPAN device to tick
Return values
>=0number of frames processed during the tick
-EINVALdevice does not have a tick function assigned to it
<0some other error encountered during the tick

Variable Documentation

wpan_address_t address

IEEE/MAC and network addresses.

uint16_t cluster_id

Cluster ID.

uint16_t cluster_id

16-bit cluster id, in host byte order. WPAN_CLUSTER_END_OF_LIST (0xFFFF) marks the end of the list. Clusters 0x0000 to 0x7FFF are Standard ZigBee clusters, 0x8000 to 0xFBFF are reserved and 0xFC00 to 0xFFFF are manufacturer-specific (with a standard ZigBee profile).

const wpan_cluster_table_entry_t* cluster_table

Pointers to a list of clusters that ends with WPAN_CLUST_ENTRY_LIST_END. Maximum of 255 input and 255 output clusters (Simple Descriptor uses 8-bit fields for input cluster count and output cluster count).

const void FAR* context

Declared const so initializers can use const or non-const pointers. The const is discarded before passing the context on to wpan_aps_handler_fn(). For a ZCL endpoint, context points to an attribute tree (zcl_attribute_tree_t).

void FAR* context
wpan_conversation_t conversations[WPAN_MAX_CONVERSATIONS]
uint8_t dest_endpoint

endpoint on recipient (dest)

struct wpan_dev_t* dev

interface received on/to send to

uint16_t device_id

This endpoint's device ID.

uint8_t device_version

Lower 4 bits are used, upper 4 are reserved and should be 0.

uint8_t endpoint

Endpoint ID, 0 to 254. 255 (0xFF) is used as an end-of-table marker.

wpan_endpoint_get_next_fn endpoint_get_next

walk endpoint table

wpan_endpoint_send_fn endpoint_send

send frame to an endpoint

const wpan_endpoint_table_entry_t* endpoint_table

Pointer to a table of the device's endpoints, ending with #WPAN_ENDPOINT_TABLE_END. Do not reference directly! Use wpan_endpoint_get_next() to walk the table.

struct wpan_ep_state_t FAR* ep_state

Structure used to track transactions and conversations on ZDO/ZDP and ZCL endpoints. Should be NULL for other types of endpoints.

uint8_t flags

flags that apply to this cluster, see WPAN_CLUST_FLAG_* macros

uint16_t flags

Bitfield describing the device's capabilities (maybe CAN_SLEEP, nodetype, etc.) and state. Only valid if xbee_cmd_init_device() is used or ALL Modem Status messages are received from radio. User code should not access this directly, but use WPAN_DEV_IS_* macros instead.

Function to receive all frames for this cluster, or NULL to have endpoint's handler process the frame.

Function to receive all frames for invalid clusters, or clusters with a NULL handler.

addr64 ieee_address

remote 64-bit address

uint8_t last_transaction
uint16_t length

number of bytes in payload

uint16_t network_address

remote 16-bit address

uint16_t options
const void FAR* payload

contents of message

uint16_t payload

max bytes in RF payload, need to refresh if encryption enabled/disabled

uint16_t profile_id

Profile ID.

uint16_t profile_id

This endpoint's profile ID. See WPAN_PROFILE_* macros for some known profile IDs.

uint8_t source_endpoint

endpoint on sender (source)

read and dispatch frames

uint16_t timeout

Time to expire conversation (0 for never or lower 16 bits of xbee_seconds_timer) – limited to 9 hours (32,768 seconds). We could save another byte if it's ok to limit to 2 minutes and we'll check for expirations at least every 7 seconds.

uint8_t transaction_id