#pragma once #include "interfaces/report_manager.hpp" #include "interfaces/trigger_factory.hpp" #include "interfaces/trigger_manager.hpp" #include "trigger.hpp" #include #include #include class TriggerManager : public interfaces::TriggerManager { public: TriggerManager( std::unique_ptr triggerFactory, std::unique_ptr triggerStorage, const std::shared_ptr& objServer); TriggerManager(const TriggerManager&) = delete; TriggerManager(TriggerManager&&) = delete; TriggerManager& operator=(const TriggerManager&) = delete; TriggerManager& operator=(TriggerManager&&) = delete; void removeTrigger(const interfaces::Trigger* trigger) override; static void verifyReportIds(const std::vector& newReportIds); private: std::unique_ptr triggerFactory; std::unique_ptr triggerStorage; std::unique_ptr managerIface; std::vector> triggers; void verifyAddTrigger(const std::string& triggerId, const std::string& triggerName, const std::vector& newReportIds) const; interfaces::Trigger& addTrigger(const std::string& triggerId, const std::string& triggerName, const std::vector& triggerActions, const std::vector& labeledSensors, const std::vector& reportIds, const LabeledTriggerThresholdParams& labeledThresholdParams); void loadFromPersistent(); public: static constexpr size_t maxTriggers{TELEMETRY_MAX_TRIGGERS}; static constexpr size_t maxTriggerIdLength{ TELEMETRY_MAX_DBUS_PATH_LENGTH - std::string_view(Trigger::triggerDir).length()}; static constexpr const char* triggerManagerIfaceName = "xyz.openbmc_project.Telemetry.TriggerManager"; static constexpr const char* triggerManagerPath = "/xyz/openbmc_project/Telemetry/Triggers"; static constexpr const char* triggerNameDefault = "Trigger"; };