--- nono/host/hostcom.h 2026/04/29 17:05:30 1.1.1.3 +++ nono/host/hostcom.h 2026/04/29 17:05:56 1.1.1.7 @@ -12,9 +12,10 @@ #include "hostdevice.h" #include "comdriver.h" -#include "monitor.h" #include "spscqueue.h" +class ConfigItem; + class HostCOMDevice : public HostDevice { using inherited = HostDevice; @@ -34,21 +35,28 @@ class HostCOMDevice : public HostDevice }; public: - HostCOMDevice(Device *parent_, const std::string& objname_); + HostCOMDevice(Device *parent_, int n, const std::string& portname_); ~HostCOMDevice() override; void SetLogLevel(int loglevel_) override; - bool Init() override; + bool Create2() override; void Dispatch(int udata) override; bool Tx(uint32 data); uint32 Rx(); + // ドライバ名を返す。 + const std::string& GetDriverName(); + private: - bool SelectDriver(); + bool SelectDriver(bool startup) override; + void CreateNone(); + void CreateStdio(const ConfigItem&, const std::string& key); + void CreateTCP(); + void CreateConsole(const ConfigItem&); int Read() override; - void Write(uint32 data) override; + void Write() override; DECLARE_MONITOR_CALLBACK(MonitorUpdate); @@ -61,5 +69,5 @@ class HostCOMDevice : public HostDevice // 統計情報 struct stat_t stat {}; - Monitor monitor { this }; + Monitor *monitor {}; };