OpenCPN Partial API docs
Loading...
Searching...
No Matches
comm_drv_n0183_serial.h
Go to the documentation of this file.
1/***************************************************************************
2 * Copyright (C) 2022 by David Register *
3 * Copyright (C) 2022 by Alec Leamas *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 **************************************************************************/
20
26#ifndef _COMMDRIVERN0183SERIAL_H
27#define _COMMDRIVERN0183SERIAL_H
28
29#include <atomic>
30#include <string>
31
32#include <wx/event.h>
33
35#include "model/comm_out_queue.h"
36#include "model/conn_params.h"
37#include "model/garmin_protocol_mgr.h"
38#include "model/serial_io.h"
39
41 public wxEvtHandler,
42 public DriverStatsProvider {
43public:
45
46 virtual ~CommDriverN0183Serial();
47
48 bool Open();
49 void Close();
50
51 bool IsSecThreadActive() { return m_serial_io->IsRunning(); }
52
53 bool IsGarminThreadActive();
54 void StopGarminUSBIOThread(bool bPause);
55
56 ConnectionParams GetParams() const { return m_params; }
57
58 bool SendMessage(std::shared_ptr<const NavMsg> msg,
59 std::shared_ptr<const NavAddr> addr) override;
60
61 DriverStats GetDriverStats() const override {
62 return m_serial_io->GetStats();
63 }
64
65private:
66 std::string m_portstring;
67 unsigned m_baudrate;
68
69 std::unique_ptr<SerialIo> m_serial_io;
70 GarminProtocolHandler* m_garmin_handler;
71
72 ConnectionParams m_params;
73 DriverListener& m_listener;
74
75 StatsTimer m_stats_timer;
76
81 void SendMessage(const std::vector<unsigned char>& msg);
82};
83
84#endif // guard
NMEA0183 drivers common part.
Interface implemented by transport layer and possible other parties like test code which should handl...
Definition comm_driver.h:48
Driver interface providing driver statistics.
Continuously report driver stats to CommDrvRegistry.evt_driver_stats.
NMEA0183 drivers common base.
Abstract N0183 serial communications interface.
Driver statistics report.