1 #pragma once 2 3 #include "base_port.hpp" 4 5 #include <sdbusplus/async.hpp> 6 7 #include <string> 8 #include <vector> 9 10 namespace phosphor::modbus::rtu::port 11 { 12 13 namespace config 14 { 15 16 enum class PortType 17 { 18 usb, 19 unknown 20 }; 21 22 struct PortFactoryConfig : public Config 23 { 24 PortType portType = PortType::unknown; 25 26 virtual ~PortFactoryConfig() = default; 27 }; 28 29 } // namespace config 30 31 class PortFactory 32 { 33 public: 34 static auto getInterfaces() -> std::vector<std::string>; 35 36 static auto getConfig(sdbusplus::async::context& ctx, 37 const sdbusplus::message::object_path& objectPath, 38 const std::string& interfaceName) 39 -> sdbusplus::async::task<std::unique_ptr<config::PortFactoryConfig>>; 40 41 static auto create(sdbusplus::async::context& ctx, 42 const config::PortFactoryConfig& config) 43 -> std::unique_ptr<BasePort>; 44 }; 45 46 } // namespace phosphor::modbus::rtu::port 47