OpenCPN Partial API docs
Loading...
Searching...
No Matches
connections_dialog.h
1/******************************************************************************
2 *
3 * Project: OpenCPN
4 * Purpose:
5 * Author: David Register
6 *
7 ***************************************************************************
8 * Copyright (C) 2022 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
27#ifndef _CONNECT_DIALOG_H
28#define _CONNECT_DIALOG_H
29
30#include <wx/checkbox.h>
31#include <wx/listctrl.h>
32#include <wx/radiobut.h>
33#include <wx/stattext.h>
34#include <wx/timer.h>
35
36
37#include "conn_params.h"
38#include "comm_util.h"
39class options;
41
42//----------------------------------------------------------------------------
43// ConnectionsDialog
44//----------------------------------------------------------------------------
45class ConnectionsDialog : public wxEvtHandler {
46public:
48 ConnectionsDialog(wxScrolledWindow *container, options *parent);
49
51
52 void Init(void);
53 void RecalculateSize(void);
54 void SetInitialSettings(void);
55 void ApplySettings();
56 ConnectionParams *CreateConnectionParamsFromSelectedItem();
57 ConnectionParams *UpdateConnectionParamsFromSelectedItem(
58 ConnectionParams *pConnectionParams);
59 void SetSelectedConnectionPanel(ConnectionParamsPanel *panel);
60 void OnSelectDatasource(wxListEvent &event);
61 void OnAddDatasourceClick(wxCommandEvent &event);
62 void OnRemoveDatasourceClick(wxCommandEvent &event);
63
64 void OnTypeSerialSelected(wxCommandEvent &event);
65 void OnTypeNetSelected(wxCommandEvent &event);
66 void OnTypeGPSSelected(wxCommandEvent &event);
67 void OnTypeBTSelected(wxCommandEvent &event);
68 void OnTypeCANSelected(wxCommandEvent &event);
69
70 void OnNetProtocolSelected(wxCommandEvent &event);
71 void OnBaudrateChoice(wxCommandEvent &event) { OnConnValChange(event); }
72 void OnProtocolChoice(wxCommandEvent &event);
73 void OnCrcCheck(wxCommandEvent &event) { OnConnValChange(event); }
74 void OnRbAcceptInput(wxCommandEvent &event);
75 void OnRbIgnoreInput(wxCommandEvent &event);
76 void OnBtnIStcs(wxCommandEvent &event);
77 void OnCbInput(wxCommandEvent &event);
78 void OnCbOutput(wxCommandEvent &event);
79 void OnRbOutput(wxCommandEvent &event);
80 void OnBtnOStcs(wxCommandEvent &event);
81 void OnConnValChange(wxCommandEvent &event);
82 void OnValChange(wxCommandEvent &event);
83 void OnUploadFormatChange(wxCommandEvent &event);
84 void OnShowGpsWindowCheckboxClick(wxCommandEvent& event);
85 void EnableConnection(ConnectionParams *conn, bool value);
86 void OnDiscoverButton(wxCommandEvent &event);
87 void UpdateDiscoverStatus(wxString stat);
88 void OnPriorityDialog(wxCommandEvent &event);
89
90 void SetConnectionParams(ConnectionParams *cp);
91 void SetDefaultConnectionParams(void);
92 void SetDSFormRWStates();
93 void SetDSFormOptionVizStates();
94 void FillSourceList();
95 void UpdateSourceList(bool bResort);
96 bool SortSourceList(void);
97
98 void ClearNMEAForm(void);
99 void SetNMEAFormToSerial(void);
100 void SetNMEAFormToNet(void);
101 void SetNMEAFormToGPS(void);
102 void SetNMEAFormToBT(void);
103 void SetNMEAFormToCAN(void);
104 void SetNMEAFormForProtocol();
105
106 void ShowNMEACommon(bool visible);
107 void ShowNMEASerial(bool visible);
108 void ShowNMEANet(bool visible);
109 void ShowNMEAGPS(bool visible);
110 void ShowNMEABT(bool visible);
111 void ShowNMEACAN(bool visible);
112
113 void OnScanBTClick(wxCommandEvent &event);
114 void onBTScanTimer(wxTimerEvent &event);
115 void StopBTScan(void);
116
117//private:
118 wxScrolledWindow *m_container;
119 options *m_parent;
120
121 wxGridSizer *gSizerNetProps, *gSizerSerProps;
122 wxTextCtrl *m_tNetAddress, *m_tNetPort, *m_tFilterSec, *m_tcInputStc;
123 wxTextCtrl *m_tcOutputStc, *m_TalkerIdText;
124 wxCheckBox *m_cbCheckCRC, *m_cbGarminHost, *m_cbGarminUploadHost,
125 *m_cbCheckSKDiscover;
126 wxCheckBox *m_cbFurunoGP3X, *m_cbNMEADebug, *m_cbFilterSogCog, *m_cbInput;
127 wxCheckBox *m_cbOutput, *m_cbAPBMagnetic;
128 wxComboBox *m_comboPort;
129 wxStdDialogButtonSizer *m_sdbSizerDlgButtons;
130 wxButton *m_ButtonSKDiscover, *m_ButtonPriorityDialog;
131 wxStaticText *m_StaticTextSKServerStatus;
132
133 wxButton *m_buttonAdd, *m_buttonRemove, *m_buttonScanBT, *m_btnInputStcList;
134 wxButton *m_btnOutputStcList, *m_sdbSizerDlgButtonsOK;
135 wxButton *m_sdbSizerDlgButtonsApply, *m_sdbSizerDlgButtonsCancel;
136 wxStaticBoxSizer *sbSizerConnectionProps, *sbSizerInFilter;
137 wxStaticBoxSizer *sbSizerOutFilter;
138 wxRadioButton *m_rbTypeSerial, *m_rbTypeNet, *m_rbTypeInternalGPS;
139 wxRadioButton *m_rbTypeInternalBT, *m_rbNetProtoTCP, *m_rbNetProtoUDP;
140 wxRadioButton *m_rbNetProtoGPSD, *m_rbIAccept, *m_rbIIgnore, *m_rbOAccept;
141 wxRadioButton *m_rbNetProtoSignalK;
142 wxRadioButton *m_rbOIgnore, *m_rbTypeCAN;
143 wxStaticText *m_stBTPairs, *m_stNetProto, *m_stNetAddr, *m_stNetPort;
144 wxStaticText *m_stSerPort, *m_stSerBaudrate, *m_stSerProtocol;
145 wxStaticText *m_stPriority, *m_stFilterSec, *m_stPrecision;
146 wxStaticText *m_stTalkerIdText;
147 wxStaticText *m_stNetComment, *m_stSerialComment, *m_stCANSource;
148 wxTextCtrl *m_tNetComment, *m_tSerialComment;
149 wxStaticBox *m_sbConnEdit;
150 wxChoice *m_choiceBTDataSources, *m_choiceBaudRate, *m_choiceSerialProtocol;
151 wxChoice *m_choicePriority, *m_choicePrecision, *m_choiceCANSource;
152 wxScrolledWindow *m_scrollWinConnections;
153 wxBoxSizer *boxSizerConnections;
154 ConnectionParams *mSelectedConnection;
155
156 bool connectionsaved;
157 bool m_connection_enabled;
158 bool m_bNMEAParams_shown;
159 int m_btNoChangeCounter, m_btlastResultCount, m_BTscanning;
160 wxArrayString m_BTscan_results;
161 wxTimer m_BTScanTimer;
162 wxArrayString m_choice_CANSource_choices;
163
164 DECLARE_EVENT_TABLE()
165
166};
167
168
169class SentenceListDlg : public wxDialog {
170public:
171 explicit SentenceListDlg(wxWindow *parent, FilterDirection dir, ListType type,
172 const wxArrayString &list);
173 wxString GetSentences(void);
174
175private:
176 void OnAddClick(wxCommandEvent &event);
177 void OnDeleteClick(wxCommandEvent &event);
178 void OnCLBSelect(wxCommandEvent &event);
179 void OnCheckAllClick(wxCommandEvent &event);
180 void OnClearAllClick(wxCommandEvent &event);
181
182 void Populate(const wxArrayString &list);
183 wxString GetBoxLabel(void) const;
184
185 wxCheckListBox *m_clbSentences;
186 wxButton *m_btnDel;
187
188 ListType m_type;
189 FilterDirection m_dir;
190 wxArrayString m_sentences;
191
192};
193
194
195#endif //_CONNECT_DIALOG_H