--- nono/host/hostcom.h 2026/04/29 17:05:11 1.1 +++ nono/host/hostcom.h 2026/04/29 17:06:02 1.1.1.8 @@ -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; @@ -29,28 +30,35 @@ class HostCOMDevice : public HostDevice uint64 write_bytes; // ホストへの書き出しバイト数 uint64 read_bytes; // ホストからの読み込みバイト数 - int txq_peak; // キューのおおよその最大使用量 - int rxq_peak; // キューのおおよその最大使用量 + uint txq_peak; // キューのおおよその最大使用量 + uint rxq_peak; // キューのおおよその最大使用量 }; public: - HostCOMDevice(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); + DECLARE_MONITOR_SCREEN(MonitorScreen); // キュー COMQueue txq {}; @@ -61,5 +69,5 @@ class HostCOMDevice : public HostDevice // 統計情報 struct stat_t stat {}; - Monitor monitor { this }; + Monitor *monitor {}; };