A library allowing basic functions of the XBEE pro to be used. Currently supported are: Enter/exit config mode, reading device serial number, setting encryption key, writing settings to non volatile memory and sending data strings.

Dependents:   IOT_sensor_nfc Xbee_Hello_world Xbee_Hello_world_A Xbee_Hello_World_B ... more

Embed: (wiki syntax)

« Back to documentation index

xbee Class Reference

xbee Class Reference

Xbee interface class for configuring, sending and recieving data using an Xbee. More...

#include <xbee.h>

Public Member Functions

 xbee (PinName tx, PinName rx, PinName reset)
 Configure serial data pin.
int ConfigMode ()
 Puts the Xbee into config mode.
int GetSerial (int *)
 Gets the serial number/mac address of the Xbee and places it into serial_no.
int SetKey (char *)
 Sets the encryption key.
int SetPanId (int)
 Sets the id of the PAN network for the Xbee to use.
int WriteSettings ()
 Writes the settings to the Non volatile memory on the Xbee.
int ExitConfigMode ()
 Exits config mode.
int SendData (char *)
 Sends data in the send_Data buffer.
void RecieveData (char *, int)
 Recieves data sent to the xbee.
void Reset ()
 Resets the Xbee.

Detailed Description

Xbee interface class for configuring, sending and recieving data using an Xbee.

Definition at line 21 of file xbee.h.


Constructor & Destructor Documentation

xbee ( PinName  tx,
PinName  rx,
PinName  reset 
)

Configure serial data pin.

Parameters:
txThe serial tx pin the xbee is conected to.
rxThe serial rx pin the xbee is conected to.
resetThe pin connected to the Xbee reset pin.

Definition at line 22 of file xbee.cpp.


Member Function Documentation

int ConfigMode (  )

Puts the Xbee into config mode.

Returns:
Returns 1 on success.

Definition at line 33 of file xbee.cpp.

int ExitConfigMode (  )

Exits config mode.

Returns:
Returns 1 on success.

Definition at line 92 of file xbee.cpp.

int GetSerial ( int *  serial_no )

Gets the serial number/mac address of the Xbee and places it into serial_no.

Parameters:
serial_noarray to store the serial of Xbee (must be 8 long).
Returns:
Returns 1 on success.

Definition at line 49 of file xbee.cpp.

void RecieveData ( char *  data_buf,
int  numchar 
)

Recieves data sent to the xbee.

Parameters:
data_bufPointer to the buffer to put recieved data into.
numcharNumber of characters to read. If 0, will use the size of data_buf.

Definition at line 108 of file xbee.cpp.

void Reset (  )

Resets the Xbee.

Definition at line 134 of file xbee.cpp.

int SendData ( char *  data_buf )

Sends data in the send_Data buffer.

Parameters:
data_bufPointer to the buffer of data to send.
Returns:
1 on success.

Definition at line 101 of file xbee.cpp.

int SetKey ( char *  key )

Sets the encryption key.

This should be a 128-bit key.

Parameters:
keyPointer to the network key to set.
Returns:
Returns 1 on success.

Definition at line 71 of file xbee.cpp.

int SetPanId ( int  pan_id )

Sets the id of the PAN network for the Xbee to use.

Parameters:
pan_idThe id of the PAN for the Xbee to use.
Returns:
Returns 1 on success.

Definition at line 125 of file xbee.cpp.

int WriteSettings (  )

Writes the settings to the Non volatile memory on the Xbee.

Parameters:
keyPointer to the network key to set.
Returns:
Returns 1 on success.

Definition at line 83 of file xbee.cpp.