olliiiver / sml_parser

Low memory C++ library to parse Smart Message Language (SML) data from smart meters.
GNU Lesser General Public License v2.1
35 stars 15 forks source link

Generate OBISHandlers dynamically #28

Open CRSLEE opened 1 year ago

CRSLEE commented 1 year ago

Hi, im trying to Generate the OBIS Handlers dynamically to switch between different smart meter types. Is there a working solution to achive this? Ive spend a lot of time figuring out how to get the data dynamic but with no succsess :/

OBISHandler OBISHandlers[] = { {{ 0x81, 0x81, 0xc7, 0x82, 0x03, 0xff }, &Manufacturer}, / 129-129:199.130.3255 / {{ 0x01, 0x00, 0x01, 0x08, 0x01, 0xff }, &PowerT1}, / 1- 0: 1. 8.1255 (T1) / {{ 0x01, 0x00, 0x01, 0x08, 0x00, 0xff }, &PowerSum}, / 1- 0: 1. 8.0255 (T1 + T2) / {{ 0x01, 0x00, 0x0F, 0x07, 0x00, 0xff }, &PowerW}, / 1- 0: 15. 7.0255 (Watt) / {{ 0, 0 }} };

olliiiver commented 1 year ago

Hi @CRSLEE . I think the best way to dynamically get the data would be to walk through the SML tree and parse the node with all the OBIS information. See also #14. However, I have not implemented that yet.