Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
XBee Class Reference
class for XBee module API mode interface More...
#include <XBee.h>
Public Types | |
enum | FrameType { None = 0, ATCommandResponse, ModemStatus, ZigBeeTransmitStatus, ZigBeeReceivePacket, ZigBeeExplicitRxIndicator, ZigBeeIODataSampleRxIndicator, XBeeSensorReadIndicator, NodeIdentificationIndicator, RemoteCommandResponse, Other } |
Frame type declaration for XBee API frames. More... | |
enum | ValueType { FrameID, ATCommand, Status, CommandData, Address16, Address64, RetryCount, DeliveryStatus, DiscoveryStatus, ReceiveOptions, ReceivedData, RawData } |
Value type declarations for retrieving frame data contents. More... | |
Public Member Functions | |
XBee (Serial &ser, int apiMode=2, bool debug=false) | |
creates an XBee interface object. | |
XBee (PinName tx, PinName rx, int apiMode=2, bool debug=false) | |
creates an XBee interface object. | |
XBee (Serial &ser, Serial &mon, int apiMode=2, bool debug=false) | |
creates an XBee interface object. | |
XBee (PinName tx, PinName rx, Serial &mon, int apiMode=2, bool debug=false) | |
creates an XBee interface object. | |
bool | init (float timeout=15.0) |
initializes XBee module. | |
void | setDestination (XBeeAddress64 address64, XBeeAddress16 address16=0xFFFE) |
sets destination addresses. | |
void | setDestination (uint64_t address64, uint16_t address16=0xFFFE) |
sets destination addresses. | |
void | setDestination (char address64[], char address16[]) |
sets destination addresses. | |
void | sendCommand (const char *command, int8_t param, bool queue=false) |
sends an AT command. | |
void | sendCommand (const char *command, const uint8_t *param=0, int param_length=0, bool queue=false) |
sends an AT command. | |
void | sendRemoteCommand (const char *command, int8_t param) |
sends a remote AT command. | |
void | sendRemoteCommand (const char *command, const uint8_t *param=0, int param_length=0, char options=0x02) |
sends a remote AT command. | |
void * | executeCommand (const char *command, int8_t param) |
executes an AT command and gets the result. | |
void * | executeCommand (const char *command, const uint8_t *param=0, int laram_length=0) |
executes an AT command and gets the result. | |
bool | send (const char *data, int length, bool confirm) |
sends data to the XBee(s) at the destination address. | |
bool | sendConfirm (const char *data, int length) |
sends data and confirm the transmit status. | |
int | printf (const char *format,...) |
sends data to the destination using printf format. | |
FrameType | receive (float timeout=3.0) |
receives data frame from the XBee module. | |
bool | scan (XBeeFrameID &id) |
scan received data | |
bool | scan (ValueType type, char *value, int maxlength=1, int *length=0) |
scan received data according to the specified format. | |
int | getFirmwareVersion () |
gets the XBee firmware version. | |
char | getFrameID () |
gets the current frame ID. | |
void | setDebug (bool debug) |
sets to run in debug mode. | |
void | dump () |
displays received data in dump format. | |
void | dumpAll () |
displays the internal data fields and receive buffer in dump format. | |
operator bool () | |
operator overloading for testing XBee modem connection status. |
Detailed Description
class for XBee module API mode interface
Definition at line 40 of file XBee.h.
Member Enumeration Documentation
enum FrameType |
Frame type declaration for XBee API frames.
- Enumerator:
None Empty data.
ATCommandResponse AT Command Response API frame.
ModemStatus Modem Status API frame.
ZigBeeTransmitStatus ZigBee Transmit Status API frame.
ZigBeeReceivePacket ZigBee Receive Packet API frame.
ZigBeeExplicitRxIndicator ZigBee Explicit Rx Indicator API frame.
ZigBeeIODataSampleRxIndicator ZigBee I/O Data Sample Rx Indicator API frame.
XBeeSensorReadIndicator XBee Sensor Read Indicator API frame.
NodeIdentificationIndicator Node Identification Indicator API frame.
RemoteCommandResponse Remote Command Response API frame.
Other Unknown API frame.
enum ValueType |
Value type declarations for retrieving frame data contents.
- Enumerator:
Constructor & Destructor Documentation
XBee | ( | Serial & | ser, |
int | apiMode = 2 , |
||
bool | debug = false |
||
) |
XBee | ( | PinName | tx, |
PinName | rx, | ||
int | apiMode = 2 , |
||
bool | debug = false |
||
) |
XBee | ( | Serial & | ser, |
Serial & | mon, | ||
int | apiMode = 2 , |
||
bool | debug = false |
||
) |
creates an XBee interface object.
- Parameters:
-
ser Serial object through which XBee module is connected to mbed mon alternate Serial object for monitoring (use serial ports other than USBTX/USBRX) apiMode API mode either 1 or 2 (use escape; default) debug display debugging (I/O state) information through LEDs
XBee | ( | PinName | tx, |
PinName | rx, | ||
Serial & | mon, | ||
int | apiMode = 2 , |
||
bool | debug = false |
||
) |
Member Function Documentation
void dumpAll | ( | ) |
void * executeCommand | ( | const char * | command, |
const uint8_t * | param = 0 , |
||
int | laram_length = 0 |
||
) |
executes an AT command and gets the result.
- Parameters:
-
command AT command char string param parameter to the AT command (pointer to byte array) param_length parameter length in bytes
- Returns:
- pointer to the command result, if the result is a number (char, short, long, long long), the address to the number will be returned; otherwise the address to the byte array containing the command response will be returned.
void * executeCommand | ( | const char * | command, |
int8_t | param | ||
) |
executes an AT command and gets the result.
- Parameters:
-
command AT command char string param parameter to the AT command
- Returns:
- pointer to the command result, if the result is a number (char, short, long, int64_t), the address to the number will be returned; otherwise the address to the byte array containing the command response will be returned.
int getFirmwareVersion | ( | ) |
char getFrameID | ( | ) |
bool init | ( | float | timeout = 15.0 ) |
operator bool | ( | ) |
int printf | ( | const char * | format, |
... | |||
) |
XBee::FrameType receive | ( | float | timeout = 3.0 ) |
receives data frame from the XBee module.
- Parameters:
-
timeout seconds bofer time out
- Returns:
- FrameType of the received frame data
Definition at line 30 of file Receive.cpp.
bool scan | ( | XBeeFrameID & | id ) |
bool scan | ( | ValueType | type, |
char * | value, | ||
int | maxlength = 1 , |
||
int * | length = 0 |
||
) |
scan received data according to the specified format.
- Parameters:
-
type ValueType of the data to be scanned value pointer to the byte array to store the scanned value maxlength max size of the value in bytes length pointer to an int to receive the actual data length true if scan succeeded, false otherwise
bool send | ( | const char * | data, |
int | length, | ||
bool | confirm = true |
||
) |
void sendCommand | ( | const char * | command, |
const uint8_t * | param = 0 , |
||
int | param_length = 0 , |
||
bool | queue = false |
||
) |
void sendCommand | ( | const char * | command, |
int8_t | param, | ||
bool | queue = false |
||
) |
bool sendConfirm | ( | const char * | data, |
int | length | ||
) |
void sendRemoteCommand | ( | const char * | command, |
int8_t | param | ||
) |
void sendRemoteCommand | ( | const char * | command, |
const uint8_t * | param = 0 , |
||
int | param_length = 0 , |
||
char | options = 0x02 |
||
) |
void setDebug | ( | bool | debug ) |
void setDestination | ( | uint64_t | address64, |
uint16_t | address16 = 0xFFFE |
||
) |
void setDestination | ( | char | address64[], |
char | address16[] | ||
) |
Generated on Wed Jul 20 2022 22:15:57 by
