Xbee Arduino
Arduino Driver for Xbee
|
Header file for the XBee class. More...
Go to the source code of this file.
Classes | |
struct | XBeeVTable |
struct | XBeeHTable |
struct | XBeeCTable |
struct | XBee |
Typedefs | |
typedef struct XBee | XBee |
Represents an XBee device instance. More... | |
Functions | |
bool | XBeeInit (XBee *self, uint32_t baudrate, void *device) |
Initializes the XBee module. More... | |
bool | XBeeConnect (XBee *self) |
Connects the XBee to the network. More... | |
bool | XBeeDisconnect (XBee *self) |
Disconnects the XBee from the network. More... | |
uint8_t | XBeeSendData (XBee *self, const void *) |
Request XBee to send data over network. More... | |
bool | XBeeSoftReset (XBee *self) |
Performs a soft reset of the XBee module. More... | |
void | XBeeHardReset (XBee *self) |
Performs a hard reset of the XBee module. More... | |
void | XBeeProcess (XBee *self) |
Calls the XBee subclass's process implementation. More... | |
bool | XBeeConnected (XBee *self) |
Checks if the XBee module is connected to the network. More... | |
bool | XBeeWriteConfig (XBee *self) |
Sends the ATWR command to write the current configuration to the XBee module's non-volatile memory. More... | |
bool | XBeeApplyChanges (XBee *self) |
Sends the ATAC command to apply pending configuration changes on the XBee module. More... | |
bool | XBeeSetAPIOptions (XBee *self, const uint8_t value) |
Sends the AT_AO command to set API Options. More... | |
Header file for the XBee class.
This file defines the interface for the XBee class, including the necessary functions, data structures, and constants required to interact with XBee modules using the API frame format. It provides prototypes for initializing the module, sending and receiving data, and handling AT commands.
@license MIT Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
bool XBeeApplyChanges | ( | XBee * | self | ) |
Sends the ATAC command to apply pending configuration changes on the XBee module.
This function sends the ATAC command using an API frame to apply any pending configuration changes on the XBee module. The function waits for a response from the module to confirm that the command was successful. If the command fails or the module does not respond, a debug message is printed.
[in] | self | Pointer to the XBee instance. |
bool XBeeConnect | ( | XBee * | self | ) |
Connects the XBee to the network.
This function connects to the network by calling the XBee subclass specific connection implementation provided by the XBee subclass. This is a blocking function.
[in] | self | Pointer to the XBee instance. |
bool XBeeConnected | ( | XBee * | self | ) |
Checks if the XBee module is connected to the network.
This function calls the connected
method defined in the XBee subclass's virtual table (vtable) to determine if the XBee module is currently connected to the network. It returns true if the module is connected, otherwise false.
[in] | self | Pointer to the XBee instance. |
bool XBeeDisconnect | ( | XBee * | self | ) |
Disconnects the XBee from the network.
This function closes the connection by calling the platform-specific close implementation provided by the XBee subclass. This is a blocking function.
[in] | self | Pointer to the XBee instance. |
void XBeeHardReset | ( | XBee * | self | ) |
Performs a hard reset of the XBee module.
This function invokes the hard_reset
method defined in the XBee subclass's virtual table (vtable) to perform a hard reset of the XBee module. A hard reset usually involves a full power cycle or reset through rst pin, resetting the module completely.
[in] | self | Pointer to the XBee instance. |
bool XBeeInit | ( | XBee * | self, |
uint32_t | baudRate, | ||
void * | device | ||
) |
Initializes the XBee module.
This function initializes the XBee module by setting the initial frame ID counter and calling the XBee subclass specific initialization routine.
[in] | self | Pointer to the XBee instance. |
[in] | baudrate | Baud rate for the serial communication. |
[in] | device | Path to the serial device (e.g., "/dev/ttyUSB0"). |
void XBeeProcess | ( | XBee * | self | ) |
Calls the XBee subclass's process implementation.
This function invokes the process
method defined in the XBee subclass's virtual table (vtable). It is responsible for processing any ongoing tasks or events related to the XBee module and must be called continuously in the application's main loop to ensure proper operation.
[in] | self | Pointer to the XBee instance. |
uint8_t XBeeSendData | ( | XBee * | self, |
const void * | data | ||
) |
bool XBeeSetAPIOptions | ( | XBee * | self, |
const uint8_t | value | ||
) |
Sends the AT_AO command to set API Options.
This function configures the API Options on the XBee module by sending the AT command AT_AO
with the specified API Options value. The function is blocking, meaning it waits for a response from the module or until a timeout occurs. If the command fails to send or the module does not respond, a debug message is printed.
[in] | self | Pointer to the XBee instance. |
[in] | value | The API Options to be set, provided as a string. |
bool XBeeSoftReset | ( | XBee * | self | ) |
Performs a soft reset of the XBee module.
This function invokes the soft_reset
method defined in the XBee subclass's virtual table (vtable) to perform a soft reset of the XBee module. A soft reset typically involves resetting the module's state without a full power cycle.
[in] | self | Pointer to the XBee instance. |
bool XBeeWriteConfig | ( | XBee * | self | ) |
Sends the ATWR command to write the current configuration to the XBee module's non-volatile memory.
This function sends the ATWR command using an API frame to write the current configuration settings to the XBee module's non-volatile memory. The function waits for a response from the module to confirm that the command was successful. If the command fails or the module does not respond, a debug message is printed.
[in] | self | Pointer to the XBee instance. |