1 #pragma once 2 3 #include "device/base_config.hpp" 4 #include "port/base_port.hpp" 5 6 #include <sdbusplus/async.hpp> 7 #include <sdbusplus/async/server.hpp> 8 #include <xyz/openbmc_project/Association/Definitions/aserver.hpp> 9 #include <xyz/openbmc_project/Software/Activation/aserver.hpp> 10 #include <xyz/openbmc_project/Software/Version/aserver.hpp> 11 12 namespace phosphor::modbus::rtu::device 13 { 14 15 namespace config 16 { 17 18 struct Config; 19 20 } // namespace config 21 22 namespace config_intf = phosphor::modbus::rtu::device::config; 23 using PortIntf = phosphor::modbus::rtu::port::BasePort; 24 25 class DeviceFirmware; 26 27 using FirmwareIntf = sdbusplus::async::server_t< 28 DeviceFirmware, sdbusplus::aserver::xyz::openbmc_project::software::Version, 29 sdbusplus::aserver::xyz::openbmc_project::software::Activation, 30 sdbusplus::aserver::xyz::openbmc_project::association::Definitions>; 31 32 class DeviceFirmware 33 { 34 public: 35 DeviceFirmware() = delete; 36 37 explicit DeviceFirmware(sdbusplus::async::context& ctx, 38 const config_intf::Config& config, 39 PortIntf& serialPort); 40 41 auto readVersionRegister() -> sdbusplus::async::task<void>; 42 43 protected: 44 // Object path of current firmware object 45 // TODO: check if its possible to get rid off this via mocking since its 46 // only used in tests 47 const sdbusplus::message::object_path objectPath; 48 49 private: 50 std::unique_ptr<FirmwareIntf> currentFirmware; 51 const config_intf::Config config; 52 PortIntf& serialPort; 53 }; 54 55 } // namespace phosphor::modbus::rtu::device 56