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