Implemented sensor class

Sensor class was introduced, it monitors
xyz.openbmc_project.Sensor.Value, for change and notifies all
listeners.

Tested:
  - Unit tested with service stub that provides dbus interface
    xyz.openbmc_project.Sensor.Value
  - All changes are delivered to listeners
  - All other unit tests are passing

Change-Id: I8c9d58cc986c1fe2a4d2386815d559814016efa6
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
diff --git a/tests/src/stubs/dbus_sensor_object.cpp b/tests/src/stubs/dbus_sensor_object.cpp
new file mode 100644
index 0000000..c3d4170
--- /dev/null
+++ b/tests/src/stubs/dbus_sensor_object.cpp
@@ -0,0 +1,59 @@
+#include "dbus_sensor_object.hpp"
+
+#include <boost/asio.hpp>
+#include <sdbusplus/asio/connection.hpp>
+#include <sdbusplus/asio/object_server.hpp>
+#include <sdbusplus/bus.hpp>
+
+namespace stubs
+{
+
+DbusSensorObject::DbusSensorObject(
+    boost::asio::io_context& ioc,
+    const std::shared_ptr<sdbusplus::asio::connection>& bus,
+    const std::shared_ptr<sdbusplus::asio::object_server>& objServer) :
+    ioc(ioc),
+    bus(bus), objServer(objServer)
+{
+    sensorIface = objServer->add_interface(path(), interface());
+
+    sensorIface->register_property_r(property.value(), double{},
+                                     sdbusplus::vtable::property_::emits_change,
+                                     [this](const auto&) { return value; });
+
+    sensorIface->initialize();
+}
+
+DbusSensorObject::~DbusSensorObject()
+{
+    objServer->remove_interface(sensorIface);
+}
+
+void DbusSensorObject::setValue(double v)
+{
+    value = v;
+
+    sensorIface->signal_property(property.value());
+}
+
+double DbusSensorObject::getValue() const
+{
+    return value;
+}
+
+const char* DbusSensorObject::path()
+{
+    return "/telemetry/ut/DbusSensorObject";
+}
+
+const char* DbusSensorObject::interface()
+{
+    return "xyz.openbmc_project.Sensor.Value";
+}
+
+const char* DbusSensorObject::Properties::value()
+{
+    return "Value";
+}
+
+} // namespace stubs