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 27 } // namespace config 28 29 class PortFactory 30 { 31 public: 32 static auto getInterfaces() -> std::vector<std::string>; 33 34 static auto getConfig(sdbusplus::async::context& ctx, 35 const sdbusplus::message::object_path& objectPath, 36 const std::string& interfaceName) 37 -> sdbusplus::async::task<std::optional<config::PortFactoryConfig>>; 38 39 static auto create(sdbusplus::async::context& ctx, 40 config::PortFactoryConfig& config) 41 -> std::unique_ptr<BasePort>; 42 }; 43 44 } // namespace phosphor::modbus::rtu::port 45