OpenCPN Partial API docs
Loading...
Searching...
No Matches
comm_drv_n0183_android_int.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 _COMMDRIVERN0183ANDROIDINT_H
27#define _COMMDRIVERN0183ANDROIDINT_H
28
29#include <atomic>
30#include <string>
31
32#include <wx/event.h>
33
35#include "model/conn_params.h"
36
37class CommDriverN0183AndroidIntEvent : public wxEvent {
38public:
39 CommDriverN0183AndroidIntEvent(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_INT,
55
56class CommDriverN0183AndroidInt : public CommDriverN0183, public wxEvtHandler {
57public:
59
61
62 bool Open();
63 void Close();
64
65 ConnectionParams GetParams() const { return m_params; }
66
67 bool SendMessage(std::shared_ptr<const NavMsg> msg,
68 std::shared_ptr<const NavAddr> addr) override;
69
70private:
71 bool m_bok;
72 std::string m_portstring;
73 std::string m_BaudRate;
74 int m_handshake;
75
76 ConnectionParams m_params;
77 DriverListener& m_listener;
78 void handle_N0183_MSG(CommDriverN0183AndroidIntEvent& event);
79};
80
81#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
NMEA0183 drivers common base.