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