Add support for dbus parameter

Added support for parameter type dbus sensor and utility functions
to read dbus sensor value.

Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
Change-Id: I04db0016f312edea095442a693500c3b4e571d6c
diff --git a/virtualSensor.hpp b/virtualSensor.hpp
index a49c94f..6b11eb4 100644
--- a/virtualSensor.hpp
+++ b/virtualSensor.hpp
@@ -1,3 +1,5 @@
+#include "dbusSensor.hpp"
+
 #include <nlohmann/json.hpp>
 #include <sdbusplus/bus.hpp>
 #include <xyz/openbmc_project/Sensor/Threshold/Critical/server.hpp>
@@ -44,11 +46,22 @@
     explicit SensorParam(double value) : value(value), paramType(constParam)
     {}
 
+    /** @brief Constructs SensorParam (type = dbusParam)
+     *
+     * @param[in] bus     - Handle to system dbus
+     * @param[in] path    - The Dbus path of sensor
+     */
+    SensorParam(sdbusplus::bus::bus& bus, std::string path) :
+        dbusSensor(std::make_unique<DbusSensor>(bus, path)),
+        paramType(dbusParam)
+    {}
+
     /** @brief Get sensor value property from D-bus interface */
     double getParamValue();
 
   private:
-    double value;
+    std::unique_ptr<DbusSensor> dbusSensor = nullptr;
+    double value = 0;
     ParamType paramType;
 };