diff --git a/lib/AmsConfiguration/include/AmsConfiguration.h b/lib/AmsConfiguration/include/AmsConfiguration.h index cc949e2b..1bc0b0b0 100644 --- a/lib/AmsConfiguration/include/AmsConfiguration.h +++ b/lib/AmsConfiguration/include/AmsConfiguration.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsConfiguration/include/AmsStorage.h b/lib/AmsConfiguration/include/AmsStorage.h index 8a29a1a3..be6610cc 100644 --- a/lib/AmsConfiguration/include/AmsStorage.h +++ b/lib/AmsConfiguration/include/AmsStorage.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsConfiguration/include/Timezones.h b/lib/AmsConfiguration/include/Timezones.h index eaa62a02..4d4ba8b8 100644 --- a/lib/AmsConfiguration/include/Timezones.h +++ b/lib/AmsConfiguration/include/Timezones.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsConfiguration/include/hexutils.h b/lib/AmsConfiguration/include/hexutils.h index 8c344639..c9266b75 100644 --- a/lib/AmsConfiguration/include/hexutils.h +++ b/lib/AmsConfiguration/include/hexutils.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsConfiguration/src/AmsConfiguration.cpp b/lib/AmsConfiguration/src/AmsConfiguration.cpp index 30536fb5..f4cbd878 100644 --- a/lib/AmsConfiguration/src/AmsConfiguration.cpp +++ b/lib/AmsConfiguration/src/AmsConfiguration.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsConfiguration/src/hexutils.cpp b/lib/AmsConfiguration/src/hexutils.cpp index 65fb19de..11a8a4e3 100644 --- a/lib/AmsConfiguration/src/hexutils.cpp +++ b/lib/AmsConfiguration/src/hexutils.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsData/include/AmsData.h b/lib/AmsData/include/AmsData.h index b6d73bb7..1bc7f9ba 100644 --- a/lib/AmsData/include/AmsData.h +++ b/lib/AmsData/include/AmsData.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsData/include/OBIScodes.h b/lib/AmsData/include/OBIScodes.h index 0a781473..3947c541 100644 --- a/lib/AmsData/include/OBIScodes.h +++ b/lib/AmsData/include/OBIScodes.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsData/src/AmsData.cpp b/lib/AmsData/src/AmsData.cpp index 139d3a51..2762531c 100644 --- a/lib/AmsData/src/AmsData.cpp +++ b/lib/AmsData/src/AmsData.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDataStorage/include/AmsDataStorage.h b/lib/AmsDataStorage/include/AmsDataStorage.h index 8d4490b6..a6d97c94 100644 --- a/lib/AmsDataStorage/include/AmsDataStorage.h +++ b/lib/AmsDataStorage/include/AmsDataStorage.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDataStorage/src/AmsDataStorage.cpp b/lib/AmsDataStorage/src/AmsDataStorage.cpp index 9a703d3d..7df5c4b0 100644 --- a/lib/AmsDataStorage/src/AmsDataStorage.cpp +++ b/lib/AmsDataStorage/src/AmsDataStorage.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDecoder/include/Cosem.h b/lib/AmsDecoder/include/Cosem.h index aafa8290..0bc933a3 100644 --- a/lib/AmsDecoder/include/Cosem.h +++ b/lib/AmsDecoder/include/Cosem.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDecoder/include/DataParser.h b/lib/AmsDecoder/include/DataParser.h index a5eedfd6..b3d17725 100644 --- a/lib/AmsDecoder/include/DataParser.h +++ b/lib/AmsDecoder/include/DataParser.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDecoder/include/DataParsers.h b/lib/AmsDecoder/include/DataParsers.h index 3e29b576..c19be13e 100644 --- a/lib/AmsDecoder/include/DataParsers.h +++ b/lib/AmsDecoder/include/DataParsers.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDecoder/include/DlmsParser.h b/lib/AmsDecoder/include/DlmsParser.h index e7ee15d4..adcf3960 100644 --- a/lib/AmsDecoder/include/DlmsParser.h +++ b/lib/AmsDecoder/include/DlmsParser.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDecoder/include/DsmrParser.h b/lib/AmsDecoder/include/DsmrParser.h index 91abf8a0..d9ed8a21 100644 --- a/lib/AmsDecoder/include/DsmrParser.h +++ b/lib/AmsDecoder/include/DsmrParser.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDecoder/include/GbtParser.h b/lib/AmsDecoder/include/GbtParser.h index 70afcd6b..a6e4139c 100644 --- a/lib/AmsDecoder/include/GbtParser.h +++ b/lib/AmsDecoder/include/GbtParser.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDecoder/include/GcmParser.h b/lib/AmsDecoder/include/GcmParser.h index 73594446..4feb2287 100644 --- a/lib/AmsDecoder/include/GcmParser.h +++ b/lib/AmsDecoder/include/GcmParser.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDecoder/include/HdlcParser.h b/lib/AmsDecoder/include/HdlcParser.h index 2289fa05..af7b4fb0 100644 --- a/lib/AmsDecoder/include/HdlcParser.h +++ b/lib/AmsDecoder/include/HdlcParser.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDecoder/include/LlcParser.h b/lib/AmsDecoder/include/LlcParser.h index a7b1fb1b..f4fa9177 100644 --- a/lib/AmsDecoder/include/LlcParser.h +++ b/lib/AmsDecoder/include/LlcParser.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDecoder/include/MbusParser.h b/lib/AmsDecoder/include/MbusParser.h index 132e8371..4355e1f3 100644 --- a/lib/AmsDecoder/include/MbusParser.h +++ b/lib/AmsDecoder/include/MbusParser.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDecoder/include/crc.h b/lib/AmsDecoder/include/crc.h index b054cd2c..a722e6fd 100644 --- a/lib/AmsDecoder/include/crc.h +++ b/lib/AmsDecoder/include/crc.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDecoder/include/ntohll.h b/lib/AmsDecoder/include/ntohll.h index 761fed0a..0fb78b51 100644 --- a/lib/AmsDecoder/include/ntohll.h +++ b/lib/AmsDecoder/include/ntohll.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDecoder/src/Cosem.cpp b/lib/AmsDecoder/src/Cosem.cpp index cbf0c78f..44ba246a 100644 --- a/lib/AmsDecoder/src/Cosem.cpp +++ b/lib/AmsDecoder/src/Cosem.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDecoder/src/DlmsParser.cpp b/lib/AmsDecoder/src/DlmsParser.cpp index 08af8dc9..779d4a6b 100644 --- a/lib/AmsDecoder/src/DlmsParser.cpp +++ b/lib/AmsDecoder/src/DlmsParser.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDecoder/src/DsmrParser.cpp b/lib/AmsDecoder/src/DsmrParser.cpp index 5729ee0d..e4d3427f 100644 --- a/lib/AmsDecoder/src/DsmrParser.cpp +++ b/lib/AmsDecoder/src/DsmrParser.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDecoder/src/GbtParser.cpp b/lib/AmsDecoder/src/GbtParser.cpp index ee82d662..01cdc100 100644 --- a/lib/AmsDecoder/src/GbtParser.cpp +++ b/lib/AmsDecoder/src/GbtParser.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDecoder/src/GcmParser.cpp b/lib/AmsDecoder/src/GcmParser.cpp index 3cde0323..e86e3aa5 100644 --- a/lib/AmsDecoder/src/GcmParser.cpp +++ b/lib/AmsDecoder/src/GcmParser.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDecoder/src/HdlcParser.cpp b/lib/AmsDecoder/src/HdlcParser.cpp index 7bb5d418..e4335eca 100644 --- a/lib/AmsDecoder/src/HdlcParser.cpp +++ b/lib/AmsDecoder/src/HdlcParser.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDecoder/src/LlcParser.cpp b/lib/AmsDecoder/src/LlcParser.cpp index 9ab24a94..b1695bfe 100644 --- a/lib/AmsDecoder/src/LlcParser.cpp +++ b/lib/AmsDecoder/src/LlcParser.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDecoder/src/MbusParser.cpp b/lib/AmsDecoder/src/MbusParser.cpp index ae948dfd..68a49aec 100644 --- a/lib/AmsDecoder/src/MbusParser.cpp +++ b/lib/AmsDecoder/src/MbusParser.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDecoder/src/crc.cpp b/lib/AmsDecoder/src/crc.cpp index 6788ce32..6ceb3faf 100644 --- a/lib/AmsDecoder/src/crc.cpp +++ b/lib/AmsDecoder/src/crc.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsDecoder/src/ntohll.cpp b/lib/AmsDecoder/src/ntohll.cpp index 52046e1a..361ee6ff 100644 --- a/lib/AmsDecoder/src/ntohll.cpp +++ b/lib/AmsDecoder/src/ntohll.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsFirmwareUpdater/include/AmsFirmwareUpdater.h b/lib/AmsFirmwareUpdater/include/AmsFirmwareUpdater.h index b0ba4979..816985d8 100644 --- a/lib/AmsFirmwareUpdater/include/AmsFirmwareUpdater.h +++ b/lib/AmsFirmwareUpdater/include/AmsFirmwareUpdater.h @@ -1,3 +1,8 @@ +/** + * @copyright Utilitech AS 2023-2026 + * License: Fair Source + * + */ #pragma once #include #include diff --git a/lib/AmsFirmwareUpdater/src/AmsFirmwareUpdater.cpp b/lib/AmsFirmwareUpdater/src/AmsFirmwareUpdater.cpp index a082016d..1d3392f0 100644 --- a/lib/AmsFirmwareUpdater/src/AmsFirmwareUpdater.cpp +++ b/lib/AmsFirmwareUpdater/src/AmsFirmwareUpdater.cpp @@ -1,3 +1,8 @@ +/** + * @copyright Utilitech AS 2023-2026 + * License: Fair Source + * + */ #include "AmsFirmwareUpdater.h" #include "AmsStorage.h" #include "FirmwareVersion.h" diff --git a/lib/AmsJsonGenerator/include/AmsJsonGenerator.h b/lib/AmsJsonGenerator/include/AmsJsonGenerator.h index 70d32a13..e7229c78 100644 --- a/lib/AmsJsonGenerator/include/AmsJsonGenerator.h +++ b/lib/AmsJsonGenerator/include/AmsJsonGenerator.h @@ -1,3 +1,8 @@ +/** + * @copyright Utilitech AS 2023-2026 + * License: Fair Source + * + */ #pragma once #include "AmsDataStorage.h" diff --git a/lib/AmsJsonGenerator/src/AmsJsonGenerator.cpp b/lib/AmsJsonGenerator/src/AmsJsonGenerator.cpp index 81239405..0921c07f 100644 --- a/lib/AmsJsonGenerator/src/AmsJsonGenerator.cpp +++ b/lib/AmsJsonGenerator/src/AmsJsonGenerator.cpp @@ -1,3 +1,8 @@ +/** + * @copyright Utilitech AS 2023-2026 + * License: Fair Source + * + */ #include "AmsJsonGenerator.h" void AmsJsonGenerator::generateDayPlotJson(AmsDataStorage* ds, char* buf, size_t bufSize) { diff --git a/lib/AmsMqttHandler/include/AmsMqttHandler.h b/lib/AmsMqttHandler/include/AmsMqttHandler.h index e4117100..ad226b5f 100644 --- a/lib/AmsMqttHandler/include/AmsMqttHandler.h +++ b/lib/AmsMqttHandler/include/AmsMqttHandler.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/AmsMqttHandler/src/AmsMqttHandler.cpp b/lib/AmsMqttHandler/src/AmsMqttHandler.cpp index 7aeeea43..a891a5a2 100644 --- a/lib/AmsMqttHandler/src/AmsMqttHandler.cpp +++ b/lib/AmsMqttHandler/src/AmsMqttHandler.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/CloudConnector/include/CloudConnector.h b/lib/CloudConnector/include/CloudConnector.h index 49cf8efc..0312920a 100644 --- a/lib/CloudConnector/include/CloudConnector.h +++ b/lib/CloudConnector/include/CloudConnector.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/CloudConnector/src/CloudConnector.cpp b/lib/CloudConnector/src/CloudConnector.cpp index 764a14e6..7179e699 100644 --- a/lib/CloudConnector/src/CloudConnector.cpp +++ b/lib/CloudConnector/src/CloudConnector.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/ConnectionHandler/include/ConnectionHandler.h b/lib/ConnectionHandler/include/ConnectionHandler.h index e1fa1e8d..c4f2ed1c 100644 --- a/lib/ConnectionHandler/include/ConnectionHandler.h +++ b/lib/ConnectionHandler/include/ConnectionHandler.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/ConnectionHandler/include/EthernetConnectionHandler.h b/lib/ConnectionHandler/include/EthernetConnectionHandler.h index fe20a1ad..1bf326ff 100644 --- a/lib/ConnectionHandler/include/EthernetConnectionHandler.h +++ b/lib/ConnectionHandler/include/EthernetConnectionHandler.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/ConnectionHandler/include/WiFiAccessPointConnectionHandler.h b/lib/ConnectionHandler/include/WiFiAccessPointConnectionHandler.h index d9acade5..1ad683f3 100644 --- a/lib/ConnectionHandler/include/WiFiAccessPointConnectionHandler.h +++ b/lib/ConnectionHandler/include/WiFiAccessPointConnectionHandler.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/ConnectionHandler/include/WiFiClientConnectionHandler.h b/lib/ConnectionHandler/include/WiFiClientConnectionHandler.h index 11e556ce..35bb4bce 100644 --- a/lib/ConnectionHandler/include/WiFiClientConnectionHandler.h +++ b/lib/ConnectionHandler/include/WiFiClientConnectionHandler.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/ConnectionHandler/src/EthernetConnectionHandler.cpp b/lib/ConnectionHandler/src/EthernetConnectionHandler.cpp index eb084999..e6361cc7 100644 --- a/lib/ConnectionHandler/src/EthernetConnectionHandler.cpp +++ b/lib/ConnectionHandler/src/EthernetConnectionHandler.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/ConnectionHandler/src/WiFiAccessPointConnectionHandler.cpp b/lib/ConnectionHandler/src/WiFiAccessPointConnectionHandler.cpp index 6b0ed557..f6687b21 100644 --- a/lib/ConnectionHandler/src/WiFiAccessPointConnectionHandler.cpp +++ b/lib/ConnectionHandler/src/WiFiAccessPointConnectionHandler.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/ConnectionHandler/src/WiFiClientConnectionHandler.cpp b/lib/ConnectionHandler/src/WiFiClientConnectionHandler.cpp index 337c217e..5dc9ecd0 100644 --- a/lib/ConnectionHandler/src/WiFiClientConnectionHandler.cpp +++ b/lib/ConnectionHandler/src/WiFiClientConnectionHandler.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/DomoticzMqttHandler/include/DomoticzMqttHandler.h b/lib/DomoticzMqttHandler/include/DomoticzMqttHandler.h index c21d82b1..4baef55b 100644 --- a/lib/DomoticzMqttHandler/include/DomoticzMqttHandler.h +++ b/lib/DomoticzMqttHandler/include/DomoticzMqttHandler.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/DomoticzMqttHandler/src/DomoticzMqttHandler.cpp b/lib/DomoticzMqttHandler/src/DomoticzMqttHandler.cpp index 269268dc..07126c7a 100644 --- a/lib/DomoticzMqttHandler/src/DomoticzMqttHandler.cpp +++ b/lib/DomoticzMqttHandler/src/DomoticzMqttHandler.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/EnergyAccounting/include/EnergyAccounting.h b/lib/EnergyAccounting/include/EnergyAccounting.h index 9ec37e11..1d3f11eb 100644 --- a/lib/EnergyAccounting/include/EnergyAccounting.h +++ b/lib/EnergyAccounting/include/EnergyAccounting.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/EnergyAccounting/src/EnergyAccounting.cpp b/lib/EnergyAccounting/src/EnergyAccounting.cpp index cad24f07..bf79d06a 100644 --- a/lib/EnergyAccounting/src/EnergyAccounting.cpp +++ b/lib/EnergyAccounting/src/EnergyAccounting.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/FirmwareVersion/include/FirmwareVersion.h b/lib/FirmwareVersion/include/FirmwareVersion.h index d6487f25..004bfff7 100644 --- a/lib/FirmwareVersion/include/FirmwareVersion.h +++ b/lib/FirmwareVersion/include/FirmwareVersion.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/FirmwareVersion/src/FirmwareVersion.cpp b/lib/FirmwareVersion/src/FirmwareVersion.cpp index 7155a617..ecdb9c4c 100644 --- a/lib/FirmwareVersion/src/FirmwareVersion.cpp +++ b/lib/FirmwareVersion/src/FirmwareVersion.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/HomeAssistantMqttHandler/include/HomeAssistantMqttHandler.h b/lib/HomeAssistantMqttHandler/include/HomeAssistantMqttHandler.h index 29152146..76898394 100644 --- a/lib/HomeAssistantMqttHandler/include/HomeAssistantMqttHandler.h +++ b/lib/HomeAssistantMqttHandler/include/HomeAssistantMqttHandler.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/HomeAssistantMqttHandler/include/HomeAssistantStatic.h b/lib/HomeAssistantMqttHandler/include/HomeAssistantStatic.h index 1867cbae..e2fbe084 100644 --- a/lib/HomeAssistantMqttHandler/include/HomeAssistantStatic.h +++ b/lib/HomeAssistantMqttHandler/include/HomeAssistantStatic.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/HomeAssistantMqttHandler/src/HomeAssistantMqttHandler.cpp b/lib/HomeAssistantMqttHandler/src/HomeAssistantMqttHandler.cpp index 79fb9778..da666dce 100644 --- a/lib/HomeAssistantMqttHandler/src/HomeAssistantMqttHandler.cpp +++ b/lib/HomeAssistantMqttHandler/src/HomeAssistantMqttHandler.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/HwTools/include/HwTools.h b/lib/HwTools/include/HwTools.h index 02c7b039..6429ba0c 100644 --- a/lib/HwTools/include/HwTools.h +++ b/lib/HwTools/include/HwTools.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/HwTools/src/HwTools.cpp b/lib/HwTools/src/HwTools.cpp index 3f3693c8..ec2a81ec 100644 --- a/lib/HwTools/src/HwTools.cpp +++ b/lib/HwTools/src/HwTools.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/JsonMqttHandler/include/JsonMqttHandler.h b/lib/JsonMqttHandler/include/JsonMqttHandler.h index cffd816a..0e77c12e 100644 --- a/lib/JsonMqttHandler/include/JsonMqttHandler.h +++ b/lib/JsonMqttHandler/include/JsonMqttHandler.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/JsonMqttHandler/src/JsonMqttHandler.cpp b/lib/JsonMqttHandler/src/JsonMqttHandler.cpp index 05d7d2e3..42bb7397 100644 --- a/lib/JsonMqttHandler/src/JsonMqttHandler.cpp +++ b/lib/JsonMqttHandler/src/JsonMqttHandler.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/MeterCommunicators/include/IEC6205621.h b/lib/MeterCommunicators/include/IEC6205621.h index b6a1bef0..5427ac0d 100644 --- a/lib/MeterCommunicators/include/IEC6205621.h +++ b/lib/MeterCommunicators/include/IEC6205621.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/MeterCommunicators/include/IEC6205675.h b/lib/MeterCommunicators/include/IEC6205675.h index e6668b3f..e8eb6106 100644 --- a/lib/MeterCommunicators/include/IEC6205675.h +++ b/lib/MeterCommunicators/include/IEC6205675.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/MeterCommunicators/include/ImpulseAmsData.h b/lib/MeterCommunicators/include/ImpulseAmsData.h index c243e984..e719cfd5 100644 --- a/lib/MeterCommunicators/include/ImpulseAmsData.h +++ b/lib/MeterCommunicators/include/ImpulseAmsData.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/MeterCommunicators/include/KmpCommunicator.h b/lib/MeterCommunicators/include/KmpCommunicator.h index 03e32fd4..168dbb1f 100644 --- a/lib/MeterCommunicators/include/KmpCommunicator.h +++ b/lib/MeterCommunicators/include/KmpCommunicator.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2024 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/MeterCommunicators/include/KmpTalker.h b/lib/MeterCommunicators/include/KmpTalker.h index 9a219de5..629c02e9 100644 --- a/lib/MeterCommunicators/include/KmpTalker.h +++ b/lib/MeterCommunicators/include/KmpTalker.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: All rights reserved * */ diff --git a/lib/MeterCommunicators/include/LNG.h b/lib/MeterCommunicators/include/LNG.h index 3805638c..31c53aa2 100644 --- a/lib/MeterCommunicators/include/LNG.h +++ b/lib/MeterCommunicators/include/LNG.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/MeterCommunicators/include/LNG2.h b/lib/MeterCommunicators/include/LNG2.h index 31651c4d..922a388a 100644 --- a/lib/MeterCommunicators/include/LNG2.h +++ b/lib/MeterCommunicators/include/LNG2.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/MeterCommunicators/include/MeterCommunicator.h b/lib/MeterCommunicators/include/MeterCommunicator.h index 49b64fdb..f4ff384c 100644 --- a/lib/MeterCommunicators/include/MeterCommunicator.h +++ b/lib/MeterCommunicators/include/MeterCommunicator.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/MeterCommunicators/include/PassiveMeterCommunicator.h b/lib/MeterCommunicators/include/PassiveMeterCommunicator.h index bc0b1e9f..9533e747 100644 --- a/lib/MeterCommunicators/include/PassiveMeterCommunicator.h +++ b/lib/MeterCommunicators/include/PassiveMeterCommunicator.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/MeterCommunicators/include/PulseMeterCommunicator.h b/lib/MeterCommunicators/include/PulseMeterCommunicator.h index 2207a99d..b48505ac 100644 --- a/lib/MeterCommunicators/include/PulseMeterCommunicator.h +++ b/lib/MeterCommunicators/include/PulseMeterCommunicator.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2024 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/MeterCommunicators/src/IEC6205621.cpp b/lib/MeterCommunicators/src/IEC6205621.cpp index 8b6b0ad9..4418d4b4 100644 --- a/lib/MeterCommunicators/src/IEC6205621.cpp +++ b/lib/MeterCommunicators/src/IEC6205621.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/MeterCommunicators/src/IEC6205675.cpp b/lib/MeterCommunicators/src/IEC6205675.cpp index 6e919f43..089781c0 100644 --- a/lib/MeterCommunicators/src/IEC6205675.cpp +++ b/lib/MeterCommunicators/src/IEC6205675.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/MeterCommunicators/src/ImpulseAmsData.cpp b/lib/MeterCommunicators/src/ImpulseAmsData.cpp index ce37ef11..7ed584ca 100644 --- a/lib/MeterCommunicators/src/ImpulseAmsData.cpp +++ b/lib/MeterCommunicators/src/ImpulseAmsData.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/MeterCommunicators/src/KmpCommunicator.cpp b/lib/MeterCommunicators/src/KmpCommunicator.cpp index e7aa2add..3d5a946e 100644 --- a/lib/MeterCommunicators/src/KmpCommunicator.cpp +++ b/lib/MeterCommunicators/src/KmpCommunicator.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/MeterCommunicators/src/LNG.cpp b/lib/MeterCommunicators/src/LNG.cpp index 14425d96..ced209c7 100644 --- a/lib/MeterCommunicators/src/LNG.cpp +++ b/lib/MeterCommunicators/src/LNG.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/MeterCommunicators/src/LNG2.cpp b/lib/MeterCommunicators/src/LNG2.cpp index 57ffd33d..241e4552 100644 --- a/lib/MeterCommunicators/src/LNG2.cpp +++ b/lib/MeterCommunicators/src/LNG2.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/MeterCommunicators/src/PassiveMeterCommunicator.cpp b/lib/MeterCommunicators/src/PassiveMeterCommunicator.cpp index ad497825..a29bffef 100644 --- a/lib/MeterCommunicators/src/PassiveMeterCommunicator.cpp +++ b/lib/MeterCommunicators/src/PassiveMeterCommunicator.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/MeterCommunicators/src/PulseMeterCommunicator.cpp b/lib/MeterCommunicators/src/PulseMeterCommunicator.cpp index 839fe315..f2e8a535 100644 --- a/lib/MeterCommunicators/src/PulseMeterCommunicator.cpp +++ b/lib/MeterCommunicators/src/PulseMeterCommunicator.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/PassthroughMqttHandler/include/PassthroughMqttHandler.h b/lib/PassthroughMqttHandler/include/PassthroughMqttHandler.h index 7d2c3106..ac721898 100644 --- a/lib/PassthroughMqttHandler/include/PassthroughMqttHandler.h +++ b/lib/PassthroughMqttHandler/include/PassthroughMqttHandler.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/PassthroughMqttHandler/src/PassthroughMqttHandler.cpp b/lib/PassthroughMqttHandler/src/PassthroughMqttHandler.cpp index 9db54467..90c0731b 100644 --- a/lib/PassthroughMqttHandler/src/PassthroughMqttHandler.cpp +++ b/lib/PassthroughMqttHandler/src/PassthroughMqttHandler.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/PriceService/include/DnbCurrParser.h b/lib/PriceService/include/DnbCurrParser.h index 184ac8d5..52fa6d31 100644 --- a/lib/PriceService/include/DnbCurrParser.h +++ b/lib/PriceService/include/DnbCurrParser.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/PriceService/include/EntsoeA44Parser.h b/lib/PriceService/include/EntsoeA44Parser.h index cd3fec91..340c87c8 100644 --- a/lib/PriceService/include/EntsoeA44Parser.h +++ b/lib/PriceService/include/EntsoeA44Parser.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/PriceService/include/PriceService.h b/lib/PriceService/include/PriceService.h index 9db9ca14..24d2c642 100644 --- a/lib/PriceService/include/PriceService.h +++ b/lib/PriceService/include/PriceService.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/PriceService/include/PricesContainer.h b/lib/PriceService/include/PricesContainer.h index 081fab14..7b007b6f 100644 --- a/lib/PriceService/include/PricesContainer.h +++ b/lib/PriceService/include/PricesContainer.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/PriceService/src/DnbCurrParser.cpp b/lib/PriceService/src/DnbCurrParser.cpp index 3233e7a9..2d81618c 100644 --- a/lib/PriceService/src/DnbCurrParser.cpp +++ b/lib/PriceService/src/DnbCurrParser.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/PriceService/src/EntsoeA44Parser.cpp b/lib/PriceService/src/EntsoeA44Parser.cpp index ce2327c6..40474496 100644 --- a/lib/PriceService/src/EntsoeA44Parser.cpp +++ b/lib/PriceService/src/EntsoeA44Parser.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/PriceService/src/PriceService.cpp b/lib/PriceService/src/PriceService.cpp index 4133f600..26bab65f 100644 --- a/lib/PriceService/src/PriceService.cpp +++ b/lib/PriceService/src/PriceService.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/PriceService/src/PricesContainer.cpp b/lib/PriceService/src/PricesContainer.cpp index 60804189..2f7cb459 100644 --- a/lib/PriceService/src/PricesContainer.cpp +++ b/lib/PriceService/src/PricesContainer.cpp @@ -1,3 +1,8 @@ +/** + * @copyright Utilitech AS 2023-2026 + * License: Fair Source + * + */ #include "PricesContainer.h" #include diff --git a/lib/RawMqttHandler/include/RawMqttHandler.h b/lib/RawMqttHandler/include/RawMqttHandler.h index 645fc7fe..887c9424 100644 --- a/lib/RawMqttHandler/include/RawMqttHandler.h +++ b/lib/RawMqttHandler/include/RawMqttHandler.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/RawMqttHandler/src/RawMqttHandler.cpp b/lib/RawMqttHandler/src/RawMqttHandler.cpp index 521b592f..fff9b3c2 100644 --- a/lib/RawMqttHandler/src/RawMqttHandler.cpp +++ b/lib/RawMqttHandler/src/RawMqttHandler.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/RealtimePlot/include/RealtimePlot.h b/lib/RealtimePlot/include/RealtimePlot.h index fc73c426..3c540c12 100644 --- a/lib/RealtimePlot/include/RealtimePlot.h +++ b/lib/RealtimePlot/include/RealtimePlot.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/RealtimePlot/src/RealtimePlot.cpp b/lib/RealtimePlot/src/RealtimePlot.cpp index 1b9a9e12..8497d89d 100644 --- a/lib/RealtimePlot/src/RealtimePlot.cpp +++ b/lib/RealtimePlot/src/RealtimePlot.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/SvelteUi/include/AmsWebHeaders.h b/lib/SvelteUi/include/AmsWebHeaders.h index 7989525d..0f364413 100644 --- a/lib/SvelteUi/include/AmsWebHeaders.h +++ b/lib/SvelteUi/include/AmsWebHeaders.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/SvelteUi/include/AmsWebServer.h b/lib/SvelteUi/include/AmsWebServer.h index 5909708e..ac2656e9 100644 --- a/lib/SvelteUi/include/AmsWebServer.h +++ b/lib/SvelteUi/include/AmsWebServer.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/SvelteUi/src/AmsWebServer.cpp b/lib/SvelteUi/src/AmsWebServer.cpp index d036b163..709f4ed3 100644 --- a/lib/SvelteUi/src/AmsWebServer.cpp +++ b/lib/SvelteUi/src/AmsWebServer.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/Uptime/include/Uptime.h b/lib/Uptime/include/Uptime.h index 1fcb8a2f..8c4fa235 100644 --- a/lib/Uptime/include/Uptime.h +++ b/lib/Uptime/include/Uptime.h @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/Uptime/src/Uptime.cpp b/lib/Uptime/src/Uptime.cpp index 5af24c37..cbd62cf1 100644 --- a/lib/Uptime/src/Uptime.cpp +++ b/lib/Uptime/src/Uptime.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source * */ diff --git a/lib/ZmartCharge/include/ZmartChargeCloudConnector.h b/lib/ZmartCharge/include/ZmartChargeCloudConnector.h index 58291bae..1f099df6 100644 --- a/lib/ZmartCharge/include/ZmartChargeCloudConnector.h +++ b/lib/ZmartCharge/include/ZmartChargeCloudConnector.h @@ -1,3 +1,8 @@ +/** + * @copyright Utilitech AS 2023-2026 + * License: Fair Source + * + */ #pragma once #include "RemoteDebug.h" diff --git a/lib/ZmartCharge/src/ZmartChargeCloudConnector.cpp b/lib/ZmartCharge/src/ZmartChargeCloudConnector.cpp index 1b816055..f79971f1 100644 --- a/lib/ZmartCharge/src/ZmartChargeCloudConnector.cpp +++ b/lib/ZmartCharge/src/ZmartChargeCloudConnector.cpp @@ -1,3 +1,8 @@ +/** + * @copyright Utilitech AS 2023-2026 + * License: Fair Source + * + */ #include "ZmartChargeCloudConnector.h" #include "Uptime.h" #include "ArduinoJson.h" diff --git a/src/AmsToMqttBridge.cpp b/src/AmsToMqttBridge.cpp index c0d09647..2601ba32 100644 --- a/src/AmsToMqttBridge.cpp +++ b/src/AmsToMqttBridge.cpp @@ -1,5 +1,5 @@ /** - * @copyright Utilitech AS 2023 + * @copyright Utilitech AS 2023-2026 * License: Fair Source 5 * * @brief Program for ESP32 and ESP8266 to receive data from AMS electric meters and send to MQTT diff --git a/tmp/KamstrupPullCommunicator.cpp b/tmp/KamstrupPullCommunicator.cpp deleted file mode 100644 index 770a3620..00000000 --- a/tmp/KamstrupPullCommunicator.cpp +++ /dev/null @@ -1,772 +0,0 @@ -/** - * @copyright Utilitech AS 2023 - * License: Fair Source - * - */ - -#include "KamstrupPullCommunicator.h" -#include "Uptime.h" -#include "Cosem.h" -#include "hexutils.h" - -#if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3) -#include -#endif - -void KamstrupPullCommunicator::configure(MeterConfig& meterConfig, Timezone* tz) { - this->meterConfig = meterConfig; - this->configChanged = false; - this->tz = tz; - setupHanPort(meterConfig.baud, meterConfig.parity, meterConfig.invert); -} - -bool KamstrupPullCommunicator::loop() { - uint64_t now = millis64(); - if(PassiveMeterCommunicator::loop() || now-lastLoop > 5000) { - if (debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("State: %d\n"), state); - lastLoop = now; - switch(state) { - case STATE_DISCONNECTED: - sendConnectMessage(); - lastMessageTime = now; - break; - - case STATE_CONNECTING: - if(!checkForConnectConfirmed() && now-lastMessageTime > 10000) { - state = STATE_DISCONNECTED; - lastLoop = 0; - } - break; - - case STATE_CONNECTED_NOT_ASSOCIATED: - sendAssociateMessage(); - lastMessageTime = now; - break; - - case STATE_CONNECTED_ASSOCIATING: - if(!checkForAssociationConfirmed() && now-lastMessageTime > 10000) { - state = STATE_CONNECTION_BROKEN; // TODO: Use state: Broken - lastLoop = 0; - } - break; - - case STATE_CONNECTED_ASSOCIATED: - if(dataAvailable) { - if (debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Data is available: %lu\n"), ctx.length); - return true; - } else { - lastMessageTime = now; - requestData(); - } - break; - - case STATE_DISCONNECT: - case STATE_CONNECTION_BROKEN: - sendDisconnectMessage(); - lastMessageTime = now; - break; - - case STATE_DISCONNECTING: - if(!checkForDisconnectMessage() && now-lastMessageTime > 10000) { - state = STATE_DISCONNECTED; - lastLoop = 0; - } - break; - - default: - state = STATE_DISCONNECTED; - } - } - return false; -} - -void KamstrupPullCommunicator::setupHanPort(uint32_t baud, uint8_t parityOrdinal, bool invert) { - uint8_t rxPin = meterConfig.rxPin; - uint8_t txPin = meterConfig.txPin; - - if (debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("(setupHanPort) Setting up HAN on pin %d/%d with baud %d and parity %d\n"), rxPin, txPin, baud, parityOrdinal); - - if(rxPin == 3 || rxPin == 113) { - #if ARDUINO_USB_CDC_ON_BOOT - hwSerial = &Serial0; - #else - hwSerial = &Serial; - #endif - } - - #if defined(ESP32) - if(rxPin == 9) { - hwSerial = &Serial1; - } - #if defined(CONFIG_IDF_TARGET_ESP32) - if(rxPin == 16) { - hwSerial = &Serial2; - } - #elif defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3) - hwSerial = &Serial1; - #endif - #endif - - if(rxPin == 0) { - if (debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("Invalid GPIO configured for HAN RX\n")); - return; - } - if(txPin == 0) { - if (debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("Invalid GPIO configured for HAN TX\n")); - return; - } - - if(meterConfig.bufferSize < 1) meterConfig.bufferSize = 1; - - if(hwSerial != NULL) { - if (debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Hardware serial\n")); - Serial.flush(); - #if defined(ESP8266) - SerialConfig serialConfig; - #elif defined(ESP32) - uint32_t serialConfig; - #endif - switch(parityOrdinal) { - case 2: - serialConfig = SERIAL_7N1; - break; - case 3: - serialConfig = SERIAL_8N1; - break; - case 10: - serialConfig = SERIAL_7E1; - break; - default: - serialConfig = SERIAL_8E1; - break; - } - if(meterConfig.bufferSize < 4) meterConfig.bufferSize = 4; // 64 bytes (1) is default for software serial, 256 bytes (4) for hardware - - hwSerial->setRxBufferSize(64 * meterConfig.bufferSize); - #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3) - hwSerial->begin(baud, serialConfig, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, invert); - uart_set_pin(UART_NUM_1, txPin == 0xFF ? UART_PIN_NO_CHANGE : txPin, rxPin, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE); - #elif defined(ESP32) - hwSerial->begin(baud, serialConfig, -1, -1, invert); - #else - hwSerial->begin(baud, serialConfig, SERIAL_FULL, 1, invert); - #endif - - #if defined(ESP8266) - if(rxPin == 3) { - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Switching UART0 to pin 1 & 3\n")); - Serial.pins(1,3); - } else if(rxPin == 113) { - if(debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Switching UART0 to pin 15 & 13\n")); - Serial.pins(15,13); - } - #endif - - // Prevent pullup on TX pin if not uart0 - #if defined(CONFIG_IDF_TARGET_ESP32S2) - if(txPin != 17) pinMode(17, INPUT); - #elif defined(CONFIG_IDF_TARGET_ESP32C3) - if(txPin != 7) pinMode(7, INPUT); - #elif defined(ESP32) - if(rxPin == 9) { - if(txPin != 10) pinMode(10, INPUT); - } else if(rxPin == 16) { - if(txPin != 17) pinMode(17, INPUT); - } - #elif defined(ESP8266) - if(rxPin == 113) { - if(txPin != 15) pinMode(15, INPUT); - } - #endif - - hanSerial = hwSerial; - if(swSerial != NULL) { - swSerial->end(); - delete swSerial; - swSerial = NULL; - } - } else { - if (debugger->isActive(RemoteDebug::DEBUG)) debugger->printf_P(PSTR("Software serial\n")); - Serial.flush(); - - if(swSerial == NULL) { - swSerial = new SoftwareSerial(rxPin, txPin == 0xFF ? -1 : txPin, invert); - } else { - swSerial->end(); - } - - SoftwareSerialConfig serialConfig; - switch(parityOrdinal) { - case 2: - serialConfig = SWSERIAL_7N1; - break; - case 3: - serialConfig = SWSERIAL_8N1; - break; - case 10: - serialConfig = SWSERIAL_7E1; - break; - default: - serialConfig = SWSERIAL_8E1; - break; - } - - swSerial->begin(baud, serialConfig, rxPin, txPin == 0xFF ? -1 : txPin, invert, meterConfig.bufferSize * 64); - hanSerial = swSerial; - - Serial.end(); - Serial.begin(115200); - hwSerial = NULL; - } - - // The library automatically sets the pullup in Serial.begin() - if(!meterConfig.rxPinPullup) { - if (debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("HAN pin pullup disabled\n")); - pinMode(meterConfig.rxPin, INPUT); - } - - hanSerial->setTimeout(250); - - // Empty buffer before starting - while (hanSerial->available() > 0) { - hanSerial->read(); - } - #if defined(ESP8266) - if(hwSerial != NULL) { - hwSerial->hasOverrun(); - } else if(swSerial != NULL) { - swSerial->overflow(); - } - #endif -} - -// 7E A0 15 21 03 52 5D 8A E6 E7 00 C4 01 81 00 06 00 BC 61 4F E4 36 7E -AmsData* KamstrupPullCommunicator::getData(AmsData& meterState) { - if(!dataAvailable) return NULL; - if(ctx.length > BUF_SIZE_HAN) { - debugger->printf_P(PSTR("Invalid context length %lu\n"), ctx.length); - dataAvailable = false; - return NULL; - } - - if(hanBuffer[5] == 0x51) { - if(debugger->isActive(RemoteDebug::WARNING)) debugger->printf_P(PSTR("Request was denied\n")); - len = 0; - dataAvailable = false; - state = STATE_CONNECTION_BROKEN; - return NULL; - } - - byte* payload = ((byte *) (hanBuffer)) + pos; - if(debugger->isActive(RemoteDebug::INFO)) { - debugger->printf_P(PSTR("Received data from Kamstrup meter:\n")); - debugPrint(payload, 0, min(ctx.length, (uint16_t) BUF_SIZE_HAN), debugger); - } - - if(hanBuffer[11] == DATA_TAG_RES) { - if(obisPosition == 1) { // Version string - debugger->printf_P(PSTR("RECEIVED Firmware version\n")); - } else if(obisPosition == 1) { // Meter model string - debugger->printf_P(PSTR("RECEIVED Meter model\n")); - } else { // All other uint32 - uint32_t value = ntohl(*((uint32_t*) (hanBuffer + 16))); - debugger->printf_P(PSTR("RECEIVED DATA FOR position %d, value: %lu\n"), obisPosition, value); - meterState.apply(currentObis, value / 1.0); - } - len = 0; - dataAvailable = false; - return NULL; - } else { - return PassiveMeterCommunicator::getData(meterState); - } -} - -void KamstrupPullCommunicator::sendConnectMessage() { - uint8_t i = 3; // Leave 3 bytes for header - hanBuffer[i++] = serverSap; // Destination address - hanBuffer[i++] = clientSap; // Source address - hanBuffer[i++] = 0x93; // Control - i += 2; // Leave 2 bytes for header checksum - hanBuffer[i++] = 0x81; // Format identifier - hanBuffer[i++] = 0x80; // Format group - uint8_t glPos = i++; // Position where we should write group length - uint8_t glLen = 0; // Actual group length - - ConnectParameter2b txMax = { 0x5, 0x2, htons(0x200) }; - memcpy(hanBuffer+i, &txMax, txMax.length+2); - i += txMax.length+2; - glLen += txMax.length+2; - - ConnectParameter2b rxMax = { 0x6, 0x2, htons(0x200) }; - memcpy(hanBuffer+i, &rxMax, rxMax.length+2); - i += rxMax.length+2; - glLen += rxMax.length+2; - - ConnectParameter4b txWin = { 0x7, 0x4, htonl(0x1) }; - memcpy(hanBuffer+i, &txWin, txWin.length+2); - i += txWin.length+2; - glLen += txWin.length+2; - - ConnectParameter4b rxWin = { 0x8, 0x4, htonl(0x1) }; - memcpy(hanBuffer+i, &rxWin, rxWin.length+2); - i += rxWin.length+2; - glLen += rxWin.length+2; - - hanBuffer[glPos] = glLen; - - HDLCHeader head = { HDLC_FLAG, htons(0xA000 | (i+1)) }; - memcpy(hanBuffer, &head, 3); - - HDLC3CtrlHcs ch = { 0x93, htons(crc16_x25(hanBuffer+1, 5)) }; - memcpy(hanBuffer+5, &ch, 3); - - HDLCFooter foot = { htons(crc16_x25(hanBuffer+1, i-1)), HDLC_FLAG }; - memcpy(hanBuffer+i, &foot, 3); - i += 3; - - for(int x = i; xwrite(hanBuffer, i); - hanSerial->flush(); - - if(debugger->isActive(RemoteDebug::INFO)) { - debugger->printf_P(PSTR("Sending data to Kamstrup meter:\n")); - debugPrint(hanBuffer, 0, i, debugger); - } - state = STATE_CONNECTING; - len = 0; - dataAvailable = false; -} - -bool KamstrupPullCommunicator::checkForConnectConfirmed() { - if(!dataAvailable) return false; - if(ctx.length > BUF_SIZE_HAN) { - debugger->printf_P(PSTR("Invalid context length\n")); - dataAvailable = false; - return NULL; - } - - byte* payload = ((byte *) (hanBuffer)) + pos; - if(debugger->isActive(RemoteDebug::INFO)) { - debugger->printf_P(PSTR("Received data from Kamstrup meter:\n")); - debugPrint(payload, 0, min(ctx.length, (uint16_t) BUF_SIZE_HAN), debugger); - } - - len = 0; - dataAvailable = false; - lastMessageTime = 0; - - // 7E A0 20 21 03 73 73 98 81 80 14 05 02 02 00 06 02 02 00 07 04 00 00 00 01 08 04 00 00 00 01 6F EF 7E - // 7E A0 20 21 03 73 73 98 81 80 14 05 02 02 00 06 02 00 80 07 04 00 00 00 01 08 04 00 00 00 01 19 D4 7E - if(payload[0] == 0x81 && payload[1] == 0x80) { - state = STATE_CONNECTED_NOT_ASSOCIATED; - return true; - } else { - state = STATE_CONNECTION_BROKEN; - return false; - } -} - - -// TA: Tag -// LE: Legth -// RA: Response allowed -// PQ: Proposed QoS -// PV: Proposed DLMS version -// CO: Conformance -// AT: Application tag -// LC: Length of content field -// LU: Number of unused bits in the final octet -// MP: Max PDU size -// DK: Dedicated key, use (0x01), length (0xXX) and data -// AC: encoding of the tag of the xDLMS APDU CHOICE (InitiateRequest) -// FF: Fixed -// BE: Ber Object Identifier, 0x06=Object, 0x80=Context, 0x20=Constructed, 0x12=Calling auth, 0x40=Application, 0x04=String -// AN: Application context name tag -// NR: Name referencing, 1d=LN unciphered, 2d=unciphered, 3d=LN ciphered, 4d=cihered -// CA: Calling-AP-title -// CU: Calling Authentication -// SR: Sender requirements - - -// No authentication - -// 7E A0 2B 03 21 10 FB AF -// E6 E6 00 - -// TA LE AN LE BO LE FF FF FF FF FF FF NR -// 60 1D A1 09 06 07 60 85 74 05 08 01 01 - -// CA LE OS LE AC DK RA PQ PV AT AT LC LU CO CO CO MP MP -// BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 00 18 1D FF FF - -// 5F AF 7E - - -// With authentication - -// 7E A0 41 21 25 10 52 3B -// E6 E6 00 - -// BE LE AN LE -// 60 33 A1 09 - -// 06=CALLING_AP_TITLE -// BE LE FF FF FF FF FF FF NR -// 06 07 60 85 74 05 08 01 01 - -// 8A=SENDER_ACSE_REQUIREMENTS (BE 0x80 + 0x0A) -// BE LE FF FF -// 8A 02 07 80 - -// 8B=MECHANISM_NAME (BE 0x80 + 0x0B) -// BE LE FF FF FF FF FF FF NR -// 8B 07 60 85 74 05 08 02 01 - -// AC=CALLING_AUTHENTICATION_VALUE (BE 0x80 + BE 0x20 + 0x0C) -// BE LE BE LE -- Password -- -// AC 07 80 05 31 32 33 34 35 - -// BE=USER_INFORMATION (BE 0x80 + BE 0x20 + 0x1E) -// CA LE BE LE AC DK RA PQ PV AT AT LC LU CO CO CO MP MP -// BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 00 FE 1F FF FF - -// 0C FF 7E - -void KamstrupPullCommunicator::sendAssociateMessage() { - bool usePsk = !passkey.isEmpty(); - - uint8_t i = 3; // Leave 3 bytes for header - hanBuffer[i++] = serverSap; // Destination address - hanBuffer[i++] = clientSap; // Source address - hanBuffer[i++] = 0x10; // Control - i += 2; // Leave 2 bytes for header checksum - hanBuffer[i++] = 0xE6; // LLC dst - hanBuffer[i++] = 0xE6; // LLC src - hanBuffer[i++] = 0x00; // LLC control - - hanBuffer[i++] = DATA_TAG_AARQ; - uint8_t aarqLenIdx = i++; // length placeholder - hanBuffer[i++] = 0xA1; - hanBuffer[i++] = 0x09; // Length - hanBuffer[i++] = 0x06; // CALLING_AP_TITLE - hanBuffer[i++] = 0x07; // Length - hanBuffer[i++] = 0x60; // Fixed data - hanBuffer[i++] = 0x85; // Fixed data - hanBuffer[i++] = 0x74; // Fixed data - hanBuffer[i++] = 0x05; // Fixed data - hanBuffer[i++] = 0x08; // Fixed data - hanBuffer[i++] = 0x01; // Fixed data - hanBuffer[i++] = 0x01; // Name referencing, 1d=LN unciphered, 2d=unciphered, 3d=LN ciphered, 4d=cihered - - if(usePsk) { - hanBuffer[i++] = 0x8A; // SENDER_ACSE_REQUIREMENTS (BE 0x80 + 0x0A) - hanBuffer[i++] = 0x02; // Length - hanBuffer[i++] = 0x07; // Data - hanBuffer[i++] = 0x80; // Data - - hanBuffer[i++] = 0x8B; // MECHANISM_NAME (BE 0x80 + 0x0B) - hanBuffer[i++] = 0x07; // Length - hanBuffer[i++] = 0x60; // Fixed data - hanBuffer[i++] = 0x85; // Fixed data - hanBuffer[i++] = 0x74; // Fixed data - hanBuffer[i++] = 0x05; // Fixed data - hanBuffer[i++] = 0x08; // Fixed data - hanBuffer[i++] = 0x02; // Fixed data - hanBuffer[i++] = 0x01; // Name referencing, 1d=LN unciphered, 2d=unciphered, 3d=LN ciphered, 4d=cihered - - hanBuffer[i++] = 0xAC; // CALLING_AUTHENTICATION_VALUE (BE 0x80 + BE 0x20 + 0x0C) - hanBuffer[i++] = passkey.length() + 2; // Length - hanBuffer[i++] = 0x80; // Ber Context - hanBuffer[i++] = passkey.length(); // Length - - const char* key = passkey.c_str(); - for(uint8_t x = 0; x < passkey.length(); x++) { - hanBuffer[i++] = key[x]; - } - } - - hanBuffer[i++] = 0xBE; // USER_INFORMATION (BE 0x80 + BE 0x20 + 0x1E) - hanBuffer[i++] = 0x10; // Length - hanBuffer[i++] = 0x04; // CALLED_AP_INVOCATION_ID - hanBuffer[i++] = 0x0E; // Length - hanBuffer[i++] = 0x01; // encoding of the tag of the xDLMS APDU CHOICE (InitiateRequest) - hanBuffer[i++] = 0x00; // Dedicated key, use (0x01), length (0xXX) and data - hanBuffer[i++] = 0x00; // Response allowed - hanBuffer[i++] = 0x00; // Proposed QoS - hanBuffer[i++] = 0x06; // Proposed DLMS version - hanBuffer[i++] = 0x5F; // - hanBuffer[i++] = 0x1F; // - hanBuffer[i++] = 0x04; // Length - hanBuffer[i++] = 0x00; // Number of unused bits - hanBuffer[i++] = 0x00; // Conformance - if(usePsk) { - hanBuffer[i++] = 0xFE; // Conformance - hanBuffer[i++] = 0x1F; // Conformance - } else { - hanBuffer[i++] = 0x18; // Conformance - hanBuffer[i++] = 0x1D; // Conformance - } - hanBuffer[i++] = 0xFF; // Max PDU size - hanBuffer[i++] = 0xFF; // Max PDU size - hanBuffer[aarqLenIdx] = i-aarqLenIdx-1; - - HDLCHeader head = { HDLC_FLAG, htons(0xA000 | (i+1)) }; - memcpy(hanBuffer, &head, 3); - - HDLC3CtrlHcs ch = { 0x10, htons(crc16_x25(hanBuffer+1, 5)) }; - memcpy(hanBuffer+5, &ch, 3); - - HDLCFooter foot = { htons(crc16_x25(hanBuffer+1, i-1)), HDLC_FLAG }; - memcpy(hanBuffer+i, &foot, 3); - i += 3; - - for(int x = i; xwrite(hanBuffer, i); - hanSerial->flush(); - - if(debugger->isActive(RemoteDebug::INFO)) { - debugger->printf_P(PSTR("Sending data to Kamstrup meter:\n")); - debugPrint(hanBuffer, 0, i, debugger); - } - state = STATE_CONNECTED_ASSOCIATING; - len = 0; - dataAvailable = false; -} - -bool KamstrupPullCommunicator::checkForAssociationConfirmed() { - if(!dataAvailable) return false; - if(ctx.length > BUF_SIZE_HAN) { - debugger->printf_P(PSTR("Invalid context length\n")); - dataAvailable = false; - return NULL; - } - - byte* payload = ((byte *) (hanBuffer)) + pos; - if(debugger->isActive(RemoteDebug::INFO)) { - debugger->printf_P(PSTR("Received data from Kamstrup meter:\n")); - debugPrint(payload, 0, ctx.length, debugger); - } - len = 0; - dataAvailable = false; - lastMessageTime = 0; - - if(payload[0] == DATA_TAG_AARE) { - state = STATE_CONNECTED_ASSOCIATED; - return true; - } else { - state = STATE_CONNECTION_BROKEN; - return false; - } - - return false; -} - -// 7E A0 19 03 21 32 6F D8 E6 E6 00 C0 01 81 00 01 01 01 00 00 01 FF 02 00 A8 E3 7E -// 7E A0 19 21 25 32 8C 09 E6 E6 00 C0 01 81 00 01 01 01 60 01 01 FF 02 00 5D 6F 7E -// 7E A0 19 21 25 32 8C 09 E6 E6 00 C0 01 C1 00 03 01 01 20 07 00 FF 02 00 38 36 7E - -// 7E A0 4C 21 25 32 CD B2 E6 E6 00 C0 01 81 00 -// 07 - Class -// 01 01 63 01 00 FF - OBIS -// 02 - Attribute number 2 -// 01 01 - Array 1 -// 02 04 - Struct 4 -// 02 04 - Struct 4 -// 12 00 08 - uint16 -// 09 06 00 01 01 00 00 FF - OBIS -// 0F 02 - int8 -// 12 00 00 - uint16 -// 09 0C 07 DD 0A 19 FF 00 00 00 00 80 00 80 - from date -// 09 0C 07 DD 0A 1A FF 00 00 00 00 80 00 80 - to date -// 01 00 - Empty array -// 2F 84 7E -bool KamstrupPullCommunicator::requestData() { - bool usePsk = !passkey.isEmpty(); - - uint8_t i = 3; // Leave 3 bytes for header - hanBuffer[i++] = serverSap; // Destination address - hanBuffer[i++] = clientSap; // Source address - hanBuffer[i++] = 0x32; // Control - i += 2; // Leave 2 bytes for header checksum - hanBuffer[i++] = 0xE6; // LLC dst - hanBuffer[i++] = 0xE6; // LLC src - hanBuffer[i++] = 0x00; // LLC control - - hanBuffer[i++] = 0xC0; // Get Request - hanBuffer[i++] = 0x01; // Type, 01 = Normal - hanBuffer[i++] = 0x81; // Invoke ID and priority - hanBuffer[i++] = 0x00; - hanBuffer[i++] = ++obisPosition < 3 ? 0x01 : 0x03; // Class ID - - OBIS_t obis = {1,1,OBIS_NULL,OBIS_RANGE_NA}; - switch(obisPosition) { - case 1: obis.code = OBIS_FIRMWARE_VERSION; break; - case 2: obis.code = OBIS_METER_MODEL; break; - case 3: obis.code = OBIS_METER_ID; break; - - case 4: obis.code = OBIS_ACTIVE_IMPORT; break; - case 5: obis.code = OBIS_REACTIVE_IMPORT; break; - case 6: obis.code = OBIS_ACTIVE_EXPORT; break; - case 7: obis.code = OBIS_REACTIVE_EXPORT; break; - default: - obisPosition = 0; return false; - } - memcpy(hanBuffer+i, &obis, sizeof(obis)); - i += sizeof(obis); - currentObis = obis.code; - - hanBuffer[i++] = 0x02; // Attribute number - hanBuffer[i++] = 0x00; - - HDLCHeader head = { HDLC_FLAG, htons(0xA000 | (i+1)) }; - memcpy(hanBuffer, &head, 3); - - HDLC3CtrlHcs ch = { 0x32, htons(crc16_x25(hanBuffer+1, 5)) }; - memcpy(hanBuffer+5, &ch, 3); - - HDLCFooter foot = { htons(crc16_x25(hanBuffer+1, i-1)), HDLC_FLAG }; - memcpy(hanBuffer+i, &foot, 3); - i += 3; - - for(int x = i; xwrite(hanBuffer, i); - hanSerial->flush(); - - if(debugger->isActive(RemoteDebug::INFO)) { - debugger->printf_P(PSTR("Sending data to Kamstrup meter:\n")); - debugPrint(hanBuffer, 0, i, debugger); - } - - len = 0; - dataAvailable = false; - - return true; -} - -//7E A0 07 03 21 53 03 C7 7E -void KamstrupPullCommunicator::sendDisconnectMessage() { - uint8_t i = 3; // Leave 3 bytes for header - hanBuffer[i++] = serverSap; // Destination address - hanBuffer[i++] = clientSap; // Source address - hanBuffer[i++] = 0x53; // Control - - HDLCHeader head = { HDLC_FLAG, htons(0xA000 | (i+1)) }; - memcpy(hanBuffer, &head, 3); - - HDLCFooter foot = { htons(crc16_x25(hanBuffer+1, i-1)), HDLC_FLAG }; - memcpy(hanBuffer+i, &foot, 3); - i += 3; - - for(int x = i; xwrite(hanBuffer, i); - hanSerial->flush(); - - if(debugger->isActive(RemoteDebug::INFO)) { - debugger->printf_P(PSTR("Sending data to Kamstrup meter:\n")); - debugPrint(hanBuffer, 0, i, debugger); - } - state = STATE_DISCONNECTING; - len = 0; - dataAvailable = false; -} - -// 7E A0 07 21 03 73 01 40 7E -bool KamstrupPullCommunicator::checkForDisconnectMessage() { - if(!dataAvailable) return false; - if(ctx.length > BUF_SIZE_HAN) { - debugger->printf_P(PSTR("Invalid context length\n")); - dataAvailable = false; - return NULL; - } - - if(debugger->isActive(RemoteDebug::INFO)) { - debugger->printf_P(PSTR("Received data from Kamstrup meter:\n")); - debugPrint(hanBuffer, 0, ctx.length, debugger); - } - for(int i = 0; ihasRxError()) { - if(debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("Serial RX error\n")); - lastError = 96; - } - if(hwSerial->hasOverrun()) { - rxerr(2); - } - #endif - } else if(swSerial != NULL) { - if(swSerial->overflow()) { - rxerr(2); - } - } - return lastError; -} - -bool KamstrupPullCommunicator::isConfigChanged() { - return configChanged; -} - -void KamstrupPullCommunicator::getCurrentConfig(MeterConfig& meterConfig) { - meterConfig = this->meterConfig; -} - -void KamstrupPullCommunicator::rxerr(int err) { - if(err == 0) return; - switch(err) { - case 2: - if (debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("Serial buffer overflow\n")); - rxBufferErrors++; - if(rxBufferErrors > 3 && meterConfig.bufferSize < 64) { - meterConfig.bufferSize += 2; - if (debugger->isActive(RemoteDebug::INFO)) debugger->printf_P(PSTR("Increasing RX buffer to %d bytes\n"), meterConfig.bufferSize * 64); - configChanged = true; - rxBufferErrors = 0; - } - break; - case 3: - if (debugger->isActive(RemoteDebug::ERROR)) debugger->printf_P(PSTR("Serial FIFO overflow\n")); - break; - case 4: - if (debugger->isActive(RemoteDebug::WARNING)) debugger->printf_P(PSTR("Serial frame error\n")); - break; - case 5: - if (debugger->isActive(RemoteDebug::WARNING)) debugger->printf_P(PSTR("Serial parity error\n")); - break; - } - // Do not include serial break - if(err > 1) lastError = 90+err; -} diff --git a/tmp/KamstrupPullCommunicator.h b/tmp/KamstrupPullCommunicator.h deleted file mode 100644 index dc642d62..00000000 --- a/tmp/KamstrupPullCommunicator.h +++ /dev/null @@ -1,77 +0,0 @@ -/** - * @copyright Utilitech AS 2023 - * License: Fair Source - * - */ - -#ifndef _KAMSTRUPPULLCOMMUNICATOR_H -#define _KAMSTRUPPULLCOMMUNICATOR_H - -#include "PassiveMeterCommunicator.h" -#include "RemoteDebug.h" -#include "AmsConfiguration.h" -#include "DataParsers.h" -#include "Timezone.h" -#include "PassthroughMqttHandler.h" -#include "HdlcParser.h" -#include "crc.h" -#include "OBIScodes.h" - -#define BUF_SIZE_HAN (1280) - -#define STATE_DISCONNECTED 0 -#define STATE_CONNECTING 1 -#define STATE_CONNECTED_NOT_ASSOCIATED 2 -#define STATE_CONNECTED_ASSOCIATING 3 -#define STATE_CONNECTED_ASSOCIATED 4 -#define STATE_CONNECTION_BROKEN 7 -#define STATE_DISCONNECT 8 -#define STATE_DISCONNECTING 9 - -struct ConnectParameter2b { - uint8_t type; - uint8_t length; - uint16_t data; -} __attribute__((packed)); - -struct ConnectParameter4b { - uint8_t type; - uint8_t length; - uint32_t data; -} __attribute__((packed)); - -class KamstrupPullCommunicator : public PassiveMeterCommunicator { -public: - KamstrupPullCommunicator(RemoteDebug* debugger) : PassiveMeterCommunicator(debugger) {}; - void configure(MeterConfig&, Timezone*); - bool loop(); - AmsData* getData(AmsData& meterState); - int getLastError(); - bool isConfigChanged(); - void getCurrentConfig(MeterConfig& meterConfig); - void setPassthroughMqttHandler(PassthroughMqttHandler*); - - HardwareSerial* getHwSerial(); - void rxerr(int err); - -private: - uint8_t state = STATE_DISCONNECTED; - uint64_t lastLoop = 0; - uint64_t lastMessageTime = 0; - String passkey = ""; - uint8_t clientSap = 0x21; - uint8_t serverSap = 0x03; - uint8_t obisPosition = 0; - OBIS_code_t currentObis = OBIS_NULL; - - void setupHanPort(uint32_t baud, uint8_t parityOrdinal, bool invert); - void sendConnectMessage(); - bool checkForConnectConfirmed(); - void sendAssociateMessage(); - bool checkForAssociationConfirmed(); - bool requestData(); - void sendDisconnectMessage(); - bool checkForDisconnectMessage(); -}; - -#endif