diff --git a/modules/API/API.hpp b/modules/API/API.hpp index fafbf147f..f0c396387 100644 --- a/modules/API/API.hpp +++ b/modules/API/API.hpp @@ -140,17 +140,19 @@ struct Conf { class API : public Everest::ModuleBase { public: API() = delete; - API(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider, std::unique_ptr p_main, - std::vector> r_evse_manager, std::vector> r_ocpp, - Conf& config) : + API(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider, Everest::WatchdogSupervisor& watchdog_supervisor, + std::unique_ptr p_main, std::vector> r_evse_manager, + std::vector> r_ocpp, Conf& config) : ModuleBase(info), mqtt(mqtt_provider), + watchdog_supervisor(watchdog_supervisor), p_main(std::move(p_main)), r_evse_manager(std::move(r_evse_manager)), r_ocpp(std::move(r_ocpp)), config(config){}; Everest::MqttProvider& mqtt; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; const std::vector> r_evse_manager; const std::vector> r_ocpp; diff --git a/modules/Auth/Auth.hpp b/modules/Auth/Auth.hpp index 3cfe76feb..73dd604c3 100644 --- a/modules/Auth/Auth.hpp +++ b/modules/Auth/Auth.hpp @@ -40,12 +40,13 @@ struct Conf { class Auth : public Everest::ModuleBase { public: Auth() = delete; - Auth(const ModuleInfo& info, std::unique_ptr p_main, + Auth(const ModuleInfo& info, Everest::WatchdogSupervisor& watchdog_supervisor, std::unique_ptr p_main, std::unique_ptr p_reservation, std::vector> r_token_provider, std::vector> r_token_validator, std::vector> r_evse_manager, Conf& config) : ModuleBase(info), + watchdog_supervisor(watchdog_supervisor), p_main(std::move(p_main)), p_reservation(std::move(p_reservation)), r_token_provider(std::move(r_token_provider)), @@ -53,6 +54,7 @@ class Auth : public Everest::ModuleBase { r_evse_manager(std::move(r_evse_manager)), config(config){}; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; const std::unique_ptr p_reservation; const std::vector> r_token_provider; diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 6b53d744a..10fd480f3 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -30,7 +30,6 @@ ev_add_module(DummyTokenValidator) ev_add_module(DummyTokenProvider) ev_add_module(DummyTokenProviderManual) -add_subdirectory(deprecated) add_subdirectory(examples) add_subdirectory(simulation) diff --git a/modules/DPM1000/DPM1000.hpp b/modules/DPM1000/DPM1000.hpp index 1ad57f313..d51154fef 100644 --- a/modules/DPM1000/DPM1000.hpp +++ b/modules/DPM1000/DPM1000.hpp @@ -35,9 +35,11 @@ struct Conf { class DPM1000 : public Everest::ModuleBase { public: DPM1000() = delete; - DPM1000(const ModuleInfo& info, std::unique_ptr p_main, Conf& config) : - ModuleBase(info), p_main(std::move(p_main)), config(config){}; + DPM1000(const ModuleInfo& info, Everest::WatchdogSupervisor& watchdog_supervisor, + std::unique_ptr p_main, Conf& config) : + ModuleBase(info), watchdog_supervisor(watchdog_supervisor), p_main(std::move(p_main)), config(config){}; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; const Conf& config; diff --git a/modules/DummyTokenProvider/DummyTokenProvider.hpp b/modules/DummyTokenProvider/DummyTokenProvider.hpp index 28e27e55b..5368f2d51 100644 --- a/modules/DummyTokenProvider/DummyTokenProvider.hpp +++ b/modules/DummyTokenProvider/DummyTokenProvider.hpp @@ -27,10 +27,16 @@ struct Conf {}; class DummyTokenProvider : public Everest::ModuleBase { public: DummyTokenProvider() = delete; - DummyTokenProvider(const ModuleInfo& info, std::unique_ptr p_main, - std::unique_ptr r_evse, Conf& config) : - ModuleBase(info), p_main(std::move(p_main)), r_evse(std::move(r_evse)), config(config){}; - + DummyTokenProvider(const ModuleInfo& info, Everest::WatchdogSupervisor& watchdog_supervisor, + std::unique_ptr p_main, std::unique_ptr r_evse, + Conf& config) : + ModuleBase(info), + watchdog_supervisor(watchdog_supervisor), + p_main(std::move(p_main)), + r_evse(std::move(r_evse)), + config(config){}; + + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; const std::unique_ptr r_evse; const Conf& config; diff --git a/modules/DummyTokenProviderManual/DummyTokenProviderManual.hpp b/modules/DummyTokenProviderManual/DummyTokenProviderManual.hpp index 9aa9eab3c..341519d65 100644 --- a/modules/DummyTokenProviderManual/DummyTokenProviderManual.hpp +++ b/modules/DummyTokenProviderManual/DummyTokenProviderManual.hpp @@ -25,10 +25,16 @@ class DummyTokenProviderManual : public Everest::ModuleBase { public: DummyTokenProviderManual() = delete; DummyTokenProviderManual(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider, + Everest::WatchdogSupervisor& watchdog_supervisor, std::unique_ptr p_main, Conf& config) : - ModuleBase(info), mqtt(mqtt_provider), p_main(std::move(p_main)), config(config){}; + ModuleBase(info), + mqtt(mqtt_provider), + watchdog_supervisor(watchdog_supervisor), + p_main(std::move(p_main)), + config(config){}; Everest::MqttProvider& mqtt; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; const Conf& config; diff --git a/modules/DummyTokenValidator/DummyTokenValidator.hpp b/modules/DummyTokenValidator/DummyTokenValidator.hpp index e650b0d27..2a5551c90 100644 --- a/modules/DummyTokenValidator/DummyTokenValidator.hpp +++ b/modules/DummyTokenValidator/DummyTokenValidator.hpp @@ -24,9 +24,11 @@ struct Conf {}; class DummyTokenValidator : public Everest::ModuleBase { public: DummyTokenValidator() = delete; - DummyTokenValidator(const ModuleInfo& info, std::unique_ptr p_main, Conf& config) : - ModuleBase(info), p_main(std::move(p_main)), config(config){}; + DummyTokenValidator(const ModuleInfo& info, Everest::WatchdogSupervisor& watchdog_supervisor, + std::unique_ptr p_main, Conf& config) : + ModuleBase(info), watchdog_supervisor(watchdog_supervisor), p_main(std::move(p_main)), config(config){}; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; const Conf& config; diff --git a/modules/DummyV2G/DummyV2G.hpp b/modules/DummyV2G/DummyV2G.hpp index 231270478..9cc0158d6 100644 --- a/modules/DummyV2G/DummyV2G.hpp +++ b/modules/DummyV2G/DummyV2G.hpp @@ -24,9 +24,11 @@ struct Conf {}; class DummyV2G : public Everest::ModuleBase { public: DummyV2G() = delete; - DummyV2G(const ModuleInfo& info, std::unique_ptr p_main, Conf& config) : - ModuleBase(info), p_main(std::move(p_main)), config(config){}; + DummyV2G(const ModuleInfo& info, Everest::WatchdogSupervisor& watchdog_supervisor, + std::unique_ptr p_main, Conf& config) : + ModuleBase(info), watchdog_supervisor(watchdog_supervisor), p_main(std::move(p_main)), config(config){}; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; const Conf& config; diff --git a/modules/EnergyManager/EnergyManager.cpp b/modules/EnergyManager/EnergyManager.cpp index 3c9b8f556..7fce3f116 100644 --- a/modules/EnergyManager/EnergyManager.cpp +++ b/modules/EnergyManager/EnergyManager.cpp @@ -25,12 +25,15 @@ void EnergyManager::ready() { // start thread to update energy optimization std::thread([this] { + auto watchdog = watchdog_supervisor.register_watchdog("Energy optimization thread", + std::chrono::seconds(config.update_interval * 10)); while (true) { globals.init(date::utc_clock::now(), config.schedule_interval_duration, config.schedule_total_duration, config.slice_ampere, config.slice_watt, config.debug, energy_flow_request); auto optimized_values = run_optimizer(energy_flow_request); enforce_limits(optimized_values); sleep(config.update_interval); + watchdog(); } }).detach(); } diff --git a/modules/EnergyManager/EnergyManager.hpp b/modules/EnergyManager/EnergyManager.hpp index f5735653b..4793a8a2c 100644 --- a/modules/EnergyManager/EnergyManager.hpp +++ b/modules/EnergyManager/EnergyManager.hpp @@ -41,10 +41,16 @@ struct Conf { class EnergyManager : public Everest::ModuleBase { public: EnergyManager() = delete; - EnergyManager(const ModuleInfo& info, std::unique_ptr p_main, - std::unique_ptr r_energy_trunk, Conf& config) : - ModuleBase(info), p_main(std::move(p_main)), r_energy_trunk(std::move(r_energy_trunk)), config(config){}; - + EnergyManager(const ModuleInfo& info, Everest::WatchdogSupervisor& watchdog_supervisor, + std::unique_ptr p_main, std::unique_ptr r_energy_trunk, + Conf& config) : + ModuleBase(info), + watchdog_supervisor(watchdog_supervisor), + p_main(std::move(p_main)), + r_energy_trunk(std::move(r_energy_trunk)), + config(config){}; + + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; const std::unique_ptr r_energy_trunk; const Conf& config; diff --git a/modules/EnergyNode/EnergyNode.hpp b/modules/EnergyNode/EnergyNode.hpp index 41ed45214..2c5cbd5ee 100644 --- a/modules/EnergyNode/EnergyNode.hpp +++ b/modules/EnergyNode/EnergyNode.hpp @@ -34,12 +34,14 @@ struct Conf { class EnergyNode : public Everest::ModuleBase { public: EnergyNode() = delete; - EnergyNode(const ModuleInfo& info, std::unique_ptr p_energy_grid, + EnergyNode(const ModuleInfo& info, Everest::WatchdogSupervisor& watchdog_supervisor, + std::unique_ptr p_energy_grid, std::unique_ptr p_external_limits, std::vector> r_energy_consumer, std::vector> r_powermeter, std::vector> r_price_information, Conf& config) : ModuleBase(info), + watchdog_supervisor(watchdog_supervisor), p_energy_grid(std::move(p_energy_grid)), p_external_limits(std::move(p_external_limits)), r_energy_consumer(std::move(r_energy_consumer)), @@ -47,6 +49,7 @@ class EnergyNode : public Everest::ModuleBase { r_price_information(std::move(r_price_information)), config(config){}; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_energy_grid; const std::unique_ptr p_external_limits; const std::vector> r_energy_consumer; diff --git a/modules/EvSlac/CMakeLists.txt b/modules/EvSlac/CMakeLists.txt index e3033a0f1..1e3e3bcf9 100644 --- a/modules/EvSlac/CMakeLists.txt +++ b/modules/EvSlac/CMakeLists.txt @@ -19,7 +19,6 @@ target_link_libraries(${MODULE_NAME} slac::io slac::fsm::ev ) - # ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1 target_sources(${MODULE_NAME} diff --git a/modules/EvSlac/EvSlac.hpp b/modules/EvSlac/EvSlac.hpp index 7a6a00a99..b6106ec7a 100644 --- a/modules/EvSlac/EvSlac.hpp +++ b/modules/EvSlac/EvSlac.hpp @@ -24,9 +24,11 @@ struct Conf {}; class EvSlac : public Everest::ModuleBase { public: EvSlac() = delete; - EvSlac(const ModuleInfo& info, std::unique_ptr p_main, Conf& config) : - ModuleBase(info), p_main(std::move(p_main)), config(config){}; + EvSlac(const ModuleInfo& info, Everest::WatchdogSupervisor& watchdog_supervisor, + std::unique_ptr p_main, Conf& config) : + ModuleBase(info), watchdog_supervisor(watchdog_supervisor), p_main(std::move(p_main)), config(config){}; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; const Conf& config; diff --git a/modules/EvseManager/Charger.cpp b/modules/EvseManager/Charger.cpp index 9041dd6a3..7d817d908 100644 --- a/modules/EvseManager/Charger.cpp +++ b/modules/EvseManager/Charger.cpp @@ -20,15 +20,15 @@ namespace module { Charger::Charger(const std::unique_ptr& bsp, const std::unique_ptr& error_handling, - const types::evse_board_support::Connector_type& connector_type) : - bsp(bsp), error_handling(error_handling), connector_type(connector_type) { - -#ifdef EVEREST_USE_BACKTRACES - Everest::install_backtrace_handler(); -#endif - - shared_context.connector_enabled = true; - shared_context.max_current = 6.0; + const types::evse_board_support::Connector_type& connector_type, + Everest::WatchdogSupervisor& _watchdog_supervisor) : + bsp(bsp), + error_handling(error_handling), + connector_type(connector_type), + watchdog_supervisor(_watchdog_supervisor) { + + connectorEnabled = true; + maxCurrent = 6.0; if (connector_type == types::evse_board_support::Connector_type::IEC62196Type2Socket) { shared_context.max_current_cable = bsp->read_pp_ampacity(); } @@ -82,7 +82,11 @@ Charger::~Charger() { pwm_F(); } -void Charger::main_thread() { +void Charger::mainThread() { + + // Register our watchdog for the main loop thread + auto watchdog = watchdog_supervisor.register_watchdog("Charger main loop", std::chrono::seconds(5)); + // Enable CP output bsp->enable(true); @@ -105,6 +109,8 @@ void Charger::main_thread() { // to be done on regular intervals independent from events) run_state_machine(); } + + watchdog(); } } diff --git a/modules/EvseManager/Charger.hpp b/modules/EvseManager/Charger.hpp index b5c137586..7e5dbf655 100644 --- a/modules/EvseManager/Charger.hpp +++ b/modules/EvseManager/Charger.hpp @@ -36,6 +36,8 @@ #include #include +#include + #include "ErrorHandling.hpp" #include "IECStateMachine.hpp" #include "scoped_lock_timeout.hpp" @@ -48,7 +50,8 @@ const std::string IEC62196Type2Socket = "IEC62196Type2Socket"; class Charger { public: Charger(const std::unique_ptr& bsp, const std::unique_ptr& error_handling, - const types::evse_board_support::Connector_type& connector_type); + const types::evse_board_support::Connector_type& connector_type, + Everest::WatchdogSupervisor& watchdog_supervisor); ~Charger(); enum class ChargeMode { @@ -299,6 +302,7 @@ class Charger { const std::unique_ptr& bsp; const std::unique_ptr& error_handling; const types::evse_board_support::Connector_type& connector_type; + Everest::WatchdogSupervisor& watchdog_supervisor; // constants static constexpr float CHARGER_ABSOLUTE_MAX_CURRENT{80.}; diff --git a/modules/EvseManager/EvseManager.cpp b/modules/EvseManager/EvseManager.cpp index fcfd12e3e..af1792d88 100644 --- a/modules/EvseManager/EvseManager.cpp +++ b/modules/EvseManager/EvseManager.cpp @@ -89,7 +89,8 @@ void EvseManager::ready() { hw_capabilities = r_bsp->call_get_hw_capabilities(); - charger = std::unique_ptr(new Charger(bsp, error_handling, hw_capabilities.connector_type)); + charger = + std::unique_ptr(new Charger(bsp, error_handling, hw_capabilities.connector_type, watchdog_supervisor)); if (r_connector_lock.size() > 0) { bsp->signal_lock.connect([this]() { r_connector_lock[0]->call_lock(); }); @@ -743,8 +744,12 @@ void EvseManager::ready() { } telemetryThreadHandle = std::thread([this]() { - while (not telemetryThreadHandle.shouldExit()) { + auto watchdog = watchdog_supervisor.register_watchdog("Telemetry thread", std::chrono::seconds(20)); + + while (!telemetryThreadHandle.shouldExit()) { sleep(10); + watchdog(); + auto p = get_latest_powermeter_data_billing(); Everest::TelemetryMap telemetry_data{{"timestamp", p.timestamp}, {"type", "power_meter"}, diff --git a/modules/EvseManager/EvseManager.hpp b/modules/EvseManager/EvseManager.hpp index 4ebecbdd8..da53d06bd 100644 --- a/modules/EvseManager/EvseManager.hpp +++ b/modules/EvseManager/EvseManager.hpp @@ -93,7 +93,8 @@ class EvseManager : public Everest::ModuleBase { public: EvseManager() = delete; EvseManager(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider, Everest::TelemetryProvider& telemetry, - std::unique_ptr p_evse, std::unique_ptr p_energy_grid, + Everest::WatchdogSupervisor& watchdog_supervisor, std::unique_ptr p_evse, + std::unique_ptr p_energy_grid, std::unique_ptr p_token_provider, std::unique_ptr r_bsp, std::vector> r_ac_rcd, std::vector> r_connector_lock, @@ -105,6 +106,7 @@ class EvseManager : public Everest::ModuleBase { ModuleBase(info), mqtt(mqtt_provider), telemetry(telemetry), + watchdog_supervisor(watchdog_supervisor), p_evse(std::move(p_evse)), p_energy_grid(std::move(p_energy_grid)), p_token_provider(std::move(p_token_provider)), @@ -121,6 +123,7 @@ class EvseManager : public Everest::ModuleBase { Everest::MqttProvider& mqtt; Everest::TelemetryProvider& telemetry; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_evse; const std::unique_ptr p_energy_grid; const std::unique_ptr p_token_provider; @@ -259,7 +262,6 @@ class EvseManager : public Everest::ModuleBase { static constexpr auto CABLECHECK_CONTACTORS_CLOSE_TIMEOUT{std::chrono::seconds(5)}; std::atomic_bool current_demand_active{false}; - // ev@211cfdbe-f69a-4cd6-a4ec-f8aaa3d1b6c8:v1 }; diff --git a/modules/EvseManager/IECStateMachine.hpp b/modules/EvseManager/IECStateMachine.hpp index b8c86dda8..fced515e8 100644 --- a/modules/EvseManager/IECStateMachine.hpp +++ b/modules/EvseManager/IECStateMachine.hpp @@ -30,7 +30,6 @@ #include #include "Timeout.hpp" -#include "utils/thread.hpp" #include "scoped_lock_timeout.hpp" diff --git a/modules/EvseManager/energy_grid/energyImpl.cpp b/modules/EvseManager/energy_grid/energyImpl.cpp index 744252475..21bbb5534 100644 --- a/modules/EvseManager/energy_grid/energyImpl.cpp +++ b/modules/EvseManager/energy_grid/energyImpl.cpp @@ -94,9 +94,12 @@ void energyImpl::ready() { // request energy every second std::thread([this] { + auto watchdog = mod->watchdog_supervisor.register_watchdog("Energy request thread", std::chrono::seconds(10)); + while (true) { request_energy_from_energy_manager(); std::this_thread::sleep_for(std::chrono::seconds(1)); + watchdog(); } }).detach(); diff --git a/modules/EvseSecurity/CMakeLists.txt b/modules/EvseSecurity/CMakeLists.txt index 176307daa..198269928 100644 --- a/modules/EvseSecurity/CMakeLists.txt +++ b/modules/EvseSecurity/CMakeLists.txt @@ -14,12 +14,16 @@ target_link_libraries(${MODULE_NAME} PRIVATE everest::evse_security ) + +target_sources(${MODULE_NAME} + PRIVATE + "conversions.cpp" +) # ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1 target_sources(${MODULE_NAME} PRIVATE "main/evse_securityImpl.cpp" - "conversions.cpp" ) # ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1 diff --git a/modules/EvseSecurity/EvseSecurity.hpp b/modules/EvseSecurity/EvseSecurity.hpp index 4fadd657f..0fcfe670f 100644 --- a/modules/EvseSecurity/EvseSecurity.hpp +++ b/modules/EvseSecurity/EvseSecurity.hpp @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright Pionix GmbH and Contributors to EVerest -#ifndef EVSE_SECURITY_FS_HPP -#define EVSE_SECURITY_FS_HPP +#ifndef EVSE_SECURITY_HPP +#define EVSE_SECURITY_HPP // // AUTO GENERATED - MARKED REGIONS WILL BE KEPT @@ -34,9 +34,11 @@ struct Conf { class EvseSecurity : public Everest::ModuleBase { public: EvseSecurity() = delete; - EvseSecurity(const ModuleInfo& info, std::unique_ptr p_main, Conf& config) : - ModuleBase(info), p_main(std::move(p_main)), config(config){}; + EvseSecurity(const ModuleInfo& info, Everest::WatchdogSupervisor& watchdog_supervisor, + std::unique_ptr p_main, Conf& config) : + ModuleBase(info), watchdog_supervisor(watchdog_supervisor), p_main(std::move(p_main)), config(config){}; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; const Conf& config; @@ -65,4 +67,4 @@ class EvseSecurity : public Everest::ModuleBase { } // namespace module -#endif // EVSE_SECURITY_FS_HPP +#endif // EVSE_SECURITY_HPP diff --git a/modules/EvseSlac/CMakeLists.txt b/modules/EvseSlac/CMakeLists.txt index 9f3ca54f2..5d7f83c23 100644 --- a/modules/EvseSlac/CMakeLists.txt +++ b/modules/EvseSlac/CMakeLists.txt @@ -19,7 +19,6 @@ target_link_libraries(${MODULE_NAME} slac::io slac::fsm::evse ) - # ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1 target_sources(${MODULE_NAME} diff --git a/modules/EvseSlac/EvseSlac.hpp b/modules/EvseSlac/EvseSlac.hpp index 4ab2e2e66..45a10e845 100644 --- a/modules/EvseSlac/EvseSlac.hpp +++ b/modules/EvseSlac/EvseSlac.hpp @@ -24,9 +24,11 @@ struct Conf {}; class EvseSlac : public Everest::ModuleBase { public: EvseSlac() = delete; - EvseSlac(const ModuleInfo& info, std::unique_ptr p_main, Conf& config) : - ModuleBase(info), p_main(std::move(p_main)), config(config){}; + EvseSlac(const ModuleInfo& info, Everest::WatchdogSupervisor& watchdog_supervisor, + std::unique_ptr p_main, Conf& config) : + ModuleBase(info), watchdog_supervisor(watchdog_supervisor), p_main(std::move(p_main)), config(config){}; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; const Conf& config; diff --git a/modules/EvseV2G/EvseV2G.hpp b/modules/EvseV2G/EvseV2G.hpp index 7835f8bb0..15acb307d 100644 --- a/modules/EvseV2G/EvseV2G.hpp +++ b/modules/EvseV2G/EvseV2G.hpp @@ -41,15 +41,17 @@ class EvseV2G : public Everest::ModuleBase { public: EvseV2G() = delete; EvseV2G(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider, - std::unique_ptr p_charger, std::unique_ptr r_security, - Conf& config) : + Everest::WatchdogSupervisor& watchdog_supervisor, std::unique_ptr p_charger, + std::unique_ptr r_security, Conf& config) : ModuleBase(info), mqtt(mqtt_provider), + watchdog_supervisor(watchdog_supervisor), p_charger(std::move(p_charger)), r_security(std::move(r_security)), config(config){}; Everest::MqttProvider& mqtt; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_charger; const std::unique_ptr r_security; const Conf& config; diff --git a/modules/GenericPowermeter/GenericPowermeter.hpp b/modules/GenericPowermeter/GenericPowermeter.hpp index 4d9de6bb6..13857b8dc 100644 --- a/modules/GenericPowermeter/GenericPowermeter.hpp +++ b/modules/GenericPowermeter/GenericPowermeter.hpp @@ -27,10 +27,16 @@ struct Conf {}; class GenericPowermeter : public Everest::ModuleBase { public: GenericPowermeter() = delete; - GenericPowermeter(const ModuleInfo& info, std::unique_ptr p_main, + GenericPowermeter(const ModuleInfo& info, Everest::WatchdogSupervisor& watchdog_supervisor, + std::unique_ptr p_main, std::unique_ptr r_serial_comm_hub, Conf& config) : - ModuleBase(info), p_main(std::move(p_main)), r_serial_comm_hub(std::move(r_serial_comm_hub)), config(config){}; + ModuleBase(info), + watchdog_supervisor(watchdog_supervisor), + p_main(std::move(p_main)), + r_serial_comm_hub(std::move(r_serial_comm_hub)), + config(config){}; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; const std::unique_ptr r_serial_comm_hub; const Conf& config; diff --git a/modules/LemDCBM400600/CMakeLists.txt b/modules/LemDCBM400600/CMakeLists.txt index ebe67e797..dba9271fe 100644 --- a/modules/LemDCBM400600/CMakeLists.txt +++ b/modules/LemDCBM400600/CMakeLists.txt @@ -5,8 +5,6 @@ # module setup: # - ${MODULE_NAME}: module name -add_compile_options(-Wpedantic) - ev_setup_cpp_module() # ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1 diff --git a/modules/LemDCBM400600/LemDCBM400600.hpp b/modules/LemDCBM400600/LemDCBM400600.hpp index 3faf10bb4..5a072c617 100644 --- a/modules/LemDCBM400600/LemDCBM400600.hpp +++ b/modules/LemDCBM400600/LemDCBM400600.hpp @@ -36,9 +36,11 @@ struct Conf { class LemDCBM400600 : public Everest::ModuleBase { public: LemDCBM400600() = delete; - LemDCBM400600(const ModuleInfo& info, std::unique_ptr p_main, Conf& config) : - ModuleBase(info), p_main(std::move(p_main)), config(config){}; + LemDCBM400600(const ModuleInfo& info, Everest::WatchdogSupervisor& watchdog_supervisor, + std::unique_ptr p_main, Conf& config) : + ModuleBase(info), watchdog_supervisor(watchdog_supervisor), p_main(std::move(p_main)), config(config){}; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; const Conf& config; diff --git a/modules/MicroMegaWattBSP/MicroMegaWattBSP.hpp b/modules/MicroMegaWattBSP/MicroMegaWattBSP.hpp index d6ea3c4cf..0e892a5ad 100644 --- a/modules/MicroMegaWattBSP/MicroMegaWattBSP.hpp +++ b/modules/MicroMegaWattBSP/MicroMegaWattBSP.hpp @@ -33,17 +33,20 @@ class MicroMegaWattBSP : public Everest::ModuleBase { public: MicroMegaWattBSP() = delete; MicroMegaWattBSP(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider, + Everest::WatchdogSupervisor& watchdog_supervisor, std::unique_ptr p_dc_supply, std::unique_ptr p_powermeter, std::unique_ptr p_board_support, Conf& config) : ModuleBase(info), mqtt(mqtt_provider), + watchdog_supervisor(watchdog_supervisor), p_dc_supply(std::move(p_dc_supply)), p_powermeter(std::move(p_powermeter)), p_board_support(std::move(p_board_support)), config(config){}; Everest::MqttProvider& mqtt; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_dc_supply; const std::unique_ptr p_powermeter; const std::unique_ptr p_board_support; diff --git a/modules/OCPP/OCPP.hpp b/modules/OCPP/OCPP.hpp index 3a524ae9f..258b9049d 100644 --- a/modules/OCPP/OCPP.hpp +++ b/modules/OCPP/OCPP.hpp @@ -62,7 +62,7 @@ struct Conf { class OCPP : public Everest::ModuleBase { public: OCPP() = delete; - OCPP(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider, + OCPP(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider, Everest::WatchdogSupervisor& watchdog_supervisor, std::unique_ptr p_main, std::unique_ptr p_auth_validator, std::unique_ptr p_auth_provider, @@ -74,6 +74,7 @@ class OCPP : public Everest::ModuleBase { std::vector> r_data_transfer, Conf& config) : ModuleBase(info), mqtt(mqtt_provider), + watchdog_supervisor(watchdog_supervisor), p_main(std::move(p_main)), p_auth_validator(std::move(p_auth_validator)), p_auth_provider(std::move(p_auth_provider)), @@ -89,6 +90,7 @@ class OCPP : public Everest::ModuleBase { config(config){}; Everest::MqttProvider& mqtt; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; const std::unique_ptr p_auth_validator; const std::unique_ptr p_auth_provider; @@ -134,7 +136,7 @@ class OCPP : public Everest::ModuleBase { void init_evse_ready_map(); EvseConnectorMap evse_connector_map; // provides access to OCPP connector id by using EVerests evse and connector id std::map - connector_evse_index_map; // provides access to r_evse_manager index by using OCPP connector id + connector_evse_index_map; // provides access to r_evse_manager index by using OCPP connector id std::map evse_ready_map; std::mutex evse_ready_mutex; std::condition_variable evse_ready_cv; diff --git a/modules/OCPP/ocpp_generic/ocppImpl.hpp b/modules/OCPP/ocpp_generic/ocppImpl.hpp index a3ee27683..f9280eb81 100644 --- a/modules/OCPP/ocpp_generic/ocppImpl.hpp +++ b/modules/OCPP/ocpp_generic/ocppImpl.hpp @@ -14,7 +14,6 @@ // ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1 // insert your custom include headers here - // ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1 namespace module { diff --git a/modules/OCPP201/OCPP201.hpp b/modules/OCPP201/OCPP201.hpp index b802987c5..be0fe0059 100644 --- a/modules/OCPP201/OCPP201.hpp +++ b/modules/OCPP201/OCPP201.hpp @@ -68,7 +68,8 @@ struct Conf { class OCPP201 : public Everest::ModuleBase { public: OCPP201() = delete; - OCPP201(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider, std::unique_ptr p_main, + OCPP201(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider, + Everest::WatchdogSupervisor& watchdog_supervisor, std::unique_ptr p_main, std::unique_ptr p_auth_validator, std::unique_ptr p_auth_provider, std::unique_ptr p_data_transfer, @@ -78,6 +79,7 @@ class OCPP201 : public Everest::ModuleBase { Conf& config) : ModuleBase(info), mqtt(mqtt_provider), + watchdog_supervisor(watchdog_supervisor), p_main(std::move(p_main)), p_auth_validator(std::move(p_auth_validator)), p_auth_provider(std::move(p_auth_provider)), @@ -90,6 +92,7 @@ class OCPP201 : public Everest::ModuleBase { config(config){}; Everest::MqttProvider& mqtt; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; const std::unique_ptr p_auth_validator; const std::unique_ptr p_auth_provider; diff --git a/modules/OCPPExtensionExample/OCPPExtensionExample.hpp b/modules/OCPPExtensionExample/OCPPExtensionExample.hpp index f9d778972..a0fcd7afe 100644 --- a/modules/OCPPExtensionExample/OCPPExtensionExample.hpp +++ b/modules/OCPPExtensionExample/OCPPExtensionExample.hpp @@ -30,15 +30,17 @@ struct Conf { class OCPPExtensionExample : public Everest::ModuleBase { public: OCPPExtensionExample() = delete; - OCPPExtensionExample(const ModuleInfo& info, std::unique_ptr p_data_transfer, - std::unique_ptr r_ocpp, std::unique_ptr r_data_transfer, - Conf& config) : + OCPPExtensionExample(const ModuleInfo& info, Everest::WatchdogSupervisor& watchdog_supervisor, + std::unique_ptr p_data_transfer, std::unique_ptr r_ocpp, + std::unique_ptr r_data_transfer, Conf& config) : ModuleBase(info), + watchdog_supervisor(watchdog_supervisor), p_data_transfer(std::move(p_data_transfer)), r_ocpp(std::move(r_ocpp)), r_data_transfer(std::move(r_data_transfer)), config(config){}; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_data_transfer; const std::unique_ptr r_ocpp; const std::unique_ptr r_data_transfer; diff --git a/modules/PN532TokenProvider/PN532TokenProvider.hpp b/modules/PN532TokenProvider/PN532TokenProvider.hpp index d6b82f410..630677ede 100644 --- a/modules/PN532TokenProvider/PN532TokenProvider.hpp +++ b/modules/PN532TokenProvider/PN532TokenProvider.hpp @@ -5,7 +5,7 @@ // // AUTO GENERATED - MARKED REGIONS WILL BE KEPT -// template version 1 +// template version 2 // #include "ld-ev.hpp" @@ -24,11 +24,13 @@ struct Conf {}; class PN532TokenProvider : public Everest::ModuleBase { public: PN532TokenProvider() = delete; - PN532TokenProvider(const ModuleInfo& info, std::unique_ptr p_main, Conf& config) : - ModuleBase(info), p_main(std::move(p_main)), config(config){}; + PN532TokenProvider(const ModuleInfo& info, Everest::WatchdogSupervisor& watchdog_supervisor, + std::unique_ptr p_main, Conf& config) : + ModuleBase(info), watchdog_supervisor(watchdog_supervisor), p_main(std::move(p_main)), config(config){}; - const Conf& config; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; + const Conf& config; // ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1 // insert your public definitions here diff --git a/modules/PacketSniffer/PacketSniffer.hpp b/modules/PacketSniffer/PacketSniffer.hpp index 0ed032dc0..c2b443417 100644 --- a/modules/PacketSniffer/PacketSniffer.hpp +++ b/modules/PacketSniffer/PacketSniffer.hpp @@ -5,7 +5,7 @@ // // AUTO GENERATED - MARKED REGIONS WILL BE KEPT -// template version 1 +// template version 2 // #include "ld-ev.hpp" @@ -31,15 +31,22 @@ struct Conf { class PacketSniffer : public Everest::ModuleBase { public: PacketSniffer() = delete; - PacketSniffer(const ModuleInfo& info, std::unique_ptr p_main, - std::unique_ptr r_evse_manager, Conf& config) : - ModuleBase(info), p_main(std::move(p_main)), r_evse_manager(std::move(r_evse_manager)), config(config){}; - - const Conf& config; + PacketSniffer(const ModuleInfo& info, Everest::WatchdogSupervisor& watchdog_supervisor, + std::unique_ptr p_main, std::unique_ptr r_evse_manager, + Conf& config) : + ModuleBase(info), + watchdog_supervisor(watchdog_supervisor), + p_main(std::move(p_main)), + r_evse_manager(std::move(r_evse_manager)), + config(config){}; + + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; const std::unique_ptr r_evse_manager; + const Conf& config; // ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1 + // insert your public definitions here // ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1 protected: diff --git a/modules/PersistentStore/PersistentStore.hpp b/modules/PersistentStore/PersistentStore.hpp index 8adb3bace..d60db2ab9 100644 --- a/modules/PersistentStore/PersistentStore.hpp +++ b/modules/PersistentStore/PersistentStore.hpp @@ -5,7 +5,7 @@ // // AUTO GENERATED - MARKED REGIONS WILL BE KEPT -// template version 1 +// template version 2 // #include "ld-ev.hpp" @@ -26,11 +26,13 @@ struct Conf { class PersistentStore : public Everest::ModuleBase { public: PersistentStore() = delete; - PersistentStore(const ModuleInfo& info, std::unique_ptr p_main, Conf& config) : - ModuleBase(info), p_main(std::move(p_main)), config(config){}; + PersistentStore(const ModuleInfo& info, Everest::WatchdogSupervisor& watchdog_supervisor, + std::unique_ptr p_main, Conf& config) : + ModuleBase(info), watchdog_supervisor(watchdog_supervisor), p_main(std::move(p_main)), config(config){}; - const Conf& config; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; + const Conf& config; // ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1 // insert your public definitions here diff --git a/modules/PowermeterBSM/PowermeterBSM.hpp b/modules/PowermeterBSM/PowermeterBSM.hpp index 5dcabc26e..213e140a0 100644 --- a/modules/PowermeterBSM/PowermeterBSM.hpp +++ b/modules/PowermeterBSM/PowermeterBSM.hpp @@ -39,16 +39,19 @@ class PowermeterBSM : public Everest::ModuleBase { public: PowermeterBSM() = delete; PowermeterBSM(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider, - std::unique_ptr p_main, std::unique_ptr p_ac_meter, + Everest::WatchdogSupervisor& watchdog_supervisor, std::unique_ptr p_main, + std::unique_ptr p_ac_meter, std::vector> r_serial_com_0_connection, Conf& config) : ModuleBase(info), mqtt(mqtt_provider), + watchdog_supervisor(watchdog_supervisor), p_main(std::move(p_main)), p_ac_meter(std::move(p_ac_meter)), r_serial_com_0_connection(std::move(r_serial_com_0_connection)), config(config){}; Everest::MqttProvider& mqtt; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; const std::unique_ptr p_ac_meter; const std::vector> r_serial_com_0_connection; diff --git a/modules/SerialCommHub/SerialCommHub.hpp b/modules/SerialCommHub/SerialCommHub.hpp index 529523f67..db154ae99 100644 --- a/modules/SerialCommHub/SerialCommHub.hpp +++ b/modules/SerialCommHub/SerialCommHub.hpp @@ -24,11 +24,13 @@ struct Conf {}; class SerialCommHub : public Everest::ModuleBase { public: SerialCommHub() = delete; - SerialCommHub(const ModuleInfo& info, std::unique_ptr p_main, Conf& config) : - ModuleBase(info), p_main(std::move(p_main)), config(config){}; + SerialCommHub(const ModuleInfo& info, Everest::WatchdogSupervisor& watchdog_supervisor, + std::unique_ptr p_main, Conf& config) : + ModuleBase(info), watchdog_supervisor(watchdog_supervisor), p_main(std::move(p_main)), config(config){}; - const Conf& config; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; + const Conf& config; // ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1 // insert your public definitions here diff --git a/modules/SerialCommHub/main/serial_communication_hubImpl.hpp b/modules/SerialCommHub/main/serial_communication_hubImpl.hpp index 6f10b7e10..ffb92f017 100644 --- a/modules/SerialCommHub/main/serial_communication_hubImpl.hpp +++ b/modules/SerialCommHub/main/serial_communication_hubImpl.hpp @@ -28,7 +28,6 @@ struct Conf { std::string serial_port; int baudrate; int parity; - int rs485_direction_gpio; bool ignore_echo; std::string rxtx_gpio_chip; int rxtx_gpio_line; diff --git a/modules/Setup/Setup.hpp b/modules/Setup/Setup.hpp index f9b51a230..9f3b76fce 100644 --- a/modules/Setup/Setup.hpp +++ b/modules/Setup/Setup.hpp @@ -18,6 +18,8 @@ // ev@4bf81b14-a215-475c-a1d3-0a484ae48918:v1 // insert your custom include headers here +namespace fs = std::filesystem; + #include "WiFiSetup.hpp" #include @@ -117,11 +119,18 @@ struct Conf { class Setup : public Everest::ModuleBase { public: Setup() = delete; - Setup(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider, std::unique_ptr p_main, + Setup(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider, + Everest::WatchdogSupervisor& watchdog_supervisor, std::unique_ptr p_main, std::unique_ptr r_store, Conf& config) : - ModuleBase(info), mqtt(mqtt_provider), p_main(std::move(p_main)), r_store(std::move(r_store)), config(config){}; + ModuleBase(info), + mqtt(mqtt_provider), + watchdog_supervisor(watchdog_supervisor), + p_main(std::move(p_main)), + r_store(std::move(r_store)), + config(config){}; Everest::MqttProvider& mqtt; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; const std::unique_ptr r_store; const Conf& config; diff --git a/modules/Store/Store.hpp b/modules/Store/Store.hpp index 904a6ebe7..d43c69240 100644 --- a/modules/Store/Store.hpp +++ b/modules/Store/Store.hpp @@ -5,7 +5,7 @@ // // AUTO GENERATED - MARKED REGIONS WILL BE KEPT -// template version 1 +// template version 2 // #include "ld-ev.hpp" @@ -24,11 +24,13 @@ struct Conf {}; class Store : public Everest::ModuleBase { public: Store() = delete; - Store(const ModuleInfo& info, std::unique_ptr p_main, Conf& config) : - ModuleBase(info), p_main(std::move(p_main)), config(config){}; + Store(const ModuleInfo& info, Everest::WatchdogSupervisor& watchdog_supervisor, std::unique_ptr p_main, + Conf& config) : + ModuleBase(info), watchdog_supervisor(watchdog_supervisor), p_main(std::move(p_main)), config(config){}; - const Conf& config; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; + const Conf& config; // ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1 // insert your public definitions here diff --git a/modules/System/System.hpp b/modules/System/System.hpp index 4713e53fc..4af8d4630 100644 --- a/modules/System/System.hpp +++ b/modules/System/System.hpp @@ -27,9 +27,11 @@ struct Conf { class System : public Everest::ModuleBase { public: System() = delete; - System(const ModuleInfo& info, std::unique_ptr p_main, Conf& config) : - ModuleBase(info), p_main(std::move(p_main)), config(config){}; + System(const ModuleInfo& info, Everest::WatchdogSupervisor& watchdog_supervisor, + std::unique_ptr p_main, Conf& config) : + ModuleBase(info), watchdog_supervisor(watchdog_supervisor), p_main(std::move(p_main)), config(config){}; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; const Conf& config; diff --git a/modules/YetiDriver/YetiDriver.hpp b/modules/YetiDriver/YetiDriver.hpp index b30f17200..4687823bb 100644 --- a/modules/YetiDriver/YetiDriver.hpp +++ b/modules/YetiDriver/YetiDriver.hpp @@ -34,11 +34,12 @@ class YetiDriver : public Everest::ModuleBase { public: YetiDriver() = delete; YetiDriver(const ModuleInfo& info, Everest::TelemetryProvider& telemetry, - std::unique_ptr p_powermeter, + Everest::WatchdogSupervisor& watchdog_supervisor, std::unique_ptr p_powermeter, std::unique_ptr p_board_support, std::unique_ptr p_rcd, std::unique_ptr p_connector_lock, Conf& config) : ModuleBase(info), telemetry(telemetry), + watchdog_supervisor(watchdog_supervisor), p_powermeter(std::move(p_powermeter)), p_board_support(std::move(p_board_support)), p_rcd(std::move(p_rcd)), @@ -46,6 +47,7 @@ class YetiDriver : public Everest::ModuleBase { config(config){}; Everest::TelemetryProvider& telemetry; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_powermeter; const std::unique_ptr p_board_support; const std::unique_ptr p_rcd; diff --git a/modules/deprecated/CMakeLists.txt b/modules/deprecated/CMakeLists.txt deleted file mode 100644 index fe29da9dd..000000000 --- a/modules/deprecated/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -ev_add_module(JsDummyTokenValidator) -ev_add_module(JsDummyTokenProvider) -ev_add_module(JsDummyTokenProviderManual) -ev_add_module(JsForecastDotSolar) -ev_add_module(JsPN532TokenProvider) -ev_add_module(PyJosev) -ev_add_module(SunspecReader) -ev_add_module(SunspecScanner) diff --git a/modules/deprecated/JsDummyTokenProvider/CMakeLists.txt b/modules/deprecated/JsDummyTokenProvider/CMakeLists.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/modules/deprecated/JsDummyTokenProvider/index.js b/modules/deprecated/JsDummyTokenProvider/index.js deleted file mode 100644 index f4aebf3ed..000000000 --- a/modules/deprecated/JsDummyTokenProvider/index.js +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2021 Pionix GmbH and Contributors to EVerest -const { evlog, boot_module } = require('everestjs'); - -boot_module(async ({ setup }) => { - setup.uses.evse.subscribe.session_event((mod, sessionEvent) => { - if (!(sessionEvent.event === undefined) && sessionEvent.event === 'AuthRequired') { - const data = { - id_token: mod.config.impl.main.token, - authorization_type: mod.config.impl.main.type, - }; - evlog.info('Publishing new dummy token: ', data); - mod.provides.main.publish.provided_token(data); - } - }); -}); diff --git a/modules/deprecated/JsDummyTokenProvider/manifest.yaml b/modules/deprecated/JsDummyTokenProvider/manifest.yaml deleted file mode 100644 index 5741876e5..000000000 --- a/modules/deprecated/JsDummyTokenProvider/manifest.yaml +++ /dev/null @@ -1,33 +0,0 @@ -description: >- - Dummy token provider that listens to AuthRequired event from evse_manager and then publishes one token -provides: - main: - description: Main implementation of dummy token provider always returning one configured token - interface: auth_token_provider - config: - token: - description: Dummy token string to return - type: string - minLength: 1 - maxLength: 20 - default: DEADBEEF - type: - description: Type to report for our dummy token - type: string - minLength: 2 - maxLength: 32 - default: RFID - timeout: - description: Time our dummy token is valid (in s) - type: number - minimum: 0 - maximum: 120 - default: 10 -requires: - evse: - interface: evse_manager -metadata: - license: https://opensource.org/licenses/Apache-2.0 - authors: - - Thilo Molitor - - Cornelius Claussen diff --git a/modules/deprecated/JsDummyTokenProviderManual/CMakeLists.txt b/modules/deprecated/JsDummyTokenProviderManual/CMakeLists.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/modules/deprecated/JsDummyTokenProviderManual/index.js b/modules/deprecated/JsDummyTokenProviderManual/index.js deleted file mode 100644 index c6018dc07..000000000 --- a/modules/deprecated/JsDummyTokenProviderManual/index.js +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2022 Pionix GmbH and Contributors to EVerest -const { evlog, boot_module } = require('everestjs'); - -boot_module(async ({ setup, info, config, mqtt }) => { - mqtt.subscribe('everest_api/dummy_token_provider/cmd/provide', (mod, raw_data) => { - const data = JSON.parse(raw_data); - evlog.info('Publishing new dummy token: ', data); - mod.provides.main.publish.provided_token(data); - }); -}); diff --git a/modules/deprecated/JsDummyTokenProviderManual/manifest.yaml b/modules/deprecated/JsDummyTokenProviderManual/manifest.yaml deleted file mode 100644 index 2173b5f88..000000000 --- a/modules/deprecated/JsDummyTokenProviderManual/manifest.yaml +++ /dev/null @@ -1,30 +0,0 @@ -description: Dummy token provider that manually publishes one token -provides: - main: - description: Main implementation of dummy token provider always returning one configured token - interface: auth_token_provider - config: - token: - description: Dummy token string to return - type: string - minLength: 1 - maxLength: 20 - default: DEADBEEF - type: - description: Type to report for our dummy token - type: string - minLength: 2 - maxLength: 32 - default: RFID - timeout: - description: Time our dummy token is valid (in s) - type: number - minimum: 0 - maximum: 120 - default: 10 -requires: {} -enable_external_mqtt: true -metadata: - license: https://opensource.org/licenses/Apache-2.0 - authors: - - Kai-Uwe Hermann diff --git a/modules/deprecated/JsDummyTokenValidator/CMakeLists.txt b/modules/deprecated/JsDummyTokenValidator/CMakeLists.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/modules/deprecated/JsDummyTokenValidator/index.js b/modules/deprecated/JsDummyTokenValidator/index.js deleted file mode 100644 index 5ce133618..000000000 --- a/modules/deprecated/JsDummyTokenValidator/index.js +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2021 Pionix GmbH and Contributors to EVerest -const { evlog, boot_module } = require('everestjs'); - -function wait(time) { - return new Promise((resolve) => { - setTimeout(resolve, time); - }); -} - -boot_module(async ({ setup, config }) => { - setup.provides.main.register.validate_token(async (mod, { provided_token } ) => { - evlog.info(`Got validation request for token '${provided_token.id_token}'...`); - await wait(config.impl.main.sleep * 1000); - const retval = { - authorization_status: config.impl.main.validation_result, - reason: config.impl.main.validation_reason, - }; - evlog.info(`Returning validation result for token '${provided_token.id_token}': `, retval); - return retval; - }); -}); diff --git a/modules/deprecated/JsDummyTokenValidator/manifest.yaml b/modules/deprecated/JsDummyTokenValidator/manifest.yaml deleted file mode 100644 index 43b76d0a1..000000000 --- a/modules/deprecated/JsDummyTokenValidator/manifest.yaml +++ /dev/null @@ -1,32 +0,0 @@ -description: Dummy token validator always returning the same configured token validation result for every token -provides: - main: - description: >- - Main implementation of dummy token validator always returning the same configured token validation result for - every token - interface: auth_token_validator - config: - validation_result: - description: Dummy validation result to return - type: string - enum: - - Accepted - - Blocked - - Expired - - Invalid - default: Accepted - validation_reason: - description: Dummy validation reason to return - type: string - minLength: 5 - default: Token valid - sleep: - description: Time to wait before returning the dumy validation result (in s) - type: number - minimum: 0 - maximum: 120 - default: 0.5 -metadata: - license: https://opensource.org/licenses/Apache-2.0 - authors: - - Thilo Molitor diff --git a/modules/deprecated/JsForecastDotSolar/CMakeLists.txt b/modules/deprecated/JsForecastDotSolar/CMakeLists.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/modules/deprecated/JsForecastDotSolar/index.js b/modules/deprecated/JsForecastDotSolar/index.js deleted file mode 100644 index deb068a77..000000000 --- a/modules/deprecated/JsForecastDotSolar/index.js +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2021 Pionix GmbH and Contributors to EVerest -const { evlog, boot_module } = require('everestjs'); -const axios = require('axios'); - -async function fetch_solar_api_data(mod) { - // We pass mod as arg for future param config - evlog.info("Making HTTP request..."); - let response = await axios.get("https://api.forecast.solar/estimate/watthours/52/12/37/0/5.67"); - let date = new Date(); - if (response.status != 200) { - evlog.error(`Could not retrieve response data from solar forecast API at ${date}`); - return; - } - let forecast_data = {utc_timestamp: date.toISOString(), forecast: response.data}; - mod.provides.main.publish.forecast(forecast_data); -}; - -function start_api_loop(mod) { - const update_interval_milliseconds = mod.config.impl.main.update_interval * 60 * 1000; - fetch_solar_api_data(mod, update_interval_milliseconds); - setInterval(fetch_solar_api_data, update_interval_milliseconds, mod); -} - -boot_module(async ({ setup, info, config, mqtt }) => { - evlog.info("Booting JsForecastSolar!"); -}).then((mod) => { - // Call API for the first time and then set an interval to fetch the data regularly - start_api_loop(mod); -}); diff --git a/modules/deprecated/JsForecastDotSolar/manifest.yaml b/modules/deprecated/JsForecastDotSolar/manifest.yaml deleted file mode 100644 index 2204e98fb..000000000 --- a/modules/deprecated/JsForecastDotSolar/manifest.yaml +++ /dev/null @@ -1,37 +0,0 @@ -description: This modules fetches data from the ForecastDotSolar API and publishes it. -provides: - main: - description: This interface is responsible for providing the solar forecast data - interface: solar_forecast - config: - api_key: - description: API key for forecast.solar - type: string - update_interval: - description: Update interval in minutes - type: integer - longitude: - description: Location longitude - type: number - minimum: -180 - maximum: 180 - latitude: - description: Location latitude - type: number - minimum: -90 - maximum: 90 - azimuth: - description: Plane azimuth angle - type: number - minimum: 0 - maximum: 360 - all_panels_max_power: - description: Maximum power peak production of ALL combined solar panels - type: number - minimum: 0 -enable_external_mqtt: true -metadata: - license: https://opensource.org/licenses/Apache-2.0 - authors: - - Andreas Heinrich - - Leonardo Oliveira diff --git a/modules/deprecated/JsPN532TokenProvider/CMakeLists.txt b/modules/deprecated/JsPN532TokenProvider/CMakeLists.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/modules/deprecated/JsPN532TokenProvider/index.js b/modules/deprecated/JsPN532TokenProvider/index.js deleted file mode 100644 index de00ae0bc..000000000 --- a/modules/deprecated/JsPN532TokenProvider/index.js +++ /dev/null @@ -1,38 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 - 2021 Pionix GmbH and Contributors to EVerest -const { evlog, boot_module } = require('everestjs'); -const pn532 = require('pn532'); -const SerialPort = require('serialport'); -const ndef = require('ndef'); - -var reader; -boot_module(async ({ setup, config }) => { - evlog.info(`Opening serial port at '${config.impl.main.serial_port}' at baud rate ${config.impl.main.baud_rate}...`); - reader = new pn532.PN532(new SerialPort(config.impl.main.serial_port, { baudRate: config.impl.main.baud_rate })); - // wait for device to get ready (sadly this is an event instead of a promise --> we have to promisify it) - await new Promise((resolve, reject) => reader.on('ready', () => resolve())); - evlog.info("PN532 firmware version: ", await reader.getFirmwareVersion()); -}).then((mod) => { - reader.on("tag", async (tag) => { - if(tag) { - evlog.info("Got raw rfid/nfc tag: ", tag); - - // read tag data for debug/logging purposes - var tagData = await reader.readNdefData(); - if(tagData) { - evlog.debug("Raw tag ndef data: ", tagData); - var records = ndef.decodeMessage(Array.from(tagData)); - evlog.debug("Tag records: ", records); - } - - // emit new token into the everest system - const data = { - id_token: tag.uid, - authorization_type: "RFID", - timeout: mod.config.impl.main.timeout, - }; - evlog.info('Publishing new rfid/nfc token: ', data); - mod.provides.main.publish.token(data); - } - }); -}); diff --git a/modules/deprecated/JsPN532TokenProvider/manifest.yaml b/modules/deprecated/JsPN532TokenProvider/manifest.yaml deleted file mode 100644 index 5261d0476..000000000 --- a/modules/deprecated/JsPN532TokenProvider/manifest.yaml +++ /dev/null @@ -1,26 +0,0 @@ -description: PN532 RFID/NFC token provider returning the token as soon as the tag can be read by the reader -provides: - main: - description: Implementation of PN532 RFID/NFC token provider - interface: auth_token_provider - config: - serial_port: - description: Serial port the PN532 hardware is connected to - type: string - default: /dev/ttyS0 - baud_rate: - description: Serial baud rate to use when communicating with PN532 hardware - type: integer - minimum: 9600 - maximum: 230400 - default: 115200 - timeout: - description: Time a new token is valid (in s) - type: number - minimum: 0 - maximum: 120 - default: 30 -metadata: - license: https://opensource.org/licenses/Apache-2.0 - authors: - - Thilo Molitor diff --git a/modules/deprecated/JsPN532TokenProvider/package.json b/modules/deprecated/JsPN532TokenProvider/package.json deleted file mode 100644 index 442afb870..000000000 --- a/modules/deprecated/JsPN532TokenProvider/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "dependencies": { - "ndef": "^0.2.0", - "pn532": "^1.0.0", - "serialport": "^9.2.5" - } -} diff --git a/modules/deprecated/SunspecReader/CMakeLists.txt b/modules/deprecated/SunspecReader/CMakeLists.txt deleted file mode 100644 index a2cb68ef0..000000000 --- a/modules/deprecated/SunspecReader/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -# -# AUTO GENERATED - MARKED REGIONS WILL BE KEPT -# template version 3 -# - -# module setup: -# - ${MODULE_NAME}: module name -ev_setup_cpp_module() - -# ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1 -# insert your custom targets and additional config variables here -target_link_libraries(${MODULE_NAME} - PRIVATE - everest::sunspec -) -# ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1 - -target_sources(${MODULE_NAME} - PRIVATE - "main/sunspec_readerImpl.cpp" -) - -# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1 -# insert other things like install cmds etc here -# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1 diff --git a/modules/deprecated/SunspecReader/SunspecReader.cpp b/modules/deprecated/SunspecReader/SunspecReader.cpp deleted file mode 100644 index 3fccb4b07..000000000 --- a/modules/deprecated/SunspecReader/SunspecReader.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "SunspecReader.hpp" - -namespace module { - -void SunspecReader::init() { - invoke_init(*p_main); -} - -void SunspecReader::ready() { - invoke_ready(*p_main); -} - -} // namespace module diff --git a/modules/deprecated/SunspecReader/SunspecReader.hpp b/modules/deprecated/SunspecReader/SunspecReader.hpp deleted file mode 100644 index a8bfc8d55..000000000 --- a/modules/deprecated/SunspecReader/SunspecReader.hpp +++ /dev/null @@ -1,60 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Pionix GmbH and Contributors to EVerest -#ifndef SUNSPEC_READER_HPP -#define SUNSPEC_READER_HPP - -// -// AUTO GENERATED - MARKED REGIONS WILL BE KEPT -// template version 1 -// - -#include "ld-ev.hpp" - -// headers for provided interface implementations -#include - -// ev@4bf81b14-a215-475c-a1d3-0a484ae48918:v1 -// insert your custom include headers here -// ev@4bf81b14-a215-475c-a1d3-0a484ae48918:v1 - -namespace module { - -struct Conf {}; - -class SunspecReader : public Everest::ModuleBase { -public: - SunspecReader() = delete; - SunspecReader(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider, - std::unique_ptr p_main, Conf& config) : - ModuleBase(info), mqtt(mqtt_provider), p_main(std::move(p_main)), config(config){}; - - const Conf& config; - Everest::MqttProvider& mqtt; - const std::unique_ptr p_main; - - // ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1 - // insert your public definitions here - // ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1 - -protected: - // ev@4714b2ab-a24f-4b95-ab81-36439e1478de:v1 - // insert your protected definitions here - // ev@4714b2ab-a24f-4b95-ab81-36439e1478de:v1 - -private: - friend class LdEverest; - void init(); - void ready(); - - // ev@211cfdbe-f69a-4cd6-a4ec-f8aaa3d1b6c8:v1 - // insert your private definitions here - // ev@211cfdbe-f69a-4cd6-a4ec-f8aaa3d1b6c8:v1 -}; - -// ev@087e516b-124c-48df-94fb-109508c7cda9:v1 -// insert other definitions here -// ev@087e516b-124c-48df-94fb-109508c7cda9:v1 - -} // namespace module - -#endif // SUNSPEC_READER_HPP diff --git a/modules/deprecated/SunspecReader/main/sunspec_readerImpl.cpp b/modules/deprecated/SunspecReader/main/sunspec_readerImpl.cpp deleted file mode 100644 index d611a7a7c..000000000 --- a/modules/deprecated/SunspecReader/main/sunspec_readerImpl.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "sunspec_readerImpl.hpp" - -using namespace everest; - -namespace module { -namespace main { - -void sunspec_readerImpl::init() { - - EVLOG_debug << "Initializing SunspecReader module..."; - try { - EVLOG_debug << "Trying to make TCP connection..."; - this->tcp_connection = std::make_unique(config.ip_address, config.port); - EVLOG_debug << "Trying to initialize MODBUS TCP client..."; - this->mb_client = std::make_unique(*this->tcp_connection); - EVLOG_debug << "Trying to initialize Sunspec device mapping..."; - this->sdm = std::make_unique(*this->mb_client, config.unit); - EVLOG_debug << "Trying to scan SunspecDeviceMapping..."; - this->sdm->scan(); - EVLOG_debug << "Initializing reader after scan..."; - this->reader = std::make_unique>(config.query, *this->sdm); - } catch (std::exception& e) { - EVLOG_error << "Error during SunspecReader initialization: " << e.what() << "\n"; - this->tcp_connection = nullptr; - this->mb_client = nullptr; - this->sdm = nullptr; - this->reader = nullptr; - } -} - -void sunspec_readerImpl::ready() { - if (this->reader != nullptr) { - this->read_loop_thread = std::thread([this] { run_read_loop(); }); - } else { - EVLOG_error << "SunspecReader initialization failed. Skipping read step."; - } -} - -void sunspec_readerImpl::run_read_loop() { - std::chrono::time_point tp_loop; - tp_loop = date::utc_clock::now(); - while (true) { - - if (this->read_loop_thread.shouldExit()) - break; - - // Reading - std::this_thread::sleep_until(tp_loop); - tp_loop += std::chrono::milliseconds(config.read_interval); - uint16_t read_value = this->reader->read(); - double converted_read_value = sunspec::utils::apply_scale_factor(read_value, reader->get_scale_factor()); - uint64_t timestamp = - std::chrono::duration_cast(date::utc_clock::now().time_since_epoch()).count(); - - // Publishing - Everest::json j; - j["timestamp"] = timestamp; - j["value"] = converted_read_value; - EVLOG_debug << "SunspecReader::run_read_loop() - Publishing: " << j; - publish_measurement(j); - } -} - -} // namespace main -} // namespace module diff --git a/modules/deprecated/SunspecReader/main/sunspec_readerImpl.hpp b/modules/deprecated/SunspecReader/main/sunspec_readerImpl.hpp deleted file mode 100644 index 88ce0c05b..000000000 --- a/modules/deprecated/SunspecReader/main/sunspec_readerImpl.hpp +++ /dev/null @@ -1,83 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Pionix GmbH and Contributors to EVerest -#ifndef MAIN_SUNSPEC_READER_IMPL_HPP -#define MAIN_SUNSPEC_READER_IMPL_HPP - -// -// AUTO GENERATED - MARKED REGIONS WILL BE KEPT -// template version 3 -// - -#include - -#include "../SunspecReader.hpp" - -// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1 -// insert your custom include headers here -#include -#include -#include -#include -#include -#include - -#include -#include -#include -// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1 - -namespace module { -namespace main { - -struct Conf { - std::string ip_address; - int port; - int unit; - std::string query; - int read_interval; -}; - -class sunspec_readerImpl : public sunspec_readerImplBase { -public: - sunspec_readerImpl() = delete; - sunspec_readerImpl(Everest::ModuleAdapter* ev, const Everest::PtrContainer& mod, Conf& config) : - sunspec_readerImplBase(ev, "main"), mod(mod), config(config){}; - - // ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1 - // insert your public definitions here - // ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1 - -protected: - // no commands defined for this interface - - // ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1 - // insert your protected definitions here - // ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1 - -private: - const Everest::PtrContainer& mod; - const Conf& config; - - virtual void init() override; - virtual void ready() override; - - // ev@3370e4dd-95f4-47a9-aaec-ea76f34a66c9:v1 - // insert your private definitions here - void run_read_loop(); - - std::unique_ptr tcp_connection; - std::unique_ptr mb_client; - std::unique_ptr sdm; - std::unique_ptr> reader; - Everest::Thread read_loop_thread; - // ev@3370e4dd-95f4-47a9-aaec-ea76f34a66c9:v1 -}; - -// ev@3d7da0ad-02c2-493d-9920-0bbbd56b9876:v1 -// insert other definitions here -// ev@3d7da0ad-02c2-493d-9920-0bbbd56b9876:v1 - -} // namespace main -} // namespace module - -#endif // MAIN_SUNSPEC_READER_IMPL_HPP diff --git a/modules/deprecated/SunspecReader/manifest.yaml b/modules/deprecated/SunspecReader/manifest.yaml deleted file mode 100644 index f982a2333..000000000 --- a/modules/deprecated/SunspecReader/manifest.yaml +++ /dev/null @@ -1,32 +0,0 @@ -description: >- - Module that collects measurements from a Sunspec-conformant device, given a string formatted input query. -provides: - main: - description: This is the main unit of the module - interface: sunspec_reader - config: - ip_address: - description: IP address of device to be read. - type: string - pattern: ^\b(?:(?:2(?:[0-4][0-9]|5[0-5])|[0-1]?[0-9]?[0-9])\.){3}(?:(?:2([0-4][0-9]|5[0-5])|[0-1]?[0-9]?[0-9]))\b$ - port: - description: TCP port number. - type: integer - minimum: 0 - unit: - description: MODBUS unit ID. - type: integer - minimum: 0 - query: - description: Query string in the predefined format. - type: string - pattern: ^<[0-9]+>::<[a-zA-Z]+>::<[a-zA-Z]+>$ - read_interval: - description: Polling interval for read (in milliseconds). - type: integer -enable_external_mqtt: true -metadata: - license: https://opensource.org/licenses/Apache-2.0 - authors: - - Andreas Heinrich - - Leonardo Fernandes diff --git a/modules/deprecated/SunspecScanner/CMakeLists.txt b/modules/deprecated/SunspecScanner/CMakeLists.txt deleted file mode 100644 index 49377d09a..000000000 --- a/modules/deprecated/SunspecScanner/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# -# AUTO GENERATED - MARKED REGIONS WILL BE KEPT -# template version 3 -# - -# module setup: -# - ${MODULE_NAME}: module name -ev_setup_cpp_module() - -# ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1 -target_link_libraries(${MODULE_NAME} - PRIVATE - everest::sunspec -) -# ev@bcc62523-e22b-41d7-ba2f-825b493a3c97:v1 - -target_sources(${MODULE_NAME} - PRIVATE - "main/sunspec_scannerImpl.cpp" -) - -# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1 -# insert other things like install cmds etc here -# ev@c55432ab-152c-45a9-9d2e-7281d50c69c3:v1 diff --git a/modules/deprecated/SunspecScanner/SunspecScanner.cpp b/modules/deprecated/SunspecScanner/SunspecScanner.cpp deleted file mode 100644 index a6dab20e5..000000000 --- a/modules/deprecated/SunspecScanner/SunspecScanner.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "SunspecScanner.hpp" - -namespace module { - -void SunspecScanner::init() { - invoke_init(*p_main); -} - -void SunspecScanner::ready() { - invoke_ready(*p_main); -} - -} // namespace module diff --git a/modules/deprecated/SunspecScanner/SunspecScanner.hpp b/modules/deprecated/SunspecScanner/SunspecScanner.hpp deleted file mode 100644 index fa4086dce..000000000 --- a/modules/deprecated/SunspecScanner/SunspecScanner.hpp +++ /dev/null @@ -1,60 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Pionix GmbH and Contributors to EVerest -#ifndef SUNSPEC_SCANNER_HPP -#define SUNSPEC_SCANNER_HPP - -// -// AUTO GENERATED - MARKED REGIONS WILL BE KEPT -// template version 1 -// - -#include "ld-ev.hpp" - -// headers for provided interface implementations -#include - -// ev@4bf81b14-a215-475c-a1d3-0a484ae48918:v1 -// insert your custom include headers here -// ev@4bf81b14-a215-475c-a1d3-0a484ae48918:v1 - -namespace module { - -struct Conf {}; - -class SunspecScanner : public Everest::ModuleBase { -public: - SunspecScanner() = delete; - SunspecScanner(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider, - std::unique_ptr p_main, Conf& config) : - ModuleBase(info), mqtt(mqtt_provider), p_main(std::move(p_main)), config(config){}; - - const Conf& config; - Everest::MqttProvider& mqtt; - const std::unique_ptr p_main; - - // ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1 - // insert your public definitions here - // ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1 - -protected: - // ev@4714b2ab-a24f-4b95-ab81-36439e1478de:v1 - // insert your protected definitions here - // ev@4714b2ab-a24f-4b95-ab81-36439e1478de:v1 - -private: - friend class LdEverest; - void init(); - void ready(); - - // ev@211cfdbe-f69a-4cd6-a4ec-f8aaa3d1b6c8:v1 - // insert your private definitions here - // ev@211cfdbe-f69a-4cd6-a4ec-f8aaa3d1b6c8:v1 -}; - -// ev@087e516b-124c-48df-94fb-109508c7cda9:v1 -// insert other definitions here -// ev@087e516b-124c-48df-94fb-109508c7cda9:v1 - -} // namespace module - -#endif // SUNSPEC_SCANNER_HPP diff --git a/modules/deprecated/SunspecScanner/main/sunspec_scannerImpl.cpp b/modules/deprecated/SunspecScanner/main/sunspec_scannerImpl.cpp deleted file mode 100644 index 03e9ccc04..000000000 --- a/modules/deprecated/SunspecScanner/main/sunspec_scannerImpl.cpp +++ /dev/null @@ -1,115 +0,0 @@ -#include "sunspec_scannerImpl.hpp" - -using namespace everest; - -namespace module { -namespace main { - -json get_sunspec_device_mapping_information(const sunspec::SunspecDeviceMapping& sdm, const std::string& ip_address, - const int& port, const int& unit) { - - json result; - result["data"] = json::array(); - std::stringstream result_message; - for (int i = 0; i < sdm.get_devices().size(); i++) { - // Looping through each device and getting general information - const auto& device = sdm.get_devices()[i]; - json device_information = device->get_device_information(); - json el_device; - el_device["ip-address"] = ip_address; - el_device["port"] = port; - el_device["unit"] = unit; - el_device["index"] = i; - el_device["manufacturer"] = device_information["Mn"]; - el_device["device_model"] = device_information["Md"]; - el_device["version"] = device_information["Vn"]; - el_device["serial_number"] = device_information["SN"]; - el_device["models"] = json::array(); - for (const auto& model : device->get_models()) { - // Getting information from each model within the logical device - json el_model; - el_model["id"] = model->model_id; - el_model["name"] = model->get_name(); - el_device["models"].push_back(el_model); - } - result["data"].push_back(el_device); - } - - if (result["data"].size() > 0) { - result_message << "SUNSPEC device found at given address and unit ID. Scanning process finished successfully."; - result["success"] = true; - } - - result["message"] = result_message.str(); - EVLOG_debug << "Returning result from SunspecScanner callback: " << result; - - return result; -} - -json scan_unit(const std::string& ip_address, const int& port, const int& unit) { - - json result; - - // Attempting scan - std::stringstream result_message; - try { - connection::TCPConnection connection_(ip_address, port); - modbus::ModbusIPClient modbus_client(connection_); - sunspec::SunspecDeviceMapping sdm(modbus_client, unit); - EVLOG_debug << "Trying to scan SunspecDeviceMapping..."; - sdm.scan(); - EVLOG_debug << "Trying to obtain scanned device mapping information..."; - return get_sunspec_device_mapping_information(sdm, ip_address, port, unit); - } - - catch (connection::exceptions::connection_error& e) { - result_message << "No device found in the specified given IP address and port. " << e.what(); - result["message"] = result_message.str(); - EVLOG_error << result["message"]; - result["success"] = false; - return result; - } catch (std::exception& e) { - result_message << e.what(); - result["message"] = result_message.str(); - EVLOG_error << result["message"]; - result["success"] = false; - return result; - } -} - -void sunspec_scannerImpl::init() { - // Subscribing to nodered interface topics - mod->mqtt.subscribe("/external/cmd/scan_unit", [this](std::string request_str) { - json request = json::parse(request_str); - std::string ip_address = request["ip_address"]; - int unit = request["unit"]; - int port = request["port"]; - const auto& scan_result = scan_unit(ip_address, port, unit); - this->mod->mqtt.publish("/external/cmd/scan_unit/res", scan_result.dump()); - }); -} - -void sunspec_scannerImpl::ready() { -} - -Object sunspec_scannerImpl::handle_scan_unit(std::string& ip_address, int& port, int& unit) { - return scan_unit(ip_address, port, unit); -}; - -Object sunspec_scannerImpl::handle_scan_port(std::string& ip_address, int& port) { - // your code for cmd scan_port goes here - return {}; -}; - -Object sunspec_scannerImpl::handle_scan_device(std::string& ip_address) { - // your code for cmd scan_device goes here - return {}; -}; - -Object sunspec_scannerImpl::handle_scan_network() { - // your code for cmd scan_network goes here - return {}; -}; - -} // namespace main -} // namespace module diff --git a/modules/deprecated/SunspecScanner/main/sunspec_scannerImpl.hpp b/modules/deprecated/SunspecScanner/main/sunspec_scannerImpl.hpp deleted file mode 100644 index 70dcab16d..000000000 --- a/modules/deprecated/SunspecScanner/main/sunspec_scannerImpl.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright Pionix GmbH and Contributors to EVerest -#ifndef MAIN_SUNSPEC_SCANNER_IMPL_HPP -#define MAIN_SUNSPEC_SCANNER_IMPL_HPP - -// -// AUTO GENERATED - MARKED REGIONS WILL BE KEPT -// template version 3 -// - -#include - -#include "../SunspecScanner.hpp" - -// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1 -#include - -#include -#include -#include -#include -#include -// ev@75ac1216-19eb-4182-a85c-820f1fc2c091:v1 - -namespace module { -namespace main { - -struct Conf {}; - -class sunspec_scannerImpl : public sunspec_scannerImplBase { -public: - sunspec_scannerImpl() = delete; - sunspec_scannerImpl(Everest::ModuleAdapter* ev, const Everest::PtrContainer& mod, Conf& config) : - sunspec_scannerImplBase(ev, "main"), mod(mod), config(config){}; - - // ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1 - // insert your public definitions here - // ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1 - -protected: - // command handler functions (virtual) - virtual Object handle_scan_unit(std::string& ip_address, int& port, int& unit) override; - virtual Object handle_scan_port(std::string& ip_address, int& port) override; - virtual Object handle_scan_device(std::string& ip_address) override; - virtual Object handle_scan_network() override; - - // ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1 - // insert your protected definitions here - // ev@d2d1847a-7b88-41dd-ad07-92785f06f5c4:v1 - -private: - const Everest::PtrContainer& mod; - const Conf& config; - - virtual void init() override; - virtual void ready() override; - - // ev@3370e4dd-95f4-47a9-aaec-ea76f34a66c9:v1 - // insert your private definitions here - // ev@3370e4dd-95f4-47a9-aaec-ea76f34a66c9:v1 -}; - -// ev@3d7da0ad-02c2-493d-9920-0bbbd56b9876:v1 -// insert other definitions here -// ev@3d7da0ad-02c2-493d-9920-0bbbd56b9876:v1 - -} // namespace main -} // namespace module - -#endif // MAIN_SUNSPEC_SCANNER_IMPL_HPP diff --git a/modules/deprecated/SunspecScanner/manifest.yaml b/modules/deprecated/SunspecScanner/manifest.yaml deleted file mode 100644 index 3f72001fe..000000000 --- a/modules/deprecated/SunspecScanner/manifest.yaml +++ /dev/null @@ -1,11 +0,0 @@ -description: Module to implement a scan for Sunspec compliant devices -provides: - main: - description: This is the main unit of the module - interface: sunspec_scanner -enable_external_mqtt: true -metadata: - license: https://opensource.org/licenses/Apache-2.0 - authors: - - Andreas Heinrich - - Leonardo Fernandes diff --git a/modules/examples/Example/Example.hpp b/modules/examples/Example/Example.hpp index e3eb2e7a7..21f7c1701 100644 --- a/modules/examples/Example/Example.hpp +++ b/modules/examples/Example/Example.hpp @@ -5,7 +5,7 @@ // // AUTO GENERATED - MARKED REGIONS WILL BE KEPT -// template version 1 +// template version 2 // #include "ld-ev.hpp" @@ -28,20 +28,23 @@ struct Conf {}; class Example : public Everest::ModuleBase { public: Example() = delete; - Example(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider, std::unique_ptr p_example, + Example(const ModuleInfo& info, Everest::MqttProvider& mqtt_provider, + Everest::WatchdogSupervisor& watchdog_supervisor, std::unique_ptr p_example, std::unique_ptr p_store, std::unique_ptr r_kvs, Conf& config) : ModuleBase(info), mqtt(mqtt_provider), + watchdog_supervisor(watchdog_supervisor), p_example(std::move(p_example)), p_store(std::move(p_store)), r_kvs(std::move(r_kvs)), config(config){}; - const Conf& config; Everest::MqttProvider& mqtt; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_example; const std::unique_ptr p_store; const std::unique_ptr r_kvs; + const Conf& config; // ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1 // insert your public definitions here diff --git a/modules/examples/ExampleUser/ExampleUser.hpp b/modules/examples/ExampleUser/ExampleUser.hpp index b91b84e3a..4a0aa3547 100644 --- a/modules/examples/ExampleUser/ExampleUser.hpp +++ b/modules/examples/ExampleUser/ExampleUser.hpp @@ -5,7 +5,7 @@ // // AUTO GENERATED - MARKED REGIONS WILL BE KEPT -// template version 1 +// template version 2 // #include "ld-ev.hpp" @@ -27,13 +27,19 @@ struct Conf {}; class ExampleUser : public Everest::ModuleBase { public: ExampleUser() = delete; - ExampleUser(const ModuleInfo& info, std::unique_ptr p_example_user, - std::unique_ptr r_example, Conf& config) : - ModuleBase(info), p_example_user(std::move(p_example_user)), r_example(std::move(r_example)), config(config){}; - - const Conf& config; + ExampleUser(const ModuleInfo& info, Everest::WatchdogSupervisor& watchdog_supervisor, + std::unique_ptr p_example_user, std::unique_ptr r_example, + Conf& config) : + ModuleBase(info), + watchdog_supervisor(watchdog_supervisor), + p_example_user(std::move(p_example_user)), + r_example(std::move(r_example)), + config(config){}; + + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_example_user; const std::unique_ptr r_example; + const Conf& config; // ev@1fce4c5e-0ab8-41bb-90f7-14277703d2ac:v1 // insert your public definitions here diff --git a/modules/simulation/DCSupplySimulator/DCSupplySimulator.hpp b/modules/simulation/DCSupplySimulator/DCSupplySimulator.hpp index daf5a827d..48db17a75 100644 --- a/modules/simulation/DCSupplySimulator/DCSupplySimulator.hpp +++ b/modules/simulation/DCSupplySimulator/DCSupplySimulator.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright chargebyte GmbH and Contributors to EVerest +// Copyright Pionix GmbH and Contributors to EVerest #ifndef DCSUPPLY_SIMULATOR_HPP #define DCSUPPLY_SIMULATOR_HPP @@ -24,9 +24,11 @@ struct Conf {}; class DCSupplySimulator : public Everest::ModuleBase { public: DCSupplySimulator() = delete; - DCSupplySimulator(const ModuleInfo& info, std::unique_ptr p_main, Conf& config) : - ModuleBase(info), p_main(std::move(p_main)), config(config){}; + DCSupplySimulator(const ModuleInfo& info, Everest::WatchdogSupervisor& watchdog_supervisor, + std::unique_ptr p_main, Conf& config) : + ModuleBase(info), watchdog_supervisor(watchdog_supervisor), p_main(std::move(p_main)), config(config){}; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; const Conf& config; diff --git a/modules/simulation/DCSupplySimulator/main/power_supply_DCImpl.hpp b/modules/simulation/DCSupplySimulator/main/power_supply_DCImpl.hpp index 2a3dfc30f..bf09b504e 100644 --- a/modules/simulation/DCSupplySimulator/main/power_supply_DCImpl.hpp +++ b/modules/simulation/DCSupplySimulator/main/power_supply_DCImpl.hpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright chargebyte GmbH and Contributors to EVerest +// Copyright Pionix GmbH and Contributors to EVerest #ifndef MAIN_POWER_SUPPLY_DC_IMPL_HPP #define MAIN_POWER_SUPPLY_DC_IMPL_HPP diff --git a/modules/simulation/IMDSimulator/IMDSimulator.hpp b/modules/simulation/IMDSimulator/IMDSimulator.hpp index a4f5f124c..47cd9da3f 100644 --- a/modules/simulation/IMDSimulator/IMDSimulator.hpp +++ b/modules/simulation/IMDSimulator/IMDSimulator.hpp @@ -24,9 +24,11 @@ struct Conf {}; class IMDSimulator : public Everest::ModuleBase { public: IMDSimulator() = delete; - IMDSimulator(const ModuleInfo& info, std::unique_ptr p_main, Conf& config) : - ModuleBase(info), p_main(std::move(p_main)), config(config){}; + IMDSimulator(const ModuleInfo& info, Everest::WatchdogSupervisor& watchdog_supervisor, + std::unique_ptr p_main, Conf& config) : + ModuleBase(info), watchdog_supervisor(watchdog_supervisor), p_main(std::move(p_main)), config(config){}; + Everest::WatchdogSupervisor& watchdog_supervisor; const std::unique_ptr p_main; const Conf& config; diff --git a/modules/simulation/IMDSimulator/main/isolation_monitorImpl.cpp b/modules/simulation/IMDSimulator/main/isolation_monitorImpl.cpp index 862f94b02..9fe7720a8 100644 --- a/modules/simulation/IMDSimulator/main/isolation_monitorImpl.cpp +++ b/modules/simulation/IMDSimulator/main/isolation_monitorImpl.cpp @@ -18,9 +18,6 @@ void isolation_monitorImpl::init() { void isolation_monitorImpl::ready() { } -isolation_monitorImpl::~isolation_monitorImpl() { -} - void isolation_monitorImpl::handle_start() { if (this->isolation_monitoring_active == false) { this->isolation_monitoring_active = true; diff --git a/modules/simulation/IMDSimulator/main/isolation_monitorImpl.hpp b/modules/simulation/IMDSimulator/main/isolation_monitorImpl.hpp index 106caa497..28f21c28c 100644 --- a/modules/simulation/IMDSimulator/main/isolation_monitorImpl.hpp +++ b/modules/simulation/IMDSimulator/main/isolation_monitorImpl.hpp @@ -1,6 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright (C) 2023 chargebyte GmbH -// Copyright (C) 2023 Contributors to EVerest +// Copyright Pionix GmbH and Contributors to EVerest #ifndef MAIN_ISOLATION_MONITOR_IMPL_HPP #define MAIN_ISOLATION_MONITOR_IMPL_HPP @@ -33,7 +32,6 @@ class isolation_monitorImpl : public isolation_monitorImplBase { isolation_monitorImpl() = delete; isolation_monitorImpl(Everest::ModuleAdapter* ev, const Everest::PtrContainer& mod, Conf& config) : isolation_monitorImplBase(ev, "main"), mod(mod), config(config){}; - ~isolation_monitorImpl(); // ev@8ea32d28-373f-4c90-ae5e-b4fcc74e2a61:v1 // insert your public definitions here