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:
- 4:a0f1fba6c2fb
- Parent:
- 2:700dc65ca3b1
- Child:
- 5:945b89c71902
diff -r 6b205ec8624b -r a0f1fba6c2fb Helper/IOSampleDecoder.cpp --- a/Helper/IOSampleDecoder.cpp Mon Oct 26 18:04:12 2015 +0000 +++ b/Helper/IOSampleDecoder.cpp Fri Oct 30 00:38:40 2015 +0000 @@ -29,23 +29,23 @@ map<Pin *, int> * digital = (samples + i)->getDigitals(); if (digitMask != 0) { if ((digitMask & 0x01) == 0x01) - (*digital)[&XBeePins::P20_AD0_DIO0] = (IOSamplePayload[index + 1] & 0x01) == 0x01 ? 1 : 0; + (*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; + (*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; + (*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; + (*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; + (*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; + (*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; + (*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; + (*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; + (*digital)[XBeePins::P9_DTR_SLEEP_DIO8] = (IOSamplePayload[index] & 0x01) == 0x01 ? 1 : 0; //skip the 2 [digital sample] index += 2; @@ -53,22 +53,22 @@ if (analogMask != 0) { if ((analogMask & 0x02) == 0x02) - (*analog)[&XBeePins::P20_AD0_DIO0] = (IOSamplePayload[index++] << 8) | IOSamplePayload[index++]; + (*analog)[XBeePins::P20_AD0_DIO0] = (IOSamplePayload[index++] << 8) | IOSamplePayload[index++]; if ((analogMask & 0x04) == 0x04) - (*analog)[&XBeePins::P19_AD1_DIO1] = (IOSamplePayload[index++] << 8) | IOSamplePayload[index++]; + (*analog)[XBeePins::P19_AD1_DIO1] = (IOSamplePayload[index++] << 8) | IOSamplePayload[index++]; if ((analogMask & 0x08) == 0x08) - (*analog)[&XBeePins::P18_AD2_DIO2] = (IOSamplePayload[index++] << 8) | IOSamplePayload[index++]; + (*analog)[XBeePins::P18_AD2_DIO2] = (IOSamplePayload[index++] << 8) | IOSamplePayload[index++]; if ((analogMask & 0x10) == 0x10) - (*analog)[&XBeePins::P17_AD3_DIO3] = (IOSamplePayload[index++] << 8) | IOSamplePayload[index++]; + (*analog)[XBeePins::P17_AD3_DIO3] = (IOSamplePayload[index++] << 8) | IOSamplePayload[index++]; if ((analogMask & 0x20) == 0x20) - (*analog)[&XBeePins::P11_AD4_DIO4] = (IOSamplePayload[index++] << 8) | IOSamplePayload[index++]; + (*analog)[XBeePins::P11_AD4_DIO4] = (IOSamplePayload[index++] << 8) | IOSamplePayload[index++]; if ((analogMask & 0x40) == 0x40) - (*analog)[&XBeePins::P15_ASSOCIATE_AD5_DIO5] = (IOSamplePayload[index++] << 8) | IOSamplePayload[index++]; + (*analog)[XBeePins::P15_ASSOCIATE_AD5_DIO5] = (IOSamplePayload[index++] << 8) | IOSamplePayload[index++]; } } @@ -101,43 +101,43 @@ if (digitMask != 0) { if ((digitMask & 0x01) == 0x01) - (*digital)[&ZigBeePins::P20_AD0_DIO0_COMMISSIONONG_BUTTON] = (IOSamplePayload[index + 1] & 0x01) == 0x01 ? 1 : 0; + (*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; + (*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; + (*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; + (*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; + (*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; + (*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; + (*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; + (*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; + (*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; + (*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; + (*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++]; + (*analog)[ZigBeePins::P20_AD0_DIO0_COMMISSIONONG_BUTTON] = (IOSamplePayload[index++] << 8) | IOSamplePayload[index++]; if ((analogMask & 0x02) == 0x02) - (*analog)[&ZigBeePins::P19_AD1_DIO1] = (IOSamplePayload[index++] << 8) | IOSamplePayload[index++]; + (*analog)[ZigBeePins::P19_AD1_DIO1] = (IOSamplePayload[index++] << 8) | IOSamplePayload[index++]; if ((analogMask & 0x04) == 0x04) - (*analog)[&ZigBeePins::P18_AD2_DIO2] = (IOSamplePayload[index++] << 8) | IOSamplePayload[index++]; + (*analog)[ZigBeePins::P18_AD2_DIO2] = (IOSamplePayload[index++] << 8) | IOSamplePayload[index++]; if ((analogMask & 0x08) == 0x08) - (*analog)[&ZigBeePins::P17_AD3_DIO3] = (IOSamplePayload[index++] << 8) | IOSamplePayload[index++]; + (*analog)[ZigBeePins::P17_AD3_DIO3] = (IOSamplePayload[index++] << 8) | IOSamplePayload[index++]; if ((analogMask & 0x80) == 0x80) (samples + i)->setSupplyVoltage((IOSamplePayload[index++] << 8) | IOSamplePayload[index++]);