40#if defined(__cplusplus)
48#define XBEE_MAX_FRAME_DATA_SIZE 256
49#define API_SEND_SUCCESS 0
50#define API_SEND_ERROR_TIMEOUT -1
51#define API_SEND_ERROR_INVALID_COMMAND -2
52#define API_SEND_ERROR_UART_FAILURE -3
53#define API_SEND_ERROR_FRAME_TOO_LARGE -4
54#define API_SEND_AT_CMD_ERROR -5
55#define API_SEND_AT_CMD_RESONSE_TIMEOUT -6
309int apiSendFrame(
XBee* self,uint8_t frame_type,
const uint8_t *data, uint16_t len);
311 uint8_t paramLength, uint8_t *responseBuffer, uint8_t *responseLength, uint32_t timeoutMs);
317#if defined(__cplusplus)
Structure to represent an XBee API frame.
Definition: xbee_api_frames.h:298
xbee_api_frame_type_t type
Type of the API frame.
Definition: xbee_api_frames.h:299
uint8_t checksum
Checksum of the API frame.
Definition: xbee_api_frames.h:301
uint16_t length
Length of the frame data.
Definition: xbee_api_frames.h:300
Header file for the XBee class.
xbee_deliveryStatus_t
Delivery status codes for XBee Transmit Status frames (0x89).
Definition: xbee_api_frames.h:104
@ XBEE_DELIVERY_STATUS_NO_ACK
Definition: xbee_api_frames.h:106
@ XBEE_DELIVERY_STATUS_NOT_JOINED
Definition: xbee_api_frames.h:111
@ XBEE_DELIVERY_STATUS_ROUTE_NOT_FOUND
Definition: xbee_api_frames.h:114
@ XBEE_DELIVERY_STATUS_SUCCESS
Definition: xbee_api_frames.h:105
@ XBEE_DELIVERY_STATUS_SELF_ADDRESSED
Definition: xbee_api_frames.h:112
@ XBEE_DELIVERY_STATUS_INVALID_DEST
Definition: xbee_api_frames.h:109
@ XBEE_DELIVERY_STATUS_NET_ACK_FAILURE
Definition: xbee_api_frames.h:110
@ XBEE_DELIVERY_STATUS_ADDRESS_NOT_FOUND
Definition: xbee_api_frames.h:113
@ XBEE_DELIVERY_STATUS_CCA_FAILURE
Definition: xbee_api_frames.h:107
@ XBEE_DELIVERY_STATUS_PAYLOAD_TOO_LARGE
Definition: xbee_api_frames.h:115
@ XBEE_DELIVERY_STATUS_PURGED
Definition: xbee_api_frames.h:108
xbee_api_frame_type_t
Enumeration of XBee API frame types.
Definition: xbee_api_frames.h:199
@ XBEE_API_TYPE_LR_RX_PACKET
Frame for receiving data packets in LoRaWAN.
Definition: xbee_api_frames.h:211
@ XBEE_API_TYPE_CELLULAR_TX_IPV4
Frame for transmitting IPv4 data (XBee Cellular)
Definition: xbee_api_frames.h:222
@ XBEE_API_TYPE_AT_RESPONSE
Frame for receiving AT command responses.
Definition: xbee_api_frames.h:205
@ XBEE_API_TYPE_REMOTE_AT_COMMAND
Frame for sending remote AT commands (GPIO/ADC)
Definition: xbee_api_frames.h:228
@ XBEE_API_TYPE_LR_JOIN_REQUEST
Frame for LoRaWAN join requests.
Definition: xbee_api_frames.h:209
@ XBEE_API_TYPE_CELLULAR_MODEM_STATUS
Frame for cellular modem status (XBee Cellular)
Definition: xbee_api_frames.h:224
@ XBEE_API_TYPE_3RF_REMOTE_AT_COMMAND
Frame for sending remote AT commands (XBee 3 RF)
Definition: xbee_api_frames.h:216
@ XBEE_API_TYPE_AT_COMMAND
Frame for sending AT commands.
Definition: xbee_api_frames.h:202
@ XBEE_API_TYPE_3RF_RX_PACKET
Frame for receiving data packets (XBee 3 RF)
Definition: xbee_api_frames.h:218
@ XBEE_API_TYPE_CELLULAR_RX_IPV4
Frame for receiving IPv4 data (XBee Cellular)
Definition: xbee_api_frames.h:223
@ XBEE_API_TYPE_TX_STATUS
Frame for delivery status reports.
Definition: xbee_api_frames.h:206
@ XBEE_API_TYPE_3RF_REMOTE_AT_RESPONSE
Frame for receiving remote AT responses (XBee 3 RF)
Definition: xbee_api_frames.h:217
@ XBEE_API_TYPE_IO_SAMPLE_RX_INDICATOR
Frame for receiving IO samples with explicit addressing (GPIO/ADC)
Definition: xbee_api_frames.h:230
@ XBEE_API_TYPE_TX_REQUEST
Frame for transmitting data.
Definition: xbee_api_frames.h:203
@ XBEE_API_TYPE_LR_TX_REQUEST
Frame for transmitting data in LoRaWAN.
Definition: xbee_api_frames.h:210
@ XBEE_API_TYPE_LR_EXPLICIT_TX_STATUS
Frame for explicit TX status in LoRaWAN.
Definition: xbee_api_frames.h:213
@ XBEE_API_TYPE_MODEM_STATUS
Frame for modem status reports.
Definition: xbee_api_frames.h:204
@ XBEE_API_TYPE_LR_EXPLICIT_RX_PACKET
Frame for receiving explicitly addressed packets in LoRaWAN.
Definition: xbee_api_frames.h:212
@ XBEE_API_TYPE_IO_DATA_SAMPLE_RX
Frame for receiving IO data samples (GPIO/ADC)
Definition: xbee_api_frames.h:227
@ XBEE_API_TYPE_REMOTE_AT_RESPONSE
Frame for receiving remote AT command responses (GPIO/ADC)
Definition: xbee_api_frames.h:229
@ XBEE_API_TYPE_3RF_RX_EXPLICIT_PACKET
Frame for receiving explicitly addressed packets (XBee 3 RF)
Definition: xbee_api_frames.h:219
void xbeeHandleAtResponse(XBee *self, xbee_api_frame_t *frame)
Definition: xbee_api_frames.c:439
void apiHandleFrame(XBee *self, xbee_api_frame_t frame)
Calls registered handlers based on the received API frame type.
Definition: xbee_api_frames.c:343
int apiSendAtCommandAndGetResponse(XBee *self, at_command_t command, const uint8_t *parameter, uint8_t paramLength, uint8_t *responseBuffer, uint8_t *responseLength, uint32_t timeoutMs)
Sends an AT command via an API frame and waits for the response.
Definition: xbee_api_frames.c:387
int apiSendAtCommand(XBee *self, at_command_t command, const uint8_t *parameter, uint8_t paramLength)
Sends an AT command through an API frame.
Definition: xbee_api_frames.c:160
api_receive_status_t
Enumeration of status codes for receiving XBee API frames.
Definition: xbee_api_frames.h:245
@ API_RECEIVE_ERROR_TIMEOUT_CHECKSUM
Timeout or error reading checksum.
Definition: xbee_api_frames.h:253
@ API_RECEIVE_ERROR_INVALID_START_DELIMITER
Invalid start delimiter received.
Definition: xbee_api_frames.h:249
@ API_RECEIVE_SUCCESS
Frame received successfully.
Definition: xbee_api_frames.h:246
@ API_RECEIVE_ERROR_UART_FAILURE
UART read or write failure.
Definition: xbee_api_frames.h:255
@ API_RECEIVE_ERROR_TIMEOUT_START_DELIMITER
Timeout or error reading start delimiter.
Definition: xbee_api_frames.h:248
@ API_RECEIVE_ERROR_TIMEOUT_LENGTH
Timeout or error reading frame length.
Definition: xbee_api_frames.h:250
@ API_RECEIVE_ERROR_FRAME_TOO_LARGE
Frame length exceeds buffer size.
Definition: xbee_api_frames.h:251
@ API_RECEIVE_ERROR_INVALID_CHECKSUM
Invalid checksum detected.
Definition: xbee_api_frames.h:254
@ API_RECEIVE_ERROR_TIMEOUT_DATA
Timeout or error reading frame data.
Definition: xbee_api_frames.h:252
@ API_RECEIVE_ERROR_INVALID_POINTER
Invalid frame pointer (NULL)
Definition: xbee_api_frames.h:247
int apiSendFrame(XBee *self, uint8_t frame_type, const uint8_t *data, uint16_t len)
Sends an XBee API frame.
Definition: xbee_api_frames.c:81
api_receive_status_t apiReceiveApiFrame(XBee *self, xbee_api_frame_t *frame)
Checks for and receives an XBee API frame, populating the provided frame pointer.
Definition: xbee_api_frames.c:255
#define XBEE_MAX_FRAME_DATA_SIZE
Definition: xbee_api_frames.h:48
void xbeeHandleRxPacket(XBee *self, xbee_api_frame_t *frame)
void xbeeHandleModemStatus(XBee *self, xbee_api_frame_t *frame)
Definition: xbee_api_frames.c:472
Header file for XBee AT commands.
at_command_t
Enumeration of common and module-specific XBee AT commands.
Definition: xbee_at_cmds.h:55