Commit 8e6686c1 authored by Michael Ott's avatar Michael Ott
Browse files

Update debug output for MQTT parsing to current data layout

parent dac94862
...@@ -143,6 +143,7 @@ void mqttCallback(SimpleMQTTMessage *msg) ...@@ -143,6 +143,7 @@ void mqttCallback(SimpleMQTTMessage *msg)
} }
//...otherwise this message is malformed -> ignore... //...otherwise this message is malformed -> ignore...
else { else {
cout << "Message malformed\n";
delete msg; delete msg;
return; return;
} }
...@@ -155,23 +156,23 @@ void mqttCallback(SimpleMQTTMessage *msg) ...@@ -155,23 +156,23 @@ void mqttCallback(SimpleMQTTMessage *msg)
DCDB::SensorId sid; DCDB::SensorId sid;
if (sid.mqttTopicConvert(msg->getTopic())) { if (sid.mqttTopicConvert(msg->getTopic())) {
#if 0 #if 0
cout << "Topic decode successful:" cout << "Topic decode successful:" << endl
<< "\nRaw: " << hex << setw(16) << setfill('0') << sid.raw[0] << " " << hex << setw(16) << setfill('0') << sid.raw[1] << " Raw: " << hex << setw(16) << setfill('0') << sid.getRaw()[0] << hex << setw(16) << setfill('0') << sid.getRaw()[1] << endl
<< "\ndatacenter_id: " << hex << ((sid.dl & 0xFF00000000000000) >> 56) << " DeviceLocation: " << hex << setw(16) << setfill('0') << sid.getDeviceLocation() << endl
<< "\ncluster_id: " << hex << ((sid.dl & 0x00FF000000000000) >> 48) << " device_id: " << hex << setw(8) << setfill('0') << sid.getDeviceSensorId().device_id << endl
<< "\nrack_id: " << hex << ((sid.dl & 0x0000FFFF00000000) >> 32) << " reserved: " << hex << setw(4) << setfill('0') << sid.getDeviceSensorId().rsvd << endl
<< "\nchassis_id: " << hex << ((sid.dl & 0x00000000FF000000) >> 24) << " sensor_number: " << hex << setw(4) << setfill('0') << sid.getDeviceSensorId().sensor_number << endl << dec;
<< "\nbic_id: " << hex << ((sid.dl & 0x0000000000FF0000) >> 16)
<< "\nbmc_id: " << hex << ((sid.dl & 0x000000000000FF00) >> 8) cout << "Payload (" << len/sizeof(mqttPayload) << " messages):"<< endl;
<< "\nknc_id: " << hex << ((sid.dl & 0x00000000000000FF)) for (uint64_t i=0; i<len/sizeof(mqttPayload); i++) {
<< "\ndevice_id: " << hex << sid.dsid.device_id cout << " " << i << ": ts=" << payload[i].timestamp << " val=" << payload[i].value << endl;
<< "\nreserved: " << hex << sid.dsid.rsvd }
<< "\nsensor_number: " << hex << sid.dsid.sensor_number cout << endl;
<< "\n";
#endif #endif
for (uint64_t i=0; i<len/sizeof(mqttPayload); i++) { for (uint64_t i=0; i<len/sizeof(mqttPayload); i++) {
mySensorDataStore->insert(&sid, payload[i].timestamp, payload[i].value); mySensorDataStore->insert(&sid, payload[i].timestamp, payload[i].value);
mySensorCache.storeSensor(sid, payload[i].timestamp, payload[i].value); mySensorCache.storeSensor(sid, payload[i].timestamp, payload[i].value);
} }
//mySensorCache.dump(); //mySensorCache.dump();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment