OpenCPN Partial API docs
Loading...
Searching...
No Matches
comm_drv_n0183_android_bt.h
1/***************************************************************************
2 *
3 * Project: OpenCPN
4 * Purpose:
5 * Author: David Register, Alec Leamas
6 *
7 ***************************************************************************
8 * Copyright (C) 2023 by David Register, Alec Leamas *
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
19 * *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
24 **************************************************************************/
25
26#ifndef _COMMDRIVERN0183ANDROIDBT_H
27#define _COMMDRIVERN0183ANDROIDBT_H
28
29#include <atomic>
30#include <string>
31
32#include <wx/event.h>
33
36#include "model/conn_params.h"
37
38class CommDriverN0183AndroidBTEvent : public wxEvent {
39public:
40 CommDriverN0183AndroidBTEvent(wxEventType commandType, int id);
42
43 // accessors
44 void SetPayload(std::shared_ptr<std::vector<unsigned char>> data);
45 std::shared_ptr<std::vector<unsigned char>> GetPayload();
46
47 // required for sending with wxPostEvent()
48 wxEvent* Clone() const;
49
50private:
51 std::shared_ptr<std::vector<unsigned char>> m_payload;
52};
53
54wxDECLARE_EVENT(wxEVT_COMMDRIVER_N0183_ANDROID_BT,
56
58 public wxEvtHandler,
59 public DriverStatsProvider {
60public:
62
64
65 bool Open();
66 void Close();
67
68 ConnectionParams GetParams() const { return m_params; }
69
70 bool SendMessage(std::shared_ptr<const NavMsg> msg,
71 std::shared_ptr<const NavAddr> addr) override;
72
73 DriverStats GetDriverStats() const override { return m_driver_stats; }
74
75private:
76 bool m_bok;
77 std::string m_portstring;
78 std::string m_BaudRate;
79 int m_handshake;
80
81 ConnectionParams m_params;
82 DriverListener& m_listener;
83 void handle_N0183_MSG(CommDriverN0183AndroidBTEvent& event);
84 StatsTimer m_stats_timer;
85 DriverStats m_driver_stats;
86};
87
88#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.
Communication statistics infrastructure.
Driver statistics report.