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 <string>
30
31#include <wx/event.h>
32
34#include "model/comm_out_queue.h"
35#include "model/conn_params.h"
36#include "model/garmin_protocol_mgr.h"
37#include "model/serial_io.h"
38
40 public wxEvtHandler,
41 public DriverStatsProvider {
42public:
44
45 ~CommDriverN0183Serial() override;
46
47 bool Open();
48 void Close();
49
50 bool IsSecThreadActive() const { return m_serial_io->IsRunning(); }
51
52 bool IsGarminThreadActive() const;
53 void StopGarminUSBIOThread(bool bPause) const;
54
55 const ConnectionParams& GetParams() const override { return m_params; }
56
57 bool SendMessage(std::shared_ptr<const NavMsg> msg,
58 std::shared_ptr<const NavAddr> addr) override;
59
60 DriverStats GetDriverStats() const override {
61 return m_serial_io->GetStats();
62 }
63
64private:
65 std::string m_portstring;
66 unsigned m_baudrate;
67
68 std::unique_ptr<SerialIo> m_serial_io;
69 GarminProtocolHandler* m_garmin_handler;
70
71 ConnectionParams m_params;
72 DriverListener& m_listener;
73
74 StatsTimer m_stats_timer;
75
80 void SendMessage(const std::vector<unsigned char>& msg);
81};
82
83#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:52
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.