XBee and XBee-PRO ZigBee RF modules provide cost-effective wireless connectivity to electronic devices. They are interoperable with other ZigBee PRO feature set devices, including devices from other vendors.

Dependencies:   BufferedArray

Dependents:   MBEDminiproject

Revision:
6:5f31ddc17239
Parent:
3:6b205ec8624b
--- a/Core/APIFrame.h	Thu Nov 05 23:03:42 2015 +0000
+++ b/Core/APIFrame.h	Sat Nov 14 16:42:36 2015 +0000
@@ -8,43 +8,43 @@
 {
 private:
     /// Checksum value for the API fram.
-    char checkSum;
+    unsigned char checkSum;
 
     /// A state to indicate whether this packet's checksum is verified while process.
     bool isVerify;
 
 public:
-    static const char Tx64_Request =0x00;
-    static const char Tx16_Request =0x01;
-    static const char AT_Command = 0x08;
-    static const char AT_Command_Queue_Parameter_Value = 0x09;
-    static const char ZigBee_Transmit_Request = 0x10;
-    static const char Explicit_Addressing_ZigBee_Command_Frame = 0x11;
-    static const char Remote_Command_Request = 0x17;
-    static const char Create_Source_Route = 0x21;
-    static const char Register_Joining_Device = 0x24;
-    static const char Rx64_Receive_Packet = 0x80;
-    static const char Rx16_Receive_Packet = 0x81;
-    static const char Rx64_IO_Data_Sample_Rx_Indicator = 0x82;
-    static const char Rx16_IO_Data_Sample_Rx_Indicator = 0x83;
-    static const char AT_Command_Response = 0x88;
-    static const char XBee_Transmit_Status = 0x89;
-    static const char Modem_Status = 0x8A;
-    static const char ZigBee_Transmit_Status = 0x8B;
-    static const char ZigBee_Receive_Packet = 0x90;
-    static const char ZigBee_Explicit_Rx_Indicator = 0x91;
-    static const char ZigBee_IO_Data_Sample_Rx_Indicator = 0x92;
-    static const char XBee_Sensor_Read_Indicato = 0x94;
-    static const char Node_Identification_Indicator = 0x95;
-    static const char Remote_Command_Response = 0x97;
-    static const char Over_the_Air_Firmware_Update_Status = 0xA0;
-    static const char Route_Record_Indicator = 0xA1;
-    static const char Device_Authenticated_Indicator = 0xA2;
-    static const char Many_to_One_Route_Request_Indicator = 0xA3;
+    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 char StartDelimiter = 0x7E;
+    static const unsigned char StartDelimiter = 0x7E;
 
-    APIFrame(int payloadLength);
+    APIFrame(unsigned int payloadLength);
 
     APIFrame(APIFrame * frame);
 
@@ -79,11 +79,11 @@
     *    Device_Authenticated_Indicator = 0xA2,
     *    Many_to_One_Route_Request_Indicator = 0xA3,
     */
-    int getFrameType();
+    unsigned char getFrameType();
 
-    void setFrameType(char identifier);
+    void setFrameType(unsigned char identifier);
 
-    void allocate(int length);
+    void allocate(unsigned long length);
 
     void rewind();
     
@@ -92,20 +92,20 @@
     /** Write 8-bit data into current posiston and increase by 1.
     * @param value sigle byte
     */
-    void set(char value);
+    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 char * value, int offset, int length);
+    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(int position, char value);
+    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
@@ -113,7 +113,7 @@
     * @param offset start point of the data
     * @param length length to write
     */
-    void sets(int position, const char * value, int offset, int length);
+    void sets(unsigned long position, const unsigned char * value, unsigned long offset, unsigned long length);
 
     /** Get checksum.
     * @returns the checksum value
@@ -123,7 +123,7 @@
     /** Set checksum.
     * @param value checksum value
     */
-    void setCheckSum(char value);
+    void setCheckSum(unsigned char value);
 
     /** Check is the API frame's checksum is verified.
     * @returns true checksum match,