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 19 static const char* path(); 20 static const char* interface(); 21 22 void setValue(double); 23 double getValue() const; 24 25 struct Properties 26 { 27 static const char* value(); 28 }; 29 30 static constexpr Properties property = {}; 31 32 private: 33 boost::asio::io_context& ioc; 34 std::shared_ptr<sdbusplus::asio::connection> bus; 35 std::shared_ptr<sdbusplus::asio::object_server> objServer; 36 37 std::unique_ptr<sdbusplus::asio::dbus_interface> sensorIface; 38 39 double value = 0.0; 40 }; 41 42 } // namespace stubs 43