trigger_manager.cpp (1477fe6a2c2d4e4d49c773fe6b54ae558b06e706) trigger_manager.cpp (f763c9e3bbe0f86a4a41e7bb0dc70bffde0af9b2)
1#include "trigger_manager.hpp"
2
3TriggerManager::TriggerManager(
4 std::unique_ptr<interfaces::TriggerFactory> triggerFactoryIn,
5 const std::shared_ptr<sdbusplus::asio::object_server>& objServer) :
6 triggerFactory(std::move(triggerFactoryIn))
7{
8 managerIface = objServer->add_unique_interface(
9 triggerManagerPath, triggerManagerIfaceName, [this](auto& iface) {
10 iface.register_method(
11 "AddTrigger",
12 [this](
13 boost::asio::yield_context& yield, const std::string& name,
14 bool isDiscrete, bool logToJournal, bool logToRedfish,
15 bool updateReport,
16 const std::vector<std::pair<sdbusplus::message::object_path,
17 std::string>>& sensors,
18 const std::vector<std::string>& reportNames,
19 const TriggerThresholdParams& thresholds) {
1#include "trigger_manager.hpp"
2
3TriggerManager::TriggerManager(
4 std::unique_ptr<interfaces::TriggerFactory> triggerFactoryIn,
5 const std::shared_ptr<sdbusplus::asio::object_server>& objServer) :
6 triggerFactory(std::move(triggerFactoryIn))
7{
8 managerIface = objServer->add_unique_interface(
9 triggerManagerPath, triggerManagerIfaceName, [this](auto& iface) {
10 iface.register_method(
11 "AddTrigger",
12 [this](
13 boost::asio::yield_context& yield, const std::string& name,
14 bool isDiscrete, bool logToJournal, bool logToRedfish,
15 bool updateReport,
16 const std::vector<std::pair<sdbusplus::message::object_path,
17 std::string>>& sensors,
18 const std::vector<std::string>& reportNames,
19 const TriggerThresholdParams& thresholds) {
20 if (isDiscrete)
21 {
22 throw sdbusplus::exception::SdBusError(
23 static_cast<int>(std::errc::not_supported),
24 "Only numeric threshold is supported");
25 }
26
27 if (triggers.size() >= maxTriggers)
28 {
29 throw sdbusplus::exception::SdBusError(
30 static_cast<int>(std::errc::too_many_files_open),
31 "Reached maximal trigger count");
32 }
33
34 for (const auto& trigger : triggers)

--- 24 unchanged lines hidden ---
20 if (triggers.size() >= maxTriggers)
21 {
22 throw sdbusplus::exception::SdBusError(
23 static_cast<int>(std::errc::too_many_files_open),
24 "Reached maximal trigger count");
25 }
26
27 for (const auto& trigger : triggers)

--- 24 unchanged lines hidden ---