4#if defined(USE_ESP32) || defined(USE_ARDUINO) || defined(USE_HOST)
20#ifdef USE_BINARY_SENSOR
24#include <dlms_parser/dlms_parser.h>
26#if defined(USE_HOST) && __has_include(<mbedtls/gcm.h>)
27#include <dlms_parser/decryption/aes_128_gcm_decryptor_mbedtls.h>
31#elif __has_include(<psa/crypto.h>)
32#include <dlms_parser/decryption/aes_128_gcm_decryptor_tfpsa.h>
36#elif defined(USE_HOST)
37#error "dlms_meter on the host needs the Mbed TLS development files: apt install libmbedtls-dev or brew install mbedtls"
38#elif !defined(USE_ESP8266) && __has_include(<mbedtls/gcm.h>)
39#if __has_include(<mbedtls/esp_config.h>)
40#include <mbedtls/esp_config.h>
42#include <dlms_parser/decryption/aes_128_gcm_decryptor_mbedtls.h>
46#elif __has_include(<bearssl/bearssl.h>)
47#include <dlms_parser/decryption/aes_128_gcm_decryptor_bearssl.h>
52#error "The platform doesn't provide a compatible encryption library for dlms_parser"
58#ifndef DLMS_MAX_SENSORS
59static constexpr uint8_t DLMS_MAX_SENSORS = 0;
61#ifndef DLMS_MAX_TEXT_SENSORS
62static constexpr uint8_t DLMS_MAX_TEXT_SENSORS = 0;
64#ifndef DLMS_MAX_BINARY_SENSORS
65static constexpr uint8_t DLMS_MAX_BINARY_SENSORS = 0;
80#ifdef USE_BINARY_SENSOR
97 const char *authentication_key, std::vector<CustomPattern> custom_patterns);
99 void setup()
override;
101 void loop()
override;
106#ifdef USE_TEXT_SENSOR
109#ifdef USE_BINARY_SENSOR
116 void on_data_(
const dlms_parser::AxdrCapture &capture);
133#ifdef USE_TEXT_SENSOR
136#ifdef USE_BINARY_SENSOR
Minimal static vector - saves memory by avoiding std::vector overhead.
Base class for all binary_sensor-type classes.
DlmsMeterComponent(uint32_t receive_timeout_ms, bool skip_crc_check, const char *decryption_key, const char *authentication_key, std::vector< CustomPattern > custom_patterns)
StaticVector< SensorItem, DLMS_MAX_SENSORS > sensors_
std::vector< CustomPattern > custom_patterns_
void on_data_(const dlms_parser::AxdrCapture &capture)
std::array< uint8_t, 2048 > rx_buffer_
void register_text_sensor(const dlms_parser::ObisId &obis, text_sensor::TextSensor *sensor)
void dump_config() override
uint32_t receive_timeout_ms_
StaticVector< TextSensorItem, DLMS_MAX_TEXT_SENSORS > text_sensors_
void register_sensor(const dlms_parser::ObisId &obis, sensor::Sensor *sensor)
StaticVector< BinarySensorItem, DLMS_MAX_BINARY_SENSORS > binary_sensors_
size_t bytes_accumulated_
dlms_parser::DlmsParser parser_
Aes128GcmDecryptorImpl decryptor_
void register_binary_sensor(const dlms_parser::ObisId &obis, binary_sensor::BinarySensor *sensor)
uint32_t last_rx_char_time_
Base-class for all sensors.
dlms_parser::Aes128GcmDecryptorMbedTls Aes128GcmDecryptorImpl
binary_sensor::BinarySensor * sensor
dlms_parser::ObisId default_obis
text_sensor::TextSensor * sensor