Senet Packet API
Dependents: MTDOT-UDKDemo_Senet Senet NAMote mDot-IKS01A1 unh-hackathon-example ... more
Diff: senet_packet.cpp
- Revision:
- 6:17e4e5f99d0c
- Parent:
- 4:7d43feca0e3d
--- a/senet_packet.cpp Thu Aug 11 12:48:46 2016 +0000 +++ b/senet_packet.cpp Tue Aug 23 16:01:03 2016 +0000 @@ -156,7 +156,21 @@ } return bytes; } - +int32_t SensorPacket::deserializePayload(uint8_t *frame, int32_t len) +{ + int32_t num_sensors = 0; + for(int i = 0;i < MAX_SENSOR_VALUES;i++) + { + if(len < 3) + break; + sensorValue[i].type = frame[i*3+0]; + sensorValue[i].value= (frame[i*3+1]<<8)|frame[i*3+2]; + sensorValue[i].isSet= true; + len-=3; + num_sensors++; + } + return(num_sensors); +} bool SelfIdPacket::setDeviceType(uint32_t model, uint8_t revision) { if((model & 0x00FFFFFF) != model)