1 #pragma once 2 3 #include <boost/asio.hpp> 4 #include <sdbusplus/asio/connection.hpp> 5 #include <sdbusplus/asio/object_server.hpp> 6 #include <sdbusplus/bus.hpp> 7 8 namespace stubs 9 { 10 11 class DbusSensorObject 12 { 13 public: 14 DbusSensorObject( 15 boost::asio::io_context& ioc, 16 const std::shared_ptr<sdbusplus::asio::connection>& bus, 17 const std::shared_ptr<sdbusplus::asio::object_server>& objServer); 18 ~DbusSensorObject(); 19 20 static const char* path(); 21 static const char* interface(); 22 23 void setValue(double); 24 double getValue() const; 25 26 struct Properties 27 { 28 static const char* value(); 29 }; 30 31 static constexpr Properties property = {}; 32 33 private: 34 boost::asio::io_context& ioc; 35 std::shared_ptr<sdbusplus::asio::connection> bus; 36 std::shared_ptr<sdbusplus::asio::object_server> objServer; 37 38 std::shared_ptr<sdbusplus::asio::dbus_interface> sensorIface; 39 40 double value = 0.0; 41 }; 42 43 } // namespace stubs 44