This folder contains an ANSI C-language parser for messages originating from the 'HAN' port of a Norwegian smart electricity meter. For more information about the meters and the data format, see the website of the responsible Norwegian committee.
An implementer is expected to implement the functions defined in hanparser_platform.h
.
There's only three, and a reference implementation against stdlib is provided in hanparser_platform_stdlib.c
han_parser_check_crc16_x25
: calculate a CRC-16/X-25 of a byte array and verify it against the provided CRChan_parser_debug_print
: print function targeting debug outputhan_parser_debug_printf
: printf function targeting debug output
Getting the decoded values is done through setting a callback function using han_parser_set_callback
. The callback gets called upon a
successful message decode, and the values struct passed to the callback function contains the decoded values.
To run this parser, feed each input byte to han_parser_input_byte
as it comes in.
SPDX-License-Identifier: Zlib
Author: Steven Cooreman, github.com/stevew817