26#ifndef _N0183_PROTOL_MGR__
27#define _N0183_PROTOL_MGR__
40#include "model/ocpn_utils.h"
43using namespace std::literals::chrono_literals;
46static std::string NormalizePort(
const std::string& port) {
47 return port.find(
"Serial:") == 0 ? port.substr(strlen(
"Serial:")) : port;
51using SendMsgFunc = std::function<void(
const std::vector<unsigned char>&)>;
58 const std::string& port,
75 const wxString m_portname;
76 const unsigned m_baud;
79 mutable std::mutex m_stats_mutex;
83 : m_portname(NormalizePort(port)),
85 m_send_msg_func(send_msg_func),
86 m_open_log_filter(5min) {}
94__attribute__((used))
static SerialIo* force_clang_to_emit_typeinfo;
Nmea0183 serial communications wrapper, possibly running a thread.
virtual void Start()=0
Start IO operations including input, possibly in separate thread.
virtual DriverStats GetStats() const =0
Retrieve updated driver statistics.
static std::unique_ptr< SerialIo > Create(SendMsgFunc send_msg_func, const std::string &port, unsigned baud)
Factory.
virtual void RequestStop() override=0
Request that thread stops operation.
virtual bool SetOutMsg(const wxString &msg)=0
Send a message to remote peer.
Thread mixin providing a "stop thread"/"wait until stopped" interface.
Filter logging repeated message with specified interval.
Line-oriented input/output buffers.
Communication statistics infrastructure.
Enhanced logging interface on top of wx/log.h.
std::function< void(const std::vector< unsigned char > &)> SendMsgFunc
Forwards data from driver to local receivers (main code, plugins, etc).
Driver statistics report.
ThreadCtrl mixin class definition.