OpenCPN Partial API docs
Loading...
Searching...
No Matches
conn_params.h
1/***************************************************************************
2 *
3 * Project: OpenCPN
4 *
5 ***************************************************************************
6 * Copyright (C) 2013 by David S. Register *
7 * *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the *
20 * Free Software Foundation, Inc., *
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
22 **************************************************************************/
23
24#ifndef _CONNECTIONPARAMS_H__
25#define _CONNECTIONPARAMS_H__
26
27#include <wx/wxprec.h>
28
29#ifndef __DSPORTTYPE_H__
30#include "model/ds_porttype.h"
31#endif
32
33#ifndef WX_PRECOMP
34#include <wx/arrstr.h>
35#include <wx/dynarray.h>
36#include <wx/string.h>
37#endif // precompiled headers
38
39#include "model/comm_navmsg.h"
40
42class ConnectionsDialog;
43
44typedef enum {
45 SERIAL = 0,
46 NETWORK = 1,
47 INTERNAL_GPS = 2,
48 INTERNAL_BT = 3,
49 SOCKETCAN = 4,
50 UNKNOWN = 5
51} ConnectionType;
52
53typedef enum {
54 TCP = 0,
55 UDP = 1,
56 GPSD = 2,
57 SIGNALK = 3,
58 PROTO_UNDEFINED = 4
59} NetworkProtocol;
60
61typedef enum { WHITELIST = 0, BLACKLIST = 1 } ListType;
62
63typedef enum { FILTER_INPUT = 0, FILTER_OUTPUT = 1 } FilterDirection;
64
65typedef enum {
66 PROTO_NMEA0183 = 0,
67 PROTO_NMEA2000 = 1,
68 PROTO_SIGNALK = 2
69} DataProtocol;
70
71#define CONN_ENABLE_ID 47621
72
74
76public:
79 ConnectionParams(const wxString &configStr);
80
81 ConnectionType Type;
82 NetworkProtocol NetProtocol;
83 wxString NetworkAddress;
84 int NetworkPort;
85
86 wxString LastNetworkAddress;
87 int LastNetworkPort;
88 NetworkProtocol LastNetProtocol;
89 DataProtocol LastDataProtocol;
90
91 DataProtocol Protocol;
92 wxString Port;
93 wxString socketCAN_port;
94 int Baudrate;
95 bool NoDataReconnect;
96 bool DisableEcho;
97 bool ChecksumCheck;
98 bool Garmin;
99 bool GarminUpload;
100 bool FurunoGP3X;
101 bool AutoSKDiscover;
102 dsPortType IOSelect;
103 ListType InputSentenceListType;
104 wxArrayString InputSentenceList;
105 ListType OutputSentenceListType;
106 wxArrayString OutputSentenceList;
107 bool bEnabled;
108 wxString UserComment;
109 wxString AuthToken;
110
112 std::string GetKey() const;
113
114 wxString Serialize() const;
115 void Deserialize(const wxString &configStr);
116
117 wxString GetSourceTypeStr() const;
118 wxString GetAddressStr() const;
119 wxString GetParametersStr() const;
120 wxString GetIOTypeValueStr() const;
121 wxString GetFiltersStr() const;
122 wxString GetDSPort() const;
123 std::string GetLastDSPort() const;
124 NavAddr::Bus GetLastCommProtocol();
125 wxString GetPortStr() const { return Port; }
126 void SetPortStr(wxString str) { Port = str; }
127 std::string GetStrippedDSPort() const;
128 NavAddr::Bus GetCommProtocol() const;
129
130 bool SentencePassesFilter(const wxString &sentence,
131 FilterDirection direction) const;
132 bool Valid;
133 bool b_IsSetup;
134 ConnectionParamsPanel *m_optionsPanel;
135
136private:
137 wxString FilterTypeToStr(ListType type, FilterDirection dir) const;
138};
139
140std::vector<ConnectionParams *> &TheConnectionParams();
141
142#endif
Panel for displaying and editing connection parameters.
std::string GetKey() const
Return string unique for each instance.
Raw, undecoded messages definitions.