Digi XBee(R) ANSI C Host Library
|
Sending AT command requests and processing the responses. More...
#include "xbee/device.h"
Go to the source code of this file.
Data Structures | |
union | xbee_at_cmd_t |
Datatype used for passing and storing XBee AT Commands. More... | |
struct | xbee_cmd_response_t |
Structure used to pass AT Command responses to registered callback handlers. More... | |
struct | xbee_cmd_request_t |
This structure is used to keep track of outstanding local and remote AT requests. More... | |
struct | xbee_header_local_at_req_t |
Header for AT Commands sent to the local (serially-attached) XBee. More... | |
struct | xbee_header_remote_at_req_t |
Header to AT Commands sent to a remote XBee on the network. More... | |
union | xbee_header_at_request_t |
Useful typedef to create either a local or remote request frame. More... | |
struct | xbee_header_local_at_resp_t |
XBEE_FRAME_LOCAL_AT_RESPONSE (0x88) More... | |
struct | xbee_header_remote_at_resp_t |
XBEE_FRAME_REMOTE_AT_RESPONSE (0x97) More... | |
struct | xbee_frame_local_at_resp_t |
Response to an AT Command sent to the local serially-connected XBee. More... | |
struct | xbee_frame_remote_at_resp_t |
Response to an AT Command sent to a remote XBee. More... | |
union | xbee_frame_at_response_t |
Useful typedef for casting either a local or remote response frame. More... | |
struct | xbee_command_list_context_t |
Context data passed to command list processor. More... | |
struct | xbee_atcmd_reg_t |
Entry for table of XBee registers to query at startup. More... | |
Macros | |
#define | XBEE_CMD_REQUEST_TABLESIZE 2 |
Maximum number of outstanding requests. More... | |
#define | XBEE_CMD_MAX_PARAM_LENGTH 64 |
Maximum number of bytes in the parameter sent to a command. More... | |
#define | XBEE_CMD_REMOTE_TIMEOUT 180 |
Timeout (in seconds) to wait for a response to a remote command. More... | |
#define | XBEE_CMD_LOCAL_TIMEOUT 2 |
Timeout (in seconds) to wait for a response to a local command. | |
#define | XBEE_CMD_ATEO_INSECURE_JOIN (1<<0) |
#define | XBEE_CMD_ATEO_USE_TRUST_CENTER (1<<1) |
#define | XBEE_CMD_ATEO_USE_HASH_LINK_KEY (1<<2) |
#define | XBEE_CMD_ATEO_USE_AUTHENTICATION (1<<3) |
#define | XBEE_AT_RESP_STATUS(var) ((var) & XBEE_AT_RESP_STATUS_MASK) |
Macro for checking the status byte of an AT response. More... | |
#define | XBEE_ATCMD_REG(c1, c2, type, obj, field) |
Macro used in creating command list tables. More... | |
#define | XBEE_ATCMD_REG_CB(c1, c2, cb, flags) { { { c1, c2 } }, flags, XBEE_CLT_NONE, cb, 0, 0 } |
Macro used in creating command list tables. More... | |
#define | XBEE_ATCMD_REG_MOVE_THEN_CB(c1, c2, type, obj, field, cb, flags) |
Macro used in creating command list tables. More... | |
#define | XBEE_ATCMD_REG_SET_8(c1, c2, value) { { { c1, c2 } }, 0, XBEE_CLT_SET_8, NULL, value, 0 } |
Macro used in creating command list tables. More... | |
#define | XBEE_ATCMD_REG_END { { { '\0', '\0' } } } |
Macro used in creating command list tables. More... | |
#define | XBEE_ATCMD_REG_END_CMD(c1, c2) { { { c1, c2 } }, 0, XBEE_CLT_LAST, NULL, 0, 0 } |
Macro used in creating command list tables. More... | |
#define | XBEE_ATCMD_REG_END_CB(cb, flags) { { { '\0', '\0' } }, flags, XBEE_CLT_NONE, cb, 0, 0 } |
Macro used in creating command list tables. More... | |
#define | XBEE_ATCMD_REG_VALID(ptr) (ptr->command.w != 0) |
Macro used in create command list tables. More... | |
#define | xbee_cmd_list_status(clc) ((clc)->status) |
#define | XBEE_CMD_REQUEST_EMPTY(index) (xbee_cmd_request_table[index].device == NULL) |
Is entry index available (unused)? | |
#define | XBEE_CMD_REQUEST_HANDLE(index) ((index << 8) || xbee_cmd_request_table[index].sequence) |
Return the handle for entry index (combination of index and .sequence member of entry). More... | |
#define | XBEE_FRAME_HANDLE_LOCAL_AT |
#define | XBEE_FRAME_HANDLE_REMOTE_AT { XBEE_FRAME_REMOTE_AT_RESPONSE, 0, _xbee_cmd_handle_response, NULL } |
#define | xbee_zcl_identify(xbee) xbee_identify( xbee, zcl_identify_isactive() > 0) |
Programs with the ZCL Identify Server Cluster can call this macro in their main loop to have the XBee module's association LED flash fast (100ms cycle) when in Identify Mode. More... | |
Typedefs | |
typedef int(* | xbee_cmd_callback_fn) (const xbee_cmd_response_t FAR *response) |
Callback registered to an AT Command with xbee_cmd_set_callback(). More... | |
typedef void(* | xbee_command_list_fn) (const xbee_cmd_response_t FAR *response, const struct xbee_atcmd_reg_t FAR *reg, void FAR *base) |
Callback registered for individual command list commands. More... | |
Enumerations | |
enum | xbee_at_resp_status { XBEE_AT_RESP_STATUS_MASK = 0x0F, XBEE_AT_RESP_SUCCESS = 0x00, XBEE_AT_RESP_ERROR = 0x01, XBEE_AT_RESP_BAD_COMMAND = 0x02, XBEE_AT_RESP_BAD_PARAMETER = 0x03, XBEE_AT_RESP_TX_FAIL = 0x04, XBEE_AT_RESP_NO_SESSION = 0x0B, XBEE_AT_RESP_ENCRYPTION_ERR = 0x0C, XBEE_AT_RESP_TO_BIT_NOT_SET = 0x0D, XBEE_AT_RESP_ATND_RSSI_INVALID = 0x40 } |
Possible values of status byte in xbee_header_local_at_resp_t and xbee_frame_local_at_resp_t. More... | |
enum | xbee_command_list_status { XBEE_COMMAND_LIST_RUNNING = -EBUSY, XBEE_COMMAND_LIST_DONE = 0, XBEE_COMMAND_LIST_TIMEOUT = -ETIMEDOUT, XBEE_COMMAND_LIST_ERROR = -EIO } |
Status codes for xbee_cmd_list_status() More... | |
enum | xbee_command_list_type { XBEE_CLT_NONE, XBEE_CLT_COPY, XBEE_CLT_COPY_PAD_LEFT, XBEE_CLT_COPY_BE, XBEE_CLT_SET, XBEE_CLT_SET_STR, XBEE_CLT_SET_BE, XBEE_CLT_SET_8, XBEE_CLT_LAST } |
Functions | |
int | xbee_cmd_list_execute (xbee_dev_t *xbee, xbee_command_list_context_t FAR *clc, const xbee_atcmd_reg_t FAR *list, void FAR *base, const wpan_address_t FAR *address) |
Execute a list of AT commands. More... | |
enum xbee_command_list_status() | xbee_cmd_list_status (xbee_command_list_context_t FAR *clc) |
Determine status of command list execution. More... | |
int | xbee_cmd_tick (void) |
This function should be called periodically (at least every few seconds) to expire old entries from the AT Command Request table. More... | |
xbee_cmd_request_t FAR * | _xbee_cmd_handle_to_address (int16_t handle) |
int | xbee_cmd_init_device (xbee_dev_t *xbee) |
Initialize the AT Command layer for an XBee device. More... | |
int | xbee_cmd_query_device (xbee_dev_t *xbee, uint_fast8_t refresh) |
Learn about the underlying device by sending a series of commands and storing the results in the xbee_dev_t. More... | |
int | xbee_cmd_query_status (xbee_dev_t *xbee) |
Check the status of querying an XBee device, as initiated by xbee_cmd_query_device(). More... | |
int16_t | xbee_cmd_create (xbee_dev_t *xbee, const char FAR command[3]) |
Allocate an AT Command request. More... | |
int | _xbee_cmd_release_request (xbee_cmd_request_t FAR *request) |
Release an entry from the request table by marking it as available. More... | |
int | xbee_cmd_release_handle (int16_t handle) |
Release an entry from the request table by marking it as available. More... | |
int | xbee_cmd_set_command (int16_t handle, const char FAR command[3]) |
Change the command associated with a request. More... | |
int | xbee_cmd_set_callback (int16_t handle, xbee_cmd_callback_fn callback, void FAR *context) |
Associate a callback with a given AT Command request. More... | |
int | xbee_cmd_set_target (int16_t handle, const addr64 FAR *ieee, uint16_t network_address) |
Associate a remote XBee device with a given AT Command request. More... | |
int | xbee_cmd_set_flags (int16_t handle, uint16_t flags) |
Set the flags for a given AT Command request. More... | |
int | xbee_cmd_clear_flags (int16_t handle, uint16_t flags) |
Clear the flags for a given AT Command request. More... | |
int | xbee_cmd_set_param (int16_t handle, uint32_t value) |
Set the parameter (up to 32-bits) for a given AT Command request. More... | |
int | xbee_cmd_set_param_bytes (int16_t handle, const void FAR *data, uint8_t length) |
Set the parameter for a given AT Command request to a sequence of bytes. More... | |
int | xbee_cmd_set_param_str (int16_t handle, const char FAR *str) |
Set a string parameter for a given AT Command request (e.g., the "NI" node identifier command). More... | |
int | xbee_cmd_send (int16_t handle) |
Send an AT Command to a local or remote XBee device. More... | |
int | xbee_cmd_simple (xbee_dev_t *xbee, const char FAR command[3], uint32_t value) |
Simple interface for sending a command with a parameter to the local XBee without checking for a response. More... | |
int | xbee_cmd_execute (xbee_dev_t *xbee, const char FAR command[3], const void FAR *data, uint8_t length) |
Simple interface for sending a command with an optional parameter to the local XBee without checking for a response. More... | |
int | _xbee_cmd_handle_response (xbee_dev_t *xbee, const void FAR *rawframe, uint16_t length, void FAR *context) |
Callback handler registered for frame types XBEE_FRAME_LOCAL_AT_RESPONSE (0x88) and XBEE_FRAME_REMOTE_AT_RESPONSE (0x97). More... | |
int | _xbee_cmd_modem_status (xbee_dev_t *xbee, const void FAR *payload, uint16_t length, void FAR *context) |
Receive modem status frames and update our network address (and payload size) on state changes. More... | |
void | xbee_identify (xbee_dev_t *xbee, bool_t identify) |
Programs with the ZCL Identify Server Cluster can call this function in their main loop to have the XBee module's association LED flash fast (100ms cycle) when in Identify Mode. More... | |
Variables | |
FAR xbee_cmd_request_t | xbee_cmd_request_table [XBEE_CMD_REQUEST_TABLESIZE] |
Table used to keep track of outstanding requests. | |
Return values for xbee_cmd_callback_fn() functions. | |
#define | XBEE_ATCMD_DONE 0 |
Returned by an xbee_cmd_callback_fn() if the handle can be released. | |
#define | XBEE_ATCMD_REUSE 1 |
Returned by an xbee_cmd_callback_fn() if more reponses are expected, or it has re-used the command handle. More... | |
XBEE_REMOTE_AT_OPT_* | |
#define | XBEE_REMOTE_AT_OPT_QUEUE (0) |
Queue changes until ATAC command or another request with XBEE_REMOTE_AT_OPT_IMMEDIATE set. More... | |
#define | XBEE_REMOTE_AT_OPT_IMMEDIATE (1<<1) |
Apply changes immediately, don't wait for ATAC command. | |
#define | XBEE_REMOTE_AT_OPT_SECURE (1<<4) |
Send securely (requires Secure Session to target). | |
Macros used for | |
#define | XBEE_CMD_RESP_MASK_STATUS 0x000F |
flags mask to retrieve status from XBee response | |
#define | XBEE_CMD_RESP_ATND_RSSI_INVALID XBEE_AT_RESP_ATND_RSSI_INVALID |
RSSI from ATND response is invalid. | |
#define | XBEE_CMD_RESP_FLAG_TIMEOUT 0x8000 |
AT command timed out. | |
#define | XBEE_CMD_FLAG_REMOTE 0x0001 |
set in xbee_cmd_set_target() and used as a quick test for remote vs. More... | |
#define | XBEE_CMD_FLAG_QUEUE_CHANGE 0x0002 |
queue change until ATAC or another request w/o this flag | |
#define | XBEE_CMD_FLAG_REUSE_HANDLE 0x0004 |
don't automatically release non-response requests (no callback) after sending (necessary for functions that reuse handle) | |
#define | XBEE_CMD_FLAG_USER_MASK |
mask of flags user can set (passed into xbee_cmd_set_flags) More... | |
Sending AT command requests and processing the responses.
#define XBEE_CMD_FLAG_REMOTE 0x0001 |
set in xbee_cmd_set_target() and used as a quick test for remote vs.
local in xbee_cmd_send()
Referenced by _xbee_cmd_handle_response(), xbee_cmd_send(), and xbee_cmd_set_target().
#define XBEE_CMD_FLAG_USER_MASK |
mask of flags user can set (passed into xbee_cmd_set_flags)
Referenced by xbee_cmd_clear_flags(), and xbee_cmd_set_flags().