control: Construct base zone group from JSON
Pulls together the profiles, zones, and fans JSON configurations to
construct a single zone group to be used as fan control's configuration.
This base zone group includes all that is necessary to get a basic fan
control configuration that will hold fans at the zone's given full
speed. A single zone group is created since the active state of any
configured profiles is checked while creating the zone group.
*Note that "profiles" in JSON configs replace what was called
"Conditions" in YAML based configs.
Tested:
Loaded profile based configurations
Loaded non-profile based configurations
Loaded combination of profile and non-profile based configurations
Change-Id: Id010c899a7633824b80c5cef21c848eadfb66243
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json_parser.hpp b/control/json_parser.hpp
index df9c680..7c08875 100644
--- a/control/json_parser.hpp
+++ b/control/json_parser.hpp
@@ -72,6 +72,28 @@
}
/**
+ * @brief Helper function to determine when a configuration entry is included
+ * based on the list of active profiles and its list of profiles
+ *
+ * A configuration entry may include a list of profiles that when any one of
+ * the profiles are active, the entry should be included. When the list of
+ * profiles for a configuration entry is empty, that results in always
+ * including the entry. An empty list of active profiles results in including
+ * only those entries configured without a list of profiles.
+ *
+ * i.e.) No profiles configured results in always being included, whereas
+ * providing a list of profiles on an entry results only in that entry being
+ * included when a profile in the list is active.
+ *
+ * @param[in] activeProfiles - List of active system profiles
+ * @param[in] entryProfiles - List of the configuration entry's profiles
+ *
+ * @return Whether the configuration entry should be included or not
+ */
+bool checkEntry(const std::vector<std::string>& activeProfiles,
+ const std::vector<std::string>& entryProfiles);
+
+/**
* @brief Get the configuration definitions for zone groups
*
* @param[in] bus - The dbus bus object