Kevin Tung | 994a77f | 2024-12-23 17:48:56 +0800 | [diff] [blame^] | 1 | #pragma once |
| 2 | |
| 3 | #include "common/include/host_power.hpp" |
| 4 | |
| 5 | #include <cstdint> |
| 6 | #include <memory> |
| 7 | #include <optional> |
| 8 | #include <string> |
| 9 | |
| 10 | namespace HostPowerInf = phosphor::software::host_power; |
| 11 | |
| 12 | class DeviceVersion |
| 13 | { |
| 14 | public: |
| 15 | DeviceVersion(const std::string& chipModel, const uint16_t bus, |
| 16 | const uint8_t address) : |
| 17 | chipModel(chipModel), bus(bus), address(address) |
| 18 | {} |
| 19 | |
| 20 | virtual std::string getVersion() = 0; |
| 21 | virtual std::optional<HostPowerInf::HostState> |
| 22 | getHostStateToQueryVersion() = 0; |
| 23 | |
| 24 | virtual ~DeviceVersion() = default; |
| 25 | DeviceVersion(const DeviceVersion&) = delete; |
| 26 | DeviceVersion& operator=(const DeviceVersion&) = delete; |
| 27 | DeviceVersion(DeviceVersion&&) = delete; |
| 28 | DeviceVersion& operator=(DeviceVersion&&) = delete; |
| 29 | |
| 30 | protected: |
| 31 | std::string chipModel; |
| 32 | uint16_t bus; |
| 33 | uint8_t address; |
| 34 | }; |
| 35 | |
| 36 | std::unique_ptr<DeviceVersion> getVersionProvider( |
| 37 | const std::string& chipModel, uint16_t bus, uint8_t address); |