OpenCPN Partial API docs
Loading...
Searching...
No Matches
wiz_ui.h
1/******************************************************************************
2 *
3 * Project: OpenCPN
4 * Purpose: Configuration wizard
5 * Author: David Register
6 *
7 ***************************************************************************
8 * Copyright (C) 2010-2024 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 *
28 */
29
30#ifndef _WIZ_UI_H__
31#define _WIZ_UI_H__
32
33#include "wiz_ui_proto.h"
34#include "model/conn_params.h"
35#include "navutil.h"
36
37#include <cstdint>
38
39struct USBDevice {
40 std::string name;
41 uint16_t vid;
42 uint16_t pid;
43 DataProtocol protocol;
44 int baudrate;
45};
46
47enum class NMEA0183Flavor { CRC, NO_CRC, INVALID };
48
49const std::vector<uint32_t> Speeds = {4800, 9600, 19200, 38400,
50 57600, 115200, 230400, 460800};
51
52// Well known ports used by various NMEA to IP gateways
53// 10110 - "Standard" for NMEA0183 over IP
54// 2000 - Quark Elec default for both TCP and UDP
55// 1456-1458 - YD (See https://www.yachtd.com/downloads/ydnr02.pdf)
56// 39150/TCP - Vesper Cortex
57const std::vector<uint16_t> UDPPorts = {10110, 2000, 1458};
58const std::vector<uint16_t> TCPPorts = {10110, 2000, 1456, 1457, 39150};
59
60const std::vector<USBDevice> known_usb_devices = {
61 {"Actisense NGT-1", 0x0403, 0xd9aa, DataProtocol::PROTO_NMEA2000, 115200},
62 {"ShipModul MiniPlex", 0x0403, 0xfd4b, DataProtocol::PROTO_NMEA0183,
63 460800}};
64
66public:
67 FirstUseWizImpl(wxWindow* parent, MyConfig* pConfig, wxWindowID id = wxID_ANY,
68 const wxString& title = _("OpenCPN Initial Configuration"),
69 const wxBitmap& bitmap = wxNullBitmap,
70 const wxPoint& pos = wxDefaultPosition,
71 long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER |
72 wxSTAY_ON_TOP);
74
75 void OnWizardPageChanging(wxWizardEvent& event) { event.Skip(); }
76 void OnWizardPageChanged(wxWizardEvent& event) { event.Skip(); }
77 void OnWizardPageShown(wxWizardEvent& event);
78 void OnWizardCancel(wxWizardEvent& event) { event.Skip(); }
79 void OnWizardHelp(wxWizardEvent& event) { event.Skip(); }
80 void OnWizardFinished(wxWizardEvent& event);
81 void m_btnRescanSourcesOnButtonClick(wxCommandEvent& event) {
82 EnumerateDatasources();
83 }
84 void m_btnAddChartDirOnButtonClick(wxCommandEvent& event);
85
86 bool Run() {
87 FitToPage(m_pages[m_pages.Count() - 1]);
88 return RunWizard(m_pages[0]);
89 }
90
91 void EnumerateDatasources();
92 void EnumerateUSB();
93 void EnumerateUDP();
94 void EnumerateTCP();
95 void EnumerateCAN();
96 void EnumerateSignalK();
97 void EnumerateGPSD();
98
99private:
100 MyConfig* m_pConfig;
101 std::vector<ConnectionParams> m_detected_connections;
102 NMEA0183Flavor SeemsN0183(std::string& data);
103 bool SeemsN2000(std::string& data);
104
105 inline void SetControlEnable(int id, bool state) {
106 wxWindow* win = wxWindow::FindWindowById(id);
107 if (win) win->Enable(state);
108 }
109};
110
111#endif //_WIZ_UI_H__
Class FirstUseWiz.