1*e92aba45SJagpal Singh Gill #pragma once 2*e92aba45SJagpal Singh Gill 3*e92aba45SJagpal Singh Gill #include "base_config.hpp" 4*e92aba45SJagpal Singh Gill #include "modbus/modbus.hpp" 5*e92aba45SJagpal Singh Gill #include "port/base_port.hpp" 6*e92aba45SJagpal Singh Gill 7*e92aba45SJagpal Singh Gill #include <sdbusplus/async.hpp> 8*e92aba45SJagpal Singh Gill #include <xyz/openbmc_project/Sensor/Value/aserver.hpp> 9*e92aba45SJagpal Singh Gill 10*e92aba45SJagpal Singh Gill namespace phosphor::modbus::rtu::device 11*e92aba45SJagpal Singh Gill { 12*e92aba45SJagpal Singh Gill 13*e92aba45SJagpal Singh Gill class Device; 14*e92aba45SJagpal Singh Gill 15*e92aba45SJagpal Singh Gill using SensorValueIntf = 16*e92aba45SJagpal Singh Gill sdbusplus::aserver::xyz::openbmc_project::sensor::Value<Device>; 17*e92aba45SJagpal Singh Gill using PortIntf = phosphor::modbus::rtu::port::BasePort; 18*e92aba45SJagpal Singh Gill 19*e92aba45SJagpal Singh Gill class BaseDevice 20*e92aba45SJagpal Singh Gill { 21*e92aba45SJagpal Singh Gill public: 22*e92aba45SJagpal Singh Gill BaseDevice() = delete; 23*e92aba45SJagpal Singh Gill 24*e92aba45SJagpal Singh Gill explicit BaseDevice(sdbusplus::async::context& ctx, 25*e92aba45SJagpal Singh Gill const config::Config& config, PortIntf& serialPort); 26*e92aba45SJagpal Singh Gill 27*e92aba45SJagpal Singh Gill auto readSensorRegisters() -> sdbusplus::async::task<void>; 28*e92aba45SJagpal Singh Gill 29*e92aba45SJagpal Singh Gill private: 30*e92aba45SJagpal Singh Gill auto createSensors() -> void; 31*e92aba45SJagpal Singh Gill 32*e92aba45SJagpal Singh Gill using sensors_map_t = 33*e92aba45SJagpal Singh Gill std::unordered_map<std::string, std::unique_ptr<SensorValueIntf>>; 34*e92aba45SJagpal Singh Gill sdbusplus::async::context& ctx; 35*e92aba45SJagpal Singh Gill const config::Config config; 36*e92aba45SJagpal Singh Gill PortIntf& serialPort; 37*e92aba45SJagpal Singh Gill sensors_map_t sensors; 38*e92aba45SJagpal Singh Gill }; 39*e92aba45SJagpal Singh Gill 40*e92aba45SJagpal Singh Gill } // namespace phosphor::modbus::rtu::device 41