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.
Diff: Helper/IOSampleDecoder.cpp
- Revision:
- 6:5f31ddc17239
- Parent:
- 5:945b89c71902
diff -r 945b89c71902 -r 5f31ddc17239 Helper/IOSampleDecoder.cpp --- 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)