vif parsing

This commit is contained in:
Wolfgang Hottgenroth 2020-11-17 18:26:11 +01:00
parent e369c51c96
commit c6ba4914f3
Signed by: wn
GPG Key ID: 6C1E5E531E0D5D7F

View File

@ -1,5 +1,6 @@
#include <mbus/mbus-protocol.h> #include <mbus/mbus-protocol.h>
#include <mbusParserExt.h> #include <mbusParserExt.h>
#include <logger.h>
#include <string.h> #include <string.h>
@ -23,6 +24,12 @@ static parsedVIB_t parseVIB_default(mbus_value_information_block vib) {
strcpy(parsedVIB.name, "Energy"); strcpy(parsedVIB.name, "Energy");
strcpy(parsedVIB.unit, "Wh"); strcpy(parsedVIB.unit, "Wh");
parsedVIB.exponent = (vib.vif & 0b0111) - 3; parsedVIB.exponent = (vib.vif & 0b0111) - 3;
} else if ((vib.vif & 0b00101000) == 0b00101000) {
strcpy(parsedVIB.name, "Power");
strcpy(parsedVIB.unit, "W");
parsedVIB.exponent = (vib.vif & 0b0111) - 3;
} else {
coloredMsg(LOG_RED, true, "mpe pvd unknown vif 0x%02x", vib.vif);
} }
return parsedVIB; return parsedVIB;