2018-12-03 09:54:53 +00:00
|
|
|
#ifndef _WBEE_WRAPPER_H_
|
|
|
|
#define _WBEE_WRAPPER_H_
|
|
|
|
|
|
|
|
#include <Wire.h>
|
|
|
|
#include <XBee.h>
|
|
|
|
#include "protocol.h"
|
|
|
|
#include "packet.h"
|
|
|
|
|
|
|
|
#define XBWRECV_OK 0
|
|
|
|
#define XBWRECV_NONE 1
|
|
|
|
#define XBWRECV_ERROR 2
|
|
|
|
|
|
|
|
#define XBWSEND_OK 0
|
|
|
|
#define XBWSEND_ERROR 1
|
|
|
|
#define XBWSEND_UNKNOWN 2
|
|
|
|
|
|
|
|
|
|
|
|
class XBeeWrapper{
|
|
|
|
private:
|
|
|
|
XBee xbee;
|
|
|
|
|
|
|
|
public:
|
|
|
|
XBeeWrapper();
|
|
|
|
|
|
|
|
// initialises the XBee interface
|
2018-12-04 08:43:11 +00:00
|
|
|
void begin(const unsigned long baud);
|
2018-12-03 09:54:53 +00:00
|
|
|
|
|
|
|
// tries to extract a received packet
|
|
|
|
uint8_t receive(Packet& pkt);
|
|
|
|
|
|
|
|
// tries to broadcast a packet
|
|
|
|
uint8_t broadcast(Packet& pkt);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|