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.
Revision 6:5f31ddc17239, committed 2015-11-14
- Comitter:
- yangcq88517
- Date:
- Sat Nov 14 16:42:36 2015 +0000
- Parent:
- 5:945b89c71902
- Commit message:
- change to unsigned char array
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BufferedArray.lib Sat Nov 14 16:42:36 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/yangcq88517/code/BufferedArray/#765da30c4d9b
--- a/Core/APIFrame.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Core/APIFrame.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -1,7 +1,7 @@ #include "APIFrame.h" -APIFrame::APIFrame(int payloadLength) - :BufferedArray(payloadLength) +APIFrame::APIFrame(unsigned int payloadLength) + :BufferedArray(payloadLength, 10) {} APIFrame::APIFrame(APIFrame * frame) @@ -13,17 +13,17 @@ } } -int APIFrame::getFrameType() +unsigned char APIFrame::getFrameType() { return data[0]; } -void APIFrame::setFrameType(char identifier) +void APIFrame::setFrameType(unsigned char identifier) { data[0] = identifier; } -void APIFrame::allocate(int length) +void APIFrame::allocate(unsigned long length) { BufferedArray::allocate(length); isVerify = false; @@ -48,25 +48,25 @@ return true; } -void APIFrame::set(char value) +void APIFrame::set(unsigned char value) { BufferedArray::set(value); isVerify = false; } -void APIFrame::sets(const char * value, int offset, int length) +void APIFrame::sets(const unsigned char * value, unsigned long offset, unsigned long length) { BufferedArray::sets(value, offset, length); isVerify = false; } -void APIFrame::set(int position, char value) +void APIFrame::set(unsigned long position, unsigned char value) { BufferedArray::set(position, value); isVerify = false; } -void APIFrame::sets(int position, const char * value, int offset, int length) +void APIFrame::sets(unsigned long position, const unsigned char * value, unsigned long offset, unsigned long length) { BufferedArray::sets(position, value, offset, length); isVerify = false; @@ -77,7 +77,7 @@ return checkSum; } -void APIFrame::setCheckSum(char value) +void APIFrame::setCheckSum(unsigned char value) { checkSum = value; }
--- 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,
--- a/Core/BufferedArray.cpp Thu Nov 05 23:03:42 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +0,0 @@ -#include "BufferedArray.h" - -BufferedArray::BufferedArray() -{ - max = EXPANDSIZE; - data = new char[EXPANDSIZE]; - index = 0; -} - -BufferedArray::BufferedArray(int size) -{ - max = size; - data = new char[size]; - index = 0; -} - -BufferedArray::BufferedArray(BufferedArray * bufferedArray) -{ - if (bufferedArray != NULL) { - this->data = bufferedArray->data; - this->index = bufferedArray->index; - this->max = bufferedArray->max; - } -} - -BufferedArray::~BufferedArray() -{ - if (data == NULL) - return; - - delete[] data; -} - -char * BufferedArray::gets() -{ - return data; -} - -char * BufferedArray::gets(int position) -{ - return data + position; -} - -char BufferedArray::get(int position) -{ - return *(data + position); -} - -int BufferedArray::getPosition() -{ - return index; -} - -void BufferedArray::setPosition(int position) -{ - if (this->index > max) - this->index = max; - else this->index = position; -} - -void BufferedArray::allocate(int length) -{ - if (length <= 0) - return; - - if (length > max) { - if (data != NULL) - delete[] data; - data = new char[length]; - } - - rewind(); -} - -void BufferedArray::rewind() -{ - index = 0; -} - -void BufferedArray::expandSpace(int length) -{ - max += EXPANDSIZE * (1 + length / EXPANDSIZE); - char * temp = new char[max]; - memcpy(temp, data, index); - delete[] data; - data = temp; -} - -void BufferedArray::set(int position, char value) -{ - if (position < 0) - return; - - if (position >= max) - expandSpace(1); - - data[position] = value; -} - -void BufferedArray::set(char value) -{ - set(index, value); - index++; -} - -void BufferedArray::sets(const char * value, int offset, int length) -{ - if (length <= 0) - return; - - if (offset < 0) - return; - - sets(index, value, offset, length); - index += length; -} - -void BufferedArray::sets(int position, const char * value, int offset, int length) -{ - if (position < 0) - return; - - if (length <= 0) - return; - - if (offset < 0) - return; - - if (position + length - offset > max) - expandSpace(position + length - offset - max); - - memcpy(data + position, value + offset, length); -} \ No newline at end of file
--- a/Core/BufferedArray.h Thu Nov 05 23:03:42 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -#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. - static const int EXPANDSIZE = 20; - - /// Raw data - char * data; - - /// Current index of the data, could also used as data lendth. - int index; - - /// Max data size that the raw data can hold. - int max; - - void expandSpace(int length); - -public: - BufferedArray(); - - BufferedArray(int size); - - BufferedArray(BufferedArray * bufferedArray); - - ~BufferedArray(); - - /** Get the raw data. - * @returns char array. - */ - char * gets(); - - /** Get the raw data from a specific location. - * - * @param position where to retrieve - * - * @returns char array. - */ - char * gets(int position); - - /** Get 1 byte data from a specific location. - * - * @param position where to retrieve - * - * @returns char. - */ - char get(int position); - - /** Get the current index. - * @returns char array. - */ - int getPosition(); - - /** Set the index within the max length of raw data. - * @param position where to begin read and write - */ - void setPosition(int position); - - /** Reset the raw data. - * @param length current max size for the raw data - */ - void allocate(int 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(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); - - /** 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); - - /** 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(int position, const char * value, int offset, int length); -}; - -#endif
--- a/Core/CoreAPI.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Core/CoreAPI.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -74,7 +74,7 @@ return value; } -void CoreAPI::writeByte(char data) +void CoreAPI::writeByte(unsigned char data) { if (isEscapeMode) { if (data == KEY || data == ESCAPED || data == XON || data == XOFF) { @@ -288,7 +288,7 @@ else return NULL; } -XBeeTxStatusIndicator * CoreAPI::sendXBeeTx16(Address * remoteAddress, OptionsBase * option, const char * payload, int offset, int length) +XBeeTxStatusIndicator * CoreAPI::sendXBeeTx16(Address * remoteAddress, OptionsBase * option, const unsigned char * payload, int offset, int length) { if (!isRunning) return NULL; @@ -328,7 +328,7 @@ return NULL; } -XBeeTxStatusIndicator * CoreAPI::sendXBeeTx64(Address * remoteAddress, OptionsBase * option, const char * payload, int offset, int length) +XBeeTxStatusIndicator * CoreAPI::sendXBeeTx64(Address * remoteAddress, OptionsBase * option, const unsigned char * payload, int offset, int length) { if (!isRunning) return NULL; @@ -367,7 +367,7 @@ return NULL; } -ATCommandIndicator * CoreAPI::sendATCommand(const char * command, bool applyChange, const char * parameter, int offset, int length) +ATCommandIndicator * CoreAPI::sendATCommand(const char * command, bool applyChange, const unsigned char * parameter, int offset, int length) { waitFrameID++; if (waitFrameID == 0) @@ -378,7 +378,8 @@ msg->set(APIFrame::AT_Command); else msg->set(APIFrame::AT_Command_Queue_Parameter_Value); msg->set(waitFrameID); - msg->sets(command, 0 , 2); + msg->set(command[0]); + msg->set(command[1]); if (parameter != NULL) msg->sets(parameter, offset, length); @@ -405,7 +406,7 @@ return NULL; } -RemoteCommandIndicator * CoreAPI::sendRemoteATCommand(Address * remoteAddress, const char * command, OptionsBase * transmitOptions, const char * parameter, int parameterOffset, int parameterLength) +RemoteCommandIndicator * CoreAPI::sendRemoteATCommand(Address * remoteAddress, const char * command, OptionsBase * transmitOptions, const unsigned char * parameter, int parameterOffset, int parameterLength) { waitFrameID++; if (waitFrameID == 0) @@ -417,7 +418,8 @@ msg->sets(remoteAddress->getAddressValue(), 0, 10); msg->set(transmitOptions->getValue()); - msg->sets(command, 0, 2); + msg->set(command[0]); + msg->set(command[1]); if (parameter != NULL) msg->sets(parameter, parameterOffset, parameterLength); @@ -445,7 +447,7 @@ return NULL; } -ZigBeeTxStatusIndicator * CoreAPI::sendZigBeeTx(Address * remoteAddress, OptionsBase * option, const char * payload, int offset, int length) +ZigBeeTxStatusIndicator * CoreAPI::sendZigBeeTx(Address * remoteAddress, OptionsBase * option, const unsigned char * payload, int offset, int length) { waitFrameID++; if (waitFrameID == 0) @@ -482,7 +484,7 @@ return NULL; } -ZigBeeTxStatusIndicator * CoreAPI::sendZigBeeExplicitTx(ExplicitAddress * remoteAddress, OptionsBase * option, const char * payload, int offset, int length) +ZigBeeTxStatusIndicator * CoreAPI::sendZigBeeExplicitTx(ExplicitAddress * remoteAddress, OptionsBase * option, const unsigned char * payload, int offset, int length) { waitFrameID++; if (waitFrameID == 0) @@ -520,7 +522,7 @@ return NULL; } -ATCommandIndicator * CoreAPI::setPinFunction(Pin * pin, char function) +ATCommandIndicator * CoreAPI::setPinFunction(Pin * pin, unsigned char function) { return sendATCommand(pin->getCommand(), true, &function, 0 , 1); } @@ -530,7 +532,7 @@ return sendATCommand(ATCommands::Digital_IO_Change_Detection, true, Pin::IOChangeDetectionConfiguration(pins, size)); } -RemoteCommandIndicator * CoreAPI::setRemotePinFunction(Address * remoteAddress, Pin * pin, char function) +RemoteCommandIndicator * CoreAPI::setRemotePinFunction(Address * remoteAddress, Pin * pin, unsigned char function) { return sendRemoteATCommand(remoteAddress, pin->getCommand(), RemoteCommandOptions::ApplyChanges, &function, 0 , 1); }
--- a/Core/CoreAPI.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Core/CoreAPI.h Sat Nov 14 16:42:36 2015 +0000 @@ -39,11 +39,11 @@ class CoreAPI { private: - static const char KEY = 0x7E; - static const char ESCAPED = 0x7D; - static const char XON = 0x11; - static const char XOFF = 0x13; - static const int INITIAL_FRAME_LENGTH = 100; + 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; @@ -51,7 +51,7 @@ bool isChecksum; Timer timer; - char waitFrameID; + unsigned char waitFrameID; APIFrame * msg; XBeeRx64Indicator xBeeRx64Indicator; @@ -81,7 +81,7 @@ /** Write one byte to the payload, which allready handle the escape char. * @param data one byte [0x00-0xFF] */ - void writeByte(char data); + void writeByte(unsigned char data); /// Processing API frame. void packetProcess(); @@ -218,17 +218,17 @@ */ ManyToOneRouteIndicator * getManyToOneRoute(); - XBeeTxStatusIndicator * sendXBeeTx16(Address * remoteAddress, OptionsBase * option, const char * payload, int offset, int length); + XBeeTxStatusIndicator * sendXBeeTx16(Address * remoteAddress, OptionsBase * option, const unsigned char * payload, int offset, int length); - XBeeTxStatusIndicator * sendXBeeTx64(Address * remoteAddress, OptionsBase * option, const 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 char * parameter = NULL, int offset = 0, int length = 0); + 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 char * parameter = NULL, int parameterOffset = 0, int parameterLength = 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 char * payload, int offset, int length); + ZigBeeTxStatusIndicator * sendZigBeeTx(Address * remoteAddress, OptionsBase * option, const unsigned char * payload, int offset, int length); - ZigBeeTxStatusIndicator * sendZigBeeExplicitTx(ExplicitAddress * remoteAddress, OptionsBase * option, const char * payload, int offset, int length); + ZigBeeTxStatusIndicator * sendZigBeeExplicitTx(ExplicitAddress * remoteAddress, OptionsBase * option, const unsigned char * payload, int offset, int length); /** * @param function @@ -240,7 +240,7 @@ * DIGITAL_OUTPUT_DEFAULT_HIGH = 0x05, * ALTERNATE_FUNCTIONALITIES_WHERE_APPLICABLE = 0x06//0x06~0x09 */ - ATCommandIndicator * setPinFunction(Pin * pin, char function); + ATCommandIndicator * setPinFunction(Pin * pin, unsigned char function); ATCommandIndicator * setIODetection(Pin ** pins, int size); @@ -254,7 +254,7 @@ * DIGITAL_OUTPUT_DEFAULT_HIGH = 0x05, * ALTERNATE_FUNCTIONALITIES_WHERE_APPLICABLE = 0x06//0x06~0x09 */ - RemoteCommandIndicator * setRemotePinFunction(Address * remoteAddress, Pin * pin, char function); + RemoteCommandIndicator * setRemotePinFunction(Address * remoteAddress, Pin * pin, unsigned char function); RemoteCommandIndicator * setRemoteIODetection(Address * remoteAddress, Pin ** pins, int size);
--- a/Device/Address.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Device/Address.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -5,7 +5,7 @@ Address::Address() {} -Address::Address(const char * address64, const char * NET16) +Address::Address(const unsigned char * address64, const unsigned char * NET16) { if (address64 != NULL) memcpy(value,address64,8); @@ -16,7 +16,7 @@ } } -Address::Address(const char * addr) +Address::Address(const unsigned char * addr) { if (addr != NULL) memcpy(value,addr,10); @@ -29,17 +29,17 @@ setNetworkAddress(networkAddress); } -long Address::getSerialNumberHigh() +unsigned long Address::getSerialNumberHigh() { return (value[0] << 24) | (value[1] << 16) | (value[2] << 8) | value[3]; } -long Address::getSerialNumberLow() +unsigned long Address::getSerialNumberLow() { return (value[4] << 24) | (value[5] << 16) | (value[6] << 8) | value[7]; } -int Address::getNetworkAddress() +unsigned int Address::getNetworkAddress() { return (value[8] << 8) | value[9]; } @@ -66,7 +66,7 @@ value[9] = networkAddress; } -const char * Address::getAddressValue() +const unsigned char * Address::getAddressValue() { return value; }
--- a/Device/Address.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Device/Address.h Sat Nov 14 16:42:36 2015 +0000 @@ -8,7 +8,7 @@ protected: // total 10 bytes // IEEE 64 + 16bit networ address - char value[10]; + unsigned char value[10]; public: static Address * BROADCAST_ZIGBEE; static Address * BROADCAST_XBEE; @@ -24,21 +24,21 @@ /// </summary> /// <param name="Address64"></param> /// <param name="NET16"></param> - Address(const char * address64, const char * NET16); + Address(const unsigned char * address64, const unsigned char * NET16); /// <summary> /// create address from byte[10] value : 8 bytes of ieee follow 2 bytes network /// </summary> /// <param name="value"></param> - Address(const char * addr); + Address(const unsigned char * addr); Address(long serialNumberHigh, long serialNumberLow, int networkAddress); - long getSerialNumberHigh(); + unsigned long getSerialNumberHigh(); - long getSerialNumberLow(); + unsigned long getSerialNumberLow(); - int getNetworkAddress(); + unsigned int getNetworkAddress(); void setSerialNumberHigh(long SerialNumberHigh); @@ -51,7 +51,7 @@ /// IEEE 64 + 16bit networ address /// </summary> /// <returns></returns> - const char * getAddressValue(); + const unsigned char * getAddressValue(); friend bool operator ==(const Address &a,const Address &b);
--- a/Device/ExplicitAddress.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Device/ExplicitAddress.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -3,7 +3,7 @@ ExplicitAddress::ExplicitAddress() { } -ExplicitAddress::ExplicitAddress (const char * address, const char * explicitAddress ) +ExplicitAddress::ExplicitAddress (const unsigned char * address, const unsigned char * explicitAddress ) : Address(address) { memcpy(explicitValue, explicitAddress, 6); @@ -20,48 +20,48 @@ explicitValue[5] = ProfileID; } -char * ExplicitAddress::getExplicitValue() +unsigned char * ExplicitAddress::getExplicitValue() { return explicitValue; } -int ExplicitAddress::getSourceEndpoint() +unsigned char ExplicitAddress::getSourceEndpoint() { return explicitValue[0]; } -void ExplicitAddress::setSourceEndpoint(int SourceEndpoint) +void ExplicitAddress::setSourceEndpoint(unsigned char SourceEndpoint) { explicitValue[0] = SourceEndpoint; } -int ExplicitAddress::getDestinationEndpoint() +unsigned char ExplicitAddress::getDestinationEndpoint() { return explicitValue[1]; } -void ExplicitAddress::setDestinationEndpoint(int DestinationEndpoint) +void ExplicitAddress::setDestinationEndpoint(unsigned char DestinationEndpoint) { explicitValue[1] = DestinationEndpoint; } -int ExplicitAddress::getClusterID() +unsigned int ExplicitAddress::getClusterID() { return (explicitValue[2] << 8) | explicitValue[3]; } -void ExplicitAddress::setClusterID(int ClusterID) +void ExplicitAddress::setClusterID(unsigned int ClusterID) { explicitValue[2] = ClusterID >> 8; explicitValue[3] = ClusterID; } -int ExplicitAddress::getProfileID() +unsigned int ExplicitAddress::getProfileID() { return (explicitValue[4] << 8) | explicitValue[5]; } -void ExplicitAddress::setProfileID(int ProfileID) +void ExplicitAddress::setProfileID(unsigned int ProfileID) { explicitValue[4] = ProfileID >> 8; explicitValue[5] = ProfileID;
--- a/Device/ExplicitAddress.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Device/ExplicitAddress.h Sat Nov 14 16:42:36 2015 +0000 @@ -8,12 +8,12 @@ private: // total 6 bytes // 1 byte of SourceEndpoint + 1 byte of DestinationEndpoint + 2 bytes of ClusterID + 2 bytes of ProfileID - char explicitValue[6]; + unsigned char explicitValue[6]; public: ExplicitAddress() ; - ExplicitAddress (const char * AddressValue, const char * ExplicitValue ); + ExplicitAddress (const unsigned char * AddressValue, const unsigned char * ExplicitValue ); ExplicitAddress(long SerialNumberHigh, long SerialNumberLow, int NetworkAddress, int SourceEndpoint, int DestinationEndpoint, int ClusterID, int ProfileID); @@ -22,23 +22,23 @@ /// 1 byte of SourceEndpoint + 1 byte of DestinationEndpoint + 2 bytes of ClusterID + 2 bytes of ProfileID /// </summary> /// <returns></returns> - char * getExplicitValue(); + unsigned char * getExplicitValue(); - int getSourceEndpoint(); + unsigned char getSourceEndpoint(); - void setSourceEndpoint(int SourceEndpoint); + void setSourceEndpoint(unsigned char SourceEndpoint); - int getDestinationEndpoint(); + unsigned char getDestinationEndpoint(); - void setDestinationEndpoint(int DestinationEndpoint); + void setDestinationEndpoint(unsigned char DestinationEndpoint); - int getClusterID(); + unsigned int getClusterID(); - void setClusterID(int ClusterID); + void setClusterID(unsigned int ClusterID); - int getProfileID(); + unsigned int getProfileID(); - void setProfileID(int ProfileID); + void setProfileID(unsigned int ProfileID); }; #endif \ No newline at end of file
--- a/Device/Pin.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Device/Pin.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -1,13 +1,13 @@ #include "Pin.h" -char Pin::bitfield[2] = {0,0}; +unsigned char Pin::bitfield[2] = {0,0}; -Pin::Pin(char number) +Pin::Pin(unsigned char number) { num = number; } -Pin::Pin(char number, char msbCom, char lsbCom, char msbIODet, char lsbIODet) +Pin::Pin(unsigned char number, unsigned char msbCom, unsigned char lsbCom, unsigned char msbIODet, unsigned char lsbIODet) { num = number; com[0] = msbCom; @@ -16,7 +16,7 @@ IODet[1] = lsbIODet; } -char Pin::getNumber() +unsigned char Pin::getNumber() { return num; } @@ -26,7 +26,7 @@ return com; } -char * Pin::IOChangeDetectionConfiguration(Pin ** pins, char size) +unsigned char * Pin::IOChangeDetectionConfiguration(Pin ** pins, unsigned char size) { Pin::bitfield[0] = 0; Pin::bitfield[1] = 0; @@ -37,12 +37,12 @@ return Pin::bitfield; } -char * Pin::getIODetection() +unsigned char * Pin::getIODetection() { return IODet; } -bool operator <(const Pin &a,const Pin &b) +bool operator ==(const Pin &a,const Pin &b) { - return a.num < b.num; + return a.num == b.num; } \ No newline at end of file
--- a/Device/Pin.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Device/Pin.h Sat Nov 14 16:42:36 2015 +0000 @@ -4,28 +4,28 @@ class Pin { private: - static char bitfield[2]; + static unsigned char bitfield[2]; - char num; + unsigned char num; char com[2]; - char IODet[2]; + unsigned char IODet[2]; public: - Pin(char number); + Pin(unsigned char number); - Pin(char number, char msbCom, char lsbCom, char msbIODet, char lsbIODet); + Pin(unsigned char number, unsigned char msbCom, unsigned char lsbCom, unsigned char msbIODet, unsigned char lsbIODet); - char getNumber(); + unsigned char getNumber(); char * getCommand(); - char * getIODetection(); + unsigned char * getIODetection(); - static char * IOChangeDetectionConfiguration(Pin ** pins, char size); + static unsigned char * IOChangeDetectionConfiguration(Pin ** pins, unsigned char size); - friend bool operator <(const Pin &a,const Pin &b); + friend bool operator ==(const Pin &a,const Pin &b); }; #endif \ No newline at end of file
--- a/Helper/IOSampleDecoder.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Helper/IOSampleDecoder.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -2,7 +2,7 @@ IOSamples * IOSampleDecoder::samples = NULL; -IOSamples * IOSampleDecoder::XBeeSamplesParse(const char * IOSamplePayload, int offset) +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]; @@ -25,8 +25,8 @@ index += 2; for (int i = 0; i < numofsamples; i++) { - map<Pin *, int> * analog = (samples + i)->getAnalogs(); - map<Pin *, int> * digital = (samples + i)->getDigitals(); + 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; @@ -86,7 +86,7 @@ return samples; } -IOSamples * IOSampleDecoder::ZigBeeSamplesParse(const char * IOSamplePayload, int offset) +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]. @@ -107,8 +107,8 @@ samples = new IOSamples[numofsamples]; for (int i = 0; i < numofsamples; i++) { - map<Pin *, int> * analog = (samples + i)->getAnalogs(); - map<Pin *, int> * digital = (samples + i)->getDigitals(); + map<Pin *, unsigned int> * analog = (samples + i)->getAnalogs(); + map<Pin *, unsigned char> * digital = (samples + i)->getDigitals(); if (digitMask != 0) { if ((digitMask & 0x01) == 0x01)
--- a/Helper/IOSampleDecoder.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Helper/IOSampleDecoder.h Sat Nov 14 16:42:36 2015 +0000 @@ -13,10 +13,10 @@ public : // return the lenght of io ample - static IOSamples * XBeeSamplesParse(const char * IOSamplePayload, int offset = 0); + static IOSamples * XBeeSamplesParse(const unsigned char * IOSamplePayload, int offset = 0); // return the lenght of io ample - static IOSamples * ZigBeeSamplesParse(const char * IOSamplePayload, int offset = 0); + static IOSamples * ZigBeeSamplesParse(const unsigned char * IOSamplePayload, int offset = 0); }; #endif \ No newline at end of file
--- a/Indicator/ATCommandIndicator.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Indicator/ATCommandIndicator.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -9,7 +9,7 @@ return data[1]; } -char * ATCommandIndicator::getRequestCommand() +unsigned char * ATCommandIndicator::getRequestCommand() { return data + 2; } @@ -19,7 +19,7 @@ return data[4]; } -char * ATCommandIndicator::getParameter() +unsigned char * ATCommandIndicator::getParameter() { if (getParameterLength() <= 0) return NULL; @@ -27,7 +27,7 @@ return data + 5; } -char ATCommandIndicator::getParameter(int index) +unsigned char ATCommandIndicator::getParameter(int index) { return data[5 + index]; }
--- a/Indicator/ATCommandIndicator.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Indicator/ATCommandIndicator.h Sat Nov 14 16:42:36 2015 +0000 @@ -11,7 +11,7 @@ virtual int getFrameID(); - virtual char * getRequestCommand(); + virtual unsigned char * getRequestCommand(); /** * @@ -28,9 +28,9 @@ /// if parameter not presented, null will be returned. /// </summary> /// <returns></returns> - virtual char * getParameter(); + virtual unsigned char * getParameter(); - virtual char getParameter(int index); + virtual unsigned char getParameter(int index); virtual int getParameterLength();
--- a/Indicator/ICommandResponse.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Indicator/ICommandResponse.h Sat Nov 14 16:42:36 2015 +0000 @@ -6,7 +6,7 @@ public: virtual int getFrameID() = 0; - virtual char * getRequestCommand() = 0; + virtual unsigned char * getRequestCommand() = 0; /** * @@ -19,9 +19,9 @@ */ virtual int getCommandStatus() = 0; - virtual char * getParameter() = 0; + virtual unsigned char * getParameter() = 0; - virtual char getParameter(int index) = 0; + virtual unsigned char getParameter(int index) = 0; virtual int getParameterLength() = 0;
--- a/Indicator/IPayloadResponse.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Indicator/IPayloadResponse.h Sat Nov 14 16:42:36 2015 +0000 @@ -19,7 +19,7 @@ virtual Address getRemoteDevice() = 0; - virtual char * getReceivedData() = 0; + virtual unsigned char * getReceivedData() = 0; virtual int getReceivedDataOffset() = 0;
--- a/Indicator/NodeIdentificationIndicator.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Indicator/NodeIdentificationIndicator.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -21,7 +21,7 @@ return Address(data + 1); } -char * NodeIdentificationIndicator::getNIString() +unsigned char * NodeIdentificationIndicator::getNIString() { int length = getPosition() - 31;
--- a/Indicator/NodeIdentificationIndicator.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Indicator/NodeIdentificationIndicator.h Sat Nov 14 16:42:36 2015 +0000 @@ -30,7 +30,7 @@ Address getSenderDevice(); - char * getNIString(); + unsigned char * getNIString(); int getParentNetworkAddress();
--- a/Indicator/RemoteCommandIndicator.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Indicator/RemoteCommandIndicator.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -9,7 +9,7 @@ return data[1]; } -char * RemoteCommandIndicator::getRequestCommand() +unsigned char * RemoteCommandIndicator::getRequestCommand() { return data + 12; } @@ -24,7 +24,7 @@ return Address(data + 2); } -char * RemoteCommandIndicator::getParameter() +unsigned char * RemoteCommandIndicator::getParameter() { if (getParameterLength() <= 0) return NULL; @@ -32,7 +32,7 @@ return data + 15; } -char RemoteCommandIndicator::getParameter(int index) +unsigned char RemoteCommandIndicator::getParameter(int index) { return data[15 + index]; }
--- a/Indicator/RemoteCommandIndicator.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Indicator/RemoteCommandIndicator.h Sat Nov 14 16:42:36 2015 +0000 @@ -13,7 +13,7 @@ virtual int getFrameID(); - virtual char * getRequestCommand(); + virtual unsigned char * getRequestCommand(); /** * @@ -28,9 +28,9 @@ Address getRemoteDevice(); - virtual char * getParameter(); + virtual unsigned char * getParameter(); - virtual char getParameter(int index); + virtual unsigned char getParameter(int index); virtual int getParameterLength();
--- a/Indicator/XBeeRx16Indicator.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Indicator/XBeeRx16Indicator.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -4,7 +4,7 @@ : RxBase(frame) { } -char * XBeeRx16Indicator::getReceivedData() +unsigned char * XBeeRx16Indicator::getReceivedData() { if (getReceivedDataLength() <= 0) return NULL;
--- a/Indicator/XBeeRx16Indicator.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Indicator/XBeeRx16Indicator.h Sat Nov 14 16:42:36 2015 +0000 @@ -10,7 +10,7 @@ public: XBeeRx16Indicator(APIFrame * frame); - virtual char * getReceivedData(); + virtual unsigned char * getReceivedData(); virtual int getReceivedDataOffset();
--- a/Indicator/XBeeRx64Indicator.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Indicator/XBeeRx64Indicator.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -4,7 +4,7 @@ : RxBase(frame) { } -char * XBeeRx64Indicator::getReceivedData() +unsigned char * XBeeRx64Indicator::getReceivedData() { if (getReceivedDataLength() <= 0) return NULL;
--- a/Indicator/XBeeRx64Indicator.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Indicator/XBeeRx64Indicator.h Sat Nov 14 16:42:36 2015 +0000 @@ -10,7 +10,7 @@ public: XBeeRx64Indicator(APIFrame * frame); - virtual char * getReceivedData(); + virtual unsigned char * getReceivedData(); virtual int getReceivedDataOffset();
--- a/Indicator/ZigBeeExplicitRxIndicator.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Indicator/ZigBeeExplicitRxIndicator.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -4,7 +4,7 @@ : RxBase(frame) { } -char * ZigBeeExplicitRxIndicator::getReceivedData() +unsigned char * ZigBeeExplicitRxIndicator::getReceivedData() { if (getReceivedDataLength() <=0) return NULL;
--- a/Indicator/ZigBeeExplicitRxIndicator.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Indicator/ZigBeeExplicitRxIndicator.h Sat Nov 14 16:42:36 2015 +0000 @@ -12,7 +12,7 @@ ZigBeeExplicitRxIndicator(APIFrame * frame); - virtual char * getReceivedData(); + virtual unsigned char * getReceivedData(); virtual int getReceivedDataOffset();
--- a/Indicator/ZigBeeRxIndicator.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Indicator/ZigBeeRxIndicator.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -4,7 +4,7 @@ : RxBase(frame) { } -char * ZigBeeRxIndicator::getReceivedData() +unsigned char * ZigBeeRxIndicator::getReceivedData() { if (getReceivedDataLength() <= 0) return NULL;
--- a/Indicator/ZigBeeRxIndicator.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Indicator/ZigBeeRxIndicator.h Sat Nov 14 16:42:36 2015 +0000 @@ -10,7 +10,7 @@ public: ZigBeeRxIndicator(APIFrame * frame); - virtual char * getReceivedData(); + virtual unsigned char * getReceivedData(); virtual int getReceivedDataOffset();
--- a/Options/OptionsBase.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Options/OptionsBase.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -5,7 +5,7 @@ value = 0x00; } -OptionsBase::OptionsBase(char option) +OptionsBase::OptionsBase(unsigned char option) { value = option; } @@ -29,7 +29,7 @@ value &= 0xFE; } -char OptionsBase::getValue() +unsigned char OptionsBase::getValue() { return value; } \ No newline at end of file
--- a/Options/OptionsBase.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Options/OptionsBase.h Sat Nov 14 16:42:36 2015 +0000 @@ -4,12 +4,12 @@ class OptionsBase { protected : - char value; + unsigned char value; public: OptionsBase(); - - OptionsBase(char option); - + + OptionsBase(unsigned char option); + static OptionsBase * DEFAULT; static OptionsBase * DisableRetriesRouteRepair; @@ -17,8 +17,8 @@ bool getDisableRetriesRouteRepair(); void setDisableRetriesRouteRepair(bool status); - - char getValue(); + + unsigned char getValue(); }; #endif \ No newline at end of file
--- a/Options/RemoteCommandOptions.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Options/RemoteCommandOptions.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -5,7 +5,7 @@ : TransmitOptions() { } -RemoteCommandOptions::RemoteCommandOptions(char option) +RemoteCommandOptions::RemoteCommandOptions(unsigned char option) : TransmitOptions(option) { }
--- a/Options/RemoteCommandOptions.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Options/RemoteCommandOptions.h Sat Nov 14 16:42:36 2015 +0000 @@ -8,7 +8,7 @@ public : RemoteCommandOptions(); - RemoteCommandOptions(char option); + RemoteCommandOptions(unsigned char option); RemoteCommandOptions(bool disable_retries_and_route_repair, bool apply_changes, bool enable_APS_encryption, bool use_extended_transmission_timeout);
--- a/Options/TransmitOptions.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Options/TransmitOptions.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -4,7 +4,7 @@ : OptionsBase() { } -TransmitOptions::TransmitOptions(char option) +TransmitOptions::TransmitOptions(unsigned char option) : OptionsBase(option) { }
--- a/Options/TransmitOptions.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Options/TransmitOptions.h Sat Nov 14 16:42:36 2015 +0000 @@ -13,7 +13,7 @@ public: TransmitOptions(); - TransmitOptions(char option); + TransmitOptions(unsigned char option); TransmitOptions(bool disable_retries_and_route_repair, bool enable_APS_encryption, bool use_extended_transmission_timeout);
--- a/Options/Tx16TransmitOptions.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Options/Tx16TransmitOptions.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -2,7 +2,7 @@ Tx16TransmitOptions::Tx16TransmitOptions() { } -Tx16TransmitOptions::Tx16TransmitOptions(char value):OptionsBase(value) +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)
--- a/Options/Tx16TransmitOptions.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Options/Tx16TransmitOptions.h Sat Nov 14 16:42:36 2015 +0000 @@ -20,7 +20,7 @@ Tx16TransmitOptions(); - Tx16TransmitOptions(char value); + Tx16TransmitOptions(unsigned char value); Tx16TransmitOptions(bool disable_retries_and_route_repair, bool force_long_header, bool disable_long_header, bool invoke_traceroute);
--- a/Options/Tx64TransmitOptions.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Options/Tx64TransmitOptions.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -2,7 +2,7 @@ Tx64TransmitOptions::Tx64TransmitOptions() { } -Tx64TransmitOptions::Tx64TransmitOptions(char value) +Tx64TransmitOptions::Tx64TransmitOptions(unsigned char value) : OptionsBase(value) { }
--- a/Options/Tx64TransmitOptions.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Options/Tx64TransmitOptions.h Sat Nov 14 16:42:36 2015 +0000 @@ -13,7 +13,7 @@ public: Tx64TransmitOptions(); - Tx64TransmitOptions(char vlaue); + 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);
--- a/Request/ATCommandRequest.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Request/ATCommandRequest.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -1,6 +1,6 @@ #include "ATCommandRequest.h" -ATCommandRequest::ATCommandRequest(char frameID, const char * command, const char * parameter, int offset, int length) +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]); @@ -24,7 +24,7 @@ set(3, command[1]); } -void ATCommandRequest::setParameter(const char * parameter, int offset, int length) +void ATCommandRequest::setParameter(const unsigned char * parameter, int offset, int length) { setPosition(4); sets(parameter, offset, length);
--- a/Request/ATCommandRequest.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Request/ATCommandRequest.h Sat Nov 14 16:42:36 2015 +0000 @@ -19,13 +19,13 @@ /// <param name="FrameID"></param> /// <param name="AT_Command"></param> /// <param name="Parameter_Value">this can be null</param> - ATCommandRequest(char frameID, const char * command, const char * parameter=NULL, int offset=0, int length=0); + 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 char * parameter, int offset, int length); + virtual void setParameter(const unsigned char * parameter, int offset, int length); }; #endif \ No newline at end of file
--- a/Request/CreateSourceRouteRequest.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Request/CreateSourceRouteRequest.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -1,6 +1,6 @@ #include "CreateSourceRouteRequest.h" -CreateSourceRouteRequest::CreateSourceRouteRequest(char frameID, Address * remoteAddress, int * addresses, int size) +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);
--- a/Request/CreateSourceRouteRequest.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Request/CreateSourceRouteRequest.h Sat Nov 14 16:42:36 2015 +0000 @@ -21,7 +21,7 @@ /// <param name="FrameID"></param> /// <param name="AT_Command"></param> /// <param name="Parameter_Value">this can be null</param> - CreateSourceRouteRequest(char frameID, Address * remoteAddress, int * addresses, int size); + CreateSourceRouteRequest(unsigned char frameID, Address * remoteAddress, int * addresses, int size); void setRemoteAddress(Address * remoteAddress);
--- a/Request/ICommandRequest.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Request/ICommandRequest.h Sat Nov 14 16:42:36 2015 +0000 @@ -10,7 +10,7 @@ virtual void setCommand(const char * command) = 0; - virtual void setParameter(const char * parameter, int offset, int length) = 0; + virtual void setParameter(const unsigned char * parameter, int offset, int length) = 0; }; #endif \ No newline at end of file
--- a/Request/IOCDetectionConfigRequest.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Request/IOCDetectionConfigRequest.h Sat Nov 14 16:42:36 2015 +0000 @@ -8,7 +8,7 @@ class IOCDetectionConfigRequest : public ATCommandRequest { public: - IOCDetectionConfigRequest(char frameID, Pin ** pins, int size) + IOCDetectionConfigRequest(unsigned char frameID, Pin ** pins, int size) : ATCommandRequest(frameID, ATCommands::Digital_IO_Change_Detection, Pin::IOChangeDetectionConfiguration(pins, size), 0, 2) { } };
--- a/Request/IPayloadRequest.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Request/IPayloadRequest.h Sat Nov 14 16:42:36 2015 +0000 @@ -5,7 +5,7 @@ { public: - virtual void setPayload(const char * data,int offset, int length) = 0; + virtual void setPayload(const unsigned char * data,int offset, int length) = 0; virtual void setTransmitOptions(OptionsBase * transmitOptions) = 0;
--- a/Request/PinConfigurationRequest.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Request/PinConfigurationRequest.h Sat Nov 14 16:42:36 2015 +0000 @@ -18,7 +18,7 @@ *DIGITAL_OUTPUT_DEFAULT_HIGH = 0x05, *ALTERNATE_FUNCTIONALITIES_WHERE_APPLICABLE = 0x06//0x06~0x09 */ - PinConfigurationRequest(char frameID, Pin * pin, char function) + PinConfigurationRequest(unsigned char frameID, Pin * pin, unsigned char function) : ATCommandRequest(frameID, pin->getCommand(), &function, 0, 1) { } @@ -32,7 +32,7 @@ *DIGITAL_OUTPUT_DEFAULT_HIGH = 0x05, *ALTERNATE_FUNCTIONALITIES_WHERE_APPLICABLE = 0x06//0x06~0x09 */ - void setPinFunction(char function) { data[4] = function; } + void setPinFunction(unsigned char function) { data[4] = function; } };
--- a/Request/RemoteATCommandRequest.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Request/RemoteATCommandRequest.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -1,11 +1,12 @@ #include "RemoteATCommandRequest.h" -RemoteATCommandRequest::RemoteATCommandRequest(char frameID, Address * remoteAddress, const char * command, OptionsBase * transmitOptions, const char * parameter, int parameterOffset, int parameterLength) +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()); - sets(command, 0, 2); + set(command[0]); + set(command[1]); if (parameter != NULL) sets(parameter, parameterOffset, parameterLength); @@ -25,10 +26,11 @@ void RemoteATCommandRequest::setCommand(const char * command) { - sets(13, command, 0, 2); + set(13, command[0]); + set(14, command[1]); } -void RemoteATCommandRequest::setParameter(const char * parameter, int offset, int length) +void RemoteATCommandRequest::setParameter(const unsigned char * parameter, int offset, int length) { setPosition(15); sets(parameter, offset, length);
--- a/Request/RemoteATCommandRequest.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Request/RemoteATCommandRequest.h Sat Nov 14 16:42:36 2015 +0000 @@ -23,7 +23,7 @@ /// <param name="options">RemoteCommandOptions</param> /// <param name="AT_Command"></param> /// <param name="Parameter_Value">this can be null</param> - RemoteATCommandRequest(char frameID, Address * remoteAddress, const char * command, OptionsBase * transmitOptions, const char * parameter=NULL, int parameterOffset=0, int parameterLength=0); + 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); @@ -31,7 +31,7 @@ virtual void setCommand(const char * command); - virtual void setParameter(const char * parameter, int offset, int length); + virtual void setParameter(const unsigned char * parameter, int offset, int length); void setRemoteAddress(Address * remoteAddress); };
--- a/Request/RemoteIODetectionConfigRequest.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Request/RemoteIODetectionConfigRequest.h Sat Nov 14 16:42:36 2015 +0000 @@ -8,7 +8,7 @@ class RemoteIODetectionConfigRequest : public RemoteATCommandRequest { public: - RemoteIODetectionConfigRequest(char frameID, Address * remoteAddress, Pin ** pins, int size) + 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) { } };
--- a/Request/RemotePinConfigurationRequest.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Request/RemotePinConfigurationRequest.h Sat Nov 14 16:42:36 2015 +0000 @@ -19,7 +19,7 @@ *DIGITAL_OUTPUT_DEFAULT_HIGH = 0x05, *ALTERNATE_FUNCTIONALITIES_WHERE_APPLICABLE = 0x06//0x06~0x09 */ - RemotePinConfigurationRequest(char frameID, Address * remoteAddress, Pin * pin, char function) + RemotePinConfigurationRequest(unsigned char frameID, Address * remoteAddress, Pin * pin, unsigned char function) : RemoteATCommandRequest(frameID, remoteAddress, pin->getCommand(), RemoteCommandOptions::ApplyChanges, &function, 0, 1) { } @@ -33,7 +33,7 @@ *DIGITAL_OUTPUT_DEFAULT_HIGH = 0x05, *ALTERNATE_FUNCTIONALITIES_WHERE_APPLICABLE = 0x06//0x06~0x09 */ - void setPinFunction(char function) { data[15] = function; } + void setPinFunction(unsigned char function) { data[15] = function; } }; #endif \ No newline at end of file
--- a/Request/TxBase.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Request/TxBase.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -1,6 +1,6 @@ #include "TxBase.h" -TxBase::TxBase(int length, char identifier, char frameID) +TxBase::TxBase(int length, unsigned char identifier, unsigned char frameID) : APIFrame(length + 2) { setFrameType(identifier); @@ -8,12 +8,12 @@ setPosition(2); } -void TxBase::setFrameID(char frameID) +void TxBase::setFrameID(unsigned char frameID) { data[1] = frameID; } -char TxBase::getFrameID() +unsigned char TxBase::getFrameID() { return data[1]; } \ No newline at end of file
--- a/Request/TxBase.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Request/TxBase.h Sat Nov 14 16:42:36 2015 +0000 @@ -19,15 +19,15 @@ /// <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, char identifier, char frameID); + 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(char frameID); + void setFrameID(unsigned char frameID); - char getFrameID(); + unsigned char getFrameID(); }; #endif \ No newline at end of file
--- a/Request/XBeeTx16Request.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Request/XBeeTx16Request.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -1,6 +1,6 @@ #include "XBeeTx16Request.h" -XBeeTx16Request::XBeeTx16Request(char frameID, Address * remoteAddress, OptionsBase * transmitOptions, const char * payload, int offset, int length) +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); @@ -9,7 +9,7 @@ sets(payload, offset, length); } -void XBeeTx16Request::setPayload(const char * data, int offset, int length) +void XBeeTx16Request::setPayload(const unsigned char * data, int offset, int length) { setPosition(5); sets(data, offset, length);
--- a/Request/XBeeTx16Request.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Request/XBeeTx16Request.h Sat Nov 14 16:42:36 2015 +0000 @@ -8,9 +8,9 @@ { public: - XBeeTx16Request(char frameID, Address * remoteAddress, OptionsBase * transmitOptions, const char * payload, int offset, int length); + XBeeTx16Request(unsigned char frameID, Address * remoteAddress, OptionsBase * transmitOptions, const unsigned char * payload, int offset, int length); - virtual void setPayload(const char * data, int offset, int length); + virtual void setPayload(const unsigned char * data, int offset, int length); virtual void setTransmitOptions(OptionsBase * transmitOptions);
--- a/Request/XBeeTx64Request.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Request/XBeeTx64Request.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -1,6 +1,6 @@ #include "XBeeTx64Request.h" -XBeeTx64Request::XBeeTx64Request(char frameID, Address * remoteAddress, OptionsBase * transmitOptions, const char * payload, int offset, int length) +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); @@ -8,7 +8,7 @@ sets(payload, offset, length); } -void XBeeTx64Request::setPayload(const char * data, int offset, int length) +void XBeeTx64Request::setPayload(const unsigned char * data, int offset, int length) { setPosition(11); sets(data, offset, length);
--- a/Request/XBeeTx64Request.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Request/XBeeTx64Request.h Sat Nov 14 16:42:36 2015 +0000 @@ -8,9 +8,9 @@ { public: - XBeeTx64Request(char frameID, Address * remoteAddress, OptionsBase * transmitOptions, const char * payload, int offset, int length); + XBeeTx64Request(unsigned char frameID, Address * remoteAddress, OptionsBase * transmitOptions, const unsigned char * payload, int offset, int length); - virtual void setPayload(const char * data, int offset, int length); + virtual void setPayload(const unsigned char * data, int offset, int length); virtual void setTransmitOptions(OptionsBase * transmitOptions);
--- a/Request/ZigBeeExplicitTxRequest.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Request/ZigBeeExplicitTxRequest.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -1,6 +1,6 @@ #include "ZigBeeExplicitTxRequest.h" -ZigBeeExplicitTxRequest::ZigBeeExplicitTxRequest(char frameID, ExplicitAddress * remoteAddress, OptionsBase * transmitOptions, const char * payload, int offset, int length) +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); @@ -10,7 +10,7 @@ sets(payload, offset, length); } -void ZigBeeExplicitTxRequest::setBroadcastRadius(char broadcastRadius) +void ZigBeeExplicitTxRequest::setBroadcastRadius(unsigned char broadcastRadius) { data[18] = broadcastRadius; } @@ -20,7 +20,7 @@ data[19] = transmitOptions->getValue(); } -void ZigBeeExplicitTxRequest::setPayload(const char * data, int offset, int length) +void ZigBeeExplicitTxRequest::setPayload(const unsigned char * data, int offset, int length) { setPosition(20); sets(data, offset, length);
--- a/Request/ZigBeeExplicitTxRequest.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Request/ZigBeeExplicitTxRequest.h Sat Nov 14 16:42:36 2015 +0000 @@ -19,9 +19,9 @@ //Broadcast_Radius; //TransmitOptions; //RF_Data; - ZigBeeExplicitTxRequest(char frameID, ExplicitAddress * remoteAddress, OptionsBase * transmitOptions, const char * payload, int offset, int length); + ZigBeeExplicitTxRequest(unsigned char frameID, ExplicitAddress * remoteAddress, OptionsBase * transmitOptions, const unsigned char * payload, int offset, int length); - virtual void setPayload(const char * data, int offset, int length); + virtual void setPayload(const unsigned char * data, int offset, int length); virtual void setTransmitOptions(OptionsBase * transmitOptions); @@ -29,7 +29,7 @@ void setRemoteAddress(ExplicitAddress * remoteAddress); - void setBroadcastRadius(char broadcastRadius); + void setBroadcastRadius(unsigned char broadcastRadius); };
--- a/Request/ZigBeeTxRequest.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Request/ZigBeeTxRequest.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -1,6 +1,6 @@ #include "ZigBeeTxRequest.h" -ZigBeeTxRequest::ZigBeeTxRequest(char frameID, Address * remoteAddress, OptionsBase * transmitOptions, const char * payload, int offset, int length) +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); @@ -9,7 +9,7 @@ sets(payload, offset, length); } -void ZigBeeTxRequest::setPayload(const char * data, int offset, int length) +void ZigBeeTxRequest::setPayload(const unsigned char * data, int offset, int length) { setPosition(14); sets(data, offset, length); @@ -26,7 +26,7 @@ } -void ZigBeeTxRequest::setBroadcastRadius(char broadcastRadius) +void ZigBeeTxRequest::setBroadcastRadius(unsigned char broadcastRadius) { data[12] = broadcastRadius; } \ No newline at end of file
--- a/Request/ZigBeeTxRequest.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Request/ZigBeeTxRequest.h Sat Nov 14 16:42:36 2015 +0000 @@ -14,15 +14,15 @@ //Broadcast_Radius; //TransmitOptions; //RF_Data; - ZigBeeTxRequest(char frameID, Address * remoteAddress, OptionsBase * transmitOptions, const char * payload, int offset, int length); + ZigBeeTxRequest(unsigned char frameID, Address * remoteAddress, OptionsBase * transmitOptions, const unsigned char * payload, int offset, int length); - virtual void setPayload(const char * data, 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(char broadcastRadius); + void setBroadcastRadius(unsigned char broadcastRadius); };
--- a/Type/ATCommands.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Type/ATCommands.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -1,17 +1,17 @@ #include "ATCommands.h" -char * ATCommands::IO_Sampling_Rate = "IR"; +char ATCommands::IO_Sampling_Rate[] = "IR"; -char * ATCommands::Digital_IO_Change_Detection = "IC"; +char ATCommands::Digital_IO_Change_Detection[] = "IC"; -char * ATCommands::Instant_Sample = "IS"; +char ATCommands::Instant_Sample[] = "IS"; -char * ATCommands::Node_Descovery = "ND"; +char ATCommands::Node_Descovery[] = "ND"; -char * ATCommands::Destination_Node_Descovery = "DN"; +char ATCommands::Destination_Node_Descovery[] = "DN"; -char * ATCommands::Node_Identifier = "NI"; +char ATCommands::Node_Identifier[] = "NI"; -char * ATCommands::Node_Join_Time = "NJ"; +char ATCommands::Node_Join_Time[] = "NJ"; -char * ATCommands::Force_Sample = "IS"; \ No newline at end of file +char ATCommands::Force_Sample[] = "IS"; \ No newline at end of file
--- a/Type/ATCommands.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Type/ATCommands.h Sat Nov 14 16:42:36 2015 +0000 @@ -4,21 +4,21 @@ class ATCommands { public: - static char * IO_Sampling_Rate; + static char IO_Sampling_Rate[]; - static char * Digital_IO_Change_Detection; + static char Digital_IO_Change_Detection[]; - static char * Instant_Sample; + static char Instant_Sample[]; - static char * Node_Descovery; + static char Node_Descovery[]; - static char * Destination_Node_Descovery; + static char Destination_Node_Descovery[]; - static char * Node_Identifier; + static char Node_Identifier[]; - static char * Node_Join_Time; + static char Node_Join_Time[]; - static char * Force_Sample; + static char Force_Sample[]; }; #endif \ No newline at end of file
--- a/Type/IOSamples.cpp Thu Nov 05 23:03:42 2015 +0000 +++ b/Type/IOSamples.cpp Sat Nov 14 16:42:36 2015 +0000 @@ -1,35 +1,35 @@ #include "IOSamples.h" -map<Pin *, int> * IOSamples::getAnalogs() +map<Pin *, unsigned int> * IOSamples::getAnalogs() { return &analog; } -int IOSamples::getAnalog(Pin * pin) +unsigned int IOSamples::getAnalog(Pin * pin) { if (analog.count(pin)) return analog[pin]; - else return -1; + else return 0xFFFF; } -map<Pin *, int> * IOSamples::getDigitals() +map<Pin *, unsigned char> * IOSamples::getDigitals() { return &digital; } -int IOSamples::getDigital(Pin * pin) +unsigned char IOSamples::getDigital(Pin * pin) { if (digital.count(pin)) return digital[pin]; else return 2; } -int IOSamples::getSupplyVoltage() +unsigned int IOSamples::getSupplyVoltage() { return SUPPLY_VOLTAGE; } -void IOSamples::setSupplyVoltage(int voltage) +void IOSamples::setSupplyVoltage(unsigned int voltage) { SUPPLY_VOLTAGE = voltage; }
--- a/Type/IOSamples.h Thu Nov 05 23:03:42 2015 +0000 +++ b/Type/IOSamples.h Sat Nov 14 16:42:36 2015 +0000 @@ -11,11 +11,11 @@ class IOSamples { private : - int SUPPLY_VOLTAGE; + unsigned int SUPPLY_VOLTAGE; - map<Pin *, int> analog; + map<Pin *, unsigned int> analog; - map<Pin *, int> digital; + map<Pin *, unsigned char> digital; public: /** @@ -23,25 +23,25 @@ * * @returns map<Pin,int> */ - map<Pin *, int> * getAnalogs(); + map<Pin *, unsigned int> * getAnalogs(); /** * Get analog value from one pin. * * @param Pin XBee S1 or S2 pin object. - * @returns -1 means sample not avaliable. + * @returns 0xFFFF means sample not avaliable. */ - int getAnalog(Pin * pin); + unsigned int getAnalog(Pin * pin); /** * Get all the avaliable digital values. * - * @returns map<Pin,int>: + * @returns map<Pin,unsigned char>: * LOW = 0, * HIGH = 1, * UNMONITORED = 2, */ - map<Pin *, int> * getDigitals(); + map<Pin *, unsigned char> * getDigitals(); /** * Get digital value from one pin. @@ -52,21 +52,21 @@ * HIGH = 1, * UNMONITORED = 2, */ - int getDigital(Pin * pin); + unsigned char getDigital(Pin * pin); /** * Get supply voltage, S2 only. * * @returns voltage */ - int getSupplyVoltage(); + unsigned int getSupplyVoltage(); /** * Set supply voltage, S2 only. * * @param voltage */ - void setSupplyVoltage(int voltage); + void setSupplyVoltage(unsigned int voltage); /** * Cleat all the sample values.