add extended mbus vib parser
This commit is contained in:
parent
cd249e5ad8
commit
e1a77d4fbf
17
cube/User/Inc/mbusParserExt.h
Normal file
17
cube/User/Inc/mbusParserExt.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#ifndef _MBUSPARSEREXT_H_
|
||||||
|
#define _MBUSPARSEREXT_H_
|
||||||
|
|
||||||
|
#include <mbus/mbus-protocol.h>
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char name[32];
|
||||||
|
char unit[16];
|
||||||
|
uint8_t exponent;
|
||||||
|
} parsedVIB_t;
|
||||||
|
|
||||||
|
parsedVIB_t parseVIB(mbus_value_information_block vib);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif //_MBUSPARSEREXT_H_
|
38
cube/User/Src/mbusParserExt.c
Normal file
38
cube/User/Src/mbusParserExt.c
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#include <mbus/mbus-protocol.h>
|
||||||
|
#include <mbusParserExt.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static parsedVIB_t parseVIB_FB(mbus_value_information_block vib) {
|
||||||
|
parsedVIB_t parsedVIB = { .name = "FB", .unit = "?", .exponent = 1 };
|
||||||
|
|
||||||
|
return parsedVIB;
|
||||||
|
}
|
||||||
|
|
||||||
|
static parsedVIB_t parseVIB_FD(mbus_value_information_block vib) {
|
||||||
|
parsedVIB_t parsedVIB = { .name = "FD", .unit = "?", .exponent = 1 };
|
||||||
|
|
||||||
|
return parsedVIB;
|
||||||
|
}
|
||||||
|
|
||||||
|
static parsedVIB_t parseVIB_default(mbus_value_information_block vib) {
|
||||||
|
parsedVIB_t parsedVIB = { .name = "default", .unit = "?", .exponent = 1 };
|
||||||
|
|
||||||
|
return parsedVIB;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
parsedVIB_t parseVIB(mbus_value_information_block vib) {
|
||||||
|
parsedVIB_t parsedVIB;
|
||||||
|
|
||||||
|
if (vib.vif == 0xfb) {
|
||||||
|
parsedVIB = parseVIB_FB(vib);
|
||||||
|
} else if (vib.vif == 0xfd) {
|
||||||
|
parsedVIB = parseVIB_FD(vib);
|
||||||
|
} else {
|
||||||
|
parsedVIB = parseVIB_default(vib);
|
||||||
|
}
|
||||||
|
|
||||||
|
return parsedVIB;
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user