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 <dsPortType.h>
31#endif
32
33
34#ifndef WX_PRECOMP
35#include <wx/arrstr.h>
36#include <wx/dynarray.h>
37#include <wx/string.h>
38#endif // precompiled headers
39
40#include "comm_navmsg.h"
41
44
45typedef enum {
46 SERIAL = 0,
47 NETWORK = 1,
48 INTERNAL_GPS = 2,
49 INTERNAL_BT = 3,
50 SOCKETCAN = 4,
51 UNKNOWN = 5
52} ConnectionType;
53
54typedef enum {
55 TCP = 0,
56 UDP = 1,
57 GPSD = 2,
58 SIGNALK = 3,
59 PROTO_UNDEFINED = 4
60} NetworkProtocol;
61
62typedef enum { WHITELIST = 0, BLACKLIST = 1 } ListType;
63
64typedef enum { FILTER_INPUT = 0, FILTER_OUTPUT = 1 } FilterDirection;
65
66typedef enum {
67 PROTO_NMEA0183 = 0,
68 PROTO_NMEA2000 = 1,
69 PROTO_SIGNALK = 2
70} DataProtocol;
71
72#define CONN_ENABLE_ID 47621
73
74
76
78public:
81 ConnectionParams(const wxString &configStr);
82
83 ConnectionType Type;
84 NetworkProtocol NetProtocol;
85 wxString NetworkAddress;
86 int NetworkPort;
87
88 wxString LastNetworkAddress;
89 int LastNetworkPort;
90 NetworkProtocol LastNetProtocol;
91 DataProtocol LastDataProtocol;
92
93 DataProtocol Protocol;
94 wxString Port;
95 wxString socketCAN_port;
96 int Baudrate;
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 int Priority;
108 bool bEnabled;
109 wxString UserComment;
110
111 wxString Serialize() const;
112 void Deserialize(const wxString &configStr);
113
114 wxString GetSourceTypeStr() const;
115 wxString GetAddressStr() const;
116 wxString GetParametersStr() const;
117 wxString GetIOTypeValueStr() const;
118 wxString GetFiltersStr() const;
119 wxString GetDSPort() const;
120 std::string GetLastDSPort() const;
121 NavAddr::Bus GetLastCommProtocol();
122 wxString GetPortStr() const { return Port; }
123 void SetPortStr(wxString str) { Port = str; }
124 std::string GetStrippedDSPort();
125 NavAddr::Bus GetCommProtocol();
126
127 bool SentencePassesFilter(const wxString& sentence, FilterDirection direction);
128
129 bool Valid;
130 bool b_IsSetup;
131 ConnectionParamsPanel *m_optionsPanel;
132
133private:
134 wxString FilterTypeToStr(ListType type, FilterDirection dir) const;
135};
136
137WX_DEFINE_ARRAY(ConnectionParams *, wxArrayOfConnPrm);
138
139wxArrayOfConnPrm* TheConnectionParams();
140
141#endif