rtu: add serial port interface
Add the interface classes for serial port with Port Factory classes to
make the code extensible for future in case a new hardware port type is
introduced. This also makes the unit testing easy by creating a Mock
Port using socat.
Tested:
```
meson test -C builddir test_port
ninja: Entering directory `/host/repos/Modbus/phosphor-modbus/builddir'
ninja: no work to do.
1/1 test_port OK 5.02s
Ok: 1
Fail: 0
```
Change-Id: Ic6bd982abf1ae993f76c39e3503d3a0402a692fe
Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
diff --git a/rtu/port/usb_port.hpp b/rtu/port/usb_port.hpp
new file mode 100644
index 0000000..5f9cff5
--- /dev/null
+++ b/rtu/port/usb_port.hpp
@@ -0,0 +1,28 @@
+#pragma once
+
+#include "base_port.hpp"
+
+#include <sdbusplus/async.hpp>
+
+namespace phosphor::modbus::rtu::port
+{
+
+namespace config
+{
+
+struct PortFactoryConfig;
+
+} // namespace config
+
+class USBPort : public BasePort
+{
+ public:
+ explicit USBPort(sdbusplus::async::context& ctx,
+ config::PortFactoryConfig& config);
+
+ static auto getConfig(sdbusplus::async::context& ctx,
+ const sdbusplus::message::object_path& objectPath)
+ -> sdbusplus::async::task<std::optional<config::PortFactoryConfig>>;
+};
+
+} // namespace phosphor::modbus::rtu::port