XBee API mode library
Diff: XBee.h
- Revision:
- 10:3da24a020e67
- Parent:
- 8:776b8dc51932
- Child:
- 12:0d32e2d0b50a
--- a/XBee.h Tue Jan 29 14:18:18 2013 +0000 +++ b/XBee.h Wed Mar 13 19:09:55 2013 +0000 @@ -27,7 +27,7 @@ #ifdef XBEE_RTOS #include "rtos.h" -#include "ThreadBase.h" +#include "AbstractThread.h" #include "RingBuffer.h" #endif #include "mbed.h" @@ -47,7 +47,7 @@ #ifndef XBEE_RTOS class XBee : public Serial { #else -class XBee : public Serial, ThreadBase { +class XBee : public Serial, AbstractThread { #endif public: @@ -375,19 +375,16 @@ * * @param data address to the data (byte array) * @param length data length in bytes - * @param confirm if true, checks the transmission status frame and returns the result */ - bool send(const char *data, int length, bool confirm); - + bool send(const char *data, int length); + /** - * sends data and confirm the transmit status. + * sets send confirmation timeout * - * @param data address to the data (byte array) - * @param length data length in bytes + * @param sendConfirmation maximum waiting time for receiving transmit status * - * @returns true if sent successfully, false otherwise (either timeout or send error occurred) */ - bool sendConfirm(const char *data, int length); + void setSendConfirmation(float sendConfirmation); /** * sends data to the destination using printf format. @@ -487,10 +484,13 @@ volatile enum {UNKNOWN, LENGTH1, LENGTH2, DATA, SUMCHECK} state; volatile int cur, in, out, received, free; char frame_id; + float sendConfirmation; char destination64[8]; char destination16[2]; char buf[BUFSIZE]; +#ifdef XBEE_RTOS RingBuffer<char, 32> rxBuf; +#endif bool debug; #ifdef XBEE_RTOS Mutex mutex; @@ -501,6 +501,7 @@ int createTxRequest(char frame_id, const char *data, int data_length, char *buf, int buf_size); int createAtRequest(char frame_id, const char *command, const uint8_t *param, int param_length, bool queue, char *buf, int buf_size); int createRemoteAtRequest(char frame_id, const char *command, const uint8_t *param, int param_length, char options, char *buf, int buf_size); + bool send(const char *data, int length, float timeout); int seekFor(FrameType type, char id, float timeout); FrameType getFrameType(char c); bool scan(int i, ValueType type, char *value, int maxlength = 1, int *length = 0);