control: Add loading JSON configuration class objects
Created a utility function to load the JSON configuration class objects
of a given type that can be used when building the zone groups.
Initially the fan control profiles are being loaded to be used later in
constructing the zone groups.
Tested:
Profiles parsed successfully
Map of parsed profiles available for creating zone groups
Change-Id: I379a46a2ecd17e4e4295131f75ca69b4f371348e
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json_parser.cpp b/control/json_parser.cpp
index 3a0e7c2..9b80706 100644
--- a/control/json_parser.cpp
+++ b/control/json_parser.cpp
@@ -16,6 +16,7 @@
#include "json_parser.hpp"
#include "json/manager.hpp"
+#include "json/profile.hpp"
#include "types.hpp"
#include <sdbusplus/bus.hpp>
@@ -27,6 +28,11 @@
{
std::vector<ZoneGroup> zoneGrps;
+ // Profiles are optional
+ auto profiles = getConfig<json::Profile>(bus, true);
+
+ // TODO Create zone groups after loading all JSON config files
+
return zoneGrps;
}