control: Add init trigger support
Add init trigger support to the available triggers where init triggered
event actions are run immediately when fan control starts. Initially the
`getProperties` and `nameHasOwner` methods are supported to be triggered
when fan control starts. The `getProperties` method populates the dbus
object cache for each group member's property configured. The
`nameHasOwner` method populates the service owned state from dbus for
each group member. Each of these attempts to do bulk
reads(getManagedObjects for `getProperties` and getSubTree for
`nameHasOwner`) from dbus when populating the caches to minimize dbus
calls.
Change-Id: Ib5d89eceadd26db1bf7610113ea30fc8ba69ab12
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/triggers/trigger.hpp b/control/json/triggers/trigger.hpp
index eff36c6..4e7e213 100644
--- a/control/json/triggers/trigger.hpp
+++ b/control/json/triggers/trigger.hpp
@@ -16,6 +16,7 @@
#pragma once
#include "action.hpp"
+#include "init.hpp"
#include "manager.hpp"
#include "signal.hpp"
#include "timer.hpp"
@@ -39,6 +40,8 @@
// Mapping of trigger class name to its creation function
static const std::map<std::string, createTrigger> triggers = {
- {"timer", timer::triggerTimer}, {"signal", signal::triggerSignal}};
+ {"timer", timer::triggerTimer},
+ {"signal", signal::triggerSignal},
+ {"init", init::triggerInit}};
} // namespace phosphor::fan::control::json::trigger