vif parsing
This commit is contained in:
parent
59e6482b3f
commit
f27c2327b8
@ -164,30 +164,24 @@ static void parseAndPrintFrame(t_mbusCommHandle *localMbusCommHandle) {
|
||||
for (uint8_t j = 0; j < MBUSDEVICE_NUM_OF_CONSIDEREDFIELDS; j++) {
|
||||
if ((localMbusCommHandle->device->consideredField[j].index == i) &&
|
||||
(strlen(localMbusCommHandle->device->consideredField[j].label) > 0)) {
|
||||
coloredMsg(LOG_YELLOW, true, "mbc papf [%d] txt: I:%d, L:%s, VIF: 0x%02x U:%s V:%s",
|
||||
localMbusCommHandle->requestId,
|
||||
i,
|
||||
localMbusCommHandle->device->consideredField[j].label,
|
||||
record->drh.vib.vif,
|
||||
mbus_data_record_unit(record),
|
||||
mbus_data_record_value(record));
|
||||
for (size_t vifeIdx = 0; vifeIdx < record->drh.vib.nvife; vifeIdx++) {
|
||||
coloredMsg(LOG_YELLOW, true, "mbc papf [%d] vife %d 0x%02x",
|
||||
localMbusCommHandle->requestId,
|
||||
vifeIdx,
|
||||
record->drh.vib.vife[vifeIdx]);
|
||||
}
|
||||
parsedVIB_t parsedVIB = parseVIB(record->drh.vib);
|
||||
coloredMsg(LOG_YELLOW, true, "mbc papf [%d] parsed VIB N: %s, U: %s, E: %d",
|
||||
coloredMsg(LOG_YELLOW, false, "mbc papf [%d] parsed VIB N: %s, U: %s, E: %d",
|
||||
localMbusCommHandle->requestId,
|
||||
parsedVIB.name, parsedVIB.unit, parsedVIB.exponent);
|
||||
|
||||
if (parsedVIB.found) {
|
||||
uint32_t value = strtol(mbus_data_record_value(record), NULL, 10);
|
||||
float weightedValue = ((float) value) * powf(10.0, ((float) parsedVIB.exponent));
|
||||
coloredMsg(LOG_YELLOW, true, "mbc papf [%d] result: %s is %.1f %s (%d * 10^%d)",
|
||||
coloredMsg(LOG_YELLOW, true, "mbc papf [%d] %s is %.1f %s (%d * 10^%d)",
|
||||
localMbusCommHandle->requestId, parsedVIB.name, weightedValue, parsedVIB.unit,
|
||||
value, parsedVIB.exponent);
|
||||
} else {
|
||||
coloredMsg(LOG_YELLOW, true, "mbc papf [%d] L:%s, VIF: 0x%02x U:%s V:%s",
|
||||
localMbusCommHandle->requestId,
|
||||
localMbusCommHandle->device->consideredField[j].label,
|
||||
record->drh.vib.vif,
|
||||
mbus_data_record_unit(record),
|
||||
mbus_data_record_value(record));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user