regulators: Add Sensors to Services hierarchy
Add the Sensors service to the Services hierarchy:
* Add Sensors class to Services
* Add DBusSensors class to BMCServices
* Add MockSensors class to MockServices
Tested:
* DBusSensors
* Acquired DBusSensors reference from BMCServices object
* Successfully executed a sensor monitoring cycle using the reference
* MockSensors
* Acquired MockSensors reference from MockServices object
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: Ida06baed47c0d8711ab3acba71f67df3646ea122
diff --git a/phosphor-regulators/src/services.hpp b/phosphor-regulators/src/services.hpp
index 44d438e..42701c3 100644
--- a/phosphor-regulators/src/services.hpp
+++ b/phosphor-regulators/src/services.hpp
@@ -15,9 +15,11 @@
*/
#pragma once
+#include "dbus_sensors.hpp"
#include "error_logging.hpp"
#include "journal.hpp"
#include "presence_service.hpp"
+#include "sensors.hpp"
#include "vpd.hpp"
#include <sdbusplus/bus.hpp>
@@ -74,6 +76,13 @@
virtual PresenceService& getPresenceService() = 0;
/**
+ * Returns the sensors interface.
+ *
+ * @return sensors interface
+ */
+ virtual Sensors& getSensors() = 0;
+
+ /**
* Returns the interface to hardware VPD (Vital Product Data).
*
* @return hardware VPD interface
@@ -103,7 +112,8 @@
* @param bus D-Bus bus object
*/
explicit BMCServices(sdbusplus::bus::bus& bus) :
- bus{bus}, errorLogging{bus}, presenceService{bus}, vpd{bus}
+ bus{bus}, errorLogging{bus},
+ presenceService{bus}, sensors{bus}, vpd{bus}
{
}
@@ -131,6 +141,12 @@
return presenceService;
}
+ /** @copydoc Services::getSensors() */
+ virtual Sensors& getSensors() override
+ {
+ return sensors;
+ }
+
/** @copydoc Services::getVPD() */
virtual VPD& getVPD() override
{
@@ -160,6 +176,11 @@
DBusPresenceService presenceService;
/**
+ * Implementation of the Sensors interface using D-Bus.
+ */
+ DBusSensors sensors;
+
+ /**
* Implementation of the VPD interface using D-Bus method calls.
*/
DBusVPD vpd;