OpenCPN Partial API docs
Loading...
Searching...
No Matches
comm_drv_n0183_android_bt.h
Go to the documentation of this file.
1/***************************************************************************
2 * Copyright (C) 2023 by David Register *
3 * Copyright (C) 2023 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 _COMMDRIVERN0183ANDROIDBT_H
26#define _COMMDRIVERN0183ANDROIDBT_H
27
28#include <atomic>
29#include <string>
30
31#include <wx/event.h>
32
35#include "model/conn_params.h"
36
37class CommDriverN0183AndroidBTEvent : public wxEvent {
38public:
39 CommDriverN0183AndroidBTEvent(wxEventType commandType, int id);
41
42 // accessors
43 void SetPayload(std::shared_ptr<std::vector<unsigned char>> data);
44 std::shared_ptr<std::vector<unsigned char>> GetPayload();
45
46 // required for sending with wxPostEvent()
47 wxEvent* Clone() const;
48
49private:
50 std::shared_ptr<std::vector<unsigned char>> m_payload;
51};
52
53wxDECLARE_EVENT(wxEVT_COMMDRIVER_N0183_ANDROID_BT,
55
57 public wxEvtHandler,
58 public DriverStatsProvider {
59public:
61
63
64 bool Open();
65 void Close();
66
67 const ConnectionParams& GetParams() const override { return m_params; }
68
69 bool SendMessage(std::shared_ptr<const NavMsg> msg,
70 std::shared_ptr<const NavAddr> addr) override;
71
72 DriverStats GetDriverStats() const override { return m_driver_stats; }
73
74private:
75 bool m_bok;
76 std::string m_portstring;
77 std::string m_BaudRate;
78 int m_handshake;
79
80 ConnectionParams m_params;
81 DriverListener& m_listener;
82 void handle_N0183_MSG(CommDriverN0183AndroidBTEvent& event);
83 StatsTimer m_stats_timer;
84 DriverStats m_driver_stats;
85};
86
87#endif // guard
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.
Communication statistics infrastructure.
Connection parameters.
Driver statistics report.