XBee API operation library for mbed

Files at this revision

API Documentation at this revision

Comitter:
yangcq88517
Date:
Wed Mar 30 19:58:48 2016 +0000
Parent:
7:6a9c4d7da3a1
Child:
9:6e4ef3c302b4
Commit message:
put every thing together and documentation bug fix

Changed in this revision

SmartLabXBeeCore.lib Show diff for this revision Revisions of this file
SmartLabXBeeCore/BufferedArray/BufferedArray.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/BufferedArray/BufferedArray.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Core/APIFrame.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Core/APIFrame.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Core/CoreAPI.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Core/CoreAPI.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Core/ISerial.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Device/Address.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Device/Address.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Device/ExplicitAddress.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Device/ExplicitAddress.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Device/Pin.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Device/Pin.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Device/XBeePins.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Device/XBeePins.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Device/ZigBeePins.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Device/ZigBeePins.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Helper/IOSampleDecoder.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Helper/IOSampleDecoder.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/ATCommandIndicator.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/ATCommandIndicator.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/ICommandResponse.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/IPayloadResponse.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/ISampleResponse.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/ITransmitStatus.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/ManyToOneRouteIndicator.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/ManyToOneRouteIndicator.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/ModemStatusIndicator.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/ModemStatusIndicator.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/NodeIdentificationIndicator.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/NodeIdentificationIndicator.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/RemoteCommandIndicator.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/RemoteCommandIndicator.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/RouteRecordIndicator.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/RouteRecordIndicator.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/RxBase.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/SensorReadIndicator.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/SensorReadIndicator.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/XBeeRx16IOSampleIndicator.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/XBeeRx16IOSampleIndicator.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/XBeeRx16Indicator.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/XBeeRx16Indicator.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/XBeeRx64IOSampleIndicator.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/XBeeRx64IOSampleIndicator.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/XBeeRx64Indicator.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/XBeeRx64Indicator.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/XBeeTxStatusIndicator.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/XBeeTxStatusIndicator.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/ZigBeeExplicitRxIndicator.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/ZigBeeExplicitRxIndicator.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/ZigBeeIOSampleIndicator.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/ZigBeeIOSampleIndicator.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/ZigBeeRxIndicator.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/ZigBeeRxIndicator.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/ZigBeeTxStatusIndicator.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Indicator/ZigBeeTxStatusIndicator.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Options/OptionsBase.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Options/OptionsBase.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Options/RemoteCommandOptions.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Options/RemoteCommandOptions.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Options/TransmitOptions.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Options/TransmitOptions.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Options/Tx16TransmitOptions.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Options/Tx16TransmitOptions.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Options/Tx64TransmitOptions.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Options/Tx64TransmitOptions.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Request/ATCommandRequest.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Request/ATCommandRequest.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Request/CreateSourceRouteRequest.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Request/CreateSourceRouteRequest.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Request/ICommandRequest.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Request/IOCDetectionConfigRequest.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Request/IPayloadRequest.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Request/PinConfigurationRequest.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Request/RemoteATCommandRequest.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Request/RemoteATCommandRequest.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Request/RemoteIODetectionConfigRequest.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Request/RemotePinConfigurationRequest.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Request/TxBase.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Request/TxBase.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Request/XBeeTx16Request.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Request/XBeeTx16Request.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Request/XBeeTx64Request.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Request/XBeeTx64Request.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Request/ZigBeeExplicitTxRequest.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Request/ZigBeeExplicitTxRequest.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Request/ZigBeeTxRequest.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Request/ZigBeeTxRequest.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Type/ATCommands.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Type/ATCommands.h Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Type/IOSamples.cpp Show annotated file Show diff for this revision Revisions of this file
SmartLabXBeeCore/Type/IOSamples.h Show annotated file Show diff for this revision Revisions of this file
XBeeAPI.h Show annotated file Show diff for this revision Revisions of this file
--- a/SmartLabXBeeCore.lib	Sat Nov 14 16:43:20 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://developer.mbed.org/users/yangcq88517/code/SmartLabXBeeCore/#5f31ddc17239
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/BufferedArray/BufferedArray.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,116 @@
+#include "BufferedArray.h"
+
+BufferedArray::BufferedArray(unsigned int initialLength, unsigned int expandSize)
+{
+    this->expandSize = expandSize;
+    max = initialLength;
+    data = new unsigned char[initialLength];
+    index = 0;
+}
+
+BufferedArray::BufferedArray(BufferedArray * bufferedArray)
+{
+    if (bufferedArray != NULL) {
+        this->data = bufferedArray->data;
+        this->index = bufferedArray->index;
+        this->max = bufferedArray->max;
+        this->expandSize = bufferedArray->expandSize;
+    }
+}
+
+BufferedArray::~BufferedArray()
+{
+    if (data == NULL)
+        return;
+
+    delete[] data;
+}
+
+unsigned char * BufferedArray::gets()
+{
+    return data;
+}
+
+unsigned char * BufferedArray::gets(unsigned long position)
+{
+    return data + position;
+}
+
+unsigned char BufferedArray::get(unsigned long position)
+{
+    return *(data + position);
+}
+
+int BufferedArray::getPosition()
+{
+    return index;
+}
+
+void BufferedArray::setPosition(unsigned long position)
+{
+    if (this->index > max)
+        this->index = max;
+    else this->index = position;
+}
+
+void BufferedArray::allocate(unsigned long length)
+{
+    if (length <= 0)
+        return;
+
+    if (length > max) {
+        if (data != NULL)
+            delete[] data;
+        data = new unsigned char[length];
+    }
+
+    rewind();
+}
+
+void BufferedArray::rewind()
+{
+    index = 0;
+}
+
+void BufferedArray::expandSpace(unsigned long length)
+{
+    max += expandSize * (1 + length / expandSize);
+    unsigned char * temp = new unsigned char[max];
+    memcpy(temp, data, index);
+    delete[] data;
+    data = temp;
+}
+
+void BufferedArray::set(unsigned long position, unsigned char value)
+{
+    if (position >= max)
+        expandSpace(position - max + 1);
+
+    data[position] = value;
+}
+
+void BufferedArray::set(unsigned char value)
+{
+    set(index, value);
+    index++;
+}
+
+void BufferedArray::sets(const unsigned char * value, unsigned long offset, unsigned long length)
+{
+    if (length <= 0)
+        return;
+
+    sets(index, value, offset, length);
+    index += length;
+}
+
+void BufferedArray::sets(unsigned long position, const unsigned char * value, unsigned long offset, unsigned long length)
+{
+    if (length <= 0)
+        return;
+
+    if (position + length > max)
+        expandSpace(position + length - max);
+
+    memcpy(data + position, value, length);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/BufferedArray/BufferedArray.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,101 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_BufferedArray
+#define UK_AC_HERTS_SMARTLAB_XBEE_BufferedArray
+
+#include "mbed.h"
+
+/**
+* Represent a generic, dynamic-length raw binary data buffer.
+*/
+class BufferedArray
+{
+protected :
+    /// initial size and automatically increase length.
+    unsigned int expandSize;
+
+    /// Raw data
+    unsigned char * data;
+
+    /// Current index of the data, could also used as data lendth.
+    unsigned long index;
+
+    /// Max data size that the raw data can hold.
+    unsigned long max;
+    
+    void expandSpace(unsigned long length);
+
+public:
+    BufferedArray(unsigned int initialLength, unsigned int expandSize);
+
+    BufferedArray(BufferedArray * bufferedArray);
+    
+    ~BufferedArray();
+
+    /** Get the raw data.
+    * @returns unsigned char array.
+    */
+    unsigned char * gets();
+        
+    /** Get the raw data from a specific location.
+    *
+    * @param position where to retrieve
+    *
+    * @returns unsigned char array.
+    */
+    unsigned char * gets(unsigned long position);
+           
+    /** Get 1 byte data from a specific location.
+    *
+    * @param position where to retrieve
+    *
+    * @returns unsigned char.
+    */
+    unsigned char get(unsigned long position);
+
+    /** Get the current index.
+    * @returns unsigned char array.
+    */
+    int getPosition();
+
+    /** Set the index within the max length of raw data.
+    * @param position where to begin read and write
+    */
+    void setPosition(unsigned long position);
+
+    /** Reset the raw data.
+    * @param length current max size for the raw data
+    */
+    void allocate(unsigned long length);
+
+    /** Reset the position and does not affect the content of the data.
+    * @param length current max size for the raw data
+    */
+    void rewind();
+    
+    /** Write 8-bit data into current posiston and increase by 1.
+    * @param value sigle byte
+    */
+    void set(unsigned char value);
+
+    /** Write array of data into current posiston, and increase by the lenght.
+    * @param value array of byte
+    * @param offset start point of the data
+    * @param length length to write
+    */
+    void sets(const unsigned char * value, unsigned long offset, unsigned long length);
+
+    /** Write 8-bit data into specific posiston and deos not affect the current position.
+    * @param position where to write
+    * @param value sigle byte
+    */
+    void set(unsigned long position, unsigned char value);
+
+    /** Write array of data into specific posiston and deos not affect the current position.
+    * @param position where to write
+    * @param value array of byte
+    * @param offset start point of the data
+    * @param length length to write
+    */
+    void sets(unsigned long position, const unsigned char * value, unsigned long offset, unsigned long length);
+}; 
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Core/APIFrame.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,111 @@
+#include "APIFrame.h"
+
+APIFrame::APIFrame(unsigned int payloadLength)
+    :BufferedArray(payloadLength, 10)
+{}
+
+APIFrame::APIFrame(APIFrame * frame)
+    :BufferedArray(frame)
+{
+    if (frame != NULL) {
+        this->checkSum = frame->checkSum;
+        this->isVerify = frame->isVerify;
+    }
+}
+
+unsigned char APIFrame::getFrameType()
+{
+    return data[0];
+}
+
+void APIFrame::setFrameType(unsigned char identifier)
+{
+    data[0] = identifier;
+}
+
+void APIFrame::allocate(unsigned long length)
+{
+    BufferedArray::allocate(length);
+    isVerify = false;
+}
+
+void APIFrame::rewind()
+{
+    BufferedArray::rewind();
+    isVerify = false;
+}
+
+bool APIFrame::convert(APIFrame * frame)
+{
+    if (frame == NULL)
+        return false;
+
+    this->data = frame->data;
+    this->index = frame->index;
+    this->max = frame->max;
+    this->checkSum = frame->checkSum;
+    this->isVerify = frame->isVerify;
+    return true;
+}
+
+void APIFrame::set(unsigned char value)
+{
+    BufferedArray::set(value);
+    isVerify = false;
+}
+
+void APIFrame::sets(const unsigned char * value, unsigned long offset, unsigned long length)
+{
+    BufferedArray::sets(value, offset, length);
+    isVerify = false;
+}
+
+void APIFrame::set(unsigned long position, unsigned char value)
+{
+    BufferedArray::set(position, value);
+    isVerify = false;
+}
+
+void APIFrame::sets(unsigned long position, const unsigned char * value, unsigned long offset, unsigned long length)
+{
+    BufferedArray::sets(position, value, offset, length);
+    isVerify = false;
+}
+
+char APIFrame::getCheckSum()
+{
+    return checkSum;
+}
+
+void APIFrame::setCheckSum(unsigned char value)
+{
+    checkSum = value;
+}
+
+bool APIFrame::verifyChecksum()
+{
+    if (isVerify)
+        return true;
+
+    char temp = 0x00;
+    for (int i = 0; i < index; i++)
+        temp += data[i];
+    if (temp + checkSum == 0xFF)
+        isVerify = true;
+    else
+        isVerify = false;
+
+    return isVerify;
+}
+
+void APIFrame::calculateChecksum()
+{
+    if (isVerify)
+        return;
+
+    char CS = 0x00;
+    for (int i = 0; i < index; i++)
+        CS += data[i];
+    checkSum = 0xFF - CS;
+    isVerify = true;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Core/APIFrame.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,138 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_APIFrame
+#define UK_AC_HERTS_SMARTLAB_XBEE_APIFrame
+
+#include "BufferedArray.h"
+
+/// An API frame is the structured data sent and received through the serial interface of the radio module when it is configured in API or API escaped operating modes. API frames are used to communicate with the module or with other modules in the network.
+class APIFrame : public BufferedArray
+{
+private:
+    /// Checksum value for the API fram.
+    unsigned char checkSum;
+
+    /// A state to indicate whether this packet's checksum is verified while process.
+    bool isVerify;
+
+public:
+    static const unsigned char Tx64_Request =0x00;
+    static const unsigned char Tx16_Request =0x01;
+    static const unsigned char AT_Command = 0x08;
+    static const unsigned char AT_Command_Queue_Parameter_Value = 0x09;
+    static const unsigned char ZigBee_Transmit_Request = 0x10;
+    static const unsigned char Explicit_Addressing_ZigBee_Command_Frame = 0x11;
+    static const unsigned char Remote_Command_Request = 0x17;
+    static const unsigned char Create_Source_Route = 0x21;
+    static const unsigned char Register_Joining_Device = 0x24;
+    static const unsigned char Rx64_Receive_Packet = 0x80;
+    static const unsigned char Rx16_Receive_Packet = 0x81;
+    static const unsigned char Rx64_IO_Data_Sample_Rx_Indicator = 0x82;
+    static const unsigned char Rx16_IO_Data_Sample_Rx_Indicator = 0x83;
+    static const unsigned char AT_Command_Response = 0x88;
+    static const unsigned char XBee_Transmit_Status = 0x89;
+    static const unsigned char Modem_Status = 0x8A;
+    static const unsigned char ZigBee_Transmit_Status = 0x8B;
+    static const unsigned char ZigBee_Receive_Packet = 0x90;
+    static const unsigned char ZigBee_Explicit_Rx_Indicator = 0x91;
+    static const unsigned char ZigBee_IO_Data_Sample_Rx_Indicator = 0x92;
+    static const unsigned char XBee_Sensor_Read_Indicato = 0x94;
+    static const unsigned char Node_Identification_Indicator = 0x95;
+    static const unsigned char Remote_Command_Response = 0x97;
+    static const unsigned char Over_the_Air_Firmware_Update_Status = 0xA0;
+    static const unsigned char Route_Record_Indicator = 0xA1;
+    static const unsigned char Device_Authenticated_Indicator = 0xA2;
+    static const unsigned char Many_to_One_Route_Request_Indicator = 0xA3;
+
+    static const unsigned char StartDelimiter = 0x7E;
+
+    APIFrame(unsigned int payloadLength);
+
+    APIFrame(APIFrame * frame);
+
+    /** Get the API frame type.
+    *
+    * @returns
+    *    Tx64_Request =0x00,
+    *    Tx16_Request =0x01,
+    *    AT_Command = 0x08,
+    *    AT_Command_Queue_Parameter_Value = 0x09,
+    *    ZigBee_Transmit_Request = 0x10,
+    *    Explicit_Addressing_ZigBee_Command_Frame = 0x11,
+    *    Remote_Command_Request = 0x17,
+    *    Create_Source_Route = 0x21,
+    *    Register_Joining_Device = 0x24,
+    *    Rx64_Receive_Packet = 0x80,
+    *    Rx16_Receive_Packet = 0x81,
+    *    Rx64_IO_Data_Sample_Rx_Indicator = 0x82,
+    *    Rx16_IO_Data_Sample_Rx_Indicator = 0x83,
+    *    AT_Command_Response = 0x88,
+    *    XBee_Transmit_Status = 0x89,
+    *    Modem_Status = 0x8A,
+    *    ZigBee_Transmit_Status = 0x8B,
+    *    ZigBee_Receive_Packet = 0x90,
+    *    ZigBee_Explicit_Rx_Indicator = 0x91,
+    *    ZigBee_IO_Data_Sample_Rx_Indicator = 0x92,
+    *    XBee_Sensor_Read_Indicato = 0x94,
+    *    Node_Identification_Indicator = 0x95,
+    *    Remote_Command_Response = 0x97,
+    *    Over_the_Air_Firmware_Update_Status = 0xA0,
+    *    Route_Record_Indicator = 0xA1,
+    *    Device_Authenticated_Indicator = 0xA2,
+    *    Many_to_One_Route_Request_Indicator = 0xA3,
+    */
+    unsigned char getFrameType();
+
+    void setFrameType(unsigned char identifier);
+
+    void allocate(unsigned long length);
+
+    void rewind();
+    
+    bool convert(APIFrame * frame);
+
+    /** Write 8-bit data into current posiston and increase by 1.
+    * @param value sigle byte
+    */
+    void set(unsigned char value);
+
+    /** Write array of data into current posiston, and increase by the lenght.
+    * @param value array of byte
+    * @param offset start point of the data
+    * @param length length to write
+    */
+    void sets(const unsigned char * value, unsigned long offset, unsigned long length);
+
+    /** Write 8-bit data into specific posiston and deos not affect the current position.
+    * @param position where to write
+    * @param value sigle byte
+    */
+    void set(unsigned long position, unsigned  char value);
+
+    /** Write array of data into specific posiston and deos not affect the current position.
+    * @param position where to write
+    * @param value array of byte
+    * @param offset start point of the data
+    * @param length length to write
+    */
+    void sets(unsigned long position, const unsigned char * value, unsigned long offset, unsigned long length);
+
+    /** Get checksum.
+    * @returns the checksum value
+    */
+    char getCheckSum();
+
+    /** Set checksum.
+    * @param value checksum value
+    */
+    void setCheckSum(unsigned char value);
+
+    /** Check is the API frame's checksum is verified.
+    * @returns true checksum match,
+    *          false checksum not match
+    */
+    bool verifyChecksum();
+
+    /// Calculate the checksum value.
+    void calculateChecksum();
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Core/CoreAPI.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,550 @@
+#include "CoreAPI.h"
+
+CoreAPI::CoreAPI(ISerial * serial, bool escape)
+    :xBeeRx64Indicator(NULL),xBeeRx16Indicator(NULL),xBeeRx64IOSampleIndicator(NULL),xBeeRx16IOSampleIndicator(NULL),xBeeTxStatusIndicator(NULL),
+     aTCommandIndicator(NULL),modemStatusIndicator(NULL),zigBeeTxStatusIndicator(NULL),zigBeeRxIndicator(NULL),
+     zigBeeExplicitRxIndicator(NULL),zigBeeIOSampleIndicator(NULL),sensorReadIndicator(NULL),nodeIdentificationIndicator(NULL),
+     remoteCommandIndicator(NULL),routeRecordIndicator(NULL),manyToOneRouteIndicator(NULL)
+{
+    this->serial = serial;
+    isEscapeMode = escape;
+    msg = new APIFrame(INITIAL_FRAME_LENGTH);
+    isChecksum = false;
+}
+
+CoreAPI::~CoreAPI()
+{
+    if (msg != NULL)
+        delete msg;
+
+    if (serial != NULL)
+        delete serial;
+}
+
+void CoreAPI::setVerifyChecksum(bool isCheck)
+{
+    isChecksum = isCheck;
+}
+
+void CoreAPI::send(APIFrame * request)
+{
+    request->calculateChecksum();
+    int size = request->getPosition();
+
+    serial->writeByte(KEY);
+
+    writeByte(size >> 8);
+    writeByte(size);
+
+    for (int i = 0; i < size; i++)
+        writeByte(request->get(i));
+
+    writeByte(request->getCheckSum());
+}
+
+int CoreAPI::readByte()
+{
+    int value = serial->readByte();
+
+    if (isEscapeMode && value == ESCAPED)
+        return serial->readByte() ^ 0x20;
+
+    return value;
+}
+
+void CoreAPI::writeByte(unsigned char data)
+{
+    if (isEscapeMode) {
+        if (data == KEY || data == ESCAPED || data == XON || data == XOFF) {
+            serial->writeByte(ESCAPED);
+            serial->writeByte(data ^ 0x20);
+            return;
+        }
+    }
+
+    serial->writeByte(data);
+}
+
+APIFrame * CoreAPI::getResponse()
+{
+    if (!serial->peek())
+        return NULL;
+
+    while (serial->readByte() != KEY);
+
+    int length = getLength();
+
+    msg->allocate(length);
+
+    readPayLoad(length);
+
+    if (isChecksum) {
+        if (msg->verifyChecksum())
+            return msg;
+        else
+            return NULL;
+    } else return msg;
+}
+
+int CoreAPI::getLength()
+{
+    int msb = readByte();
+
+    int lsb = readByte();
+
+    return (msb << 8) | lsb;
+}
+
+void CoreAPI::readPayLoad(int length)
+{
+    for (int i = 0; i < length; i++)
+        msg->set(readByte());
+
+    msg->setCheckSum(readByte());
+}
+
+XBeeRx64Indicator * CoreAPI::getXBeeRx64()
+{
+    if (getResponse() == NULL)
+        return NULL;
+
+    if (xBeeRx64Indicator.convert(msg))
+        return &xBeeRx64Indicator;
+    else return NULL;
+}
+
+XBeeRx16Indicator * CoreAPI::getXBeeRx16()
+{
+    if (getResponse() == NULL)
+        return NULL;
+
+    if (xBeeRx16Indicator.convert(msg))
+        return &xBeeRx16Indicator;
+    else return NULL;
+}
+
+XBeeRx64IOSampleIndicator * CoreAPI::getXBeeRx64IOSample()
+{
+    if (getResponse() == NULL)
+        return NULL;
+
+    if (xBeeRx64IOSampleIndicator.convert(msg))
+        return &xBeeRx64IOSampleIndicator;
+    else return NULL;
+}
+
+XBeeRx16IOSampleIndicator * CoreAPI::getXBeeRx16IOSample()
+{
+    if (getResponse() == NULL)
+        return NULL;
+
+    if (xBeeRx16IOSampleIndicator.convert(msg))
+        return &xBeeRx16IOSampleIndicator;
+    else return NULL;
+}
+
+XBeeTxStatusIndicator * CoreAPI::getXBeeTxStatus()
+{
+    if (getResponse() == NULL)
+        return NULL;
+
+    if (xBeeTxStatusIndicator.convert(msg))
+        return &xBeeTxStatusIndicator;
+    else return NULL;
+}
+
+ATCommandIndicator * CoreAPI::getATCommand()
+{
+    if (getResponse() == NULL)
+        return NULL;
+
+    if (aTCommandIndicator.convert(msg))
+        return &aTCommandIndicator;
+    else return NULL;
+}
+
+ModemStatusIndicator * CoreAPI::getModemStatus()
+{
+    if (getResponse() == NULL)
+        return NULL;
+
+    if (modemStatusIndicator.convert(msg))
+        return &modemStatusIndicator;
+    else return NULL;
+}
+
+ZigBeeTxStatusIndicator * CoreAPI::getZigBeeTxStatus()
+{
+    if (getResponse() == NULL)
+        return NULL;
+
+    if (zigBeeTxStatusIndicator.convert(msg))
+        return &zigBeeTxStatusIndicator;
+    else return NULL;
+}
+
+ZigBeeRxIndicator * CoreAPI::getZigBeeRx()
+{
+    if (getResponse() == NULL)
+        return NULL;
+
+    if (zigBeeRxIndicator.convert(msg))
+        return &zigBeeRxIndicator;
+    else return NULL;
+}
+
+ZigBeeExplicitRxIndicator * CoreAPI::getZigBeeExplicitRx()
+{
+    if (getResponse() == NULL)
+        return NULL;
+
+    if (zigBeeExplicitRxIndicator.convert(msg))
+        return &zigBeeExplicitRxIndicator;
+    else return NULL;
+}
+
+ZigBeeIOSampleIndicator * CoreAPI::getZigBeeIOSample()
+{
+    if (getResponse() == NULL)
+        return NULL;
+
+    if (zigBeeIOSampleIndicator.convert(msg))
+        return &zigBeeIOSampleIndicator;
+    else return NULL;
+}
+
+SensorReadIndicator * CoreAPI::getSensorRead()
+{
+    if (getResponse() == NULL)
+        return NULL;
+
+    if (sensorReadIndicator.convert(msg))
+        return &sensorReadIndicator;
+    else return NULL;
+}
+
+NodeIdentificationIndicator * CoreAPI::getNodeIdentification()
+{
+    if (getResponse() == NULL)
+        return NULL;
+
+    if (nodeIdentificationIndicator.convert(msg))
+        return &nodeIdentificationIndicator;
+    else return NULL;
+}
+
+RemoteCommandIndicator * CoreAPI::getRemoteCommand()
+{
+    if (getResponse() == NULL)
+        return NULL;
+
+    if (remoteCommandIndicator.convert(msg))
+        return &remoteCommandIndicator;
+    else return NULL;
+}
+
+RouteRecordIndicator * CoreAPI::getRouteRecord()
+{
+    if (getResponse() == NULL)
+        return NULL;
+
+    if (routeRecordIndicator.convert(msg))
+        return &routeRecordIndicator;
+    else return NULL;
+}
+
+ManyToOneRouteIndicator * CoreAPI::getManyToOneRoute()
+{
+    if (getResponse() == NULL)
+        return NULL;
+
+    if (manyToOneRouteIndicator.convert(msg))
+        return &manyToOneRouteIndicator;
+    else return NULL;
+}
+
+XBeeTxStatusIndicator * CoreAPI::sendXBeeTx16(Address * remoteAddress, OptionsBase * option, const unsigned char * payload, int offset, int length)
+{
+    waitFrameID++;
+    if (waitFrameID == 0)
+        waitFrameID = 0x01;
+
+    msg->rewind();
+    msg->set(APIFrame::Tx16_Request);
+    msg->set(waitFrameID);
+    msg->set(remoteAddress->getNetworkAddress() >> 8);
+    msg->set(remoteAddress->getNetworkAddress());
+    msg->set(option->getValue());
+    msg->sets(payload, offset, length);
+
+    send(msg);
+
+    timer.start();
+    for (int i = 0; i < 3; i++) {
+        timer.reset();
+        while (!serial->peek()) {
+            if (timer.read_ms() > 1000) {
+                timer.stop();
+                return NULL;
+            }
+        }
+
+        getResponse();
+
+        if (xBeeTxStatusIndicator.convert(msg) && xBeeTxStatusIndicator.getFrameID() == waitFrameID) {
+            timer.stop();
+            return &xBeeTxStatusIndicator;
+        }
+    }
+    timer.stop();
+    return NULL;
+}
+
+XBeeTxStatusIndicator * CoreAPI::sendXBeeTx64(Address * remoteAddress, OptionsBase * option, const unsigned  char * payload, int offset, int length)
+{
+    waitFrameID++;
+    if (waitFrameID == 0)
+        waitFrameID = 0x01;
+
+    msg->rewind();
+    msg->set(APIFrame::Tx64_Request);
+    msg->set(waitFrameID);
+    msg->sets(remoteAddress->getAddressValue(), 0, 8);
+    msg->set(option->getValue());
+    msg->sets(payload, offset, length);
+
+    send(msg);
+
+    timer.start();
+    for (int i = 0; i < 3; i++) {
+        timer.reset();
+        while (!serial->peek()) {
+            if (timer.read_ms() > 1000) {
+                timer.stop();
+                return NULL;
+            }
+        }
+
+        getResponse();
+
+        if (xBeeTxStatusIndicator.convert(msg) && xBeeTxStatusIndicator.getFrameID() == waitFrameID) {
+            timer.stop();
+            return &xBeeTxStatusIndicator;
+        }
+    }
+    timer.stop();
+    return NULL;
+}
+
+ATCommandIndicator * CoreAPI::sendATCommand(const char * command, bool applyChange, const unsigned  char * parameter, int offset, int length)
+{
+    waitFrameID++;
+    if (waitFrameID == 0)
+        waitFrameID = 0x01;
+
+    msg->rewind();
+    if (applyChange)
+        msg->set(APIFrame::AT_Command);
+    else msg->set(APIFrame::AT_Command_Queue_Parameter_Value);
+    msg->set(waitFrameID);
+    msg->set(command[0]);
+    msg->set(command[1]);
+    if (parameter != NULL)
+        msg->sets(parameter, offset, length);
+
+    send(msg);
+
+    timer.start();
+    for (int i = 0; i < 3; i++) {
+        timer.reset();
+        while (!serial->peek()) {
+            if (timer.read_ms() > 1000) {
+                timer.stop();
+                return NULL;
+            }
+        }
+
+        getResponse();
+
+        if (aTCommandIndicator.convert(msg) && aTCommandIndicator.getFrameID() == waitFrameID) {
+            timer.stop();
+            return &aTCommandIndicator;
+        }
+    }
+    timer.stop();
+    return NULL;
+}
+
+RemoteCommandIndicator * CoreAPI::sendRemoteATCommand(Address * remoteAddress, const char * command, OptionsBase * transmitOptions, const unsigned  char * parameter, int parameterOffset, int parameterLength)
+{
+    waitFrameID++;
+    if (waitFrameID == 0)
+        waitFrameID = 0x01;
+
+    msg->rewind();
+    msg->set(APIFrame::Remote_Command_Request);
+    msg->set(waitFrameID);
+
+    msg->sets(remoteAddress->getAddressValue(), 0, 10);
+    msg->set(transmitOptions->getValue());
+    msg->set(command[0]);
+    msg->set(command[1]);
+
+    if (parameter != NULL)
+        msg->sets(parameter, parameterOffset, parameterLength);
+
+    send(msg);
+
+    timer.start();
+    for (int i = 0; i < 3; i++) {
+        timer.reset();
+        while (!serial->peek()) {
+            if (timer.read_ms() > 1000) {
+                timer.stop();
+                return NULL;
+            }
+        }
+
+        getResponse();
+
+        if (remoteCommandIndicator.convert(msg) && remoteCommandIndicator.getFrameID() == waitFrameID) {
+            timer.stop();
+            return &remoteCommandIndicator;
+        }
+    }
+    timer.stop();
+    return NULL;
+}
+
+ZigBeeTxStatusIndicator * CoreAPI::sendZigBeeTx(Address * remoteAddress, OptionsBase * option, const unsigned  char * payload, int offset, int length)
+{
+    waitFrameID++;
+    if (waitFrameID == 0)
+        waitFrameID = 0x01;
+
+    msg->rewind();
+    msg->set(APIFrame::ZigBee_Transmit_Request);
+    msg->set(waitFrameID);
+    msg->sets(remoteAddress->getAddressValue(), 0, 10);
+    msg->set(0x00);
+    msg->set(option->getValue());
+    msg->sets(payload, offset, length);
+
+    send(msg);
+
+    timer.start();
+    for (int i = 0; i < 3; i++) {
+        timer.reset();
+        while (!serial->peek()) {
+            if (timer.read_ms() > 1000) {
+                timer.stop();
+                return NULL;
+            }
+        }
+
+        getResponse();
+
+        if (zigBeeTxStatusIndicator.convert(msg) && zigBeeTxStatusIndicator.getFrameID() == waitFrameID) {
+            timer.stop();
+            return &zigBeeTxStatusIndicator;
+        }
+    }
+    timer.stop();
+    return NULL;
+}
+
+ZigBeeTxStatusIndicator * CoreAPI::sendZigBeeExplicitTx(ExplicitAddress * remoteAddress, OptionsBase * option, const unsigned  char * payload, int offset, int length)
+{
+    waitFrameID++;
+    if (waitFrameID == 0)
+        waitFrameID = 0x01;
+
+    msg->rewind();
+    msg->set(APIFrame::Explicit_Addressing_ZigBee_Command_Frame);
+    msg->set(waitFrameID);
+    msg->sets(remoteAddress->getAddressValue(), 0, 10);
+    msg->sets(remoteAddress->getExplicitValue(), 0 , 6);
+    msg->set(0x00);
+    msg->set(option->getValue());
+    msg->sets(payload, offset, length);
+
+    send(msg);
+
+    timer.start();
+    for (int i = 0; i < 3; i++) {
+        timer.reset();
+        while (!serial->peek()) {
+            if (timer.read_ms() > 1000) {
+                timer.stop();
+                return NULL;
+            }
+        }
+
+        getResponse();
+
+        if (zigBeeTxStatusIndicator.convert(msg) && zigBeeTxStatusIndicator.getFrameID() == waitFrameID) {
+            timer.stop();
+            return &zigBeeTxStatusIndicator;
+        }
+    }
+    timer.stop();
+    return NULL;
+}
+
+ATCommandIndicator * CoreAPI::setPinFunction(Pin * pin, unsigned char function)
+{
+    return sendATCommand(pin->getCommand(), true, &function, 0 , 1);
+}
+
+ATCommandIndicator * CoreAPI::setIODetection(Pin ** pins, int size)
+{
+    return sendATCommand(ATCommands::Digital_IO_Change_Detection, true, Pin::IOChangeDetectionConfiguration(pins, size));
+}
+
+RemoteCommandIndicator * CoreAPI::setRemotePinFunction(Address * remoteAddress, Pin * pin, unsigned char function)
+{
+    return sendRemoteATCommand(remoteAddress, pin->getCommand(), RemoteCommandOptions::ApplyChanges, &function, 0 , 1);
+}
+
+RemoteCommandIndicator * CoreAPI::setRemoteIODetection(Address * remoteAddress, Pin ** pins, int size)
+{
+    return sendRemoteATCommand(remoteAddress, ATCommands::Digital_IO_Change_Detection, RemoteCommandOptions::ApplyChanges, Pin::IOChangeDetectionConfiguration(pins, size), 0, 2);
+}
+
+bool CoreAPI::forceXBeeLocalIOSample()
+{
+    ATCommandIndicator * re = sendATCommand(ATCommands::Force_Sample, true);
+
+    if (re == NULL)
+        return false;
+
+    if (re->getCommandStatus() != 0x00)
+        return false;
+
+    return true;
+}
+
+IOSamples * CoreAPI::forceZigBeeLocalIOSample()
+{
+    ATCommandIndicator * re = sendATCommand(ATCommands::Force_Sample, true);
+
+    if (re == NULL)
+        return NULL;
+
+    return IOSampleDecoder::ZigBeeSamplesParse(re->getParameter());
+}
+
+IOSamples * CoreAPI::forceXBeeRemoteIOSample(Address * remote)
+{
+    RemoteCommandIndicator * re = sendRemoteATCommand(remote, ATCommands::Force_Sample, OptionsBase::DEFAULT);
+
+    return IOSampleDecoder::XBeeSamplesParse(re->getParameter());
+}
+
+IOSamples * CoreAPI::forceZigBeeRemoteIOSample(Address * remote)
+{
+    RemoteCommandIndicator * re = sendRemoteATCommand(remote, ATCommands::Force_Sample, OptionsBase::DEFAULT);
+
+    return IOSampleDecoder::ZigBeeSamplesParse(re->getParameter());
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Core/CoreAPI.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,281 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_CoreAPI
+#define UK_AC_HERTS_SMARTLAB_XBEE_CoreAPI
+
+#include "APIFrame.h"
+#include "ISerial.h"
+
+#include "ATCommandRequest.h"
+#include "CreateSourceRouteRequest.h"
+#include "IOCDetectionConfigRequest.h"
+#include "PinConfigurationRequest.h"
+#include "RemoteATCommandRequest.h"
+#include "RemoteIODetectionConfigRequest.h"
+#include "RemotePinConfigurationRequest.h"
+#include "XBeeTx16Request.h"
+#include "XBeeTx64Request.h"
+#include "ZigBeeExplicitTxRequest.h"
+#include "ZigBeeTxRequest.h"
+
+#include "XBeeRx64Indicator.h"
+#include "XBeeRx16Indicator.h"
+#include "XBeeRx64IOSampleIndicator.h"
+#include "XBeeRx16IOSampleIndicator.h"
+#include "XBeeTxStatusIndicator.h"
+#include "ATCommandIndicator.h"
+#include "ModemStatusIndicator.h"
+#include "ZigBeeTxStatusIndicator.h"
+#include "ZigBeeRxIndicator.h"
+#include "ZigBeeExplicitRxIndicator.h"
+#include "ZigBeeIOSampleIndicator.h"
+#include "SensorReadIndicator.h"
+#include "NodeIdentificationIndicator.h"
+#include "RemoteCommandIndicator.h"
+#include "RouteRecordIndicator.h"
+#include "ManyToOneRouteIndicator.h"
+
+/**
+* The core API class which responseable for processing frame data, but not the serial operation.
+*/
+class CoreAPI
+{
+private:
+    static const unsigned char KEY = 0x7E;
+    static const unsigned char ESCAPED = 0x7D;
+    static const unsigned char XON = 0x11;
+    static const unsigned char XOFF = 0x13;
+    static const unsigned int INITIAL_FRAME_LENGTH = 10;
+
+    ISerial * serial;
+    bool isEscapeMode;
+    bool isChecksum;
+    Timer timer;
+
+    unsigned char waitFrameID;
+
+    APIFrame * msg;
+    XBeeRx64Indicator xBeeRx64Indicator;
+    XBeeRx16Indicator xBeeRx16Indicator;
+    XBeeRx64IOSampleIndicator xBeeRx64IOSampleIndicator;
+    XBeeRx16IOSampleIndicator xBeeRx16IOSampleIndicator;
+    XBeeTxStatusIndicator xBeeTxStatusIndicator;
+    ATCommandIndicator aTCommandIndicator;
+    ModemStatusIndicator modemStatusIndicator;
+    ZigBeeTxStatusIndicator zigBeeTxStatusIndicator;
+    ZigBeeRxIndicator zigBeeRxIndicator;
+    ZigBeeExplicitRxIndicator zigBeeExplicitRxIndicator;
+    ZigBeeIOSampleIndicator zigBeeIOSampleIndicator;
+    SensorReadIndicator sensorReadIndicator;
+    NodeIdentificationIndicator nodeIdentificationIndicator;
+    RemoteCommandIndicator remoteCommandIndicator;
+    RouteRecordIndicator routeRecordIndicator;
+    ManyToOneRouteIndicator manyToOneRouteIndicator;
+
+protected:
+
+    /** Read one byte payload, which allready handle the escape char, if less than 0 means error occured
+    * @returns if less than 0 means error occured.
+    */
+    int readByte();
+
+    /** Write one byte to the payload, which allready handle the escape char.
+    * @param data one byte [0x00-0xFF]
+    */
+    void writeByte(unsigned  char data);
+
+    /// Processing API frame.
+    void packetProcess();
+
+    /// Get the next avaliable API frame length.
+    int getLength();
+
+    /// Read the next avaliable API frame data.
+    void readPayLoad(int length);
+
+public:
+    CoreAPI(ISerial * serial, bool escape);
+
+    ~CoreAPI();
+
+    /** Set whether to verify checksum during receiving, default is not verify.
+    *
+    * @param isCheck true only to process API frame when checksum matches.
+    *                false ignore the checksum.
+    */
+    void setVerifyChecksum(bool isCheck);
+
+    /** A general function to send frame out
+    *
+    * @param request any API frame
+    */
+    void send(APIFrame * request);
+
+    /** Read the next avaliable API frame, and the type of fram can be retrieved from getFrameType().
+    *
+    * @returns a API frame, NULL means data not avaliable.
+    */
+    APIFrame * getResponse();
+
+    /** Read the next avaliable API frame.
+    *
+    * @returns a API frame, NULL means data not avaliable.
+    */
+    XBeeRx64Indicator * getXBeeRx64();
+
+    /** Read the next avaliable API frame.
+    *
+    * @returns a API frame, NULL means data not avaliable.
+    */
+    XBeeRx16Indicator * getXBeeRx16();
+
+    /** Read the next avaliable API frame.
+    *
+    * @returns a API frame, NULL means data not avaliable.
+    */
+    XBeeRx64IOSampleIndicator * getXBeeRx64IOSample();
+
+    /** Read the next avaliable API frame.
+    *
+    * @returns a API frame, NULL means data not avaliable.
+    */
+    XBeeRx16IOSampleIndicator * getXBeeRx16IOSample();
+
+    /** Read the next avaliable API frame.
+    *
+    * @returns a API frame, NULL means data not avaliable.
+    */
+    XBeeTxStatusIndicator * getXBeeTxStatus();
+
+    /** Read the next avaliable API frame.
+    *
+    * @returns a API frame, NULL means data not avaliable.
+    */
+    ATCommandIndicator * getATCommand();
+
+    /** Read the next avaliable API frame.
+    *
+    * @returns a API frame, NULL means data not avaliable.
+    */
+    ModemStatusIndicator * getModemStatus();
+
+    /** Read the next avaliable API frame.
+    *
+    * @returns a API frame, NULL means data not avaliable.
+    */
+    ZigBeeTxStatusIndicator * getZigBeeTxStatus();
+
+    /** Read the next avaliable API frame.
+    *
+    * @returns a API frame, NULL means data not avaliable.
+    */
+    ZigBeeRxIndicator * getZigBeeRx();
+
+    /** Read the next avaliable API frame.
+    *
+    * @returns a API frame, NULL means data not avaliable.
+    */
+    ZigBeeExplicitRxIndicator * getZigBeeExplicitRx();
+
+    /** Read the next avaliable API frame.
+    *
+    * @returns a API frame, NULL means data not avaliable.
+    */
+    ZigBeeIOSampleIndicator * getZigBeeIOSample();
+
+    /** Read the next avaliable API frame.
+    *
+    * @returns a API frame, NULL means data not avaliable.
+    */
+    SensorReadIndicator * getSensorRead();
+
+    /** Read the next avaliable API frame.
+    *
+    * @returns a API frame, NULL means data not avaliable.
+    */
+    NodeIdentificationIndicator * getNodeIdentification();
+
+    /** Read the next avaliable API frame.
+    *
+    * @returns a API frame, NULL means data not avaliable.
+    */
+    RemoteCommandIndicator * getRemoteCommand();
+
+    /** Read the next avaliable API frame.
+    *
+    * @returns a API frame, NULL means data not avaliable.
+    */
+    RouteRecordIndicator * getRouteRecord();
+
+    /** Read the next avaliable API frame.
+    *
+    * @returns a API frame, NULL means data not avaliable.
+    */
+    ManyToOneRouteIndicator * getManyToOneRoute();
+    
+    XBeeTxStatusIndicator * sendXBeeTx16(Address * remoteAddress, OptionsBase * option, const unsigned char * payload, int offset, int length);
+
+    XBeeTxStatusIndicator * sendXBeeTx64(Address * remoteAddress, OptionsBase * option, const unsigned char * payload, int offset, int length);
+
+    ATCommandIndicator * sendATCommand(const char * command, bool applyChange, const unsigned  char * parameter = NULL, int offset = 0, int length = 0);
+
+    RemoteCommandIndicator * sendRemoteATCommand(Address * remoteAddress, const char * command, OptionsBase * transmitOptions, const unsigned  char * parameter = NULL, int parameterOffset = 0, int parameterLength = 0);
+
+    ZigBeeTxStatusIndicator * sendZigBeeTx(Address * remoteAddress, OptionsBase * option, const unsigned  char * payload, int offset, int length);
+
+    ZigBeeTxStatusIndicator * sendZigBeeExplicitTx(ExplicitAddress * remoteAddress, OptionsBase * option, const unsigned  char * payload, int offset, int length);
+
+    /**
+    * @param function
+    * DISABLED = 0x00,
+    * RESERVED_FOR_PIN_SPECIFIC_ALTERNATE_FUNCTIONALITIES = 0x01,
+    * ANALOG_INPUT_SINGLE_ENDED = 0x02,
+    * DIGITAL_INPUT_MONITORED = 0x03,
+    * DIGITAL_OUTPUT_DEFAULT_LOW = 0x04,
+    * DIGITAL_OUTPUT_DEFAULT_HIGH = 0x05,
+    * ALTERNATE_FUNCTIONALITIES_WHERE_APPLICABLE = 0x06//0x06~0x09
+    */
+    ATCommandIndicator * setPinFunction(Pin * pin, unsigned  char function);
+
+    ATCommandIndicator * setIODetection(Pin ** pins, int size);
+
+    /**
+    * @param function
+    * DISABLED = 0x00,
+    * RESERVED_FOR_PIN_SPECIFIC_ALTERNATE_FUNCTIONALITIES = 0x01,
+    * ANALOG_INPUT_SINGLE_ENDED = 0x02,
+    * DIGITAL_INPUT_MONITORED = 0x03,
+    * DIGITAL_OUTPUT_DEFAULT_LOW = 0x04,
+    * DIGITAL_OUTPUT_DEFAULT_HIGH = 0x05,
+    * ALTERNATE_FUNCTIONALITIES_WHERE_APPLICABLE = 0x06//0x06~0x09
+    */
+    RemoteCommandIndicator * setRemotePinFunction(Address * remoteAddress, Pin * pin, unsigned char function);
+
+    RemoteCommandIndicator * setRemoteIODetection(Address * remoteAddress, Pin ** pins, int size);
+
+    /// <summary>
+    /// The command will immediately return an "OK" response. The data will follow in the normal API format for DIO data event.
+    /// </summary>
+    /// <returns>true if the command is "OK", false if no IO is enabled.</returns>
+    bool forceXBeeLocalIOSample();
+
+    /// <summary>
+    /// Return 1 IO sample from the local module.
+    /// </summary>
+    /// <returns></returns>
+    IOSamples * forceZigBeeLocalIOSample();
+
+    /// <summary>
+    /// Return 1 IO sample only, Samples before TX (IT) does not affect.
+    /// </summary>
+    /// <param name="remote"Remote address of the device></param>
+    /// <returns></returns>
+    IOSamples * forceXBeeRemoteIOSample(Address * remote);
+
+    /// <summary>
+    /// Return 1 IO sample only.
+    /// </summary>
+    /// <param name="remote">Remote address of the device</param>
+    /// <returns></returns>
+    IOSamples * forceZigBeeRemoteIOSample(Address * remote);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Core/ISerial.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,31 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_ISerial
+#define UK_AC_HERTS_SMARTLAB_XBEE_ISerial
+
+/// Serial data interface.
+class ISerial
+{
+public:
+    /** Read one byte data from the serila port.
+    * @returns if success return non zero [0x00-0xFF], -1 means something is wrong
+    */
+    virtual int readByte() = 0;
+
+    /** write one byte data to the serila port.
+    * @param data [0x00-0xFF]
+    */
+    virtual void writeByte(char data) = 0;
+
+    /// Check if the serial port is already open.
+    virtual bool isOpen() = 0;
+
+    /// Open the serila port.
+    virtual void open() = 0;
+
+    /// Close the serila port.
+    virtual void close() = 0;
+    
+    /// Check if data is avaliable to read. 
+    virtual bool peek() = 0;
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Device/Address.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,85 @@
+#include "Address.h"
+
+Address * BROADCAST_ZIGBEE = new Address(0x00000000, 0x0000FFFF, 0xFFFE);
+Address * BROADCAST_XBEE = new Address(0x00000000, 0x00000000, 0xFFFF);
+
+Address::Address() {}
+
+Address::Address(const unsigned  char * address64, const unsigned  char * NET16)
+{
+    if (address64 != NULL)
+        memcpy(value,address64,8);
+
+    if (NET16 != NULL) {
+        value[8] = NET16[0];
+        value[9] = NET16[1];
+    }
+}
+
+Address::Address(const unsigned  char * addr)
+{
+    if (addr != NULL)
+        memcpy(value,addr,10);
+}
+
+Address::Address(long serialNumberHigh, long serialNumberLow, int networkAddress)
+{
+    setSerialNumberHigh(serialNumberHigh);
+    setSerialNumberLow(serialNumberLow);
+    setNetworkAddress(networkAddress);
+}
+
+unsigned long Address::getSerialNumberHigh()
+{
+    return (value[0] << 24) | (value[1] << 16) | (value[2] << 8) | value[3];
+}
+
+unsigned long Address::getSerialNumberLow()
+{
+    return (value[4] << 24) | (value[5] << 16) | (value[6] << 8) | value[7];
+}
+
+unsigned int Address::getNetworkAddress()
+{
+    return (value[8] << 8) | value[9];
+}
+
+void Address::setSerialNumberHigh(long serialNumberHigh)
+{
+    value[0] = serialNumberHigh >> 24;
+    value[1] = serialNumberHigh >> 16;
+    value[2] = serialNumberHigh >> 8;
+    value[3] = serialNumberHigh;
+}
+
+void Address::setSerialNumberLow(long serialNumberLow)
+{
+    value[4] = serialNumberLow >> 24;
+    value[5] = serialNumberLow >> 16;
+    value[6] = serialNumberLow >> 8;
+    value[7] = serialNumberLow;
+}
+
+void Address::setNetworkAddress(int networkAddress)
+{
+    value[8] = networkAddress >> 8;
+    value[9] = networkAddress;
+}
+
+const unsigned  char * Address::getAddressValue()
+{
+    return value;
+}
+
+bool operator ==(const Address &a,const Address &b)
+{
+    for (uint8_t i = 0; i < 8; i++)
+        if (a.value[i] != b.value[i])
+            return false;
+    return true;
+}
+
+bool operator !=(const Address &a,const Address &b)
+{
+    return !(a==b);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Device/Address.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,74 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_Address
+#define UK_AC_HERTS_SMARTLAB_XBEE_Address
+
+#include "mbed.h"
+
+/// XBee address class for both S1 and S2 hardware
+class Address
+{
+protected:
+    /// total 10 bytes (IEEE 64 bits + 16 bits networ address)
+    unsigned char value[10];
+public:
+    /// Get the ZigBee broadcast address.
+    static Address * BROADCAST_ZIGBEE;
+    
+    /// Get the XBee broadcast address.
+    static Address * BROADCAST_XBEE;
+
+    /**
+    * Create empty address : 0x00000000 0x00000000 0x0000
+    * this is the default ZigBee Coordinatior
+    */
+    Address();
+
+    /**
+    * Create address from existing byte aray value : 8 bytes of ieee + 2 bytes network
+    * @param address64 8 bytes of IEEE address
+    * @param NET16 value 2 bytes network address
+    */
+    Address(const unsigned char * address64, const unsigned char * NET16);
+
+    /** Create address from existing byte array value ( 8 bytes of IEEE address + 2 bytes 16 bit network address)
+    * @param addr 10 bytes leong : (0-7 bytes for IEEE address, 8-9 bytes for 16 bit network address)
+    */
+    Address(const unsigned char * addr);
+
+    /** Create address from number value.
+    * @param serialNumberHigh first four byts of IEEE address and this can be retrieved by 'SH' command (eg. 0x0013A200)
+    * @param serialNumberLow last four byts of IEEE address and this can be retrieved by 'SL' command.
+    * @param networkAddress a dynamic allocated value for XBee module, 0x0000 is reserved for the coordinator, and this can be retrieved by 'MY' command.
+    */
+    Address(long serialNumberHigh, long serialNumberLow, int networkAddress);
+    
+    /// Get the first 4 bytes of IEEE address
+    unsigned long getSerialNumberHigh();
+
+    /// Get the last 4 bytes of IEEE address
+    unsigned long getSerialNumberLow();
+    
+    /// Get the 16 bit network address
+    unsigned int getNetworkAddress();
+
+    /// Set the first 4 bytes of IEEE address
+    void setSerialNumberHigh(long SerialNumberHigh);
+
+    /// Set the last 4 bytes of IEEE address
+    void setSerialNumberLow(long SerialNumberLow);
+
+    /// Set the 16 bit network address
+    void setNetworkAddress(int NetworkAddress);
+
+    /** Convert the device address to 10 bytes array.
+    * @returns IEEE 64 bit address follow by 16 bit network address
+    */
+    const unsigned  char * getAddressValue();
+    
+    /// Compare two XBee addresses and check if both point to the same device.
+    friend bool operator ==(const Address &a,const Address &b);
+
+    /// Compare two XBee addresses and check if both point to the same device.
+    friend bool operator !=(const Address &a,const Address &b);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Device/ExplicitAddress.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,68 @@
+#include "ExplicitAddress.h"
+
+ExplicitAddress::ExplicitAddress()
+{ }
+
+ExplicitAddress::ExplicitAddress (const unsigned  char * address, const unsigned  char * explicitAddress )
+    : Address(address)
+{
+    memcpy(explicitValue, explicitAddress, 6);
+}
+
+ExplicitAddress::ExplicitAddress(long serialNumberHigh, long serialNumberLow, int networkAddress, int sourceEndpoint, int destinationEndpoint, int clusterID, int profileID)
+    : Address(serialNumberHigh, serialNumberLow, networkAddress)
+{
+    explicitValue[0] = sourceEndpoint;
+    explicitValue[1] = destinationEndpoint;
+    explicitValue[2] = clusterID >> 8;
+    explicitValue[3] = clusterID;
+    explicitValue[4] = profileID >> 8;
+    explicitValue[5] = profileID;
+}
+
+unsigned  char * ExplicitAddress::getExplicitValue()
+{
+    return explicitValue;
+}
+
+unsigned char ExplicitAddress::getSourceEndpoint()
+{
+    return explicitValue[0];
+}
+
+void ExplicitAddress::setSourceEndpoint(unsigned char SourceEndpoint)
+{
+    explicitValue[0] = SourceEndpoint;
+}
+
+unsigned char ExplicitAddress::getDestinationEndpoint()
+{
+    return explicitValue[1];
+}
+
+void ExplicitAddress::setDestinationEndpoint(unsigned char DestinationEndpoint)
+{
+    explicitValue[1] = DestinationEndpoint;
+}
+
+unsigned int ExplicitAddress::getClusterID()
+{
+    return (explicitValue[2] << 8) | explicitValue[3];
+}
+
+void ExplicitAddress::setClusterID(unsigned int ClusterID)
+{
+    explicitValue[2] = ClusterID >> 8;
+    explicitValue[3] = ClusterID;
+}
+
+unsigned int ExplicitAddress::getProfileID()
+{
+    return (explicitValue[4] << 8) | explicitValue[5];
+}
+
+void ExplicitAddress::setProfileID(unsigned int ProfileID)
+{
+    explicitValue[4] = ProfileID >> 8;
+    explicitValue[5] = ProfileID;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Device/ExplicitAddress.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,61 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_ExplicitAddress
+#define UK_AC_HERTS_SMARTLAB_XBEE_ExplicitAddress
+
+#include "Address.h"
+
+/// ZigBeee address class for S2 hardware
+class ExplicitAddress : public Address
+{
+private:
+    /// total 6 bytes : 1 byte of SourceEndpoint + 1 byte of DestinationEndpoint + 2 bytes of ClusterID + 2 bytes of ProfileID
+    unsigned char explicitValue[6];
+
+public:
+    /**
+    * Create a XBee explicit address, with all the value with defatul 0x00
+    */
+    ExplicitAddress();
+
+    /**
+    * Create explicit address from existing byte aray value.
+    * @param addressValue 10 bytes (8 bytes of IEEE address + 2 bytes of network address)
+    * @param explicitValue 6 bytes : 1 byte of SourceEndpoint + 1 byte of DestinationEndpoint + 2 bytes of ClusterID + 2 bytes of ProfileID
+    */
+    ExplicitAddress (const unsigned  char * addressValue, const unsigned  char * explicitValue );
+
+    /**
+    * Create address from existing value.
+    * @param serialNumberHigh
+    * @param serialNumberLow
+    * @param networkAddress
+    * @param sourceEndpoint
+    * @param destinationEndpoint
+    * @param clusterID
+    * @param profileID
+    */
+    ExplicitAddress(long serialNumberHigh, long serialNumberLow, int networkAddress, int sourceEndpoint, int destinationEndpoint, int clusterID, int profileID);
+
+    /**
+    * total 6 bytes/
+    * 1 byte of SourceEndpoint + 1 byte of DestinationEndpoint + 2 bytes of ClusterID + 2 bytes of ProfileID
+    */
+    unsigned  char * getExplicitValue();
+
+    unsigned char getSourceEndpoint();
+
+    void setSourceEndpoint(unsigned char SourceEndpoint);
+
+    unsigned char getDestinationEndpoint();
+
+    void setDestinationEndpoint(unsigned char DestinationEndpoint);
+
+    unsigned int getClusterID();
+
+    void setClusterID(unsigned int ClusterID);
+
+    unsigned int getProfileID();
+
+    void setProfileID(unsigned int ProfileID);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Device/Pin.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,53 @@
+#include "Pin.h"
+
+unsigned char Pin::bitfield[2] = {0,0};
+
+Pin::Pin(unsigned char number)
+{
+    num = number;
+}
+
+Pin::Pin(unsigned char number, const char * command, unsigned int changeDetection)
+{
+    num = number;
+    com[0] = command[0];
+    com[1] = command[2];
+    IODet[0] = changeDetection >> 8;
+    IODet[1] = changeDetection;
+}
+
+unsigned char Pin::getNumber()
+{
+    return num;
+}
+
+const char * Pin::getCommand()
+{
+    return com;
+}
+
+const unsigned char * Pin::IOChangeDetectionConfiguration(Pin ** pins, unsigned char size)
+{
+    Pin::bitfield[0] = 0;
+    Pin::bitfield[1] = 0;
+    for (int i = 0; i < size; i++) {
+        Pin::bitfield[0] |= pins[i]->IODet[0];
+        Pin::bitfield[1] |= pins[i]->IODet[1];
+    }
+    return Pin::bitfield;
+}
+
+const unsigned char * Pin::getIODetection()
+{
+    return IODet;
+}
+
+bool operator ==(const Pin &a,const Pin &b)
+{
+    return a.num == b.num;
+}
+
+bool operator !=(const Pin &a,const Pin &b)
+{
+    return !(a==b);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Device/Pin.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,50 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_Pin
+#define UK_AC_HERTS_SMARTLAB_XBEE_Pin
+
+/// Base class for XBee module pin configuration
+class Pin
+{
+private:
+    static unsigned char bitfield[2];
+
+    unsigned char num;
+
+    char com[2];
+
+    unsigned char IODet[2];
+
+public:
+    /**
+    * Create a pin with its number, using this constructor means this pin has no IO functions.
+    * @param number the number of the pin (0 - 20)
+    */
+    Pin(unsigned char number);
+
+    /**
+    * Create a pin with its number, using this constructor means this pin has IO functions.
+    * @param number the number of the pin (0 - 20)
+    * @param command the configure command for the pin (eg. 'D0')
+    * @param changeDetection IO change dection bitmask configuration.
+    */
+    Pin(unsigned char number, const char * command, unsigned int changeDetection);
+    
+    // Get the pin number
+    unsigned char getNumber();
+    
+    /// Get the configuration command
+    const char * getCommand();
+    
+    /// Get the IO change detection bitmask for this pin
+    const unsigned  char * getIODetection();
+    
+    /// Get the IO change detection bitmask for a set of pins.
+    static const unsigned  char * IOChangeDetectionConfiguration(Pin ** pins, unsigned char size);
+
+    /// Compare two pin and check if both are the same.
+    friend bool operator ==(const Pin &a,const Pin &b);
+    
+    /// Compare two pin and check if both are the same.
+    friend bool operator !=(const Pin &a,const Pin &b);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Device/XBeePins.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,22 @@
+#include "XBeePins.h"
+
+Pin * XBeePins::P1_VCC = new Pin(1);
+Pin * XBeePins::P2_DOUT = new Pin(2);
+Pin * XBeePins::P3_DIN_CONFIG = new Pin(3);
+Pin * XBeePins::P4_DO8 = new Pin(4);
+Pin * XBeePins::P5_RESET = new Pin(5);
+Pin * XBeePins::P6_RSSI_PWM0 = new Pin(6);
+Pin * XBeePins::P7_PWM1 = new Pin(7);
+Pin * XBeePins::P8_RESERVED = new Pin(8);
+Pin * XBeePins::P9_DTR_SLEEP_DIO8 = new Pin(9,"D8",0x0000);
+Pin * XBeePins::P10_GND = new Pin(10);
+Pin * XBeePins::P11_AD4_DIO4 = new Pin(11,"D4",0x0010);
+Pin * XBeePins::P12_CTS_DIO7 = new Pin(12,"D7",0x0080);
+Pin * XBeePins::P13_ON_SLEEP = new Pin(13);
+Pin * XBeePins::P14_VREF = new Pin(14);
+Pin * XBeePins::P15_ASSOCIATE_AD5_DIO5 = new Pin(15,"D5",0x0020);
+Pin * XBeePins::P16_RTS_AD6_DIO6 = new Pin(16,"D6",0x0040);
+Pin * XBeePins::P17_AD3_DIO3 = new Pin(17,"D3",0x0008);
+Pin * XBeePins::P18_AD2_DIO2 = new Pin(18,"D2",0x0004);
+Pin * XBeePins::P19_AD1_DIO1 = new Pin(19,"D1",0x0002);
+Pin * XBeePins::P20_AD0_DIO0 = new Pin(20,"D0",0x0001);
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Device/XBeePins.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,75 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_XBeePins
+#define UK_AC_HERTS_SMARTLAB_XBEE_XBeePins
+
+#include "Pin.h"
+
+/**
+* Pin configuration information for XBee S1 modules.
+*/
+class XBeePins
+{
+public:
+    /** Power supply.
+    * Poor power supply can lead to poor radio performance, especially if the supply voltage is not kept within tolerance or is excessively noisy. To help reduce noise, we recommend placing a 1.0 μF and 8.2 pF capacitor as near as possible to pin 1 on the XBee. If using a switching regulator for the power supply, switching frequencies above 500 kHz are preferred. Power supply ripple should be limited to a maximum 100 mV peak to peak.
+    */
+    static Pin * P1_VCC;
+
+    /// DOUT, Output, UART data out.
+    static Pin * P2_DOUT;
+
+    /// DIN / CONFIG(active low), Input, UART data In.
+    static Pin * P3_DIN_CONFIG;
+
+    /// DO8, Either, Digital output 8, Function is not supported at the time of this release(18/05/2015).
+    static Pin * P4_DO8;
+
+    /// RESET(active low), Input, Module reset (reset pulse must be at least 200 ns).
+    static Pin * P5_RESET;
+
+    /// PWM0 / RSSI, Either, PWM output 0 / RX signal strength indicator.
+    static Pin * P6_RSSI_PWM0;
+
+    /// PWM1, Either, PWM output 1.
+    static Pin * P7_PWM1;
+
+    /// Reserved, Do not connect.
+    static Pin * P8_RESERVED;
+
+    /// DTR(active low) / SLEEP_RQ/ DI8, Either, Pin sleep control line or digital input 8.
+    static Pin * P9_DTR_SLEEP_DIO8;
+
+    /// Ground.
+    static Pin * P10_GND;
+
+    /// AD4 / DIO4, Either, Analog input 4 or digital I/O 4.
+    static Pin * P11_AD4_DIO4;
+
+    /// CTS(active low) / DIO7 Either Clear-to-send flow control or digital I/O 7.
+    static Pin * P12_CTS_DIO7;
+
+    /// ON / SLEEP(active low), Output, Module status indicator
+    static Pin * P13_ON_SLEEP;
+
+    /// VREF, Input, Voltage reference for A/D inputs.
+    static Pin * P14_VREF;
+
+    /// Associate / AD5 / DIO5, Either, Associated indicator, analog input 5 or digital I/O 5.
+    static Pin * P15_ASSOCIATE_AD5_DIO5;
+
+    /// RTS(active low) / DIO6, Either, Request-to-send flow control, or digital I/O 6.
+    static Pin * P16_RTS_AD6_DIO6;
+
+    /// AD3 / DIO3 Either Analog input 3 or digital I/O 3.
+    static Pin * P17_AD3_DIO3;
+
+    /// AD2 / DIO2 Either Analog input 2 or digital I/O 2.
+    static Pin * P18_AD2_DIO2;
+
+    /// AD1 / DIO1 Either Analog input 1 or digital I/O 1.
+    static Pin * P19_AD1_DIO1;
+
+    /// AD0 / DIO0 Either Analog input 0, digital I/O 0.
+    static Pin * P20_AD0_DIO0;
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Device/ZigBeePins.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,22 @@
+#include "ZigBeePins.h"
+
+Pin * ZigBeePins::P1_VCC = new Pin(1);
+Pin * ZigBeePins::P2_DOUT = new Pin(2);
+Pin * ZigBeePins::P3_DIN_CONFIG = new Pin(3);
+Pin * ZigBeePins::P4_DIO12 = new Pin(4,"P2",0x1000);
+Pin * ZigBeePins::P5_RESET = new Pin(5);
+Pin * ZigBeePins::P6_RSSI_PWM_DIO10 = new Pin(6,"P0",0x0400);
+Pin * ZigBeePins::P7_PWM_DIO11 = new Pin(7,"P1",0x0800);
+Pin * ZigBeePins::P8_RESERVED = new Pin(8);
+Pin * ZigBeePins::P9_DTR_SLEEP_DIO8 = new Pin(9);
+Pin * ZigBeePins::P10_GND = new Pin(10);
+Pin * ZigBeePins::P11_DIO4 = new Pin(11,"D4",0x0010);
+Pin * ZigBeePins::P12_CTS_DIO7 = new Pin(12,"D7",0x0080);
+Pin * ZigBeePins::P13_ON_SLEEP = new Pin(13);
+Pin * ZigBeePins::P14_VREF = new Pin(14);
+Pin * ZigBeePins::P15_ASSOCIATE_DIO5 = new Pin(15,"D5",0x0020);
+Pin * ZigBeePins::P16_RTS_DIO6 = new Pin(16,"D6",0x0040);
+Pin * ZigBeePins::P17_AD3_DIO3 = new Pin(17,"D3",0x0008);
+Pin * ZigBeePins::P18_AD2_DIO2 = new Pin(18,"D2",0x0004);
+Pin * ZigBeePins::P19_AD1_DIO1 = new Pin(19,"D1",0x0002);
+Pin * ZigBeePins::P20_AD0_DIO0_COMMISSIONONG_BUTTON = new Pin(20,"D0",0x0001);
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Device/ZigBeePins.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,79 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_ZigBeePins
+#define UK_AC_HERTS_SMARTLAB_XBEE_ZigBeePins
+
+#include "Pin.h"
+
+/**
+* Pin configuration information for XBee S2 modules.
+*/
+class ZigBeePins
+{
+public:
+
+    /** VCC - - Power supply.
+    * Poor power supply can lead to poor radio performance especially if the supply voltage is not kept within tolerance or is excessively noisy. To help reduce noise a 1uF and 8.2pF capacitor are recommended to be placed as near to pin1 on the PCB as possible. If using a switching regulator for your power supply, switching frequencies above 500 kHz are preferred. Power supply ripple should be limited to a maximum 50 mV peak to peak.
+    */
+    static Pin * P1_VCC;
+
+    /// DOUT Output Output UART Data Out.
+    static Pin * P2_DOUT;
+
+    /// DIN / CONFIG(active low) Input Input UART Data In
+    static Pin * P3_DIN_CONFIG;
+
+    /// DIO12 Both Disabled Digital I/O 12.
+    static Pin * P4_DIO12;
+
+    /**
+    * RESET Both Open-Collector with pull-up
+    * Module Reset (reset pulse must be at least 200 ns).
+    */
+    static Pin * P5_RESET;
+
+    /// RSSI PWM / DIO10 Both Output RX Signal Strength Indicator / Digital IO.
+    static Pin * P6_RSSI_PWM_DIO10;
+
+    /// DIO11 Both Input Digital I/O 11.
+    static Pin * P7_PWM_DIO11;
+
+    /// [reserved] - Disabled Do not connect.
+    static Pin * P8_RESERVED;
+
+    /// DTR(avtive low) / SLEEP_RQ/ DIO8 Both Input Pin Sleep Control Line or Digital IO 8.
+    static Pin * P9_DTR_SLEEP_DIO8;
+
+    /// GND - - Ground.
+    static Pin * P10_GND;
+
+    /// DIO4 Both Disabled Digital I/O 4.
+    static Pin * P11_DIO4;
+
+    /// CTS(active low) / DIO7 Both Output Clear-to-Send Flow Control or Digital I/O 7. CTS, if enabled, is an output.
+    static Pin * P12_CTS_DIO7;
+
+    /// ON / SLEEP(active low) Output Output Module Status Indicator or Digital I/O 9.
+    static Pin * P13_ON_SLEEP;
+
+    /// VREF Input - Not used for EM250. Used for programmable secondary processor. For compatibility with other XBee modules, we recommend connecting this pin voltage reference if Analog sampling is desired. Otherwise, connect to GND.
+    static Pin * P14_VREF;
+
+    /// Associate / DIO5 Both Output Associated Indicator, Digital I/O 5.
+    static Pin * P15_ASSOCIATE_DIO5;
+
+    /// RTS(active low) / DIO6 Both Input Request-to-Send Flow Control, Digital I/O 6. RTS, if enabled, is an input.
+    static Pin * P16_RTS_DIO6;
+
+    /// AD3 / DIO3 Both Disabled Analog Input 3 or Digital I/O 3.
+    static Pin * P17_AD3_DIO3;
+
+    /// AD2 / DIO2 Both Disabled Analog Input 2 or Digital I/O 2.
+    static Pin * P18_AD2_DIO2;
+
+    /// AD1 / DIO1 Both Disabled Analog Input 1 or Digital I/O 1.
+    static Pin * P19_AD1_DIO1;
+
+    /// AD0 / DIO0 / Commissioning Button Both Disabled Analog Input 0, Digital IO 0, or Commissioning Button.
+    static Pin * P20_AD0_DIO0_COMMISSIONONG_BUTTON;
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Helper/IOSampleDecoder.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,177 @@
+#include "IOSampleDecoder.h"
+
+IOSamples * IOSampleDecoder::samples = NULL;
+
+int IOSampleDecoder::num = 0;
+
+IOSamples * IOSampleDecoder::XBeeSamplesParse(const unsigned  char * IOSamplePayload, int offset)
+{
+    // at least 3 bytes, 1 byte of [number of samples] + 2 bytes of [digital channel mask] and [analog channel mask].
+    int numofsamples = IOSamplePayload[offset];
+
+    if (numofsamples <= 0)
+        return NULL;
+
+    if (samples != NULL) {
+        if (numofsamples > num) {
+            delete[] samples;
+            samples = new IOSamples[numofsamples];
+        }
+    } else samples = new IOSamples[numofsamples];
+    num = numofsamples;
+
+    // first byte is the number of sample
+    int index = offset + 1;
+
+    int digitMask = ((IOSamplePayload[index] & 0x01) << 8) | IOSamplePayload[index + 1];
+    int analogMask = IOSamplePayload[index] & 0xFE;
+
+    // sample start at +2 [mask]
+    index += 2;
+
+    for (int i = 0; i < numofsamples; i++) {
+        map<Pin *, unsigned int> *  analog = (samples + i)->getAnalogs();
+        map<Pin *, unsigned char> *  digital = (samples + i)->getDigitals();
+        if (digitMask != 0) {
+            if ((digitMask & 0x01) == 0x01)
+                (*digital)[XBeePins::P20_AD0_DIO0] = (IOSamplePayload[index + 1] & 0x01) == 0x01 ? 1 : 0;
+            if ((digitMask & 0x02) == 0x02)
+                (*digital)[XBeePins::P19_AD1_DIO1] = (IOSamplePayload[index + 1] & 0x02) == 0x02 ? 1 : 0;
+            if ((digitMask & 0x04) == 0x04)
+                (*digital)[XBeePins::P18_AD2_DIO2] = (IOSamplePayload[index + 1] & 0x04) == 0x04 ? 1 : 0;
+            if ((digitMask & 0x08) == 0x08)
+                (*digital)[XBeePins::P17_AD3_DIO3] = (IOSamplePayload[index + 1] & 0x08) == 0x08 ? 1 : 0;
+            if ((digitMask & 0x10) == 0x10)
+                (*digital)[XBeePins::P11_AD4_DIO4] = (IOSamplePayload[index + 1] & 0x10) == 0x10 ? 1 : 0;
+            if ((digitMask & 0x20) == 0x20)
+                (*digital)[XBeePins::P15_ASSOCIATE_AD5_DIO5] = (IOSamplePayload[index + 1] & 0x20) == 0x20 ? 1 : 0;
+            if ((digitMask & 0x40) == 0x40)
+                (*digital)[XBeePins::P16_RTS_AD6_DIO6] = (IOSamplePayload[index + 1] & 0x40) == 0x40 ? 1 : 0;
+            if ((digitMask & 0x80) == 0x80)
+                (*digital)[XBeePins::P12_CTS_DIO7] = (IOSamplePayload[index + 1] & 0x80) == 0x80 ? 1 : 0;
+            if (((digitMask >> 8) & 0x01) == 0x01)
+                (*digital)[XBeePins::P9_DTR_SLEEP_DIO8] = (IOSamplePayload[index] & 0x01) == 0x01 ? 1 : 0;
+
+            //skip the 2 [digital sample]
+            index += 2;
+        }
+
+        if (analogMask != 0) {
+            if ((analogMask & 0x02) == 0x02) {
+                (*analog)[XBeePins::P20_AD0_DIO0] = IOSamplePayload[index] << 8 | IOSamplePayload[index+1];
+                index+=2;
+            }
+            if ((analogMask & 0x04) == 0x04) {
+                (*analog)[XBeePins::P19_AD1_DIO1] = IOSamplePayload[index] << 8 | IOSamplePayload[index+1];
+                index+=2;
+            }
+
+            if ((analogMask & 0x08) == 0x08) {
+                (*analog)[XBeePins::P18_AD2_DIO2] = IOSamplePayload[index] << 8 | IOSamplePayload[index+1];
+                index+=2;
+            }
+
+            if ((analogMask & 0x10) == 0x10) {
+                (*analog)[XBeePins::P17_AD3_DIO3] = IOSamplePayload[index] << 8 | IOSamplePayload[index+1];
+                index+=2;
+            }
+
+            if ((analogMask & 0x20) == 0x20) {
+                (*analog)[XBeePins::P11_AD4_DIO4] = IOSamplePayload[index] << 8 | IOSamplePayload[index+1];
+                index+=2;
+            }
+
+            if ((analogMask & 0x40) == 0x40) {
+                (*analog)[XBeePins::P15_ASSOCIATE_AD5_DIO5] = IOSamplePayload[index] << 8 | IOSamplePayload[index+1];
+                index+=2;
+            }
+        }
+    }
+
+    return samples;
+}
+
+IOSamples * IOSampleDecoder::ZigBeeSamplesParse(const unsigned  char * IOSamplePayload, int offset)
+{
+    // at least 4 bytes, 1 byte of [number of samples] + 2 bytes of [digital channel mask] + 1 bytes of [analog channel mask].
+
+    // the [number of samples] always set to 1.
+    int numofsamples = IOSamplePayload[offset];
+
+    if (numofsamples <= 0)
+        return NULL;
+
+    if (samples != NULL) {
+        if (numofsamples > num) {
+            delete[] samples;
+            samples = new IOSamples[numofsamples];
+        }
+    } else samples = new IOSamples[numofsamples];
+    num = numofsamples;
+    
+    int index = offset + 1;
+
+    int digitMask = (IOSamplePayload[index++] << 8) | IOSamplePayload[index++];
+    int analogMask = IOSamplePayload[index++];
+
+    for (int i = 0; i < numofsamples; i++) {
+        map<Pin *, unsigned int> *  analog = (samples + i)->getAnalogs();
+        map<Pin *, unsigned char> *  digital = (samples + i)->getDigitals();
+
+        if (digitMask != 0) {
+            if ((digitMask & 0x01) == 0x01)
+                (*digital)[ZigBeePins::P20_AD0_DIO0_COMMISSIONONG_BUTTON] = (IOSamplePayload[index + 1] & 0x01) == 0x01 ? 1 : 0;
+            if ((digitMask & 0x02) == 0x02)
+                (*digital)[ZigBeePins::P19_AD1_DIO1] = (IOSamplePayload[index + 1] & 0x02) == 0x02 ? 1 : 0;
+            if ((digitMask & 0x04) == 0x04)
+                (*digital)[ZigBeePins::P18_AD2_DIO2] = (IOSamplePayload[index + 1] & 0x04) == 0x04 ? 1 : 0;
+            if ((digitMask & 0x08) == 0x08)
+                (*digital)[ZigBeePins::P17_AD3_DIO3] = (IOSamplePayload[index + 1] & 0x08) == 0x08 ? 1 : 0;
+            if ((digitMask & 0x10) == 0x10)
+                (*digital)[ZigBeePins::P11_DIO4] = (IOSamplePayload[index + 1] & 0x10) == 0x10 ? 1 : 0;
+            if ((digitMask & 0x20) == 0x20)
+                (*digital)[ZigBeePins::P15_ASSOCIATE_DIO5] = (IOSamplePayload[index + 1] & 0x20) == 0x20 ? 1 : 0;
+            if ((digitMask & 0x40) == 0x40)
+                (*digital)[ZigBeePins::P16_RTS_DIO6] = (IOSamplePayload[index + 1] & 0x40) == 0x40 ? 1 : 0;
+            if ((digitMask & 0x80) == 0x80)
+                (*digital)[ZigBeePins::P12_CTS_DIO7] = (IOSamplePayload[index + 1] & 0x80) == 0x80 ? 1 : 0;
+
+            if (((digitMask >> 8) & 0x04) == 0x04)
+                (*digital)[ZigBeePins::P6_RSSI_PWM_DIO10] = (IOSamplePayload[index] & 0x04) == 0x04 ? 1 : 0;
+            if (((digitMask >> 8) & 0x08) == 0x08)
+                (*digital)[ZigBeePins::P7_PWM_DIO11] = (IOSamplePayload[index] & 0x08) == 0x08 ? 1 : 0;
+            if (((digitMask >> 8) & 0x10) == 0x10)
+                (*digital)[ZigBeePins::P4_DIO12] = (IOSamplePayload[index] & 0x10) == 0x10 ? 1 : 0;
+
+            index += 2;// 2 [digital sample]
+        }
+        if (analogMask != 0x00) { //analog mask
+            if ((analogMask & 0x01) == 0x01){
+                (*analog)[ZigBeePins::P20_AD0_DIO0_COMMISSIONONG_BUTTON] = (IOSamplePayload[index] << 8) | IOSamplePayload[index+1];
+                index+=2;
+            }
+
+            if ((analogMask & 0x02) == 0x02){
+                (*analog)[ZigBeePins::P19_AD1_DIO1] = (IOSamplePayload[index] << 8) | IOSamplePayload[index+1];
+                index+=2;
+            }
+
+            if ((analogMask & 0x04) == 0x04){
+                (*analog)[ZigBeePins::P18_AD2_DIO2] = (IOSamplePayload[index] << 8) | IOSamplePayload[index+1];
+                index+=2;
+            }
+
+            if ((analogMask & 0x08) == 0x08){
+                (*analog)[ZigBeePins::P17_AD3_DIO3] = (IOSamplePayload[index] << 8) | IOSamplePayload[index+1];
+                index+=2;
+            }
+
+            if ((analogMask & 0x80) == 0x80){
+                (samples + i)->setSupplyVoltage((IOSamplePayload[index] << 8) | IOSamplePayload[index+1]);
+                index+=2;
+            }
+        }
+    }
+
+    return samples;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Helper/IOSampleDecoder.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,23 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_IOSampleDecoder
+#define UK_AC_HERTS_SMARTLAB_XBEE_IOSampleDecoder
+
+#include "mbed.h"
+#include "IOSamples.h"
+#include "XBeePins.h"
+#include "ZigBeePins.h"
+
+class IOSampleDecoder
+{
+private:
+    static IOSamples * samples;
+    static int num;
+
+public :
+    // return the lenght of io ample
+    static IOSamples * XBeeSamplesParse(const unsigned  char * IOSamplePayload, int offset = 0);
+
+    // return the lenght of io ample
+    static IOSamples * ZigBeeSamplesParse(const unsigned  char * IOSamplePayload, int offset = 0);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/ATCommandIndicator.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,55 @@
+#include "ATCommandIndicator.h"
+
+ATCommandIndicator::ATCommandIndicator(APIFrame *frame)
+    : RxBase(frame)
+{ }
+
+int ATCommandIndicator::getFrameID()
+{
+    return data[1];
+}
+
+unsigned char * ATCommandIndicator::getRequestCommand()
+{
+    return data + 2;
+}
+
+int ATCommandIndicator::getCommandStatus()
+{
+    return data[4];
+}
+
+unsigned  char * ATCommandIndicator::getParameter()
+{
+    if (getParameterLength() <= 0)
+        return NULL;
+
+    return data + 5;
+}
+
+unsigned char ATCommandIndicator::getParameter(int index)
+{
+    return data[5 + index];
+}
+
+int ATCommandIndicator::getParameterLength()
+{
+    return getPosition() - 5;
+}
+
+int ATCommandIndicator::getParameterOffset()
+{
+    return 5;
+}
+
+bool ATCommandIndicator::convert(APIFrame * frame)
+{
+    if (frame == NULL)
+        return false;
+
+    if (frame->getFrameType() != APIFrame::AT_Command_Response)
+        return false;
+
+    return APIFrame::convert(frame);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/ATCommandIndicator.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,42 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_ATCommandIndicator
+#define UK_AC_HERTS_SMARTLAB_XBEE_ATCommandIndicator
+
+#include "RxBase.h"
+#include "ICommandResponse.h"
+
+class ATCommandIndicator : public ICommandResponse, public RxBase
+{
+public :
+    ATCommandIndicator(APIFrame * frame);
+
+    virtual int getFrameID();
+    
+    virtual unsigned char * getRequestCommand();
+
+    /**
+    *
+    * @returns
+    *    OK = 0x00,
+    *    ERROR = 0x01,
+    *    INVALID_COMMAND = 0x02,
+    *    INVALID_Parameter = 0x03,
+    *    TRANSMISSION_FAILED = 0x04,
+    */
+    virtual int getCommandStatus();
+
+    /// <summary>
+    /// if parameter not presented, null will be returned.
+    /// </summary>
+    /// <returns></returns>
+    virtual unsigned  char * getParameter();
+
+    virtual unsigned char getParameter(int index);
+
+    virtual int getParameterLength();
+
+    virtual int getParameterOffset();
+    
+    bool convert(APIFrame * frame);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/ICommandResponse.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,31 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_ICommandResponse
+#define UK_AC_HERTS_SMARTLAB_XBEE_ICommandResponse
+
+class ICommandResponse
+{
+public:
+    virtual int getFrameID() = 0;
+
+    virtual unsigned char * getRequestCommand() = 0;
+
+    /**
+    *
+    * @returns
+    *    OK = 0x00,
+    *    ERROR = 0x01,
+    *    INVALID_COMMAND = 0x02,
+    *    INVALID_Parameter = 0x03,
+    *    TRANSMISSION_FAILED = 0x04,
+    */
+    virtual int getCommandStatus() = 0;
+
+    virtual unsigned  char * getParameter() = 0;
+
+    virtual unsigned char getParameter(int index) = 0;
+
+    virtual int getParameterLength() = 0;
+
+    virtual int getParameterOffset() = 0;
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/IPayloadResponse.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,37 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_IPayloadResponse
+#define UK_AC_HERTS_SMARTLAB_XBEE_IPayloadResponse
+
+#include "Address.h"
+
+class IPayloadResponse
+{
+public:
+    /**
+    * bit mask
+    * SUCCESS = 0x00,
+    * PACKET_ACKNOWLEDGED = 0x01,
+    * PACKET_WAS_A_BROADCAST = 0x02,
+    * PACKET_RECEIVED_ON_BOARDCAST_PAN = 0x04,
+    * PACKET_ENCRYPTED_WITH_APS_ENCRYPTION = 0x20,
+    * PACKET_WAS_SENT_FROM_AN_END_DEVICE = 0x40,
+    */
+    virtual int getReceiveStatus() = 0;
+
+    virtual Address getRemoteDevice() = 0;
+
+    virtual unsigned  char * getReceivedData() = 0;
+
+    virtual int getReceivedDataOffset() = 0;
+
+    virtual char getReceivedData(int index) = 0;
+
+    virtual int getReceivedDataLength() = 0;
+
+    /// <summary>
+    /// not apply to ZigBee
+    /// </summary>
+    /// <returns></returns>
+    virtual int getRSSI() = 0;
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/ISampleResponse.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,40 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_ISampleResponse
+#define UK_AC_HERTS_SMARTLAB_XBEE_ISampleResponse
+
+#include "Address.h"
+#include "IOSamples.h"
+#include "IOSampleDecoder.h"
+
+class ISampleResponse
+{
+protected:
+    //IOSamples * samples;
+
+public:
+    virtual IOSamples * getIOSamples() = 0;
+
+    virtual int getSamplesCount() = 0;
+
+    /**
+    * bit mask
+    * SUCCESS = 0x00,
+    * PACKET_ACKNOWLEDGED = 0x01,
+    * PACKET_WAS_A_BROADCAST = 0x02,
+    * PACKET_RECEIVED_ON_BOARDCAST_PAN = 0x04,
+    * PACKET_ENCRYPTED_WITH_APS_ENCRYPTION = 0x20,
+    * PACKET_WAS_SENT_FROM_AN_END_DEVICE = 0x40,
+    */
+    virtual int getReceiveStatus() = 0;
+
+    virtual Address getRemoteDevice() = 0;
+
+    /// <summary>
+    /// not apply to ZigBee
+    /// </summary>
+    /// <returns></returns>
+    virtual int getRSSI() = 0;
+
+
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/ITransmitStatus.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,39 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_ITransmitStatus
+#define UK_AC_HERTS_SMARTLAB_XBEE_ITransmitStatus
+
+#include "Address.h"
+
+class ITransmitStatus
+{
+public:
+    virtual int getFrameID() = 0;
+
+    /**
+    *SUCCESS = 0x00,
+    *        MAC_ACK_FAILURE = 0x01,
+    *        CCA_FAILURE = 0x02,
+    *        TRANSMISSION_WAS_PURGED = 0x03,
+    *        PHYSICAL_ERROR_OCCURRED_ON_THE_INTERFACE_WITH_THE_WIFI_TRANSCEIVER = 0x04,
+    *        INVALID_DESTINATION_ENDPOINT = 0x15,
+    *        NO_BUFFERS = 0x18,
+    *        NETWORK_ACK_FAILURE = 0x21,
+    *        NOT_JOINED_TO_NETWORK = 0x22,
+    *        SELF_ADDRESSED = 0x23,
+    *        ADDRESS_NOT_FOUND = 0x24,
+    *        ROUTE_NOT_FOUND = 0x25,
+    *        BROADCAST_SOURCE_FAILED_TO_HEAR_A_NEIGBOR_RELAY_THE_MESSAGE = 0x26,
+    *        INVALID_BINDING_TABLE_INDEX = 0x2B,
+    *        INVALID_ENDPOINT = 0x2C,
+    *        ATTEMPTED_BROADCAST_WITH_APS_TRANSMISSION = 0x2D,
+    *        ATTEMPTED_UNICAST_WITH_APS_TRANSMISSION_BUT_EE_0 = 0x2E,
+    *        SOFTWARE_ERROR_OCCURRED = 0x31,
+    *        RESOURCE_ERROR_LACK_OF_FREE_BUFFERS_TIMERS_ETC = 0x32,
+    *        DATA_PAYLOAD_TOO_LARGE = 0x74,
+    *        INDIRECT_MESSAGE_UNREQUESTED = 0x75,
+    *        ATTEMPT_TO_CREATE_A_CLIENT_SOCKET_FAILED = 0x76,
+    *        KEY_NOT_AUTHORIZED = 0xBB,
+    */
+    virtual int getDeliveryStatus() = 0;
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/ManyToOneRouteIndicator.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,21 @@
+#include "ManyToOneRouteIndicator.h"
+
+ManyToOneRouteIndicator::ManyToOneRouteIndicator(APIFrame * frame)
+    : RxBase(frame)
+{  }
+
+Address ManyToOneRouteIndicator::getRemoteDevice()
+{
+    return Address(data + 1);
+}
+
+bool ManyToOneRouteIndicator::convert(APIFrame * frame)
+{
+    if (frame == NULL)
+        return false;
+
+    if (frame->getFrameType() != APIFrame::Many_to_One_Route_Request_Indicator)
+        return false;
+
+    return APIFrame::convert(frame);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/ManyToOneRouteIndicator.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,17 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_ManyToOneRouteIndicator
+#define UK_AC_HERTS_SMARTLAB_XBEE_ManyToOneRouteIndicator
+
+#include "RxBase.h"
+#include "Address.h"
+
+class ManyToOneRouteIndicator: public RxBase
+{
+public:
+    ManyToOneRouteIndicator(APIFrame * frame);
+
+    Address getRemoteDevice();
+    
+    bool convert(APIFrame * frame);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/ModemStatusIndicator.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,21 @@
+#include "ModemStatusIndicator.h"
+
+ModemStatusIndicator::ModemStatusIndicator(APIFrame * frame)
+    : RxBase(frame)
+{ }
+
+int  ModemStatusIndicator::getModemStatus()
+{
+    return data[1];
+}
+
+bool  ModemStatusIndicator::convert(APIFrame * frame)
+{
+    if (frame == NULL)
+        return false;
+
+    if (frame->getFrameType() != APIFrame::Modem_Status)
+        return false;
+
+    return APIFrame::convert(frame);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/ModemStatusIndicator.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,50 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_ModemStatusIndicator
+#define UK_AC_HERTS_SMARTLAB_XBEE_ModemStatusIndicator
+
+#include "RxBase.h"
+
+class ModemStatusIndicator: public RxBase
+{
+public:
+    ModemStatusIndicator(APIFrame * frame);
+
+    /**
+    *
+    * @returns
+    *
+    *        HARDWARE_RESET = 0x00,
+    *        WATCHDOG_TIMER_RESET = 0x01,
+    *        JOINED_NETWORK = 0x02,
+    *        DISASSOCIATED = 0x03,
+    *
+    *        CONFIGURATION_ERROR = 0x04,
+    *        COORDINATOR_REALIGNMENT = 0x05,
+    *
+    *        COORDINATOR_START = 0x06,
+    *        NETWORK_SECURITY_KEY_WAS_UPDATED = 0x07,
+    *
+    *        NETWORK_WOKE_UP = 0x0B,
+    *        NETWORK_WENT_TO_SLEEP = 0x0C,
+    *
+    *        VOLTAGE_SPPLY_LIMIT_EXCEEDED = 0x0D,
+    *        MODEM_CONFIGURATION_CHANGED_WHILE_JOIN_IN_PRIGRESS = 0x11,
+    *
+    *        //0x80+ STACK_ERROR
+    *        STACK_ERROR = 0x80,
+    *
+    *        SEND_JOIN_ISSIED_WITHOUT_CONNECTING_AP = 0x82,
+    *        ACCESS_POINT_NOT_FOUND = 0x83,
+    *        PSK_NOT_FOUND = 0x84,
+    *        SSID_NOT_FOUND = 0x87,
+    *
+    *        FAILED_TO_JOIN_WITH_SECURITY_ENABLED = 0x88,
+    *        INVALID_CHANNEL = 0x8A,
+    *        FAILED_TO_JOIN_ACCESS_POINT = 0x8E,
+    *
+    */
+    int getModemStatus();
+
+    bool convert(APIFrame * frame);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/NodeIdentificationIndicator.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,68 @@
+#include "NodeIdentificationIndicator.h"
+
+NodeIdentificationIndicator::NodeIdentificationIndicator(APIFrame * frame)
+    : RxBase(frame)
+{
+    offset = getPosition() - 8;
+}
+
+int NodeIdentificationIndicator::getReceiveStatus()
+{
+    return data[11];
+}
+
+Address NodeIdentificationIndicator::getRemoteDevice()
+{
+    return Address(data + 14, data + 8);
+}
+
+Address NodeIdentificationIndicator::getSenderDevice()
+{
+    return Address(data + 1);
+}
+
+unsigned  char * NodeIdentificationIndicator::getNIString()
+{
+    int length = getPosition() - 31;
+
+    if (length <= 0)
+        return NULL;
+
+    return data + 22;
+}
+
+int NodeIdentificationIndicator::getParentNetworkAddress()
+{
+    return (data[offset] << 8) | data[offset + 1];
+}
+
+int NodeIdentificationIndicator::getDeviceType()
+{
+    return data[offset + 2];
+}
+
+int NodeIdentificationIndicator::getSourceEvent()
+{
+    return data[offset + 3];
+}
+
+int NodeIdentificationIndicator::getDigiProfileID()
+{
+    return (data[offset + 4] << 8) | data[offset + 5];
+}
+
+int NodeIdentificationIndicator::getManufacturerID()
+{
+    return (data[offset + 6] << 8) | data[offset + 7];
+}
+
+bool  NodeIdentificationIndicator::convert(APIFrame * frame)
+{
+    if (frame == NULL)
+        return false;
+
+    if (frame->getFrameType() != APIFrame::Node_Identification_Indicator)
+        return false;
+
+    return APIFrame::convert(frame);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/NodeIdentificationIndicator.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,64 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_NodeIdentificationIndicator
+#define UK_AC_HERTS_SMARTLAB_XBEE_NodeIdentificationIndicator
+
+#include "Address.h"
+#include "RxBase.h"
+
+class NodeIdentificationIndicator : public RxBase
+{
+private:
+    int offset;
+
+public:
+    NodeIdentificationIndicator(APIFrame * frame);
+
+    /**
+    *
+    * @returns
+    * bit mask
+    *       SUCCESS = 0x00,
+    *       PACKET_ACKNOWLEDGED = 0x01,
+    *       PACKET_WAS_A_BROADCAST = 0x02,
+    *       PACKET_RECEIVED_ON_BOARDCAST_PAN = 0x04,
+    *       PACKET_ENCRYPTED_WITH_APS_ENCRYPTION = 0x20,
+    *       PACKET_WAS_SENT_FROM_AN_END_DEVICE = 0x40,
+    *
+    */
+    int getReceiveStatus();
+
+    Address getRemoteDevice();
+
+    Address getSenderDevice();
+
+    unsigned  char * getNIString();
+
+    int getParentNetworkAddress();
+
+    /*
+    *
+    * @returns
+    *        COORDINATOR = 0x00,
+    *        ROUTER = 0x01,
+    *        END_DEVICE = 0x02,
+    *
+    */
+    int getDeviceType();
+
+    /*
+    *
+    * @returns
+    *    FRAME_SENT_BY_NODE_IDENTIFICATION_PUSHBUTTON_EVENT = 0x01,
+    *    FRAME_SENT_AFTER_JOINING_EVENT_OCCURRED = 0x02,
+    *    FRAME_SENT_AFTER_POWER_CYCLE_EVENT_OCCURRED = 0x03,
+    *
+    */
+    int getSourceEvent();
+
+    int getDigiProfileID();
+
+    int getManufacturerID();
+    
+    bool convert(APIFrame * frame);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/RemoteCommandIndicator.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,59 @@
+#include "RemoteCommandIndicator.h"
+
+RemoteCommandIndicator::RemoteCommandIndicator(APIFrame * frame)
+    : RxBase(frame)
+{}
+
+int RemoteCommandIndicator::getFrameID()
+{
+    return data[1];
+}
+
+unsigned  char * RemoteCommandIndicator::getRequestCommand()
+{
+    return data + 12;
+}
+
+int RemoteCommandIndicator::getCommandStatus()
+{
+    return data[14];
+}
+
+Address RemoteCommandIndicator::getRemoteDevice()
+{
+    return Address(data + 2);
+}
+
+unsigned  char * RemoteCommandIndicator::getParameter()
+{
+    if (getParameterLength() <= 0)
+        return NULL;
+
+    return data + 15;
+}
+
+unsigned char RemoteCommandIndicator::getParameter(int index)
+{
+    return data[15 + index];
+}
+
+int RemoteCommandIndicator::getParameterLength()
+{
+    return getPosition() - 15;
+}
+
+int RemoteCommandIndicator::getParameterOffset()
+{
+    return 15;
+}
+
+bool  RemoteCommandIndicator::convert(APIFrame * frame)
+{
+    if (frame == NULL)
+        return false;
+
+    if (frame->getFrameType() != APIFrame::Remote_Command_Response)
+        return false;
+
+    return APIFrame::convert(frame);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/RemoteCommandIndicator.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,42 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_RemoteCommandIndicator
+#define UK_AC_HERTS_SMARTLAB_XBEE_RemoteCommandIndicator
+
+#include "Address.h"
+#include "RxBase.h"
+#include "ICommandResponse.h"
+
+class RemoteCommandIndicator : public ICommandResponse, public RxBase
+{
+public:
+
+    RemoteCommandIndicator(APIFrame * frame);
+
+    virtual int getFrameID();
+    
+    virtual unsigned  char * getRequestCommand();
+
+    /**
+    *
+    * @returns
+    *    OK = 0x00,
+    *    ERROR = 0x01,
+    *    INVALID_COMMAND = 0x02,
+    *    INVALID_Parameter = 0x03,
+    *    TRANSMISSION_FAILED = 0x04,
+    */
+    virtual int getCommandStatus();
+
+    Address getRemoteDevice();
+
+    virtual unsigned  char * getParameter();
+
+    virtual unsigned char getParameter(int index);
+
+    virtual int getParameterLength();
+
+    virtual int getParameterOffset();
+    
+    bool convert(APIFrame * frame);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/RouteRecordIndicator.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,39 @@
+#include "RouteRecordIndicator.h"
+
+RouteRecordIndicator::RouteRecordIndicator(APIFrame * frame)
+    : RxBase(frame)
+{  }
+
+Address RouteRecordIndicator::getRemoteDevice()
+{
+    return Address(data + 1);
+}
+
+int RouteRecordIndicator::getReceiveStatus()
+{
+    return data[11];
+}
+
+int RouteRecordIndicator::getNumberOfAddresses()
+{
+    return data[12];
+}
+
+int RouteRecordIndicator::getAddresses(int index)
+{
+    if (index >= getNumberOfAddresses())
+        return -1;
+
+    return (data[13 + (index << 2)] << 8) | data[13 + (index << 2) + 1];
+}
+
+bool  RouteRecordIndicator::convert(APIFrame * frame)
+{
+    if (frame == NULL)
+        return false;
+
+    if (frame->getFrameType() != APIFrame::Route_Record_Indicator)
+        return false;
+
+    return APIFrame::convert(frame);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/RouteRecordIndicator.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,35 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_RouteRecordIndicator
+#define UK_AC_HERTS_SMARTLAB_XBEE_RouteRecordIndicator
+
+#include "Address.h"
+#include "RxBase.h"
+
+class RouteRecordIndicator : public RxBase
+{
+public:
+    RouteRecordIndicator(APIFrame * frame);
+
+    Address getRemoteDevice();
+
+    /**
+    * bit mask
+    * SUCCESS = 0x00,
+    * PACKET_ACKNOWLEDGED = 0x01,
+    * PACKET_WAS_A_BROADCAST = 0x02,
+    * PACKET_RECEIVED_ON_BOARDCAST_PAN = 0x04,
+    * PACKET_ENCRYPTED_WITH_APS_ENCRYPTION = 0x20,
+    * PACKET_WAS_SENT_FROM_AN_END_DEVICE = 0x40,
+    */
+    int getReceiveStatus();
+
+    int getNumberOfAddresses();
+
+    /** Array of NET16 address
+    * index is [0, getNumberOfAddresses() -1], -1 means not avaliable
+    */
+    int getAddresses(int index);
+    
+    bool convert(APIFrame * frame);
+};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/RxBase.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,14 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_RxBase
+#define UK_AC_HERTS_SMARTLAB_XBEE_RxBase
+
+#include "APIFrame.h"
+
+class RxBase: public APIFrame
+{
+public:
+    RxBase(APIFrame * frame)
+        : APIFrame(frame)
+    { }
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/SensorReadIndicator.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,56 @@
+#include "SensorReadIndicator.h"
+
+SensorReadIndicator::SensorReadIndicator(APIFrame * frame)
+    : RxBase(frame)
+{ }
+
+Address SensorReadIndicator::GetRemoteDevice()
+{
+    return Address(data + 1);
+}
+
+int SensorReadIndicator::GetReceiveStatus()
+{
+    return data[11];
+}
+
+int SensorReadIndicator::GetOneWireSensor()
+{
+    return data[12];
+}
+
+int SensorReadIndicator::GetAD0()
+{
+    return (data[13] << 8) | data[14];
+}
+
+int SensorReadIndicator::GetAD1()
+{
+    return (data[15] << 8) | data[16];
+}
+
+int SensorReadIndicator::GetAD2()
+{
+    return (data[17] << 8) | data[18];
+}
+
+int SensorReadIndicator::GetAD3()
+{
+    return (data[19] << 8) | data[20];
+}
+
+int SensorReadIndicator::GetThemometer()
+{
+    return (data[21] << 8) | data[22];
+}
+
+bool  SensorReadIndicator::convert(APIFrame * frame)
+{
+    if (frame == NULL)
+        return false;
+
+    if (frame->getFrameType() != APIFrame::XBee_Sensor_Read_Indicato)
+        return false;
+
+    return APIFrame::convert(frame);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/SensorReadIndicator.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,46 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_SensorReadIndicator
+#define UK_AC_HERTS_SMARTLAB_XBEE_SensorReadIndicator
+
+#include "RxBase.h"
+#include "Address.h"
+
+class SensorReadIndicator:  public RxBase
+{
+public:
+    SensorReadIndicator(APIFrame * frame);
+
+    Address GetRemoteDevice();
+
+    /**
+    * bit mask
+    * SUCCESS = 0x00,
+    * PACKET_ACKNOWLEDGED = 0x01,
+    * PACKET_WAS_A_BROADCAST = 0x02,
+    * PACKET_RECEIVED_ON_BOARDCAST_PAN = 0x04,
+    * PACKET_ENCRYPTED_WITH_APS_ENCRYPTION = 0x20,
+    * PACKET_WAS_SENT_FROM_AN_END_DEVICE = 0x40,
+    */
+    int GetReceiveStatus();
+
+    /**
+    *    AD_SENSOR_READ = 0x01,
+    *    TEMPERATURE_SENSOR_READ = 0x02,
+    *    HUMIDITY_SENSOR_READ = 0x03,
+    *    WATER_PRESENT = 0x60,
+    */
+    int GetOneWireSensor();
+
+    int GetAD0();
+
+    int GetAD1();
+
+    int GetAD2();
+
+    int GetAD3();
+
+    int GetThemometer();
+    
+    bool convert(APIFrame * frame);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/XBeeRx16IOSampleIndicator.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,42 @@
+#include "XBeeRx16IOSampleIndicator.h"
+
+XBeeRx16IOSampleIndicator::XBeeRx16IOSampleIndicator(APIFrame *frame)
+    : RxBase(frame)
+{}
+
+int XBeeRx16IOSampleIndicator::getRSSI()
+{
+    return data[3] * -1;
+}
+
+IOSamples * XBeeRx16IOSampleIndicator::getIOSamples()
+{
+    return IOSampleDecoder::XBeeSamplesParse(data + 5);
+    //return samples;
+}
+
+int XBeeRx16IOSampleIndicator::getSamplesCount()
+{
+    return data[5];
+}
+
+int XBeeRx16IOSampleIndicator::getReceiveStatus()
+{
+    return data[4];
+}
+
+Address XBeeRx16IOSampleIndicator::getRemoteDevice()
+{
+    return Address(NULL, data + 1);
+}
+
+bool  XBeeRx16IOSampleIndicator::convert(APIFrame * frame)
+{
+    if (frame == NULL)
+        return false;
+
+    if (frame->getFrameType() != APIFrame::Rx16_IO_Data_Sample_Rx_Indicator)
+        return false;
+
+    return APIFrame::convert(frame);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/XBeeRx16IOSampleIndicator.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,36 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_XBeeRx16IOSampleIndicator
+#define UK_AC_HERTS_SMARTLAB_XBEE_XBeeRx16IOSampleIndicator
+
+#include "RxBase.h"
+#include "Address.h"
+#include "IOSamples.h"
+#include "ISampleResponse.h"
+
+class XBeeRx16IOSampleIndicator: public ISampleResponse, public RxBase
+{
+public:
+    XBeeRx16IOSampleIndicator(APIFrame *frame);
+
+    virtual int getRSSI();
+
+    virtual IOSamples * getIOSamples();
+    
+    virtual int getSamplesCount();
+
+    /**
+    * bit mask
+    * SUCCESS = 0x00,
+    * PACKET_ACKNOWLEDGED = 0x01,
+    * PACKET_WAS_A_BROADCAST = 0x02,
+    * PACKET_RECEIVED_ON_BOARDCAST_PAN = 0x04,
+    * PACKET_ENCRYPTED_WITH_APS_ENCRYPTION = 0x20,
+    * PACKET_WAS_SENT_FROM_AN_END_DEVICE = 0x40,
+    */
+    virtual int getReceiveStatus();
+
+    virtual Address getRemoteDevice();
+    
+    bool convert(APIFrame * frame);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/XBeeRx16Indicator.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,54 @@
+#include "XBeeRx16Indicator.h"
+
+XBeeRx16Indicator::XBeeRx16Indicator(APIFrame * frame)
+    : RxBase(frame)
+{ }
+
+unsigned  char *  XBeeRx16Indicator::getReceivedData()
+{
+    if (getReceivedDataLength() <= 0)
+        return NULL;
+
+    return data + 5;
+}
+
+int  XBeeRx16Indicator::getReceivedDataOffset()
+{
+    return 5;
+}
+
+char  XBeeRx16Indicator::getReceivedData(int index)
+{
+    return data[5 + index];
+}
+
+int  XBeeRx16Indicator::getReceivedDataLength()
+{
+    return getPosition() - 5;
+}
+
+int  XBeeRx16Indicator::getRSSI()
+{
+    return data[3] * -1;
+}
+
+int  XBeeRx16Indicator::getReceiveStatus()
+{
+    return data[4];
+}
+
+Address  XBeeRx16Indicator::getRemoteDevice()
+{
+    return Address(NULL, data + 1);
+}
+
+bool  XBeeRx16Indicator::convert(APIFrame * frame)
+{
+    if (frame == NULL)
+        return false;
+
+    if (frame->getFrameType() != APIFrame::Rx16_Receive_Packet)
+        return false;
+
+    return APIFrame::convert(frame);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/XBeeRx16Indicator.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,39 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_XBeeRx16Indicator
+#define UK_AC_HERTS_SMARTLAB_XBEE_XBeeRx16Indicator
+
+#include "RxBase.h"
+#include "Address.h"
+#include "IPayloadResponse.h"
+
+class XBeeRx16Indicator: public IPayloadResponse, public RxBase
+{
+public:
+    XBeeRx16Indicator(APIFrame * frame);
+
+    virtual unsigned  char * getReceivedData();
+
+    virtual int getReceivedDataOffset();
+
+    virtual char getReceivedData(int index);
+
+    virtual int getReceivedDataLength();
+
+    virtual int getRSSI();
+
+    /**
+    * bit mask
+    * SUCCESS = 0x00,
+    * PACKET_ACKNOWLEDGED = 0x01,
+    * PACKET_WAS_A_BROADCAST = 0x02,
+    * PACKET_RECEIVED_ON_BOARDCAST_PAN = 0x04,
+    * PACKET_ENCRYPTED_WITH_APS_ENCRYPTION = 0x20,
+    * PACKET_WAS_SENT_FROM_AN_END_DEVICE = 0x40,
+    */
+    virtual int getReceiveStatus();
+
+    virtual Address getRemoteDevice();
+    
+    bool convert(APIFrame * frame);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/XBeeRx64IOSampleIndicator.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,41 @@
+#include "XBeeRx64IOSampleIndicator.h"
+
+XBeeRx64IOSampleIndicator::XBeeRx64IOSampleIndicator(APIFrame *frame)
+    : RxBase(frame) {}
+
+int XBeeRx64IOSampleIndicator::getRSSI()
+{
+    return data[9] * -1;
+}
+
+IOSamples * XBeeRx64IOSampleIndicator::getIOSamples()
+{
+    return IOSampleDecoder::XBeeSamplesParse(data + 11);
+    //return samples;
+}
+
+int XBeeRx64IOSampleIndicator::getSamplesCount()
+{
+    return data[11];
+}
+
+int XBeeRx64IOSampleIndicator::getReceiveStatus()
+{
+    return data[10];
+}
+
+Address XBeeRx64IOSampleIndicator::getRemoteDevice()
+{
+    return Address(data + 1 , NULL);
+}
+
+bool  XBeeRx64IOSampleIndicator::convert(APIFrame * frame)
+{
+    if (frame == NULL)
+        return false;
+
+    if (frame->getFrameType() != APIFrame::Rx64_IO_Data_Sample_Rx_Indicator)
+        return false;
+
+    return APIFrame::convert(frame);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/XBeeRx64IOSampleIndicator.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,36 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_XBeeRx64IOSampleIndicator
+#define UK_AC_HERTS_SMARTLAB_XBEE_XBeeRx64IOSampleIndicator
+
+#include "RxBase.h"
+#include "Address.h"
+#include "IOSamples.h"
+#include "ISampleResponse.h"
+
+class XBeeRx64IOSampleIndicator: public ISampleResponse, public RxBase
+{
+public:
+    XBeeRx64IOSampleIndicator(APIFrame *frame);
+
+    virtual int getRSSI();
+
+    virtual IOSamples * getIOSamples();
+    
+    virtual int getSamplesCount();
+
+    /**
+    * bit mask
+    * SUCCESS = 0x00,
+    * PACKET_ACKNOWLEDGED = 0x01,
+    * PACKET_WAS_A_BROADCAST = 0x02,
+    * PACKET_RECEIVED_ON_BOARDCAST_PAN = 0x04,
+    * PACKET_ENCRYPTED_WITH_APS_ENCRYPTION = 0x20,
+    * PACKET_WAS_SENT_FROM_AN_END_DEVICE = 0x40,
+    */
+    virtual int getReceiveStatus();
+
+    virtual Address getRemoteDevice();
+    
+    bool convert(APIFrame * frame);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/XBeeRx64Indicator.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,55 @@
+#include "XBeeRx64Indicator.h"
+
+XBeeRx64Indicator::XBeeRx64Indicator(APIFrame * frame)
+    : RxBase(frame)
+{ }
+
+unsigned  char * XBeeRx64Indicator::getReceivedData()
+{
+    if (getReceivedDataLength() <= 0)
+        return NULL;
+
+    return data + 11;
+}
+
+int XBeeRx64Indicator::getReceivedDataOffset()
+{
+    return 11;
+}
+
+char XBeeRx64Indicator::getReceivedData(int index)
+{
+    return data[11 + index];
+}
+
+int XBeeRx64Indicator::getReceivedDataLength()
+{
+    return getPosition() - 11;
+}
+
+int XBeeRx64Indicator::getRSSI()
+{
+    return data[9] * -1;
+}
+
+int XBeeRx64Indicator::getReceiveStatus()
+{
+    return data[10];
+}
+
+Address XBeeRx64Indicator::getRemoteDevice()
+{
+    return Address(data + 1, NULL);
+}
+
+bool XBeeRx64Indicator::convert(APIFrame * frame)
+{
+    if (frame == NULL)
+        return false;
+
+    if (frame->getFrameType() != APIFrame::Rx64_Receive_Packet)
+        return false;
+
+    return APIFrame::convert(frame);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/XBeeRx64Indicator.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,39 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_XBeeRx64Indicator
+#define UK_AC_HERTS_SMARTLAB_XBEE_XBeeRx64Indicator
+
+#include "RxBase.h"
+#include "Address.h"
+#include "IPayloadResponse.h"
+
+class XBeeRx64Indicator: public IPayloadResponse, public RxBase
+{
+public:
+    XBeeRx64Indicator(APIFrame * frame);
+
+    virtual unsigned  char * getReceivedData();
+
+    virtual int getReceivedDataOffset();
+
+    virtual char getReceivedData(int index);
+
+    virtual int getReceivedDataLength();
+
+    virtual int getRSSI();
+
+    /**
+    * bit mask
+    * SUCCESS = 0x00,
+    * PACKET_ACKNOWLEDGED = 0x01,
+    * PACKET_WAS_A_BROADCAST = 0x02,
+    * PACKET_RECEIVED_ON_BOARDCAST_PAN = 0x04,
+    * PACKET_ENCRYPTED_WITH_APS_ENCRYPTION = 0x20,
+    * PACKET_WAS_SENT_FROM_AN_END_DEVICE = 0x40,
+    */
+    virtual int getReceiveStatus();
+
+    virtual Address getRemoteDevice();
+    
+    bool convert(APIFrame * frame);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/XBeeTxStatusIndicator.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,26 @@
+#include "XBeeTxStatusIndicator.h"
+
+XBeeTxStatusIndicator::XBeeTxStatusIndicator(APIFrame * frame)
+    : RxBase(frame)
+{ }
+
+int XBeeTxStatusIndicator::getFrameID()
+{
+    return data[1];
+}
+
+int XBeeTxStatusIndicator::getDeliveryStatus()
+{
+    return data[2];
+}
+
+bool  XBeeTxStatusIndicator::convert(APIFrame * frame)
+{
+    if (frame == NULL)
+        return false;
+
+    if (frame->getFrameType() != APIFrame::XBee_Transmit_Status)
+        return false;
+
+    return APIFrame::convert(frame);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/XBeeTxStatusIndicator.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,44 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_XBeeTxStatusIndicator
+#define UK_AC_HERTS_SMARTLAB_XBEE_XBeeTxStatusIndicator
+
+#include "RxBase.h"
+#include "ITransmitStatus.h"
+
+class XBeeTxStatusIndicator: public ITransmitStatus, public RxBase
+{
+public:
+    XBeeTxStatusIndicator(APIFrame * frame);
+
+    virtual int getFrameID();
+
+    /**
+    *SUCCESS = 0x00,
+    *        MAC_ACK_FAILURE = 0x01,
+    *        CCA_FAILURE = 0x02,
+    *        TRANSMISSION_WAS_PURGED = 0x03,
+    *        PHYSICAL_ERROR_OCCURRED_ON_THE_INTERFACE_WITH_THE_WIFI_TRANSCEIVER = 0x04,
+    *        INVALID_DESTINATION_ENDPOINT = 0x15,
+    *        NO_BUFFERS = 0x18,
+    *        NETWORK_ACK_FAILURE = 0x21,
+    *        NOT_JOINED_TO_NETWORK = 0x22,
+    *        SELF_ADDRESSED = 0x23,
+    *        ADDRESS_NOT_FOUND = 0x24,
+    *        ROUTE_NOT_FOUND = 0x25,
+    *        BROADCAST_SOURCE_FAILED_TO_HEAR_A_NEIGBOR_RELAY_THE_MESSAGE = 0x26,
+    *        INVALID_BINDING_TABLE_INDEX = 0x2B,
+    *        INVALID_ENDPOINT = 0x2C,
+    *        ATTEMPTED_BROADCAST_WITH_APS_TRANSMISSION = 0x2D,
+    *        ATTEMPTED_UNICAST_WITH_APS_TRANSMISSION_BUT_EE_0 = 0x2E,
+    *        SOFTWARE_ERROR_OCCURRED = 0x31,
+    *        RESOURCE_ERROR_LACK_OF_FREE_BUFFERS_TIMERS_ETC = 0x32,
+    *        DATA_PAYLOAD_TOO_LARGE = 0x74,
+    *        INDIRECT_MESSAGE_UNREQUESTED = 0x75,
+    *        ATTEMPT_TO_CREATE_A_CLIENT_SOCKET_FAILED = 0x76,
+    *        KEY_NOT_AUTHORIZED = 0xBB,
+    */
+    virtual int getDeliveryStatus();
+    
+    bool convert(APIFrame * frame);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/ZigBeeExplicitRxIndicator.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,59 @@
+#include "ZigBeeExplicitRxIndicator.h"
+
+ZigBeeExplicitRxIndicator::ZigBeeExplicitRxIndicator(APIFrame * frame)
+    : RxBase(frame)
+{ }
+
+unsigned  char * ZigBeeExplicitRxIndicator::getReceivedData()
+{
+    if (getReceivedDataLength() <=0)
+        return NULL;
+
+    return data + 18;
+}
+
+int ZigBeeExplicitRxIndicator::getReceivedDataOffset()
+{
+    return 18;
+}
+
+char ZigBeeExplicitRxIndicator::getReceivedData(int index)
+{
+    return data[18 + index];
+}
+
+int ZigBeeExplicitRxIndicator::getReceivedDataLength()
+{
+    return getPosition() - 18;
+}
+
+ExplicitAddress ZigBeeExplicitRxIndicator::getExplicitRemoteDevice()
+{
+    return ExplicitAddress(data + 1, data + 11);
+}
+
+Address ZigBeeExplicitRxIndicator::getRemoteDevice()
+{
+    return Address(data + 1);
+}
+
+int ZigBeeExplicitRxIndicator::getReceiveStatus()
+{
+    return data[17];
+}
+
+int ZigBeeExplicitRxIndicator::getRSSI()
+{
+    return 0;
+}
+
+bool  ZigBeeExplicitRxIndicator::convert(APIFrame * frame)
+{
+    if (frame == NULL)
+        return false;
+
+    if (frame->getFrameType() != APIFrame::ZigBee_Explicit_Rx_Indicator)
+        return false;
+
+    return APIFrame::convert(frame);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/ZigBeeExplicitRxIndicator.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,34 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_ZigBeeExplicitRxIndicator
+#define UK_AC_HERTS_SMARTLAB_XBEE_ZigBeeExplicitRxIndicator
+
+#include "RxBase.h"
+#include "Address.h"
+#include "ExplicitAddress.h"
+#include "IPayloadResponse.h"
+
+class ZigBeeExplicitRxIndicator: public IPayloadResponse, public RxBase
+{
+public:
+
+    ZigBeeExplicitRxIndicator(APIFrame * frame);
+
+    virtual unsigned  char * getReceivedData();
+
+    virtual int getReceivedDataOffset();
+
+    virtual char getReceivedData(int index);
+
+    virtual int getReceivedDataLength();
+
+    ExplicitAddress getExplicitRemoteDevice();
+
+    virtual Address getRemoteDevice();
+
+    virtual int getReceiveStatus();
+
+    virtual int getRSSI();
+    
+    bool convert(APIFrame * frame);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/ZigBeeIOSampleIndicator.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,41 @@
+#include "ZigBeeIOSampleIndicator.h"
+
+ZigBeeIOSampleIndicator::ZigBeeIOSampleIndicator(APIFrame *frame)
+    : RxBase(frame) {}
+
+int ZigBeeIOSampleIndicator::getRSSI()
+{
+    return 0;
+}
+
+IOSamples * ZigBeeIOSampleIndicator::getIOSamples()
+{
+    return IOSampleDecoder::ZigBeeSamplesParse(data + 12);
+    //return samples;
+}
+
+int ZigBeeIOSampleIndicator::getSamplesCount()
+{
+    return data[12];
+}
+
+int ZigBeeIOSampleIndicator::getReceiveStatus()
+{
+    return data[11];
+}
+
+Address ZigBeeIOSampleIndicator::getRemoteDevice()
+{
+    return Address(data + 1);
+}
+
+bool  ZigBeeIOSampleIndicator::convert(APIFrame * frame)
+{
+    if (frame == NULL)
+        return false;
+
+    if (frame->getFrameType() != APIFrame::ZigBee_IO_Data_Sample_Rx_Indicator)
+        return false;
+
+    return APIFrame::convert(frame);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/ZigBeeIOSampleIndicator.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,36 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_ZigBeeIOSampleIndicator
+#define UK_AC_HERTS_SMARTLAB_XBEE_ZigBeeIOSampleIndicator
+
+#include "RxBase.h"
+#include "Address.h"
+#include "IOSamples.h"
+#include "ISampleResponse.h"
+
+class ZigBeeIOSampleIndicator: public ISampleResponse, public RxBase
+{
+public:
+    ZigBeeIOSampleIndicator(APIFrame *frame);
+
+    virtual int getRSSI();
+
+    virtual IOSamples * getIOSamples();
+    
+    virtual int getSamplesCount();
+
+    /**
+    * bit mask
+    * SUCCESS = 0x00,
+    * PACKET_ACKNOWLEDGED = 0x01,
+    * PACKET_WAS_A_BROADCAST = 0x02,
+    * PACKET_RECEIVED_ON_BOARDCAST_PAN = 0x04,
+    * PACKET_ENCRYPTED_WITH_APS_ENCRYPTION = 0x20,
+    * PACKET_WAS_SENT_FROM_AN_END_DEVICE = 0x40,
+    */
+    virtual int getReceiveStatus();
+
+    virtual Address getRemoteDevice();
+    
+    bool convert(APIFrame * frame);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/ZigBeeRxIndicator.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,54 @@
+#include "ZigBeeRxIndicator.h"
+
+ZigBeeRxIndicator::ZigBeeRxIndicator(APIFrame * frame)
+    : RxBase(frame)
+{ }
+
+unsigned  char * ZigBeeRxIndicator::getReceivedData()
+{
+    if (getReceivedDataLength() <= 0)
+        return NULL;
+
+    return data + 12;
+}
+
+int  ZigBeeRxIndicator::getReceivedDataOffset()
+{
+    return 12;
+}
+
+char  ZigBeeRxIndicator::getReceivedData(int index)
+{
+    return data[12 + index];
+}
+
+int  ZigBeeRxIndicator::getReceivedDataLength()
+{
+    return getPosition() - 12;
+}
+
+int  ZigBeeRxIndicator::getReceiveStatus()
+{
+    return data[11];
+}
+
+Address  ZigBeeRxIndicator::getRemoteDevice()
+{
+    return Address(data + 1);
+}
+
+int  ZigBeeRxIndicator::getRSSI()
+{
+    return 0;
+}
+
+bool  ZigBeeRxIndicator::convert(APIFrame * frame)
+{
+    if (frame == NULL)
+        return false;
+
+    if (frame->getFrameType() != APIFrame::ZigBee_Receive_Packet)
+        return false;
+
+    return APIFrame::convert(frame);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/ZigBeeRxIndicator.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,39 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_ZigBeeRxIndicator
+#define UK_AC_HERTS_SMARTLAB_XBEE_ZigBeeRxIndicator
+
+#include "RxBase.h"
+#include "Address.h"
+#include "IPayloadResponse.h"
+
+class ZigBeeRxIndicator: public IPayloadResponse, public RxBase
+{
+public:
+    ZigBeeRxIndicator(APIFrame * frame);
+
+    virtual unsigned  char * getReceivedData();
+
+    virtual int getReceivedDataOffset();
+
+    virtual char getReceivedData(int index);
+
+    virtual int getReceivedDataLength();
+
+    /**
+    * bit mask
+    * SUCCESS = 0x00,
+    * PACKET_ACKNOWLEDGED = 0x01,
+    * PACKET_WAS_A_BROADCAST = 0x02,
+    * PACKET_RECEIVED_ON_BOARDCAST_PAN = 0x04,
+    * PACKET_ENCRYPTED_WITH_APS_ENCRYPTION = 0x20,
+    * PACKET_WAS_SENT_FROM_AN_END_DEVICE = 0x40,
+    */
+    virtual int getReceiveStatus();
+
+    virtual Address getRemoteDevice();
+
+    virtual int getRSSI();
+    
+    bool convert(APIFrame * frame);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/ZigBeeTxStatusIndicator.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,41 @@
+#include "ZigBeeTxStatusIndicator.h"
+
+ZigBeeTxStatusIndicator::ZigBeeTxStatusIndicator(APIFrame * frame)
+    : RxBase(frame)
+{ }
+
+int ZigBeeTxStatusIndicator::getFrameID()
+{
+    return data[1];
+}
+
+int ZigBeeTxStatusIndicator::getDeliveryStatus()
+{
+    return data[5];
+}
+
+int ZigBeeTxStatusIndicator::getDestinationAddress16()
+{
+    return (data[2] << 8) | data[3];
+}
+
+int ZigBeeTxStatusIndicator::getTransmitRetryCount()
+{
+    return data[4];
+}
+
+int ZigBeeTxStatusIndicator::getDiscoveryStatus()
+{
+    return data[6];
+}
+
+bool  ZigBeeTxStatusIndicator::convert(APIFrame * frame)
+{
+    if (frame == NULL)
+        return false;
+
+    if (frame->getFrameType() != APIFrame::ZigBee_Transmit_Status)
+        return false;
+
+    return APIFrame::convert(frame);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Indicator/ZigBeeTxStatusIndicator.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,57 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_ZigBeeTxStatusIndicator
+#define UK_AC_HERTS_SMARTLAB_XBEE_ZigBeeTxStatusIndicator
+
+#include "RxBase.h"
+#include "ITransmitStatus.h"
+
+class ZigBeeTxStatusIndicator: public ITransmitStatus, public RxBase
+{
+public:
+    ZigBeeTxStatusIndicator(APIFrame * frame);
+
+    virtual int getFrameID();
+
+    /**
+       *SUCCESS = 0x00,
+       *        MAC_ACK_FAILURE = 0x01,
+       *        CCA_FAILURE = 0x02,
+       *        TRANSMISSION_WAS_PURGED = 0x03,
+       *        PHYSICAL_ERROR_OCCURRED_ON_THE_INTERFACE_WITH_THE_WIFI_TRANSCEIVER = 0x04,
+       *        INVALID_DESTINATION_ENDPOINT = 0x15,
+       *        NO_BUFFERS = 0x18,
+       *        NETWORK_ACK_FAILURE = 0x21,
+       *        NOT_JOINED_TO_NETWORK = 0x22,
+       *        SELF_ADDRESSED = 0x23,
+       *        ADDRESS_NOT_FOUND = 0x24,
+       *        ROUTE_NOT_FOUND = 0x25,
+       *        BROADCAST_SOURCE_FAILED_TO_HEAR_A_NEIGBOR_RELAY_THE_MESSAGE = 0x26,
+       *        INVALID_BINDING_TABLE_INDEX = 0x2B,
+       *        INVALID_ENDPOINT = 0x2C,
+       *        ATTEMPTED_BROADCAST_WITH_APS_TRANSMISSION = 0x2D,
+       *        ATTEMPTED_UNICAST_WITH_APS_TRANSMISSION_BUT_EE_0 = 0x2E,
+       *        SOFTWARE_ERROR_OCCURRED = 0x31,
+       *        RESOURCE_ERROR_LACK_OF_FREE_BUFFERS_TIMERS_ETC = 0x32,
+       *        DATA_PAYLOAD_TOO_LARGE = 0x74,
+       *        INDIRECT_MESSAGE_UNREQUESTED = 0x75,
+       *        ATTEMPT_TO_CREATE_A_CLIENT_SOCKET_FAILED = 0x76,
+       *        KEY_NOT_AUTHORIZED = 0xBB,
+       */
+    virtual int getDeliveryStatus();
+
+    int getDestinationAddress16();
+
+    int getTransmitRetryCount();
+
+    /**
+    *   NO_DISCOVERY_OVERHEAD = 0x00,
+    *    ADDRESS_DISCOVERY = 0x01,
+    *    ROUTE_DISCOVERY = 0x02,
+    *    ADDRESS_AND_ROUTE_DISCOVERY = 0x03,
+    *    EXTENED_TIMEOUT_DISCOVERY = 0x40,
+    */
+    int getDiscoveryStatus();
+    
+    bool convert(APIFrame * frame);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Options/OptionsBase.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,35 @@
+#include "OptionsBase.h"
+
+OptionsBase::OptionsBase()
+{
+    value = 0x00;
+}
+
+OptionsBase::OptionsBase(unsigned char option)
+{
+    value = option;
+}
+
+OptionsBase * OptionsBase::DEFAULT = new OptionsBase();
+
+OptionsBase * OptionsBase::DisableRetriesRouteRepair = new OptionsBase(0x01);
+
+bool OptionsBase::getDisableRetriesRouteRepair()
+{
+    if ((value & 0x01) == 0x01)
+        return true;
+    else return false;
+}
+
+void OptionsBase::setDisableRetriesRouteRepair(bool status)
+{
+    if (status)
+        value |= 0x01;
+    else
+        value &= 0xFE;
+}
+
+unsigned char OptionsBase::getValue()
+{
+    return value;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Options/OptionsBase.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,24 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_OptionsBase
+#define UK_AC_HERTS_SMARTLAB_XBEE_OptionsBase
+
+class OptionsBase
+{
+protected :
+    unsigned char value;
+public:
+    OptionsBase();
+
+    OptionsBase(unsigned char option);
+
+    static OptionsBase * DEFAULT;
+
+    static OptionsBase * DisableRetriesRouteRepair;
+
+    bool getDisableRetriesRouteRepair();
+
+    void setDisableRetriesRouteRepair(bool status);
+
+    unsigned char getValue();
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Options/RemoteCommandOptions.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,34 @@
+#include "RemoteCommandOptions.h"
+
+
+RemoteCommandOptions::RemoteCommandOptions()
+    : TransmitOptions()
+{ }
+
+RemoteCommandOptions::RemoteCommandOptions(unsigned char option)
+    : TransmitOptions(option)
+{ }
+
+RemoteCommandOptions::RemoteCommandOptions(bool disable_retries_and_route_repair, bool apply_changes, bool enable_APS_encryption, bool use_extended_transmission_timeout)
+    : TransmitOptions(disable_retries_and_route_repair, enable_APS_encryption, use_extended_transmission_timeout)
+{
+    if (apply_changes)
+        value |= 0x02;
+}
+
+RemoteCommandOptions * RemoteCommandOptions::ApplyChanges =  new RemoteCommandOptions (0x02);
+
+void RemoteCommandOptions::setApplyChanges(bool status)
+{
+    if (status)
+        value |= 0x02;
+    else
+        value &= 0xFD;
+}
+
+bool RemoteCommandOptions::getApplyChanges()
+{
+    if (value & 0x02 == 0x02)
+        return true;
+    else return false;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Options/RemoteCommandOptions.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,23 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_RemoteCommandOptions
+#define UK_AC_HERTS_SMARTLAB_XBEE_RemoteCommandOptions
+
+#include "TransmitOptions.h"
+
+class RemoteCommandOptions : public TransmitOptions
+{
+public :
+    RemoteCommandOptions();
+    
+    RemoteCommandOptions(unsigned char option);
+
+    RemoteCommandOptions(bool disable_retries_and_route_repair, bool apply_changes, bool enable_APS_encryption, bool use_extended_transmission_timeout);
+
+    static RemoteCommandOptions * ApplyChanges;
+
+    bool getApplyChanges();
+
+    void setApplyChanges(bool status);
+
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Options/TransmitOptions.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,54 @@
+#include "TransmitOptions.h"
+
+TransmitOptions::TransmitOptions()
+    : OptionsBase()
+{ }
+
+TransmitOptions::TransmitOptions(unsigned char option)
+    : OptionsBase(option)
+{ }
+
+TransmitOptions::TransmitOptions(bool disable_retries_and_route_repair, bool enable_APS_encryption, bool use_extended_transmission_timeout)
+{
+    value = 0x00;
+    if (disable_retries_and_route_repair)
+        value |= 0x01;
+    if (enable_APS_encryption)
+        value |= 0x20;
+    if (use_extended_transmission_timeout)
+        value |= 0x40;
+}
+
+TransmitOptions * TransmitOptions::EnableAPS = new TransmitOptions(0x20);
+
+TransmitOptions * TransmitOptions::UseExtendedTimeout = new TransmitOptions(0x40);
+
+bool TransmitOptions::getEnableAPS()
+{
+    if (value & 0x20 == 0x20)
+        return true;
+    else return false;
+}
+
+void TransmitOptions::setEnableAPS(bool status)
+{
+    if (status)
+        value |= 0x20;
+    else
+        value &= 0xDF;
+}
+
+bool TransmitOptions::getUseExtendedTimeout()
+{
+    if ((value & 0x40) == 0x40)
+        return true;
+    else return false;
+}
+
+void TransmitOptions::setUseExtendedTimeout(bool status)
+{
+    if (status)
+        value |= 0x40;
+    else
+        value &= 0xBF;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Options/TransmitOptions.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,33 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_TransmitOptions
+#define UK_AC_HERTS_SMARTLAB_XBEE_TransmitOptions
+
+#include "OptionsBase.h"
+
+class TransmitOptions : public OptionsBase
+{
+    //Default = 0x00;
+    //Disable_Retries_Route_Repair = 0x01;
+    //Enable_APS = 0x20;
+    //Use_Extended_Timeout = 0x40;
+
+public:
+    TransmitOptions();
+    
+    TransmitOptions(unsigned char option);
+
+    TransmitOptions(bool disable_retries_and_route_repair, bool enable_APS_encryption, bool use_extended_transmission_timeout);
+
+    static TransmitOptions * EnableAPS;
+
+    static TransmitOptions * UseExtendedTimeout;
+    
+    bool getEnableAPS();
+
+    void setEnableAPS(bool status);
+
+    bool getUseExtendedTimeout();
+
+    void setUseExtendedTimeout(bool status);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Options/Tx16TransmitOptions.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,70 @@
+#include "Tx16TransmitOptions.h"
+
+Tx16TransmitOptions::Tx16TransmitOptions() { }
+
+Tx16TransmitOptions::Tx16TransmitOptions(unsigned char value):OptionsBase(value)
+{ }
+
+Tx16TransmitOptions::Tx16TransmitOptions(bool disable_retries_and_route_repair, bool force_long_header, bool disable_long_header, bool invoke_traceroute)
+{
+    value = 0x00;
+    if (disable_retries_and_route_repair)
+        value |= 0x01;
+    if (force_long_header)
+        value |= 0x02;
+    if (disable_long_header)
+        value |= 0x04;
+    if (invoke_traceroute)
+        value |= 0x08;
+}
+
+Tx16TransmitOptions * Tx16TransmitOptions::ForceLongHeader = new Tx16TransmitOptions(0x02);
+
+Tx16TransmitOptions * Tx16TransmitOptions::DisableLongHeader = new Tx16TransmitOptions(0x04);
+
+Tx16TransmitOptions * Tx16TransmitOptions::InvokeTraceroute = new Tx16TransmitOptions(0x08);
+
+bool Tx16TransmitOptions::getForceLongHeader()
+{
+    if ((value & 0x02) == 0x02)
+        return true;
+    else return false;
+}
+
+void Tx16TransmitOptions::setForceLongHeader(bool status)
+{
+    if (status)
+        value |= 0x02;
+    else
+        value &= 0xFD;
+}
+
+bool Tx16TransmitOptions::getDisableLongHeader()
+{
+    if ((value & 0x04) == 0x04)
+        return true;
+    else return false;
+}
+
+void Tx16TransmitOptions::setDisableLongHeader(bool status)
+{
+    if (status)
+        value |= 0x04;
+    else
+        value &= 0xFB;
+}
+
+bool Tx16TransmitOptions::getInvokeTraceroute()
+{
+    if ((value & 0x08) == 0x08)
+        return true;
+    else return false;
+}
+
+void Tx16TransmitOptions::setInvokeTraceroute(bool status)
+{
+    if (status)
+        value |= 0x08;
+    else
+        value &= 0xF7;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Options/Tx16TransmitOptions.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,40 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_Tx16TransmitOptions
+#define UK_AC_HERTS_SMARTLAB_XBEE_Tx16TransmitOptions
+
+#include "OptionsBase.h"
+
+class Tx16TransmitOptions : public OptionsBase
+{
+
+    //0x01 - Disable retries and route repair
+    //0x02 - Force a long header to precede this packet
+    //0x04 - Disable Sending of long header
+    //0x08 - Invoke Traceroute
+
+public:
+    static Tx16TransmitOptions * ForceLongHeader;
+
+    static Tx16TransmitOptions * DisableLongHeader;
+
+    static Tx16TransmitOptions * InvokeTraceroute;
+
+    Tx16TransmitOptions();
+    
+    Tx16TransmitOptions(unsigned char value);
+
+    Tx16TransmitOptions(bool disable_retries_and_route_repair, bool force_long_header, bool disable_long_header, bool invoke_traceroute);
+
+    bool getForceLongHeader();
+
+    void setForceLongHeader(bool status);
+
+    bool getDisableLongHeader();
+
+    void setDisableLongHeader(bool status);
+
+    bool getInvokeTraceroute();
+
+    void setInvokeTraceroute(bool status);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Options/Tx64TransmitOptions.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,90 @@
+#include "Tx64TransmitOptions.h"
+
+Tx64TransmitOptions::Tx64TransmitOptions() { }
+
+Tx64TransmitOptions::Tx64TransmitOptions(unsigned char value)
+    : OptionsBase(value)
+{ }
+
+Tx64TransmitOptions::Tx64TransmitOptions(bool disable_retries_and_route_repair, bool donot_repeat_packet, bool send_packet_with_broadcast_PanID, bool invoke_traceroute, bool purge_packet_if_delayed_due_to_duty_cycle)
+{
+    value = 0x00;
+    if (disable_retries_and_route_repair)
+        value |= 0x01;
+    if (donot_repeat_packet)
+        value |= 0x02;
+    if (send_packet_with_broadcast_PanID)
+        value |= 0x04;
+    if (invoke_traceroute)
+        value |= 0x08;
+    if (purge_packet_if_delayed_due_to_duty_cycle)
+        value |= 0x10;
+}
+
+Tx64TransmitOptions * Tx64TransmitOptions::DonotRepeatPacket = new Tx64TransmitOptions(0x02);
+
+Tx64TransmitOptions * Tx64TransmitOptions::SendPacketWithBroadcastPanID = new Tx64TransmitOptions(0x04);
+
+Tx64TransmitOptions * Tx64TransmitOptions::InvokeTraceroute = new Tx64TransmitOptions(0x08);
+
+Tx64TransmitOptions * Tx64TransmitOptions::PurgePacketWhenDelayed = new Tx64TransmitOptions(0x10);
+
+bool Tx64TransmitOptions::getDonotRepeatPacket()
+{
+    if ((value & 0x02) == 0x02)
+        return true;
+    else return false;
+}
+
+void Tx64TransmitOptions::setDonotRepeatPacket(bool status)
+{
+    if (status)
+        value |= 0x02;
+    else
+        value &= 0xFD;
+}
+
+bool Tx64TransmitOptions::getSendPacketWithBroadcastPanID()
+{
+    if ((value & 0x04) == 0x04)
+        return true;
+    else return false;
+}
+
+void Tx64TransmitOptions::setSendPacketWithBroadcastPanID(bool status)
+{
+    if (status)
+        value |= 0x04;
+    else
+        value &= 0xFB;
+}
+
+bool Tx64TransmitOptions::getInvokeTraceroute()
+{
+    if ((value & 0x08) == 0x08)
+        return true;
+    else return false;
+}
+
+void Tx64TransmitOptions::setInvokeTraceroute(bool status)
+{
+    if (status)
+        value |= 0x08;
+    else
+        value &= 0xF7;
+}
+
+bool Tx64TransmitOptions::getPurgePacketWhenDelayed()
+{
+    if ((value & 0x10) == 0x10)
+        return true;
+    else return false;
+}
+
+void Tx64TransmitOptions::setPurgePacketWhenDelayed(bool status)
+{
+    if (status)
+        value |= 0x10;
+    else
+        value &= 0xEF;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Options/Tx64TransmitOptions.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,45 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_Tx64TransmitOptions
+#define UK_AC_HERTS_SMARTLAB_XBEE_Tx64TransmitOptions
+
+#include "OptionsBase.h"
+
+class Tx64TransmitOptions : public OptionsBase
+{
+    //0x01 - Disable retries and route repair (XTEND and XBEE)
+    //0x02 - Don't repeat this packet (not implemented)
+    //0x04 - Send packet with Broadcast Pan ID (XBEE only)
+    //0x08 - Invoke Traceroute (XTEND version 8030 only)
+    //0x10 (XB868DP) If the packet would be delayed due to duty cycle then purge it. All other bits must be set to 0
+public:
+    Tx64TransmitOptions();
+
+    Tx64TransmitOptions(unsigned char vlaue);
+
+    Tx64TransmitOptions(bool disable_retries_and_route_repair, bool donot_repeat_packet, bool send_packet_with_broadcast_PanID, bool invoke_traceroute, bool purge_packet_if_delayed_due_to_duty_cycle);
+
+    static Tx64TransmitOptions * DonotRepeatPacket;
+
+    static Tx64TransmitOptions * SendPacketWithBroadcastPanID;
+
+    static Tx64TransmitOptions * InvokeTraceroute;
+
+    static Tx64TransmitOptions * PurgePacketWhenDelayed;
+
+    bool getDonotRepeatPacket();
+
+    void setDonotRepeatPacket(bool status);
+
+    bool getSendPacketWithBroadcastPanID();
+
+    void setSendPacketWithBroadcastPanID(bool status);
+
+    bool getInvokeTraceroute();
+
+    void setInvokeTraceroute(bool status);
+
+    bool getPurgePacketWhenDelayed();
+
+    void setPurgePacketWhenDelayed(bool status);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Request/ATCommandRequest.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,31 @@
+#include "ATCommandRequest.h"
+
+ATCommandRequest::ATCommandRequest(unsigned  char frameID, const char * command, const unsigned  char * parameter, int offset, int length)
+    : TxBase(2 + (parameter == NULL ? 0 : length), APIFrame::AT_Command, frameID)
+{
+    set(command[0]);
+    set(command[1]);
+
+    if (parameter != NULL)
+        sets(parameter, offset, length);
+}
+
+void ATCommandRequest::setAppleChanges(bool appleChanges)
+{
+    if (appleChanges)
+        setFrameType(APIFrame::AT_Command);
+    else
+        setFrameType(APIFrame::AT_Command_Queue_Parameter_Value);
+}
+
+void ATCommandRequest::setCommand(const char * command)
+{
+    set(2, command[0]);
+    set(3, command[1]);
+}
+
+void ATCommandRequest::setParameter(const unsigned  char * parameter, int offset, int length)
+{
+    setPosition(4);
+    sets(parameter, offset, length);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Request/ATCommandRequest.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,31 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_ATCommandRequest
+#define UK_AC_HERTS_SMARTLAB_XBEE_ATCommandRequest
+
+#include "TxBase.h"
+#include "ICommandRequest.h"
+
+class ATCommandRequest: public TxBase, public ICommandRequest
+{
+
+public:
+        //0x08 or 0x09
+        //FrameID
+        //AT_Command
+        //Parameter_Value
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="FrameID"></param>
+        /// <param name="AT_Command"></param>
+        /// <param name="Parameter_Value">this can be null</param>
+        ATCommandRequest(unsigned  char frameID, const char * command, const unsigned  char * parameter=NULL, int offset=0, int length=0);
+
+        virtual void setAppleChanges(bool appleChanges);
+
+        virtual void setCommand(const char * command);
+
+        virtual void setParameter(const unsigned  char * parameter, int offset, int length);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Request/CreateSourceRouteRequest.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,24 @@
+#include "CreateSourceRouteRequest.h"
+
+CreateSourceRouteRequest::CreateSourceRouteRequest(unsigned  char frameID, Address * remoteAddress, int * addresses, int size)
+    : TxBase(12 + (size << 2), APIFrame::Create_Source_Route, frameID)
+{
+    sets(remoteAddress->getAddressValue(), 0, 10);
+    set(0x00);
+    setAddresses(addresses, size);
+}
+
+void CreateSourceRouteRequest::setRemoteAddress(Address * remoteAddress)
+{
+    sets(2, remoteAddress->getAddressValue(), 0, 10);
+}
+
+void CreateSourceRouteRequest::setAddresses(int * addresses, int size)
+{
+    setPosition(13);
+    set(size);
+    for (int i = 0; i< size; i++) {
+        set(addresses[i] >> 8);
+        set(addresses[i]);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Request/CreateSourceRouteRequest.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,36 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_CreateSourceRouteRequest
+#define UK_AC_HERTS_SMARTLAB_XBEE_CreateSourceRouteRequest
+
+#include "TxBase.h"
+#include "Address.h"
+
+class CreateSourceRouteRequest: public TxBase
+{
+
+public:
+    //0x21
+    //FrameID
+    //RemoteDevice (64 + 16)
+    //0x00
+    //Number of Address
+    //Address List
+
+    /// <summary>
+    ///
+    /// </summary>
+    /// <param name="FrameID"></param>
+    /// <param name="AT_Command"></param>
+    /// <param name="Parameter_Value">this can be null</param>
+    CreateSourceRouteRequest(unsigned  char frameID, Address * remoteAddress, int * addresses, int size);
+
+    void setRemoteAddress(Address * remoteAddress);
+
+    /**
+    *
+    * @param addresses array of network address
+    *
+    */
+    void setAddresses(int * addresses, int size);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Request/ICommandRequest.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,16 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_ICommandRequest
+#define UK_AC_HERTS_SMARTLAB_XBEE_ICommandRequest
+
+class ICommandRequest
+{
+
+public:
+
+    virtual void setAppleChanges(bool appleChanges) = 0;
+
+    virtual void setCommand(const char * command) = 0;
+
+    virtual void setParameter(const unsigned  char * parameter, int offset, int length) = 0;
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Request/IOCDetectionConfigRequest.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,16 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_IOCDetectionConfigRequest
+#define UK_AC_HERTS_SMARTLAB_XBEE_IOCDetectionConfigRequest
+
+#include "Pin.h"
+#include "ATCommands.h"
+#include "ATCommandRequest.h"
+
+class IOCDetectionConfigRequest : public ATCommandRequest
+{
+public:
+    IOCDetectionConfigRequest(unsigned  char frameID, Pin ** pins, int size)
+        : ATCommandRequest(frameID, ATCommands::Digital_IO_Change_Detection, Pin::IOChangeDetectionConfiguration(pins, size), 0, 2)
+    { }
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Request/IPayloadRequest.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,15 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_IPayloadRequest
+#define UK_AC_HERTS_SMARTLAB_XBEE_IPayloadRequest
+
+class IPayloadRequest
+{
+
+public:
+    virtual void setPayload(const unsigned char * data,int offset, int length) = 0;
+
+    virtual void setTransmitOptions(OptionsBase * transmitOptions) = 0;
+
+    virtual void setRemoteAddress(Address * remoteAddress) = 0;
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Request/PinConfigurationRequest.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,39 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_PinConfigurationRequest
+#define UK_AC_HERTS_SMARTLAB_XBEE_PinConfigurationRequest
+
+#include "Pin.h"
+#include "ATCommands.h"
+#include "ATCommandRequest.h"
+
+class PinConfigurationRequest : public ATCommandRequest
+{
+public:
+    /**
+    * @param function
+    *DISABLED = 0x00,
+    *RESERVED_FOR_PIN_SPECIFIC_ALTERNATE_FUNCTIONALITIES = 0x01,
+    *ANALOG_INPUT_SINGLE_ENDED = 0x02,
+    *DIGITAL_INPUT_MONITORED = 0x03,
+    *DIGITAL_OUTPUT_DEFAULT_LOW = 0x04,
+    *DIGITAL_OUTPUT_DEFAULT_HIGH = 0x05,
+    *ALTERNATE_FUNCTIONALITIES_WHERE_APPLICABLE = 0x06//0x06~0x09
+    */
+    PinConfigurationRequest(unsigned  char frameID, Pin * pin, unsigned char function)
+        : ATCommandRequest(frameID, pin->getCommand(), &function, 0, 1)
+    { }
+    
+    /**
+    * @param function
+    *DISABLED = 0x00,
+    *RESERVED_FOR_PIN_SPECIFIC_ALTERNATE_FUNCTIONALITIES = 0x01,
+    *ANALOG_INPUT_SINGLE_ENDED = 0x02,
+    *DIGITAL_INPUT_MONITORED = 0x03,
+    *DIGITAL_OUTPUT_DEFAULT_LOW = 0x04,
+    *DIGITAL_OUTPUT_DEFAULT_HIGH = 0x05,
+    *ALTERNATE_FUNCTIONALITIES_WHERE_APPLICABLE = 0x06//0x06~0x09
+    */
+    void setPinFunction(unsigned  char function) { data[4] = function; }
+    
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Request/RemoteATCommandRequest.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,42 @@
+#include "RemoteATCommandRequest.h"
+
+RemoteATCommandRequest::RemoteATCommandRequest(unsigned  char frameID, Address * remoteAddress, const char * command, OptionsBase * transmitOptions, const unsigned  char * parameter, int parameterOffset, int parameterLength)
+    : TxBase(13 + (parameter == NULL ? 0 : parameterLength), APIFrame::Remote_Command_Request, frameID)
+{
+    sets(remoteAddress->getAddressValue(), 0, 10);
+    set(transmitOptions->getValue());
+    set(command[0]);
+    set(command[1]);
+
+    if (parameter != NULL)
+        sets(parameter, parameterOffset, parameterLength);
+}
+
+void RemoteATCommandRequest::setTransmitOptions(OptionsBase * transmitOptions)
+{
+    data[12] = transmitOptions->getValue();
+}
+
+void RemoteATCommandRequest::setAppleChanges(bool appleChanges)
+{
+    if (appleChanges)
+       data[12] |= 0x02;
+    else data[12] &= 0xFD;
+}
+
+void RemoteATCommandRequest::setCommand(const char * command)
+{
+    set(13, command[0]);
+    set(14, command[1]);
+}
+
+void RemoteATCommandRequest::setParameter(const unsigned  char * parameter, int offset, int length)
+{
+    setPosition(15);
+    sets(parameter, offset, length);
+}
+
+void RemoteATCommandRequest::setRemoteAddress(Address * remoteAddress)
+{
+    sets(2, remoteAddress->getAddressValue(), 0, 10);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Request/RemoteATCommandRequest.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,39 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_RemoteATCommandRequest
+#define UK_AC_HERTS_SMARTLAB_XBEE_RemoteATCommandRequest
+
+#include "TxBase.h"
+#include "ICommandRequest.h"
+
+class RemoteATCommandRequest : public TxBase, public ICommandRequest
+{
+
+public:
+        //0x17
+        //FrameID;
+        //RemoteDevice
+        //Remote Command Options
+        //AT_Command
+        //Parameter_Value
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="FrameID"></param>
+        /// <param name="RemoteDevice"></param>
+        /// <param name="options">RemoteCommandOptions</param>
+        /// <param name="AT_Command"></param>
+        /// <param name="Parameter_Value">this can be null</param>
+        RemoteATCommandRequest(unsigned  char frameID, Address * remoteAddress, const char * command, OptionsBase * transmitOptions, const unsigned  char * parameter=NULL, int parameterOffset=0, int parameterLength=0);
+
+        void setTransmitOptions(OptionsBase * transmitOptions);
+
+        virtual void setAppleChanges(bool appleChanges);
+
+        virtual void setCommand(const char * command);
+
+        virtual void setParameter(const unsigned  char * parameter, int offset, int length);
+
+        void setRemoteAddress(Address * remoteAddress);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Request/RemoteIODetectionConfigRequest.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,16 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_RemoteIODetectionConfigRequest
+#define UK_AC_HERTS_SMARTLAB_XBEE_RemoteIODetectionConfigRequest
+
+#include "Pin.h"
+#include "ATCommands.h"
+#include "RemoteATCommandRequest.h"
+
+class RemoteIODetectionConfigRequest : public RemoteATCommandRequest
+{
+public:
+    RemoteIODetectionConfigRequest(unsigned  char frameID, Address * remoteAddress, Pin ** pins, int size)
+        : RemoteATCommandRequest(frameID, remoteAddress, ATCommands::Digital_IO_Change_Detection, RemoteCommandOptions::ApplyChanges, Pin::IOChangeDetectionConfiguration(pins, size), 0, 2)
+    { }
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Request/RemotePinConfigurationRequest.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,39 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_RemotePinConfigurationRequest
+#define UK_AC_HERTS_SMARTLAB_XBEE_RemotePinConfigurationRequest
+
+#include "Pin.h"
+#include "Address.h"
+#include "ATCommands.h"
+#include "RemoteATCommandRequest.h"
+
+class RemotePinConfigurationRequest : public RemoteATCommandRequest
+{
+public:
+    /**
+    * @param function
+    *DISABLED = 0x00,
+    *RESERVED_FOR_PIN_SPECIFIC_ALTERNATE_FUNCTIONALITIES = 0x01,
+    *ANALOG_INPUT_SINGLE_ENDED = 0x02,
+    *DIGITAL_INPUT_MONITORED = 0x03,
+    *DIGITAL_OUTPUT_DEFAULT_LOW = 0x04,
+    *DIGITAL_OUTPUT_DEFAULT_HIGH = 0x05,
+    *ALTERNATE_FUNCTIONALITIES_WHERE_APPLICABLE = 0x06//0x06~0x09
+    */
+    RemotePinConfigurationRequest(unsigned char frameID,  Address * remoteAddress, Pin * pin, unsigned char function)
+        : RemoteATCommandRequest(frameID, remoteAddress, pin->getCommand(), RemoteCommandOptions::ApplyChanges, &function, 0, 1)
+    { }
+    
+    /**
+    * @param function
+    *DISABLED = 0x00,
+    *RESERVED_FOR_PIN_SPECIFIC_ALTERNATE_FUNCTIONALITIES = 0x01,
+    *ANALOG_INPUT_SINGLE_ENDED = 0x02,
+    *DIGITAL_INPUT_MONITORED = 0x03,
+    *DIGITAL_OUTPUT_DEFAULT_LOW = 0x04,
+    *DIGITAL_OUTPUT_DEFAULT_HIGH = 0x05,
+    *ALTERNATE_FUNCTIONALITIES_WHERE_APPLICABLE = 0x06//0x06~0x09
+    */
+    void setPinFunction(unsigned  char function) { data[15] = function; }
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Request/TxBase.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,19 @@
+#include "TxBase.h"
+
+TxBase::TxBase(int length, unsigned char identifier, unsigned char frameID)
+    : APIFrame(length + 2)
+{
+    setFrameType(identifier);
+    setFrameID(frameID);
+    setPosition(2);
+}
+
+void TxBase::setFrameID(unsigned char frameID)
+{
+    data[1] = frameID;
+}
+
+unsigned char TxBase::getFrameID()
+{
+    return data[1];
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Request/TxBase.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,33 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_TxBase
+#define UK_AC_HERTS_SMARTLAB_XBEE_TxBase
+
+#include "APIFrame.h"
+
+#include "Address.h"
+#include "OptionsBase.h"
+#include "TransmitOptions.h"
+#include "RemoteCommandOptions.h"
+
+class TxBase : public APIFrame
+{
+
+public:
+
+    /// <summary>
+    ///
+    /// </summary>
+    /// <param name="Length">the length of payload not include Frame Type, Frame ID and CheckSum</param>
+    /// <param name="identifier">Frame Type</param>
+    /// <param name="frameID">Frame ID</param>
+    TxBase(int length, unsigned char identifier, unsigned char frameID);
+
+    /// <summary>
+    /// this does not affect the position, will always write to position 1
+    /// </summary>
+    /// <param name="identifier"></param>
+    void setFrameID(unsigned char frameID);
+
+    unsigned  char getFrameID();
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Request/XBeeTx16Request.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,27 @@
+#include "XBeeTx16Request.h"
+
+XBeeTx16Request::XBeeTx16Request(unsigned  char frameID, Address * remoteAddress, OptionsBase * transmitOptions, const unsigned  char * payload, int offset, int length)
+    : TxBase(3 + length, APIFrame::Tx16_Request, frameID)
+{
+    set(remoteAddress->getNetworkAddress() >> 8);
+    set(remoteAddress->getNetworkAddress());
+    set(transmitOptions->getValue());
+    sets(payload, offset, length);
+}
+
+void XBeeTx16Request::setPayload(const unsigned char * data, int offset, int length)
+{
+    setPosition(5);
+    sets(data, offset, length);
+}
+
+void XBeeTx16Request::setTransmitOptions(OptionsBase * transmitOptions)
+{
+    data[4] = transmitOptions->getValue();
+}
+
+void XBeeTx16Request::setRemoteAddress(Address * remoteAddress)
+{
+    data[2] = remoteAddress->getNetworkAddress() >> 8;
+    data[3] = remoteAddress->getNetworkAddress();
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Request/XBeeTx16Request.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,24 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_XBeeTx16Request
+#define UK_AC_HERTS_SMARTLAB_XBEE_XBeeTx16Request
+
+#include "TxBase.h"
+#include "IPayloadRequest.h"
+
+class XBeeTx16Request : public TxBase, public IPayloadRequest
+{
+
+public:
+    XBeeTx16Request(unsigned  char frameID, Address * remoteAddress, OptionsBase * transmitOptions, const unsigned  char * payload, int offset, int length);
+
+    virtual void setPayload(const unsigned char * data, int offset, int length);
+
+    virtual void setTransmitOptions(OptionsBase * transmitOptions);
+
+    /// <summary>
+    /// the ieee 64 bit address is ignored
+    /// </summary>
+    /// <param name="networkAddress"></param>
+    virtual void setRemoteAddress(Address * remoteAddress);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Request/XBeeTx64Request.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,25 @@
+#include "XBeeTx64Request.h"
+
+XBeeTx64Request::XBeeTx64Request(unsigned  char frameID, Address * remoteAddress, OptionsBase * transmitOptions, const unsigned char * payload, int offset, int length)
+    : TxBase(9 + length, APIFrame::Tx64_Request, frameID)
+{
+    sets(remoteAddress->getAddressValue(), 0, 8);
+    set(transmitOptions->getValue());
+    sets(payload, offset, length);
+}
+
+void XBeeTx64Request::setPayload(const unsigned char * data, int offset, int length)
+{
+    setPosition(11);
+    sets(data, offset, length);
+}
+
+void XBeeTx64Request::setTransmitOptions(OptionsBase * transmitOptions)
+{
+    data[10] = transmitOptions->getValue();
+}
+
+void XBeeTx64Request::setRemoteAddress(Address * remoteAddress)
+{
+    sets(2, remoteAddress->getAddressValue(), 0, 8);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Request/XBeeTx64Request.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,24 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_XBeeTx64Request
+#define UK_AC_HERTS_SMARTLAB_XBEE_XBeeTx64Request
+
+#include "TxBase.h"
+#include "IPayloadRequest.h"
+
+class XBeeTx64Request : public TxBase, public IPayloadRequest
+{
+
+public:
+    XBeeTx64Request(unsigned  char frameID, Address * remoteAddress, OptionsBase * transmitOptions, const unsigned  char * payload, int offset, int length);
+
+    virtual void setPayload(const unsigned  char * data, int offset, int length);
+
+    virtual void setTransmitOptions(OptionsBase * transmitOptions);
+
+    /// <summary>
+    /// the ieee 64 bit address is ignored
+    /// </summary>
+    /// <param name="networkAddress"></param>
+    virtual void setRemoteAddress(Address * remoteAddress);
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Request/ZigBeeExplicitTxRequest.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,38 @@
+#include "ZigBeeExplicitTxRequest.h"
+
+ZigBeeExplicitTxRequest::ZigBeeExplicitTxRequest(unsigned  char frameID, ExplicitAddress * remoteAddress, OptionsBase * transmitOptions, const unsigned char * payload, int offset, int length)
+    : TxBase(18 + length, APIFrame::Explicit_Addressing_ZigBee_Command_Frame, frameID)
+{
+    sets(remoteAddress->getAddressValue(), 0, 10);
+    sets(remoteAddress->getExplicitValue(), 0, 6);
+    set(0x00);
+    set(transmitOptions->getValue());
+    sets(payload, offset, length);
+}
+
+void ZigBeeExplicitTxRequest::setBroadcastRadius(unsigned  char broadcastRadius)
+{
+    data[18] = broadcastRadius;
+}
+
+void ZigBeeExplicitTxRequest::setTransmitOptions(OptionsBase * transmitOptions)
+{
+    data[19] = transmitOptions->getValue();
+}
+
+void ZigBeeExplicitTxRequest::setPayload(const unsigned char * data, int offset, int length)
+{
+    setPosition(20);
+    sets(data, offset, length);
+}
+
+void ZigBeeExplicitTxRequest::setRemoteAddress(Address * remoteAddress)
+{
+    sets(2, remoteAddress->getAddressValue(), 0, 10);
+}
+
+void ZigBeeExplicitTxRequest::setRemoteAddress(ExplicitAddress * remoteAddress)
+{
+    sets(2, remoteAddress->getAddressValue(), 0, 10);
+    sets(12, remoteAddress->getExplicitValue(), 0, 6);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Request/ZigBeeExplicitTxRequest.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,36 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_ZigBeeExplicitTxRequest
+#define UK_AC_HERTS_SMARTLAB_XBEE_ZigBeeExplicitTxRequest
+
+#include "TxBase.h"
+#include "IPayloadRequest.h"
+#include "ExplicitAddress.h"
+
+class ZigBeeExplicitTxRequest : public TxBase, public IPayloadRequest
+{
+
+public:
+    //0x11
+    //FrameID;
+    //ExplicitRemoteDevice
+    //Source Endpoint
+    //Destination Endpoint
+    //Cluster ID
+    //Profile ID
+    //Broadcast_Radius;
+    //TransmitOptions;
+    //RF_Data;
+    ZigBeeExplicitTxRequest(unsigned  char frameID, ExplicitAddress * remoteAddress, OptionsBase * transmitOptions, const unsigned char * payload, int offset, int length);
+
+    virtual void setPayload(const unsigned char * data, int offset, int length);
+
+    virtual void setTransmitOptions(OptionsBase * transmitOptions);
+    
+    virtual void setRemoteAddress(Address * remoteAddress);
+    
+    void setRemoteAddress(ExplicitAddress * remoteAddress);
+
+    void setBroadcastRadius(unsigned  char broadcastRadius);
+
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Request/ZigBeeTxRequest.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,32 @@
+#include "ZigBeeTxRequest.h"
+
+ZigBeeTxRequest::ZigBeeTxRequest(unsigned  char frameID, Address * remoteAddress, OptionsBase * transmitOptions, const unsigned char * payload, int offset, int length)
+    : TxBase(9 + length, APIFrame::ZigBee_Transmit_Request, frameID)
+{
+    sets(remoteAddress->getAddressValue(), 0, 10);
+    set(0x00);
+    set(transmitOptions->getValue());
+    sets(payload, offset, length);
+}
+
+void ZigBeeTxRequest::setPayload(const unsigned  char * data, int offset, int length)
+{
+    setPosition(14);
+    sets(data, offset, length);
+}
+
+void ZigBeeTxRequest::setTransmitOptions(OptionsBase * transmitOptions)
+{
+    data[13] = transmitOptions->getValue();
+}
+
+void ZigBeeTxRequest::setRemoteAddress(Address * remoteAddress)
+{
+    sets(2, remoteAddress->getAddressValue(), 0, 10);
+}
+
+
+void ZigBeeTxRequest::setBroadcastRadius(unsigned  char broadcastRadius)
+{
+    data[12] = broadcastRadius;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Request/ZigBeeTxRequest.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,29 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_ZigBeeTxRequest
+#define UK_AC_HERTS_SMARTLAB_XBEE_ZigBeeTxRequest
+
+#include "TxBase.h"
+#include "IPayloadRequest.h"
+
+class ZigBeeTxRequest : public TxBase, public IPayloadRequest
+{
+
+public:
+    //0x10
+    //FrameID;
+    //RemoteDevice
+    //Broadcast_Radius;
+    //TransmitOptions;
+    //RF_Data;
+    ZigBeeTxRequest(unsigned  char frameID, Address * remoteAddress, OptionsBase * transmitOptions, const unsigned char * payload, int offset, int length);
+
+    virtual void setPayload(const unsigned char * data, int offset, int length);
+
+    virtual void setTransmitOptions(OptionsBase * transmitOptions);
+
+    virtual void setRemoteAddress(Address * remoteAddress);
+
+    void setBroadcastRadius(unsigned  char broadcastRadius);
+
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Type/ATCommands.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,17 @@
+#include "ATCommands.h"
+
+char ATCommands::IO_Sampling_Rate[] = "IR";
+
+char ATCommands::Digital_IO_Change_Detection[] = "IC";
+
+char ATCommands::Instant_Sample[] = "IS";
+
+char ATCommands::Node_Descovery[] = "ND";
+
+char ATCommands::Destination_Node_Descovery[] = "DN";
+
+char ATCommands::Node_Identifier[] = "NI";
+
+char ATCommands::Node_Join_Time[] = "NJ";
+
+char ATCommands::Force_Sample[] = "IS";
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Type/ATCommands.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,24 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_ATCommands
+#define UK_AC_HERTS_SMARTLAB_XBEE_ATCommands
+
+class ATCommands
+{
+public:
+    static char IO_Sampling_Rate[];
+
+    static char Digital_IO_Change_Detection[];
+
+    static char Instant_Sample[];
+
+    static char Node_Descovery[];
+
+    static char Destination_Node_Descovery[];
+
+    static char Node_Identifier[];
+
+    static char Node_Join_Time[];
+    
+    static char Force_Sample[];
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Type/IOSamples.cpp	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,41 @@
+#include "IOSamples.h"
+
+map<Pin *, unsigned int> * IOSamples::getAnalogs()
+{
+    return &analog;
+}
+
+unsigned int IOSamples::getAnalog(Pin * pin)
+{
+    if (analog.count(pin))
+        return analog[pin];
+    else return 0xFFFF;
+}
+
+map<Pin *, unsigned char> * IOSamples::getDigitals()
+{
+    return &digital;
+}
+
+unsigned char IOSamples::getDigital(Pin * pin)
+{
+    if (digital.count(pin))
+        return digital[pin];
+    else return 2;
+}
+
+unsigned int IOSamples::getSupplyVoltage()
+{
+    return SUPPLY_VOLTAGE;
+}
+
+void IOSamples::setSupplyVoltage(unsigned int voltage)
+{
+    SUPPLY_VOLTAGE =  voltage;
+}
+
+void IOSamples::clear()
+{
+    analog.clear();
+    digital.clear();
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmartLabXBeeCore/Type/IOSamples.h	Wed Mar 30 19:58:48 2016 +0000
@@ -0,0 +1,77 @@
+#ifndef UK_AC_HERTS_SMARTLAB_XBEE_IOSamples
+#define UK_AC_HERTS_SMARTLAB_XBEE_IOSamples
+
+#include "Pin.h"
+#include <map>
+
+using namespace std;
+/**
+* A collection of digital and analog samples reported by XBee module.
+*/
+class IOSamples
+{
+private :
+    unsigned int SUPPLY_VOLTAGE;
+
+    map<Pin *, unsigned int> analog;
+
+    map<Pin *, unsigned char> digital;
+
+public:
+    /**
+    * Get all the avaliable analog values.
+    *
+    * @returns map<Pin,int>
+    */
+    map<Pin *, unsigned int> * getAnalogs();
+
+    /**
+    * Get analog value from one pin.
+    *
+    * @param Pin XBee S1 or S2 pin object.
+    * @returns 0xFFFF means sample not avaliable.
+    */
+    unsigned int getAnalog(Pin * pin);
+
+    /**
+    * Get all the avaliable digital values.
+    *
+    * @returns map<Pin,unsigned char>:
+    *        LOW = 0,
+    *        HIGH = 1,
+    *        UNMONITORED = 2,
+    */
+    map<Pin *, unsigned char> * getDigitals();
+
+    /**
+    * Get digital value from one pin.
+    *
+    * @param Pin XBee S1 or S2 pin object.
+    * @returns
+    *      LOW = 0,
+    *      HIGH = 1,
+    *      UNMONITORED = 2,
+    */
+    unsigned char getDigital(Pin * pin);
+
+    /**
+    * Get supply voltage, S2 only.
+    *
+    * @returns voltage
+    */
+    unsigned int getSupplyVoltage();
+
+    /**
+    * Set supply voltage, S2 only.
+    *
+    * @param voltage
+    */
+    void setSupplyVoltage(unsigned int voltage);
+
+    /**
+    * Cleat all the sample values.
+    */
+    void clear();
+};
+
+#endif
\ No newline at end of file
--- a/XBeeAPI.h	Sat Nov 14 16:43:20 2015 +0000
+++ b/XBeeAPI.h	Wed Mar 30 19:58:48 2016 +0000
@@ -19,7 +19,6 @@
 * int main()
 * {
 *    xbee.setVerifyChecksum(false);
-*    xbee.start();
 *
 *    // option 1
 *    while(1) {