RadioLib
Universal wireless communication library for Arduino
XBee Class Reference

Control class for XBee modules. More...

#include <XBee.h>

Public Member Functions

 XBee (Module *mod)
 Default constructor. More...
 
int16_t begin (long speed)
 Initialization method. More...
 
void reset ()
 Resets module using interrupt/GPIO pin 1.
 
int16_t transmit (uint8_t *dest, const char *payload, uint8_t radius=1)
 Sends data to the destination 64-bit (global) address, when destination 16-bit (local) address is unknown. More...
 
int16_t transmit (uint8_t *dest, uint8_t *destNetwork, const char *payload, uint8_t radius=1)
 Sends data to the destination 64-bit (global) address, when destination 16-bit (local) address is known. More...
 
size_t available ()
 Gets the number of payload bytes received. More...
 
String getPacketSource ()
 Gets packet source 64-bit address. More...
 
String getPacketData ()
 Gets packet payload. More...
 
int16_t setPanId (uint8_t *panId)
 Sets PAN (Personal Area Network) ID. All XBees must be in the same PAN in order to communicate. More...
 

Detailed Description

Control class for XBee modules.

Constructor & Destructor Documentation

◆ XBee()

XBee::XBee ( Module mod)

Default constructor.

Parameters
modInstance of Module that will be used to communicate with the radio.

Member Function Documentation

◆ available()

size_t XBee::available ( )

Gets the number of payload bytes received.

Returns
Number of available payload bytes, or 0 if nothing was received.

◆ begin()

int16_t XBee::begin ( long  speed)

Initialization method.

Parameters
speedBaud rate to use for UART interface.
Returns
Status Codes

◆ getPacketData()

String XBee::getPacketData ( )

Gets packet payload.

Returns
Packet payload, in the form of Arduino String.

◆ getPacketSource()

String XBee::getPacketSource ( )

Gets packet source 64-bit address.

Returns
Packet source address, in the form of uppercase hexadecimal Arduino String (i.e. 16 characters).

◆ setPanId()

int16_t XBee::setPanId ( uint8_t *  panId)

Sets PAN (Personal Area Network) ID. All XBees must be in the same PAN in order to communicate.

Parameters
panId8-byte PAN ID to be used, in the form of uppercase hexadecimal string (i.e. 16 characters).

◆ transmit() [1/2]

int16_t XBee::transmit ( uint8_t *  dest,
const char *  payload,
uint8_t  radius = 1 
)

Sends data to the destination 64-bit (global) address, when destination 16-bit (local) address is unknown.

Parameters
destDestination 64-bit address, in the form of 8-byte array.
payloadString of payload bytes.
radiusNumber of maximum "hops" for a broadcast transmission. Defaults to 1, set to 0 for unlimited number of hops.

◆ transmit() [2/2]

int16_t XBee::transmit ( uint8_t *  dest,
uint8_t *  destNetwork,
const char *  payload,
uint8_t  radius = 1 
)

Sends data to the destination 64-bit (global) address, when destination 16-bit (local) address is known.

Parameters
destDestination 64-bit address, in the form of 8-byte array.
destNetworkDestination 16-bit address, in the form of 2-byte array.
payloadString of payload bytes.
radiusNumber of maximum "hops" for a broadcast transmission. Defaults to 1, set to 0 for unlimited number of hops.

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