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

Files

file  atcmd.h
 
file  xbee_atcmd.c
 

Data Structures

union  xbee_at_cmd
 
struct  xbee_atcmd_reg_t
 Entry for table of XBee registers to query at startup. More...
 
struct  xbee_cmd_request
 
struct  xbee_cmd_response
 
struct  xbee_command_list_context_t
 Context data passed to command list processor. More...
 
union  xbee_frame_at_response
 Useful typedef for casting either a local or remote response frame. More...
 
union  xbee_header_at_request
 Useful typedef to create either a local or remote request frame. More...
 

Typedefs

typedef union xbee_at_cmd xbee_at_cmd_t
 
typedef struct xbee_atcmd_reg_t xbee_atcmd_reg_t
 Entry for table of XBee registers to query at startup. More...
 
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 struct xbee_cmd_request xbee_cmd_request_t
 
typedef struct xbee_cmd_response xbee_cmd_response_t
 
typedef struct xbee_command_list_context_t xbee_command_list_context_t
 Context data passed to command list processor. 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...
 
typedef union xbee_frame_at_response xbee_frame_at_response_t
 Useful typedef for casting either a local or remote response frame. More...
 
typedef PACKED_STRUCT xbee_frame_local_at_resp
 Response to an AT Command sent to the local serially-connected XBee. More...
 
typedef PACKED_STRUCT xbee_frame_remote_at_resp
 Response to an AT Command sent to a remote XBee. More...
 
typedef union xbee_header_at_request xbee_header_at_request_t
 Useful typedef to create either a local or remote request frame. More...
 
typedef PACKED_STRUCT xbee_header_local_at_req
 Header for AT Commands sent to the local (serially-attached) XBee. More...
 
typedef PACKED_STRUCT xbee_header_local_at_resp
 
typedef PACKED_STRUCT xbee_header_remote_at_req
 Header to AT Commands sent to a remote XBee on the network. More...
 
typedef PACKED_STRUCT xbee_header_remote_at_resp
 

Enumerations

enum  xbee_at_resp_status {
  XBEE_AT_RESP_STATUS_MASK = 0x0F, XBEE_AT_RESP_SUCCESS = 0, XBEE_AT_RESP_ERROR = 1, XBEE_AT_RESP_BAD_COMMAND = 2,
  XBEE_AT_RESP_BAD_PARAMETER = 3, XBEE_AT_RESP_TX_FAIL = 4, XBEE_AT_RESP_ATND_RSSI_INVALID = 0x40
}
 
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_BE, XBEE_CLT_SET,
  XBEE_CLT_SET_STR, XBEE_CLT_SET_BE, XBEE_CLT_SET_8, XBEE_CLT_LAST
}
 

Functions

uint8_t _xbee_cmd_encode_param (void FAR *buffer, uint32_t value)
 
int _xbee_cmd_handle_response (xbee_dev_t *xbee, const void FAR *rawframe, uint16_t length, void FAR *context)
 
xbee_cmd_request_t FAR * _xbee_cmd_handle_to_address (int16_t handle)
 
_xbee_atcmd_debug int _xbee_cmd_issue_list (xbee_dev_t *xbee, xbee_command_list_context_t FAR *clc, const xbee_cmd_response_t FAR *response)
 
_xbee_atcmd_debug int _xbee_cmd_list_callback (const xbee_cmd_response_t FAR *response)
 
int _xbee_cmd_modem_status (xbee_dev_t *xbee, const void FAR *payload, uint16_t length, void FAR *context)
 
_xbee_atcmd_debug void _xbee_cmd_query_handle_ai (const xbee_cmd_response_t FAR *response, const struct xbee_atcmd_reg_t FAR *reg, void FAR *base)
 
_xbee_atcmd_debug void _xbee_cmd_query_handle_end (const xbee_cmd_response_t FAR *response, const struct xbee_atcmd_reg_t FAR *reg, void FAR *base)
 
_xbee_atcmd_debug void _xbee_cmd_query_handle_eo (const xbee_cmd_response_t FAR *response, const struct xbee_atcmd_reg_t FAR *reg, void FAR *base)
 
int _xbee_cmd_release_request (xbee_cmd_request_t FAR *request)
 
int xbee_cmd_clear_flags (int16_t handle, uint16_t flags)
 Clear the flags for a given AT Command request. More...
 
int16_t xbee_cmd_create (xbee_dev_t *xbee, const char FAR command[3])
 Allocate an AT Command request. 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_init_device (xbee_dev_t *xbee)
 Initialize the AT Command layer for an XBee device. More...
 
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_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...
 
int xbee_cmd_release_handle (int16_t handle)
 Release an entry from the request table by marking it as available. More...
 
int xbee_cmd_send (int16_t handle)
 Send an AT Command to a local or remote XBee device. 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_command (int16_t handle, const char FAR command[3])
 Change the command associated with a 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_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_set_target (int16_t handle, const addr64 FAR *ieee, uint16_t network_address)
 Associate a remote XBee device with a given AT Command request. By default, xbee_cmd_create() configures the request as a local AT Command for the serially-attached XBee module. Use this function to send the command to a remote 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_tick (void)
 This function should be called periodically (at least every few seconds) to expire old entries from the AT Command Request table. 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

const xbee_atcmd_reg_t _xbee_atcmd_query_regs []
 
xbee_command_list_context_t _xbee_atcmd_query_regs_head
 
xbee_at_cmd_t command
 two-character AT Command More...
 
uint8_t frame_id
 1 to 255, or 0 to suppress the Transmit Status response More...
 
addr64 ieee_address
 64-bit IEEE address (big-endian) of target More...
 
uint16_t network_address_be
 16-bit network address (big-endian) of target More...
 
uint8_t options
 Options byte (see XBEE_REMOTE_AT_OPT_* macros) More...
 
uint8_t status
 
uint8_t value [1]
 First byte of multi-byte value. More...
 
FAR xbee_cmd_request_t xbee_cmd_request_table [XBEE_CMD_REQUEST_TABLESIZE]
 Table used to keep track of outstanding requests. More...
 
FAR xbee_cmd_request_t xbee_cmd_request_table [XBEE_CMD_REQUEST_TABLESIZE]
 Table used to keep track of outstanding requests. More...
 
 xbee_frame_local_at_resp_t
 
 xbee_frame_remote_at_resp_t
 
 xbee_header_local_at_req_t
 
 xbee_header_local_at_resp_t
 
 xbee_header_remote_at_req_t
 
 xbee_header_remote_at_resp_t
 

Detailed Description

This layer wraps the AT request/response frames to provide an easy method for querying/setting registers on, and sending AT commands to the XBee.

Typedef Documentation

typedef union xbee_at_cmd xbee_at_cmd_t

Datatype used for passing and storing XBee AT Commands. Allows printing (e.g., printf( "%.2s", foo.str)), easy copying (bar.w = foo.w) and easy comparison (bar.w == foo.w).

Entry for table of XBee registers to query at startup.

Use #_XBEE_ATCMD_REG() to populate _xbee_atcmd_query_regs[].

typedef int(* xbee_cmd_callback_fn) (const xbee_cmd_response_t FAR *response)

Callback registered to an AT Command with xbee_cmd_set_callback().

It should not modify the contents of the xbee_cmd_response_t structure passed to it. It should return either #XBEE_ATCMD_DONE or #XBEE_ATCMD_REUSE.

View the help on xbee_cmd_response_t for details on the members of that structure.

Parameters
[in]responseresponse received for AT Command
Return values
XBEE_ATCMD_DONEdone with the request handle
XBEE_ATCMD_REUSEmore responses are expected, or the request handle will be reused
See also
xbee_cmd_set_callback(), xbee_cmd_response_t

This structure is used to keep track of outstanding local and remote AT requests.

Structure used to pass AT Command responses to registered callback handlers. This is used for both local and remote command responses.

Context data passed to command list processor.

This struct (or another struct with this as its first member) must be used as the context for the command list processor.

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.

Parameters
[in]responseresponse received for AT Command. From this, the context field points to the start of the entire set of commands in the list being processed.
[in]regTable element for this command. Usually, the callback will dereference reg->context to find any required auxiliary data for processing this command.
[in,out]baseBase address of structure to populate with response value (typical use).
Note
This callback is called for a command response, and is intended to be used for manipulating the raw response data into something suitable for the application. There is no corresponding callback for a request (i.e. called before setting parameter data); the application is expected to perform setting parameter manipulation before invoking xbee_cmd_list_execute().

Useful typedef for casting either a local or remote response frame.

Initial value:
{
xbee_header_local_at_resp_t
Definition: atcmd.h:330

Response to an AT Command sent to the local serially-connected XBee.

Initial value:
{
xbee_header_remote_at_resp_t
Definition: atcmd.h:352

Response to an AT Command sent to a remote XBee.

Useful typedef to create either a local or remote request frame.

Initial value:
{
uint8_t frame_type
unsigned char uint8_t
A unsigned char variable 8 bits.
Definition: types.h:43

Header for AT Commands sent to the local (serially-attached) XBee.

Initial value:
{
uint8_t frame_type
unsigned char uint8_t
A unsigned char variable 8 bits.
Definition: types.h:43
Initial value:
{
uint8_t frame_type
unsigned char uint8_t
A unsigned char variable 8 bits.
Definition: types.h:43

Header to AT Commands sent to a remote XBee on the network.

Initial value:
{
uint8_t frame_type
unsigned char uint8_t
A unsigned char variable 8 bits.
Definition: types.h:43

Enumeration Type Documentation

Possible values of status byte in xbee_header_local_at_resp_t and xbee_frame_local_at_resp_t.

Enumerator
XBEE_AT_RESP_STATUS_MASK 

Mask to ignore extra bits used in the status response.

XBEE_AT_RESP_SUCCESS 
XBEE_AT_RESP_ERROR 
XBEE_AT_RESP_BAD_COMMAND 
XBEE_AT_RESP_BAD_PARAMETER 
XBEE_AT_RESP_TX_FAIL 
XBEE_AT_RESP_ATND_RSSI_INVALID 

The RSSI field of the ATND response is not valid [DigiMesh].

Status codes for xbee_cmd_list_status()

We force these to be -Exxx codes (or 0).

Enumerator
XBEE_COMMAND_LIST_RUNNING 
XBEE_COMMAND_LIST_DONE 
XBEE_COMMAND_LIST_TIMEOUT 
XBEE_COMMAND_LIST_ERROR 
Enumerator
XBEE_CLT_NONE 

No default action. Often used for callbacks.

XBEE_CLT_COPY 

Copy response data byte-for-byte to base struct.

XBEE_CLT_COPY_BE 

Data must be 1,2 or 4 bytes, assumed unsigned.

Copy response, changing expected big-endian to host byte order, and store in base struct.

XBEE_CLT_SET 

with binary data copied byte-for-byte.

Use data in base struct as parameter for command,

XBEE_CLT_SET_STR 

with null-terminated string data copied byte-for-byte.

Use data in base struct as parameter for command,

XBEE_CLT_SET_BE 

Data must be 1,2 or 4 bytes, assumed unsigned.

Use data in base struct as parameter for command, changing host byte order to big-endian.

XBEE_CLT_SET_8 

field of the xbee_atcmd_reg_t entry. No response.

Set value to immediate 8-bit constant in .bytes

XBEE_CLT_LAST 

Last command, any response is discarded, no further command list entries are processed. This is useful if ND is the last command, since the command list will terminate, but discovered nodes will be handled subsequently (asynchronously).

Function Documentation

_xbee_atcmd_debug uint8_t _xbee_cmd_encode_param ( void FAR *  buffer,
uint32_t  value 
)
_xbee_atcmd_debug int _xbee_cmd_handle_response ( xbee_dev_t xbee,
const void FAR *  rawframe,
uint16_t  length,
void FAR *  context 
)
_xbee_atcmd_debug xbee_cmd_request_t FAR * _xbee_cmd_handle_to_address ( int16_t  handle)
_xbee_atcmd_debug int _xbee_cmd_issue_list ( xbee_dev_t xbee,
xbee_command_list_context_t FAR *  clc,
const xbee_cmd_response_t FAR *  response 
)
_xbee_atcmd_debug int _xbee_cmd_list_callback ( const xbee_cmd_response_t FAR *  response)
_xbee_atcmd_debug int _xbee_cmd_modem_status ( xbee_dev_t xbee,
const void FAR *  payload,
uint16_t  length,
void FAR *  context 
)
_xbee_atcmd_debug void _xbee_cmd_query_handle_ai ( const xbee_cmd_response_t FAR *  response,
const struct xbee_atcmd_reg_t FAR *  reg,
void FAR *  base 
)
_xbee_atcmd_debug void _xbee_cmd_query_handle_end ( const xbee_cmd_response_t FAR *  response,
const struct xbee_atcmd_reg_t FAR *  reg,
void FAR *  base 
)
_xbee_atcmd_debug void _xbee_cmd_query_handle_eo ( const xbee_cmd_response_t FAR *  response,
const struct xbee_atcmd_reg_t FAR *  reg,
void FAR *  base 
)
_xbee_atcmd_debug int _xbee_cmd_release_request ( xbee_cmd_request_t FAR *  request)
_xbee_atcmd_debug int xbee_cmd_clear_flags ( int16_t  handle,
uint16_t  flags 
)

Clear the flags for a given AT Command request.

Parameters
[in]handleHandle to the request, as returned by xbee_cmd_create().
[in]flagsOne or more of the following:
  • XBEE_CMD_FLAG_QUEUE_CHANGE don't apply changes until ATAC or another command without this flag is sent
Return values
0flags cleared
-EINVALhandle is not valid
See also
xbee_cmd_set_flags
_xbee_atcmd_debug int16_t xbee_cmd_create ( xbee_dev_t xbee,
const char FAR  command[3] 
)

Allocate an AT Command request.

Parameters
[in]xbeeXBee device to use as the target (local) or to send through (remote). This function will automatically call xbee_cmd_init() if it hasn't already been called for this device.
[in]commandTwo-letter AT Command to send (e.g., "VR", "NI", etc.).
Return values
>0a "handle" to a request that can be built up and sent to a local (serially-attached) or remote XBee module.
-ENOSPCthe AT command table is full (increase the compile-time macro XBEE_CMD_REQUEST_TABLESIZE)
-EINVALan invalid parameter was passed to the function
See also
xbee_cmd_init_device(), xbee_cmd_query_device(), xbee_cmd_set_command(), xbee_cmd_set_callback(), xbee_cmd_set_target(), xbee_cmd_set_param(), xbee_cmd_set_param_bytes(), xbee_cmd_set_param_str(), xbee_cmd_send()
_xbee_atcmd_debug 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.

For an asynchronous method of sending AT commands and getting the response, see xbee_cmd_create, the xbee_cmd_set_* functions and xbee_cmd_send.

Parameters
[in]xbeeXBee device to use as the target.
[in]commandTwo-letter AT Command to send (e.g., "ID", "CH", etc.).
[in]dataOptional big-endian (MSB-first) value to assign to command. Use NULL if command doesn't take a parameter.
[in]lengthNumber of bytes in data; ignored if data is NULL.
Return values
0command sent
-EINVALan invalid parameter was passed to the function
-EBUSYtransmit serial buffer is full, or XBee is not accepting serial data (deasserting /CTS signal).
See also
xbee_cmd_create(), xbee_cmd_set_command(), xbee_cmd_set_callback(), xbee_cmd_set_target(), xbee_cmd_set_param(), xbee_cmd_set_param_bytes(), xbee_cmd_set_param_str(), xbee_cmd_simple()
_xbee_atcmd_debug int xbee_cmd_init_device ( xbee_dev_t xbee)

Initialize the AT Command layer for an XBee device.

You need to call this function before any of the other xbee_cmd_* functions.

Parameters
[in]xbeeXBee device on which to enable the AT Command layer. This function will automatically call xbee_cmd_query_device if it hasn't already been called for this device.
Return values
0the XBee device was successfully configured to send and receive AT commands
-EINVALan invalid parameter was passed to the function
See also
xbee_cmd_query_device(), xbee_cmd_create(), xbee_cmd_set_command(), xbee_cmd_set_callback(), xbee_cmd_set_target(), xbee_cmd_set_param(), xbee_cmd_set_param_bytes(), xbee_cmd_set_param_str(), xbee_cmd_send()
_xbee_atcmd_debug 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.

Parameters
[in,out]xbeeDevice to execute commands
[out]clcList head to set up. This must be static since callback functions access it asynchronously.
[in]listFirst entry of list of commands to execute. The list must be terminated by either #XBEE_ATCMD_REG_END or #XBEE_ATCMD_REG_END_CB. List entries are created using #XBEE_ATCMD_REG macros etc.
[in]baseBase address of a structure to fill in with command results or as a source of values to set.
[in]addressRemote address, or NULL if local device.
Return values
0started sending commands from the list
-ENOSPCthe AT command table is full (increase the compile-time macro XBEE_CMD_REQUEST_TABLESIZE)
-EINVALan invalid parameter was passed to the function
See also
xbee_cmd_list_status()
enum xbee_command_list_status() xbee_cmd_list_status ( xbee_command_list_context_t FAR *  clc)

Determine status of command list execution.

Parameters
[in]clcList head passed to xbee_cmd_list_execute().
Return values
XBEE_COMMAND_LIST_RUNNINGcurrently executing commands
XBEE_COMMAND_LIST_DONEsuccessfully completed
XBEE_COMMAND_LIST_TIMEOUTtimed out
XBEE_COMMAND_LIST_ERRORcompleted with error(s)
See also
xbee_cmd_list_execute()
_xbee_atcmd_debug 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.

This function will likely get called by the XBee stack at some point in the startup/initialization phase.

Use xbee_cmd_query_status() to check on the progress of querying the device.

Parameters
[in,out]xbeeXBee device to query.
[in]refreshif non-zero, just refresh the volatile values (e.g., network settings, as opposed to device serial number)
Return values
0Started querying device.
-EBUSYTransmit serial buffer is full, or XBee is not accepting serial data (deasserting /CTS signal).
See also
xbee_cmd_init_device(), xbee_cmd_query_status()
_xbee_atcmd_debug int xbee_cmd_query_status ( xbee_dev_t xbee)

Check the status of querying an XBee device, as initiated by xbee_cmd_query_device().

Parameters
[in]xbeedevice to check
Return values
0query completed
-EINVALxbee is NULL
-EBUSYquery underway
-ETIMEDOUTquery timed out
-EIOhalted, but query may not have completed (unexpected response)
_xbee_atcmd_debug int xbee_cmd_release_handle ( int16_t  handle)

Release an entry from the request table by marking it as available.

Parameters
[in]handlehandle to the request (as returned by xbee_cmd_create)
Return values
0request freed
-EINVALhandle is not valid
See also
xbee_cmd_create(), xbee_cmd_release_handle()
_xbee_atcmd_debug int xbee_cmd_send ( int16_t  handle)

Send an AT Command to a local or remote XBee device.

Parameters
[in]handleHandle to the request, as returned by xbee_cmd_create().
Return values
0frame sent
-EINVALhandle is not valid
-EBUSYtransmit serial buffer is full, or XBee is not accepting serial data (deasserting /CTS signal).
Note
If the request does not have a callback set, it will be automatically released if xbee_cmd_send() returns 0.
See also
xbee_cmd_create(), xbee_cmd_set_command(), xbee_cmd_set_callback(), xbee_cmd_set_target(), xbee_cmd_set_param(), xbee_cmd_set_param_bytes(), xbee_cmd_set_param_str()
_xbee_atcmd_debug 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.

Parameters
[in]handleHandle to the request, as returned by xbee_cmd_create().
[in]callbackCallback function to receive the AT Command response. This function should take a single parameter (pointer to an xbee_cmd_response_t) and return either #XBEE_ATCMD_DONE (if done with the request handle) or #XBEE_ATCMD_REUSE (if more responses are expected, or the request handle is going to be reused).
1 int atcmd_callback( const xbee_cmd_response_t FAR *response)
[in]contextContext (or "userdata") value to pass to the callback along with the AT Command response when it arrives. Should be set to NULL if not used.
Return values
0callback set
-EINVALhandle is not valid
See also
xbee_cmd_create(), xbee_cmd_set_command(), xbee_cmd_set_target(), xbee_cmd_set_param(), xbee_cmd_set_param_bytes(), xbee_cmd_set_param_str(), xbee_cmd_send()
_xbee_atcmd_debug int xbee_cmd_set_command ( int16_t  handle,
const char FAR  command[3] 
)

Change the command associated with a request.

Parameters
[in]handlehandle to the request, as returned by xbee_cmd_create()
[in]commandtwo-letter AT Command to send (e.g., "VR", "NI", etc.)
Return values
0command changed
-EINVALhandle is not valid
See also
xbee_cmd_create(), xbee_cmd_set_callback(), xbee_cmd_set_target(), xbee_cmd_set_param(), xbee_cmd_set_param_bytes(), xbee_cmd_set_param_str(), xbee_cmd_send()
_xbee_atcmd_debug int xbee_cmd_set_flags ( int16_t  handle,
uint16_t  flags 
)

Set the flags for a given AT Command request.

Parameters
[in]handleHandle to the request, as returned by xbee_cmd_create().
[in]flagsOne or more of the following:
  • XBEE_CMD_FLAG_QUEUE_CHANGE don't apply changes until ATAC or another command without this flag is sent
Return values
0flags set
-EINVALhandle is not valid
See also
xbee_cmd_clear_flags
_xbee_atcmd_debug int xbee_cmd_set_param ( int16_t  handle,
uint32_t  value 
)

Set the parameter (up to 32-bits) for a given AT Command request.

Parameters
[in]handleHandle to the request, as returned by xbee_cmd_create().
[in]valueValue to use as the parameter to the AT Command. For negative values, or values > 0xFFFFFFFF, use xbee_cmd_set_param_bytes(). For string parameters (e.g., for the "NI" command), use xbee_cmd_set_param_str().
Return values
0parameter set
-EINVALhandle is not valid
See also
xbee_cmd_create(), xbee_cmd_set_command(), xbee_cmd_set_callback(), xbee_cmd_set_target(), xbee_cmd_set_param_bytes(), xbee_cmd_set_param_str(), xbee_cmd_send()
_xbee_atcmd_debug 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.

Parameters
[in]handleHandle to the request, as returned by xbee_cmd_create().
[in]dataPointer to bytes (MSB-first) to copy into request.
[in]lengthNumber of bytes to copy. 0 < length <= #XBEE_CMD_MAX_PARAM_LENGTH
Return values
0parameter set
-EINVALhandle or length is not valid
-EMSGSIZElength is greater than #XBEE_CMD_MAX_PARAM_LENGTH
See also
xbee_cmd_create(), xbee_cmd_set_command(), xbee_cmd_set_callback(), xbee_cmd_set_target(), xbee_cmd_set_param(), xbee_cmd_set_param_str(), xbee_cmd_send()
_xbee_atcmd_debug 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).

Parameters
[in]handleHandle to the request, as returned by xbee_cmd_create().
[in]strString to use as the parameter. Must be less than #XBEE_CMD_MAX_PARAM_LENGTH characters long.
Return values
0parameter set
-EINVALhandle is not valid
-EMSGSIZEstr is more than #XBEE_CMD_MAX_PARAM_LENGTH characters.
See also
xbee_cmd_create(), xbee_cmd_set_command(), xbee_cmd_set_callback(), xbee_cmd_set_target(), xbee_cmd_set_param(), xbee_cmd_set_param_bytes(), xbee_cmd_send()
_xbee_atcmd_debug 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. By default, xbee_cmd_create() configures the request as a local AT Command for the serially-attached XBee module. Use this function to send the command to a remote device.

Parameters
[in]handleHandle to the request, as returned by xbee_cmd_create().
[in]ieeePointer to 64-bit IEEE hardware address of target, or NULL to switch back to the local XBee device.
  • #WPAN_IEEE_ADDR_BROADCAST for broadcast.
  • #WPAN_IEEE_ADDR_COORDINATOR for the coordinator (use #WPAN_NET_ADDR_UNDEFINED for the network address).
  • #WPAN_IEEE_ADDR_UNDEFINED to use the 16-bit network address.
[in]network16-bit network address of target.
  • #WPAN_NET_ADDR_UNDEFINED if the node's network address isn't known or this is a DigiMesh network.
  • #WPAN_NET_ADDR_COORDINATOR for the coordinator (use the coordinator's actual IEEE address for the ieee parameter).
  • #WPAN_NET_ADDR_BCAST_NOT_ASLEEP to broadcast to all nodes that aren't sleeping.
  • #WPAN_NET_ADDR_BCAST_ROUTERS to broadcast to the coordinator and all routers.
Return values
0target set
-EINVALhandle is not valid
-ENOSYSfunction not implemented (XBEE_CMD_DISABLE_REMOTE defined)
See also
xbee_cmd_create(), xbee_cmd_set_command(), xbee_cmd_set_callback(), xbee_cmd_set_param(), xbee_cmd_set_param_bytes(), xbee_cmd_set_param_str(), xbee_cmd_send()
_xbee_atcmd_debug 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.

Parameters
[in]xbeeXBee device to use as the target.
[in]commandTwo-letter AT Command to send (e.g., "ID", "CH", etc.).
[in]valueValue to use as the parameter to the AT Command.
Return values
0command sent
-EINVALan invalid parameter was passed to the function
-EBUSYtransmit serial buffer is full, or XBee is not accepting serial data (deasserting /CTS signal).
See also
xbee_cmd_create(), xbee_cmd_set_command(), xbee_cmd_set_callback(), xbee_cmd_set_target(), xbee_cmd_set_param(), xbee_cmd_set_param_bytes(), xbee_cmd_set_param_str(), xbee_cmd_execute()
_xbee_atcmd_debug 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.

Returns
>0 number of requests expired
0 none of the requests in the table expired
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.

Parameters
[in]xbeedevice to identify
[in]identifyTRUE if XBee should be in identify mode
See also
xbee_zcl_identify, zcl_identify_isactive, ZCL_CLUST_ENTRY_IDENTIFY_SERVER

Variable Documentation

const xbee_atcmd_reg_t _xbee_atcmd_query_regs[]
Initial value:
= {
XBEE_ATCMD_REG( 'H', 'V', XBEE_CLT_COPY_BE, xbee_dev_t, hardware_version),
XBEE_ATCMD_REG( 'V', 'R', XBEE_CLT_COPY_BE, xbee_dev_t, firmware_version),
XBEE_ATCMD_REG( 'S', 'H', XBEE_CLT_COPY, xbee_dev_t, wpan_dev.address.ieee.l[0]),
XBEE_ATCMD_REG( 'S', 'L', XBEE_CLT_COPY, xbee_dev_t, wpan_dev.address.ieee.l[1]),
#ifdef XBEE_DEVICE_ENABLE_ATMODE
XBEE_ATCMD_REG( 'G', 'T', XBEE_CLT_COPY_BE, xbee_dev_t, guard_time),
XBEE_ATCMD_REG( 'C', 'T', XBEE_CLT_COPY_BE, xbee_dev_t, idle_timeout),
XBEE_ATCMD_REG( 'C', 'C', XBEE_CLT_COPY, xbee_dev_t, escape_char),
#endif
XBEE_ATCMD_REG_CB( 'E', 'O', _xbee_cmd_query_handle_eo, 0),
XBEE_ATCMD_REG_CB( 'A', 'I', _xbee_cmd_query_handle_ai, 0),
XBEE_ATCMD_REG( 'N', 'P', XBEE_CLT_COPY_BE, xbee_dev_t, wpan_dev.payload),
XBEE_ATCMD_REG( 'M', 'Y', XBEE_CLT_COPY_BE, xbee_dev_t, wpan_dev.address.network),
XBEE_ATCMD_REG_END_CB(_xbee_cmd_query_handle_end, 0)
}
_xbee_atcmd_debug void _xbee_cmd_query_handle_end(const xbee_cmd_response_t FAR *response, const struct xbee_atcmd_reg_t FAR *reg, void FAR *base)
Definition: xbee_atcmd.c:645
Data must be 1,2 or 4 bytes, assumed unsigned.
Definition: atcmd.h:449
_xbee_atcmd_debug void _xbee_cmd_query_handle_eo(const xbee_cmd_response_t FAR *response, const struct xbee_atcmd_reg_t FAR *reg, void FAR *base)
Definition: xbee_atcmd.c:577
Definition: device.h:346
_xbee_atcmd_debug void _xbee_cmd_query_handle_ai(const xbee_cmd_response_t FAR *response, const struct xbee_atcmd_reg_t FAR *reg, void FAR *base)
Definition: xbee_atcmd.c:609
Copy response data byte-for-byte to base struct.
Definition: atcmd.h:448
xbee_command_list_context_t _xbee_atcmd_query_regs_head
uint8_t command

two-character AT Command

Command from original request.

uint8_t frame_id

1 to 255, or 0 to suppress the Transmit Status response

ID from request, used to match response to request.

addr64 ieee_address

64-bit IEEE address (big-endian) of target

64-bit IEEE address (big-endian) of source.

64-bit IEEE address (big-endian) of responder.

uint16_t network_address_be

16-bit network address (big-endian) of target

16-bit network address (big-endian) of source.

16-bit network address (big-endian) of responder.

uint8_t options

Options byte (see XBEE_REMOTE_AT_OPT_* macros)

combination of XBEE_TX_OPT_* macros

bitfield, see XBEE_RX_OPT_xxx macros

uint8_t status

See enum xbee_at_resp_status. Note that DigiMesh uses the upper nibble for additional flags – use XBEE_AT_RESP_STATUS() macro when comparing this field to the xbee_at_resp_status enum.

uint8_t value

First byte of multi-byte value.

variable length, only if ZCL_STATUS_SUCCESS

FAR xbee_cmd_request_t xbee_cmd_request_table[XBEE_CMD_REQUEST_TABLESIZE]

Table used to keep track of outstanding requests.

FAR xbee_cmd_request_t xbee_cmd_request_table[XBEE_CMD_REQUEST_TABLESIZE]

Table used to keep track of outstanding requests.

xbee_frame_local_at_resp_t
xbee_frame_remote_at_resp_t
xbee_header_local_at_req_t
xbee_header_local_at_resp_t
xbee_header_remote_at_req_t
xbee_header_remote_at_resp_t