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, see <https://www.gnu.org/licenses/>. *
17 **************************************************************************/
18
25#ifndef COMMDRIVERN0183SERIAL_H
26#define COMMDRIVERN0183SERIAL_H
27
28#include <string>
29
30#include <wx/event.h>
31
34#include "model/conn_params.h"
36#include "model/serial_io.h"
37
39 public wxEvtHandler,
40 public DriverStatsProvider {
41public:
43
44 ~CommDriverN0183Serial() override;
45
46 bool Open();
47 void Close();
48
49 bool IsSecThreadActive() const { return m_serial_io->IsRunning(); }
50
51 bool IsGarminThreadActive() const;
52 void StopGarminUSBIOThread(bool bPause) const;
53
54 const ConnectionParams& GetParams() const override { return m_params; }
55
56 bool SendMessage(std::shared_ptr<const NavMsg> msg,
57 std::shared_ptr<const NavAddr> addr) override;
58
59 DriverStats GetDriverStats() const override {
60 return m_serial_io->GetStats();
61 }
62
63private:
64 std::string m_portstring;
65 unsigned m_baudrate;
66
67 std::unique_ptr<SerialIo> m_serial_io;
68 GarminProtocolHandler* m_garmin_handler;
69
70 ConnectionParams m_params;
71 DriverListener& m_listener;
72
73 StatsTimer m_stats_timer;
74
79 void SendMessage(const std::vector<unsigned char>& msg);
80};
81
82#endif // COMMDRIVERN0183SERIAL_H
DriverStats GetDriverStats() const override
Get the Driver Statistics.
NMEA0183 basic parsing common parts:
Interface for handling incoming messages.
Definition comm_driver.h:50
Driver interface providing driver statistics.
Continuously report driver stats to CommDrvRegistry.evt_driver_stats.
NMEA0183 drivers common base.
Communications output queue.
Connection parameters.
NMEA Data Object.
Abstract N0183 serial communications interface.
Driver statistics report.