Xbee Arduino
Arduino Driver for Xbee
Loading...
Searching...
No Matches
XBeeArduino Class Reference

A class to interface with XBee modules on Arduino platforms. More...

#include <XBeeArduino.h>

Public Member Functions

 XBeeArduino (Stream *serialPort, uint32_t baudrate, XBeeModuleType moduleType, void(*onReceiveCallback)(void *), void(*onSendCallback)(void *))
 Constructor for XBeeArduino class. More...
 
 ~XBeeArduino ()
 Destructor for XBeeArduino class. More...
 
bool begin ()
 Initializes the XBee module. More...
 
bool connect ()
 Connects the XBee module to the network. More...
 
void process ()
 Lets the XBee class process. More...
 
bool disconnect ()
 Disconnects the XBee module from the network. More...
 
template<typename T >
bool sendData (const T &data)
 Sends data through the XBee module. More...
 
bool isConnected ()
 Checks if the XBee module is connected to the network. More...
 
void reset ()
 Resets the XBee module. More...
 
bool setApiOptions (const uint8_t options)
 Sets the API options for XBee. More...
 
bool getLoRaWANDevEUI (uint8_t *devEUI, uint8_t length)
 Retrieves the DevEUI of the LoRaWAN XBee module. More...
 
bool setLoRaWANAppEUI (const char *value)
 Sets the App EUI of the LoRaWAN XBee module. More...
 
bool setLoRaWANAppKey (const char *value)
 Sets the App Key of the LoRaWAN XBee module. More...
 
bool setLoRaWANNwkKey (const char *value)
 Sets the App Key of the LoRaWAN XBee module. More...
 
bool applyChanges (void)
 Applys config changes on XBee. More...
 
bool writeConfig (void)
 Write config on XBee. More...
 
bool setLoRaWANClass (const char value)
 Sets the LoRaWAN Class on the XBee LR module. More...
 
bool setLoRaWANActivationMode (const uint8_t value)
 Sets the LoRaWAN Activation Mode on the XBee LR module. More...
 
bool setLoRaWANADR (const uint8_t value)
 Sets the LoRaWAN Adaptive Data Rate (ADR) on the XBee LR module. More...
 
bool setLoRaWANDataRate (const uint8_t value)
 Sets the LoRaWAN Data Rate on the XBee LR module. More...
 
bool setLoRaWANRegion (const uint8_t value)
 Sets the LoRaWAN Region on the XBee LR module. More...
 
bool setLoRaWANDutyCycle (const uint8_t value)
 Sets the LoRaWAN Duty Cycle on the XBee LR module. More...
 
bool getLoRaWANSpecVersion (char *responseBuffer, uint8_t buffer_size)
 Gets the LoRaWAN Specification Version from the XBee LR module. More...
 
bool setLoRaWANJoinRX1Delay (const uint32_t value)
 Sets the LoRaWAN Join RX1 Delay on the XBee LR module. More...
 
bool setLoRaWANJoinRX2Delay (const uint32_t value)
 Sets the LoRaWAN Join RX2 Delay on the XBee LR module. More...
 
bool setLoRaWANRX1Delay (const uint32_t value)
 Sets the LoRaWAN RX1 Delay on the XBee LR module. More...
 
bool setLoRaWANRX2Delay (const uint32_t value)
 Sets the LoRaWAN RX2 Delay on the XBee LR module. More...
 
bool setLoRaWANRX2DataRate (const uint8_t value)
 Sets the LoRaWAN RX2 Data Rate on the XBee LR module. More...
 
bool setLoRaWANRX2Frequency (const uint32_t value)
 Sets the LoRaWAN RX2 Frequency on the XBee LR module. More...
 
bool setLoRaWANTransmitPower (const uint8_t value)
 Sets the LoRaWAN Transmit Power on the XBee LR module. More...
 

Detailed Description

A class to interface with XBee modules on Arduino platforms.

This class provides methods for interacting with XBee modules. It includes functionality for initializing the module, sending/receiving data, and configuring the module.

Constructor & Destructor Documentation

◆ XBeeArduino()

XBeeArduino::XBeeArduino ( Stream *  serialPort,
uint32_t  baudrate,
XBeeModuleType  moduleType,
void(*)(void *)  onReceiveCallback,
void(*)(void *)  onSendCallback 
)

Constructor for XBeeArduino class.

Parameters
serialPortA pointer to a Stream object (HardwareSerial or SoftwareSerial).
baudrateThe baud rate for UART communication.
moduleTypeThe type of XBee module (standard or LoRa).
onReceiveCallbackA callback function to handle received data.
onSendCallbackA callback function to handle post-send events.

Initializes the XBee module based on the type and sets up callbacks and UART communication.

Parameters
serialPortA pointer to a Stream object (HardwareSerial or SoftwareSerial).
baudrateThe baud rate for UART communication.
moduleTypeThe type of XBee module (standard or LoRa).
onReceiveCallbackA callback function to handle received data.
onSendCallbackA callback function to handle post-send events.

◆ ~XBeeArduino()

XBeeArduino::~XBeeArduino ( )

Destructor for XBeeArduino class.

Ensures proper disconnection and cleanup of the XBee module.

Member Function Documentation

◆ applyChanges()

bool XBeeArduino::applyChanges ( void  )

Applys config changes on XBee.

Returns
True if the changes are applied successfully, otherwise false.

◆ begin()

bool XBeeArduino::begin ( )

Initializes the XBee module.

Returns
True if initialization is successful, otherwise false.

◆ connect()

bool XBeeArduino::connect ( )

Connects the XBee module to the network.

Returns
True if the connection is successful, otherwise false.

◆ disconnect()

bool XBeeArduino::disconnect ( )

Disconnects the XBee module from the network.

Returns
True if disconnection is successful, otherwise false.

◆ getLoRaWANDevEUI()

bool XBeeArduino::getLoRaWANDevEUI ( uint8_t *  devEUI,
uint8_t  length 
)

Retrieves the DevEUI of the LoRaWAN XBee module.

Parameters
devEUIA pointer to a buffer where the DevEUI will be stored.
Returns
True if the DevEUI is retrieved successfully, otherwise false.

◆ getLoRaWANSpecVersion()

bool XBeeArduino::getLoRaWANSpecVersion ( char *  responseBuffer,
uint8_t  buffer_size 
)

Gets the LoRaWAN Specification Version from the XBee LR module.

Wrapper function to get the LoRaWAN Specification Version from the XBee LR module.

This function sends the AT_LV command to retrieve the LoRaWAN Specification Version currently in use by the XBee LR module.

Parameters
[out]responseBufferBuffer to store the retrieved version string.
[in]buffer_sizeThe size of the response buffer.
Returns
bool Returns true if the command was successfully sent and a valid response was received, otherwise false.

This function sends the AT_LV command to retrieve the LoRaWAN Specification Version currently in use by the XBee LR module.

Parameters
[out]responseBufferBuffer to store the retrieved version string.
[in]buffer_sizeThe size of the response buffer.
Returns
bool Returns true if the command was successfully sent and a valid response was received, otherwise false.

◆ isConnected()

bool XBeeArduino::isConnected ( )

Checks if the XBee module is connected to the network.

Returns
True if the module is connected, otherwise false.

◆ process()

void XBeeArduino::process ( )

Lets the XBee class process.

Returns
void

◆ reset()

void XBeeArduino::reset ( )

Resets the XBee module.

◆ sendData()

template<typename T >
template bool XBeeArduino::sendData< XBeeLRPacket_s > ( const T &  data)

Sends data through the XBee module.

Parameters
dataThe data to be sent.
Returns
True if the data is sent successfully, otherwise false.

◆ setApiOptions()

bool XBeeArduino::setApiOptions ( const uint8_t  options)

Sets the API options for XBee.

Parameters
optionsThe API options to set.
Returns
True if the options are set successfully, otherwise false.

◆ setLoRaWANActivationMode()

bool XBeeArduino::setLoRaWANActivationMode ( const uint8_t  value)

Sets the LoRaWAN Activation Mode on the XBee LR module.

Wrapper function to set the LoRaWAN Activation Mode on the XBee LR module.

This function sends the AT_AM command to set the Activation Mode (e.g., OTAA or ABP) on the XBee LR module.

Parameters
[in]valueThe Activation Mode to be set.
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

This function sends the AT_AM command to set the Activation Mode (e.g., OTAA or ABP) on the XBee LR module.

Parameters
[in]valueThe Activation Mode to be set.
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

◆ setLoRaWANADR()

bool XBeeArduino::setLoRaWANADR ( const uint8_t  value)

Sets the LoRaWAN Adaptive Data Rate (ADR) on the XBee LR module.

Wrapper function to set the LoRaWAN Adaptive Data Rate (ADR) on the XBee LR module.

This function sends the AT_AD command to enable or disable the Adaptive Data Rate (ADR) feature on the XBee LR module.

Parameters
[in]valueThe ADR setting to be set (e.g., 0 for disable, 1 for enable).
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

This function sends the AT_AD command to enable or disable the Adaptive Data Rate (ADR) feature on the XBee LR module.

Parameters
[in]valueThe ADR setting to be set (e.g., 0 for disable, 1 for enable).
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

◆ setLoRaWANAppEUI()

bool XBeeArduino::setLoRaWANAppEUI ( const char *  value)

Sets the App EUI of the LoRaWAN XBee module.

Parameters
valueA pointer to a buffer where the App EUI will be stored.
Returns
True if the AppEUI is set successfully, otherwise false.

◆ setLoRaWANAppKey()

bool XBeeArduino::setLoRaWANAppKey ( const char *  value)

Sets the App Key of the LoRaWAN XBee module.

Parameters
valueA pointer to a buffer where the App Key will be stored.
Returns
True if the App Key is set successfully, otherwise false.

◆ setLoRaWANClass()

bool XBeeArduino::setLoRaWANClass ( const char  value)

Sets the LoRaWAN Class on the XBee LR module.

Wrapper function to set the LoRaWAN Class on the XBee LR module.

This function sends the AT_LC command to set the LoRaWAN Class (e.g., 'A', 'B', 'C') on the XBee LR module.

Parameters
[in]valueThe LoRaWAN Class to be set ('A', 'B', or 'C').
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

This function sends the AT_LC command to set the LoRaWAN Class (e.g., 'A', 'B', 'C') on the XBee LR module.

Parameters
[in]valueThe LoRaWAN Class to be set ('A', 'B', or 'C').
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

◆ setLoRaWANDataRate()

bool XBeeArduino::setLoRaWANDataRate ( const uint8_t  value)

Sets the LoRaWAN Data Rate on the XBee LR module.

Wrapper function to set the LoRaWAN Data Rate on the XBee LR module.

This function sends the AT_DR command to set the Data Rate on the XBee LR module.

Parameters
[in]valueThe Data Rate to be set.
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

This function sends the AT_DR command to set the Data Rate on the XBee LR module.

Parameters
[in]valueThe Data Rate to be set.
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

◆ setLoRaWANDutyCycle()

bool XBeeArduino::setLoRaWANDutyCycle ( const uint8_t  value)

Sets the LoRaWAN Duty Cycle on the XBee LR module.

Wrapper function to set the LoRaWAN Duty Cycle on the XBee LR module.

This function sends the AT_DC command to configure the duty cycle settings on the XBee LR module.

Parameters
[in]valueThe Duty Cycle to be set.
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

This function sends the AT_DC command to configure the duty cycle settings on the XBee LR module.

Parameters
[in]valueThe Duty Cycle to be set.
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

◆ setLoRaWANJoinRX1Delay()

bool XBeeArduino::setLoRaWANJoinRX1Delay ( const uint32_t  value)

Sets the LoRaWAN Join RX1 Delay on the XBee LR module.

Wrapper function to set the LoRaWAN Join RX1 Delay on the XBee LR module.

This function sends the AT_J1 command to set the RX1 delay (in milliseconds) for the Join Accept message on the XBee LR module.

Parameters
[in]valueThe RX1 Delay value to be set (in milliseconds).
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

This function sends the AT_J1 command to set the RX1 delay (in milliseconds) for the Join Accept message on the XBee LR module.

Parameters
[in]valueThe RX1 Delay value to be set (in milliseconds).
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

◆ setLoRaWANJoinRX2Delay()

bool XBeeArduino::setLoRaWANJoinRX2Delay ( const uint32_t  value)

Sets the LoRaWAN Join RX2 Delay on the XBee LR module.

Wrapper function to set the LoRaWAN Join RX2 Delay on the XBee LR module.

This function sends the AT_J2 command to set the RX2 delay (in milliseconds) for the Join Accept message on the XBee LR module.

Parameters
[in]valueThe RX2 Delay value to be set (in milliseconds).
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

This function sends the AT_J2 command to set the RX2 delay (in milliseconds) for the Join Accept message on the XBee LR module.

Parameters
[in]valueThe RX2 Delay value to be set (in milliseconds).
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

◆ setLoRaWANNwkKey()

bool XBeeArduino::setLoRaWANNwkKey ( const char *  value)

Sets the App Key of the LoRaWAN XBee module.

Parameters
valueA pointer to a buffer where the App Key will be stored.
Returns
True if the App Key is set successfully, otherwise false.

◆ setLoRaWANRegion()

bool XBeeArduino::setLoRaWANRegion ( const uint8_t  value)

Sets the LoRaWAN Region on the XBee LR module.

Wrapper function to set the LoRaWAN Region on the XBee LR module.

This function sends the AT_LR command to set the operational region (e.g., US915, EU868) on the XBee LR module.

Parameters
[in]valueThe Region to be set.
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

This function sends the AT_LR command to set the operational region (e.g., US915, EU868) on the XBee LR module.

Parameters
[in]valueThe Region to be set.
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

◆ setLoRaWANRX1Delay()

bool XBeeArduino::setLoRaWANRX1Delay ( const uint32_t  value)

Sets the LoRaWAN RX1 Delay on the XBee LR module.

Wrapper function to set the LoRaWAN RX1 Delay on the XBee LR module.

This function sends the AT_D1 command to set the RX1 delay (in milliseconds) on the XBee LR module.

Parameters
[in]valueThe RX1 Delay value to be set (in milliseconds).
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

This function sends the AT_D1 command to set the RX1 delay (in milliseconds) on the XBee LR module.

Parameters
[in]valueThe RX1 Delay value to be set (in milliseconds).
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

◆ setLoRaWANRX2DataRate()

bool XBeeArduino::setLoRaWANRX2DataRate ( const uint8_t  value)

Sets the LoRaWAN RX2 Data Rate on the XBee LR module.

Wrapper function to set the LoRaWAN RX2 Data Rate on the XBee LR module.

This function sends the AT_XD command to set the RX2 Data Rate on the XBee LR module.

Parameters
[in]valueThe RX2 Data Rate to be set.
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

This function sends the AT_XD command to set the RX2 Data Rate on the XBee LR module.

Parameters
[in]valueThe RX2 Data Rate to be set.
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

◆ setLoRaWANRX2Delay()

bool XBeeArduino::setLoRaWANRX2Delay ( const uint32_t  value)

Sets the LoRaWAN RX2 Delay on the XBee LR module.

Wrapper function to set the LoRaWAN RX2 Delay on the XBee LR module.

This function sends the AT_D2 command to set the RX2 delay (in milliseconds) on the XBee LR module.

Parameters
[in]valueThe RX2 Delay value to be set (in milliseconds).
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

This function sends the AT_D2 command to set the RX2 delay (in milliseconds) on the XBee LR module.

Parameters
[in]valueThe RX2 Delay value to be set (in milliseconds).
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

◆ setLoRaWANRX2Frequency()

bool XBeeArduino::setLoRaWANRX2Frequency ( const uint32_t  value)

Sets the LoRaWAN RX2 Frequency on the XBee LR module.

Wrapper function to set the LoRaWAN RX2 Frequency on the XBee LR module.

This function sends the AT_XF command to set the RX2 Frequency on the XBee LR module.

Parameters
[in]valueThe RX2 Frequency to be set (in Hz).
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

This function sends the AT_XF command to set the RX2 Frequency on the XBee LR module.

Parameters
[in]valueThe RX2 Frequency to be set (in Hz).
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

◆ setLoRaWANTransmitPower()

bool XBeeArduino::setLoRaWANTransmitPower ( const uint8_t  value)

Sets the LoRaWAN Transmit Power on the XBee LR module.

Wrapper function to set the LoRaWAN Transmit Power on the XBee LR module.

This function sends the AT_PO command to set the transmit power level on the XBee LR module.

Parameters
[in]valueThe Transmit Power value to be set (in dBm).
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

This function sends the AT_PO command to set the transmit power level on the XBee LR module.

Parameters
[in]valueThe Transmit Power value to be set (in dBm).
Returns
bool Returns true if the command was successfully sent and the response was positive, otherwise false.

◆ writeConfig()

bool XBeeArduino::writeConfig ( void  )

Write config on XBee.

Returns
True if the write config is successfull, otherwise false.

The documentation for this class was generated from the following files: