[XBee] Added Doxygen comments
This commit is contained in:
parent
4a67bb59c7
commit
1fddac14e5
1 changed files with 117 additions and 13 deletions
|
@ -31,56 +31,160 @@
|
||||||
#define XBEE_API_FRAME_ROUTE_RECORD 0xA1
|
#define XBEE_API_FRAME_ROUTE_RECORD 0xA1
|
||||||
#define XBEE_API_FRAME_MANY_TO_ONE_ROUTE_REQUEST 0xA3
|
#define XBEE_API_FRAME_MANY_TO_ONE_ROUTE_REQUEST 0xA3
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\class XBeeSerial
|
||||||
|
|
||||||
|
\brief %XBee Serial interface. This class is used for XBees in transparent mode, i.e. when two XBees act as a "wireless UART".
|
||||||
|
*/
|
||||||
class XBeeSerial: public ISerial {
|
class XBeeSerial: public ISerial {
|
||||||
public:
|
public:
|
||||||
// constructor
|
/*!
|
||||||
|
\brief Default constructor.
|
||||||
|
|
||||||
|
\param mod Instance of Module that will be used to communicate with the radio.
|
||||||
|
*/
|
||||||
XBeeSerial(Module* mod);
|
XBeeSerial(Module* mod);
|
||||||
|
|
||||||
// basic methods
|
// basic methods
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Initialization method.
|
||||||
|
|
||||||
|
\param speed Baud rate to use for UART interface.
|
||||||
|
|
||||||
|
\returns \ref status_codes
|
||||||
|
*/
|
||||||
int16_t begin(long speed);
|
int16_t begin(long speed);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Resets module using interrupt/GPIO pin 1.
|
||||||
|
*/
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
// configuration methods
|
// configuration methods
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Sets destination XBee address.
|
||||||
|
|
||||||
|
\param destinationAddressHigh Higher 4 bytes of the destination XBee module, in the form of uppercase hexadecimal string (i.e. 8 characters).
|
||||||
|
|
||||||
|
\param destinationAddressLow Lower 4 bytes of the destination XBee module, in the form of uppercase hexadecimal string (i.e. 8 characters).
|
||||||
|
|
||||||
|
\returns \ref status_codes
|
||||||
|
*/
|
||||||
int16_t setDestinationAddress(const char* destinationAddressHigh, const char* destinationAddressLow);
|
int16_t setDestinationAddress(const char* destinationAddressHigh, const char* destinationAddressLow);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Sets PAN (Personal Area Network) ID. Both XBees must be in the same PAN in order to use transparent mode.
|
||||||
|
|
||||||
|
\param panId 8-byte PAN ID to be used, in the form of uppercase hexadecimal string (i.e. 16 characters).
|
||||||
|
*/
|
||||||
int16_t setPanId(const char* panID);
|
int16_t setPanId(const char* panID);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool enterCmdMode();
|
bool enterCmdMode();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\class XBee
|
||||||
|
|
||||||
|
\brief Control class for %XBee modules.
|
||||||
|
*/
|
||||||
class XBee {
|
class XBee {
|
||||||
public:
|
public:
|
||||||
// constructor
|
/*!
|
||||||
|
\brief Default constructor.
|
||||||
|
|
||||||
|
\param mod Instance of Module that will be used to communicate with the radio.
|
||||||
|
*/
|
||||||
XBee(Module* mod);
|
XBee(Module* mod);
|
||||||
|
|
||||||
// basic methods
|
// basic methods
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Initialization method.
|
||||||
|
|
||||||
|
\param speed Baud rate to use for UART interface.
|
||||||
|
|
||||||
|
\returns \ref status_codes
|
||||||
|
*/
|
||||||
int16_t begin(long speed);
|
int16_t begin(long speed);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Resets module using interrupt/GPIO pin 1.
|
||||||
|
*/
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Sends data to the destination 64-bit (global) address, when destination 16-bit (local) address is unknown.
|
||||||
|
|
||||||
|
\param dest Destination 64-bit address, in the form of 8-byte array.
|
||||||
|
|
||||||
|
\param payload String of payload bytes.
|
||||||
|
|
||||||
|
\param radius Number of maximum "hops" for a broadcast transmission. Defaults to 1, set to 0 for unlimited number of hops.
|
||||||
|
*/
|
||||||
int16_t transmit(uint8_t* dest, const char* payload, uint8_t radius = 1);
|
int16_t transmit(uint8_t* dest, const char* payload, uint8_t radius = 1);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Sends data to the destination 64-bit (global) address, when destination 16-bit (local) address is known.
|
||||||
|
|
||||||
|
\param dest Destination 64-bit address, in the form of 8-byte array.
|
||||||
|
|
||||||
|
\param destNetwork Destination 16-bit address, in the form of 2-byte array.
|
||||||
|
|
||||||
|
\param payload String of payload bytes.
|
||||||
|
|
||||||
|
\param radius Number of maximum "hops" for a broadcast transmission. Defaults to 1, set to 0 for unlimited number of hops.
|
||||||
|
*/
|
||||||
int16_t transmit(uint8_t* dest, uint8_t* destNetwork, const char* payload, uint8_t radius = 1);
|
int16_t transmit(uint8_t* dest, uint8_t* destNetwork, const char* payload, uint8_t radius = 1);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Gets the number of payload bytes received.
|
||||||
|
|
||||||
|
\returns Number of available payload bytes, or 0 if nothing was received.
|
||||||
|
*/
|
||||||
size_t available();
|
size_t available();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Gets packet source 64-bit address.
|
||||||
|
|
||||||
|
\returns Packet source address, in the form of uppercase hexadecimal Arduino String (i.e. 16 characters).
|
||||||
|
*/
|
||||||
String getPacketSource();
|
String getPacketSource();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Gets packet payload.
|
||||||
|
|
||||||
|
\returns Packet payload, in the form of Arduino String.
|
||||||
|
*/
|
||||||
String getPacketData();
|
String getPacketData();
|
||||||
|
|
||||||
// configuration methods
|
// configuration methods
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Sets PAN (Personal Area Network) ID. All XBees must be in the same PAN in order to communicate.
|
||||||
|
|
||||||
|
\param panId 8-byte PAN ID to be used, in the form of uppercase hexadecimal string (i.e. 16 characters).
|
||||||
|
*/
|
||||||
int16_t setPanId(uint8_t* panID);
|
int16_t setPanId(uint8_t* panID);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Module* _mod;
|
Module* _mod;
|
||||||
uint8_t _frameID;
|
uint8_t _frameID;
|
||||||
size_t _frameLength;
|
size_t _frameLength;
|
||||||
bool _frameHeaderProcessed;
|
bool _frameHeaderProcessed;
|
||||||
|
|
||||||
char* _packetData;
|
char* _packetData;
|
||||||
uint8_t _packetSource[8];
|
uint8_t _packetSource[8];
|
||||||
|
|
||||||
int16_t confirmChanges();
|
int16_t confirmChanges();
|
||||||
|
|
||||||
void sendApiFrame(uint8_t type, uint8_t id, const char* data);
|
void sendApiFrame(uint8_t type, uint8_t id, const char* data);
|
||||||
void sendApiFrame(uint8_t type, uint8_t id, uint8_t* data, uint16_t length);
|
void sendApiFrame(uint8_t type, uint8_t id, uint8_t* data, uint16_t length);
|
||||||
int16_t readApiFrame(uint8_t frameID, uint8_t codePos, uint16_t timeout = 5000);
|
int16_t readApiFrame(uint8_t frameID, uint8_t codePos, uint16_t timeout = 5000);
|
||||||
|
|
||||||
uint16_t getNumBytes(uint32_t timeout = 10000, size_t minBytes = 10);
|
uint16_t getNumBytes(uint32_t timeout = 10000, size_t minBytes = 10);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue