27 #ifndef _CONNECT_EDIT_H
28 #define _CONNECT_EDIT_H
30 #include <wx/checkbox.h>
31 #include <wx/listctrl.h>
32 #include <wx/radiobut.h>
33 #include <wx/stattext.h>
36 #include "model/conn_params.h"
37 #include "model/comm_util.h"
39 #include "observable.h"
49 const wxString DEFAULT_TCP_PORT =
"10110";
50 const wxString DEFAULT_UDP_PORT =
"10110";
51 const wxString DEFAULT_GPSD_PORT =
"2947";
52 const wxString DEFAULT_SIGNALK_PORT =
"3000";
53 const wxString DEFAULT_IP_ADDRESS =
"localhost";
56 const wxString DEFAULT_UDP_OUT_ADDRESS =
"255.255.255.255";
65 void SetInitialSettings(
void);
68 void SetPropsLabel(wxString label);
75 void OnSelectDatasource(wxListEvent &event);
76 void OnAddDatasourceClick(wxCommandEvent &event);
77 void OnRemoveDatasourceClick(wxCommandEvent &event);
79 void OnTypeSerialSelected(wxCommandEvent &event);
80 void OnTypeNetSelected(wxCommandEvent &event);
81 void OnTypeGPSSelected(wxCommandEvent &event);
82 void OnTypeBTSelected(wxCommandEvent &event);
83 void OnTypeCANSelected(wxCommandEvent &event);
85 void OnNetProtocolSelected(wxCommandEvent &event);
86 void OnBaudrateChoice(wxCommandEvent &event) { OnConnValChange(event); }
87 void OnProtocolChoice(wxCommandEvent &event);
88 void OnCrcCheck(wxCommandEvent &event) { OnConnValChange(event); }
89 void OnRbAcceptInput(wxCommandEvent &event);
90 void OnRbIgnoreInput(wxCommandEvent &event);
91 void OnBtnIStcs(wxCommandEvent &event);
92 void OnCbInput(wxCommandEvent &event);
93 void OnCbOutput(wxCommandEvent &event);
94 void OnCbMultiCast(wxCommandEvent &event);
95 void OnCbAdvanced(wxCommandEvent &event);
96 void OnClickMore(wxMouseEvent &event);
97 void OnRbOutput(wxCommandEvent &event);
98 void OnBtnOStcs(wxCommandEvent &event);
99 void OnConnValChange(wxCommandEvent &event);
100 void OnValChange(wxCommandEvent &event);
101 void OnUploadFormatChange(wxCommandEvent &event);
102 void OnShowGpsWindowCheckboxClick(wxCommandEvent &event);
104 void OnDiscoverButton(wxCommandEvent &event);
105 void UpdateDiscoverStatus(wxString stat);
106 void OnPriorityDialog(wxCommandEvent &event);
109 void SetDefaultConnectionParams(
void);
110 void SetDSFormRWStates();
111 void SetDSFormOptionVizStates();
112 void FillSourceList();
113 void UpdateSourceList(
bool bResort);
114 bool SortSourceList(
void);
115 void SetUDPNetAddressVisiblity(
void);
116 bool IsAddressMultiCast(wxString ip);
117 bool IsAddressBroadcast(wxString ip);
118 bool IsDefaultPort(wxString address);
120 void ClearNMEAForm(
void);
121 void SetNMEAFormToSerial(
void);
122 void SetNMEAFormToNet(
void);
123 void SetNMEAFormToGPS(
void);
124 void SetNMEAFormToBT(
void);
125 void SetNMEAFormToCAN(
void);
126 void SetNMEAFormForSerialProtocol();
127 void SetNMEAFormForNetProtocol();
129 void ShowTypeCommon(
bool visible =
true);
130 void ShowNMEACommon(
bool visible);
131 void ShowNMEASerial(
bool visible);
132 void ShowNMEANet(
bool visible);
133 void ShowNMEAGPS(
bool visible);
134 void ShowNMEABT(
bool visible);
135 void ShowNMEACAN(
bool visible);
137 void OnScanBTClick(wxCommandEvent &event);
138 void onBTScanTimer(wxTimerEvent &event);
139 void StopBTScan(
void);
141 void OnWheelChoice(wxMouseEvent &event);
143 void ShowInFilter(
bool bshow =
true);
144 void ShowOutFilter(
bool bshow =
true);
147 void CreateControls();
148 void ConnectControls();
152 wxScrolledWindow *m_scrolledwin;
154 wxGridSizer *gSizerNetProps, *gSizerSerProps, *gSizerCanProps;
155 wxTextCtrl *m_tNetAddress, *m_tNetPort, *m_tFilterSec, *m_tcInputStc;
156 wxTextCtrl *m_tcOutputStc;
157 wxCheckBox *m_cbCheckCRC, *m_cbGarminHost, *m_cbGarminUploadHost,
158 *m_cbCheckSKDiscover;
159 wxCheckBox *m_cbFurunoGP3X, *m_cbNMEADebug, *m_cbFilterSogCog, *m_cbInput;
160 wxCheckBox *m_cbMultiCast, *m_cbAdvanced;
161 wxCheckBox *m_cbOutput, *m_cbAPBMagnetic;
162 wxComboBox *m_comboPort;
163 wxStdDialogButtonSizer *m_sdbSizerDlgButtons;
164 wxButton *m_ButtonSKDiscover, *m_ButtonPriorityDialog;
165 wxStaticText *m_StaticTextSKServerStatus;
167 wxButton *m_buttonAdd, *m_buttonRemove, *m_buttonScanBT, *m_btnInputStcList;
168 wxButton *m_btnOutputStcList, *m_sdbSizerDlgButtonsOK;
169 wxButton *m_sdbSizerDlgButtonsApply, *m_sdbSizerDlgButtonsCancel;
170 wxStaticBoxSizer *sbSizerConnectionProps, *sbSizerInFilter;
171 wxStaticBoxSizer *sbSizerOutFilter;
172 wxRadioButton *m_rbTypeSerial, *m_rbTypeNet, *m_rbTypeInternalGPS;
173 wxRadioButton *m_rbTypeInternalBT, *m_rbNetProtoTCP, *m_rbNetProtoUDP;
174 wxRadioButton *m_rbNetProtoGPSD, *m_rbIAccept, *m_rbIIgnore, *m_rbOAccept;
175 wxRadioButton *m_rbNetProtoSignalK;
176 wxRadioButton *m_rbOIgnore, *m_rbTypeCAN;
177 wxStaticText *m_stBTPairs, *m_stNetProto, *m_stNetAddr, *m_stNetPort;
178 wxStaticText *m_stSerPort, *m_stSerBaudrate, *m_stSerProtocol;
179 wxStaticText *m_stPriority, *m_stFilterSec, *m_stPrecision;
180 wxStaticText *m_stTalkerIdText;
181 wxStaticText *m_stNetComment, *m_stSerialComment, *m_stCANSource,
183 wxTextCtrl *m_tNetComment, *m_tSerialComment, *m_tAuthToken;
184 wxStaticBox *m_sbConnEdit;
185 wxChoice *m_choiceBTDataSources, *m_choiceBaudRate, *m_choiceSerialProtocol;
186 wxChoice *m_choicePriority, *m_choicePrecision, *m_choiceCANSource;
187 wxChoice *m_choiceNetDataProtocol;
189 wxBoxSizer *boxSizerConnections;
190 wxStaticText *m_stNetDataProtocol;
195 wxPanel *m_scrollWinConnections;
197 wxScrolledWindow *m_scrollWinConnections;
200 bool connectionsaved;
201 bool m_advanced =
false;
202 bool m_connection_enabled;
203 bool m_bNMEAParams_shown;
204 int m_btNoChangeCounter, m_btlastResultCount, m_BTscanning;
205 wxArrayString m_BTscan_results;
206 wxTimer m_BTScanTimer;
207 wxArrayString m_choice_CANSource_choices;
214 wxStaticText *m_more;
219 explicit SentenceListDlg(wxWindow *parent, FilterDirection dir, ListType type,
220 const wxArrayString &list);
221 wxString GetSentences(
void);
224 void OnAddClick(wxCommandEvent &event);
225 void OnDeleteClick(wxCommandEvent &event);
226 void OnCLBSelect(wxCommandEvent &event);
227 void OnCheckAllClick(wxCommandEvent &event);
228 void OnClearAllClick(wxCommandEvent &event);
230 void Populate(
const wxArrayString &list);
231 wxString GetBoxLabel(
void)
const;
233 wxCheckListBox *m_clbSentences;
237 FilterDirection m_dir;
238 wxArrayString m_sentences;
Define an action to be performed when a KeyProvider is notified.