OpenCPN Partial API docs
comm_n0183_output.h
1 /***************************************************************************
2  *
3  * Project: OpenCPN
4  * Purpose: NMEA Data Multiplexer Object
5  * Author: David Register
6  *
7  ***************************************************************************
8  * Copyright (C) 2010 by David S. Register *
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 _COMMN0183_OUT_H
27 #define _COMMN0183_OUT_H
28 
29 #include <functional>
30 
31 #include <wx/wxprec.h>
32 
33 #include "model/nmea_log.h"
34 #include "model/multiplexer.h"
35 #include "observable_evtvar.h"
36 
37 #ifndef WX_PRECOMP
38 #include <wx/wx.h>
39 #endif // precompiled headers
40 
41 class RoutePoint;
42 class Route;
43 
44 // Garmin interface private error codes
45 #define ERR_GARMIN_INITIALIZE -1
46 #define ERR_GARMIN_GENERAL -2
47 
48 void BroadcastNMEA0183Message(const wxString& msg, NmeaLog& nmea_log,
49  EventVar& on_msg_sent);
50 
51 class N0183DlgCtx {
52 public:
53  std::function<void(int)> set_value;
54  std::function<void(int)> set_range;
55  std::function<void(void)> pulse;
56  std::function<void(const std::string&)> set_message;
57  std::function<bool()> confirm_overwrite;
58 
59  N0183DlgCtx()
60  : set_value([](int) {}),
61  set_range([](int) {}),
62  pulse([](void) {}),
63  set_message([](const std::string&) {}),
64  confirm_overwrite([]() { return true; }) {}
65 };
66 
67 
68 int SendRouteToGPS_N0183(Route* pr, const wxString& com_name,
69  bool bsend_waypoints, Multiplexer& multiplexer,
70  N0183DlgCtx ctx);
71 
72 int SendWaypointToGPS_N0183(RoutePoint* prp, const wxString& com_name,
73  Multiplexer& multiplexer, N0183DlgCtx ctx);
74 
75 #endif // _COMMN0183>>UT_H
Generic event handling between MVC Model and Controller based on a shared EventVar variable.
Definition: route.h:75