mirror of
https://github.com/g4klx/ircDDBGateway.git
synced 2026-01-20 15:10:18 +01:00
Add Mobile GPS to ircDDB Gateway Config GUI.
This commit is contained in:
parent
baeee75cfd
commit
e57faf2418
|
|
@ -139,6 +139,7 @@
|
|||
<ClCompile Include="DExtraSet.cpp" />
|
||||
<ClCompile Include="DPlusSet.cpp" />
|
||||
<ClCompile Include="DPRSSet.cpp" />
|
||||
<ClCompile Include="MobileGPSSet.cpp" />
|
||||
<ClCompile Include="PortTextCtrl.cpp" />
|
||||
<ClCompile Include="RemoteSet.cpp" />
|
||||
<ClCompile Include="RepeaterDataSet.cpp" />
|
||||
|
|
@ -155,6 +156,7 @@
|
|||
<ClInclude Include="DExtraSet.h" />
|
||||
<ClInclude Include="DPlusSet.h" />
|
||||
<ClInclude Include="DPRSSet.h" />
|
||||
<ClInclude Include="MobileGPSSet.h" />
|
||||
<ClInclude Include="PortTextCtrl.h" />
|
||||
<ClInclude Include="RemoteSet.h" />
|
||||
<ClInclude Include="RepeaterDataSet.h" />
|
||||
|
|
|
|||
|
|
@ -53,6 +53,9 @@
|
|||
<ClCompile Include="XLXSet.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MobileGPSSet.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="AddressTextCtrl.h">
|
||||
|
|
@ -97,5 +100,8 @@
|
|||
<ClInclude Include="XLXSet.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MobileGPSSet.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
OBJECTS = AddressTextCtrl.o CallsignTextCtrl.o DCSSet.o DescriptionTextCtrl.o DExtraSet.o DPlusSet.o DPRSSet.o PortTextCtrl.o RemoteSet.o \
|
||||
OBJECTS = AddressTextCtrl.o CallsignTextCtrl.o DCSSet.o DescriptionTextCtrl.o DExtraSet.o DPlusSet.o DPRSSet.o MobileGPSSet.o PortTextCtrl.o RemoteSet.o \
|
||||
RepeaterDataSet.o RepeaterInfoSet.o RestrictedTextCtrl.o StarNetSet.o XLXSet.o
|
||||
|
||||
all: GUICommon.a
|
||||
|
|
|
|||
118
GUICommon/MobileGPSSet.cpp
Normal file
118
GUICommon/MobileGPSSet.cpp
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "MobileGPSSet.h"
|
||||
|
||||
const unsigned int CONTROL_WIDTH1 = 130U;
|
||||
const unsigned int CONTROL_WIDTH2 = 80U;
|
||||
|
||||
const unsigned int ADDRESS_LENGTH = 15U;
|
||||
const unsigned int PORT_LENGTH = 5U;
|
||||
|
||||
const unsigned int BORDER_SIZE = 5U;
|
||||
|
||||
CMobileGPSSet::CMobileGPSSet(wxWindow* parent, int id, const wxString& title, bool enabled, const wxString& address, unsigned int port) :
|
||||
wxPanel(parent, id),
|
||||
m_title(title),
|
||||
m_enabled(NULL),
|
||||
m_address(NULL),
|
||||
m_port(NULL)
|
||||
{
|
||||
wxFlexGridSizer* sizer = new wxFlexGridSizer(2);
|
||||
|
||||
wxStaticText* enabledLabel = new wxStaticText(this, -1, _("Mobile GPS"));
|
||||
sizer->Add(enabledLabel, 0, wxALL | wxALIGN_RIGHT, BORDER_SIZE);
|
||||
|
||||
m_enabled = new wxChoice(this, -1, wxDefaultPosition, wxSize(CONTROL_WIDTH1, -1));
|
||||
m_enabled->Append(_("Disabled"));
|
||||
m_enabled->Append(_("Enabled"));
|
||||
sizer->Add(m_enabled, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE);
|
||||
m_enabled->SetSelection(enabled ? 1 : 0);
|
||||
|
||||
wxStaticText* addressLabel = new wxStaticText(this, -1, _("Address"));
|
||||
sizer->Add(addressLabel, 0, wxALL | wxALIGN_RIGHT, BORDER_SIZE);
|
||||
|
||||
m_address = new CAddressTextCtrl(this, -1, address, wxDefaultPosition, wxSize(CONTROL_WIDTH1, -1));
|
||||
m_address->SetMaxLength(ADDRESS_LENGTH);
|
||||
sizer->Add(m_address, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE);
|
||||
|
||||
wxStaticText* portLabel = new wxStaticText(this, -1, _("Port"));
|
||||
sizer->Add(portLabel, 0, wxALL | wxALIGN_RIGHT, BORDER_SIZE);
|
||||
|
||||
wxString buffer;
|
||||
buffer.Printf(wxT("%u"), port);
|
||||
|
||||
m_port = new CPortTextCtrl(this, -1, buffer, wxDefaultPosition, wxSize(CONTROL_WIDTH2, -1));
|
||||
m_port->SetMaxLength(PORT_LENGTH);
|
||||
sizer->Add(m_port, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE);
|
||||
|
||||
SetAutoLayout(true);
|
||||
|
||||
SetSizer(sizer);
|
||||
}
|
||||
|
||||
|
||||
CMobileGPSSet::~CMobileGPSSet()
|
||||
{
|
||||
}
|
||||
|
||||
bool CMobileGPSSet::Validate()
|
||||
{
|
||||
if (m_enabled->GetCurrentSelection() == wxNOT_FOUND)
|
||||
return false;
|
||||
|
||||
wxString address = getAddress();
|
||||
|
||||
if (address.IsEmpty()) {
|
||||
wxMessageDialog dialog(this, _("The Repeater Address is not valid"), m_title + _(" Error"), wxICON_ERROR);
|
||||
dialog.ShowModal();
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned int port = getPort();
|
||||
|
||||
if (port == 0U || port > 65535U) {
|
||||
wxMessageDialog dialog(this, _("The Repeater Port is not valid"), m_title + _(" Error"), wxICON_ERROR);
|
||||
dialog.ShowModal();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CMobileGPSSet::getEnabled() const
|
||||
{
|
||||
int c = m_enabled->GetCurrentSelection();
|
||||
if (c == wxNOT_FOUND)
|
||||
return false;
|
||||
|
||||
return c == 1;
|
||||
}
|
||||
|
||||
wxString CMobileGPSSet::getAddress() const
|
||||
{
|
||||
return m_address->GetValue();
|
||||
}
|
||||
|
||||
unsigned int CMobileGPSSet::getPort() const
|
||||
{
|
||||
unsigned long n;
|
||||
m_port->GetValue().ToULong(&n);
|
||||
|
||||
return n;
|
||||
}
|
||||
46
GUICommon/MobileGPSSet.h
Normal file
46
GUICommon/MobileGPSSet.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (C) 2018 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef MobileGPSSet_H
|
||||
#define MobileGPSSet_H
|
||||
|
||||
#include "AddressTextCtrl.h"
|
||||
#include "PortTextCtrl.h"
|
||||
#include "Defs.h"
|
||||
|
||||
#include <wx/wx.h>
|
||||
|
||||
class CMobileGPSSet: public wxPanel {
|
||||
public:
|
||||
CMobileGPSSet(wxWindow* parent, int id, const wxString& title, bool enabled, const wxString& address, unsigned int port);
|
||||
virtual ~CMobileGPSSet();
|
||||
|
||||
virtual bool Validate();
|
||||
|
||||
virtual bool getEnabled() const;
|
||||
virtual wxString getAddress() const;
|
||||
virtual unsigned int getPort() const;
|
||||
|
||||
private:
|
||||
wxString m_title;
|
||||
wxChoice* m_enabled;
|
||||
CAddressTextCtrl* m_address;
|
||||
CPortTextCtrl* m_port;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -65,6 +65,7 @@ m_starNet3(NULL),
|
|||
m_starNet4(NULL),
|
||||
m_starNet5(NULL),
|
||||
m_remote(NULL),
|
||||
m_mobileGPS(NULL),
|
||||
m_miscellaneous(NULL)
|
||||
{
|
||||
SetMenuBar(createMenuBar());
|
||||
|
|
@ -314,6 +315,14 @@ m_miscellaneous(NULL)
|
|||
m_remote = new CRemoteSet(noteBook, -1, APPLICATION_NAME, remoteEnabled, remotePassword, remotePort);
|
||||
noteBook->AddPage(m_remote, wxT("Remote"), false);
|
||||
|
||||
bool mobileGPSEnabled;
|
||||
wxString mobileGPSAddress;
|
||||
unsigned int mobileGPSPort;
|
||||
m_config->getMobileGPS(mobileGPSEnabled, mobileGPSAddress, mobileGPSPort);
|
||||
|
||||
m_mobileGPS = new CMobileGPSSet(noteBook, -1, APPLICATION_NAME, mobileGPSEnabled, mobileGPSAddress, mobileGPSPort);
|
||||
noteBook->AddPage(m_mobileGPS, wxT("Mobile GPS"), false);
|
||||
|
||||
TEXT_LANG language;
|
||||
bool infoEnabled, echoEnabled, logEnabled, dratsEnabled, dtmfEnabled;
|
||||
m_config->getMiscellaneous(language, infoEnabled, echoEnabled, logEnabled, dratsEnabled, dtmfEnabled);
|
||||
|
|
@ -321,15 +330,15 @@ m_miscellaneous(NULL)
|
|||
m_miscellaneous = new CIRCDDBGatewayConfigMiscellaneousSet(noteBook, -1, APPLICATION_NAME, language, infoEnabled, echoEnabled, logEnabled, dratsEnabled, dtmfEnabled);
|
||||
noteBook->AddPage(m_miscellaneous, wxT("Misc"), false);
|
||||
|
||||
sizer->Add(noteBook, 0, wxEXPAND | wxALL, BORDER_SIZE);
|
||||
sizer->Add(noteBook, 0, wxEXPAND | wxALL, BORDER_SIZE);
|
||||
|
||||
panel->SetSizer(sizer);
|
||||
panel->SetSizer(sizer);
|
||||
|
||||
mainSizer->Add(panel, 0, wxEXPAND | wxALL, BORDER_SIZE);
|
||||
mainSizer->Add(panel, 0, wxEXPAND | wxALL, BORDER_SIZE);
|
||||
|
||||
mainSizer->SetSizeHints(this);
|
||||
mainSizer->SetSizeHints(this);
|
||||
|
||||
SetSizer(mainSizer);
|
||||
SetSizer(mainSizer);
|
||||
}
|
||||
|
||||
CIRCDDBGatewayConfigFrame::~CIRCDDBGatewayConfigFrame()
|
||||
|
|
@ -371,7 +380,7 @@ void CIRCDDBGatewayConfigFrame::onSave(wxCommandEvent&)
|
|||
!m_repeaterInfo4->Validate() ||
|
||||
!m_ircDDB->Validate() || !m_ircDDB2->Validate() || !m_ircDDB3->Validate() || !m_ircDDB4->Validate() || !m_dprs->Validate() || !m_dplus->Validate() || !m_dcs->Validate() || !m_xlx->Validate() ||
|
||||
!m_starNet1->Validate() || !m_starNet2->Validate() || !m_starNet3->Validate() || !m_starNet4->Validate() ||
|
||||
!m_starNet5->Validate() || !m_remote->Validate() || !m_miscellaneous->Validate())
|
||||
!m_starNet5->Validate() || !m_remote->Validate() || !m_mobileGPS->Validate() || !m_miscellaneous->Validate())
|
||||
return;
|
||||
|
||||
GATEWAY_TYPE gatewayType = m_gateway->getType();
|
||||
|
|
@ -606,6 +615,11 @@ void CIRCDDBGatewayConfigFrame::onSave(wxCommandEvent&)
|
|||
unsigned int remotePort = m_remote->getPort();
|
||||
m_config->setRemote(remoteEnabled, remotePassword, remotePort);
|
||||
|
||||
bool mobileGPSEnabled = m_mobileGPS->getEnabled();
|
||||
wxString mobileGPSAddress = m_mobileGPS->getAddress();
|
||||
unsigned int mobileGPSPort = m_mobileGPS->getPort();
|
||||
m_config->setMobileGPS(mobileGPSEnabled, mobileGPSAddress, mobileGPSPort);
|
||||
|
||||
TEXT_LANG language = m_miscellaneous->getLanguage();
|
||||
bool infoEnabled = m_miscellaneous->getInfoEnabled();
|
||||
bool echoEnabled = m_miscellaneous->getEchoEnabled();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2010-2014 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2010-2014,2018 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -25,6 +25,7 @@
|
|||
#include "IRCDDBGatewayConfig.h"
|
||||
#include "RepeaterInfoSet.h"
|
||||
#include "RepeaterDataSet.h"
|
||||
#include "MobileGPSSet.h"
|
||||
#include "StarNetSet.h"
|
||||
#include "RemoteSet.h"
|
||||
#include "DExtraSet.h"
|
||||
|
|
@ -65,13 +66,14 @@ private:
|
|||
CDExtraSet* m_dextra;
|
||||
CDPlusSet* m_dplus;
|
||||
CDCSSet* m_dcs;
|
||||
CXLXSet* m_xlx;
|
||||
CXLXSet* m_xlx;
|
||||
CStarNetSet* m_starNet1;
|
||||
CStarNetSet* m_starNet2;
|
||||
CStarNetSet* m_starNet3;
|
||||
CStarNetSet* m_starNet4;
|
||||
CStarNetSet* m_starNet5;
|
||||
CRemoteSet* m_remote;
|
||||
CMobileGPSSet* m_mobileGPS;
|
||||
CIRCDDBGatewayConfigMiscellaneousSet* m_miscellaneous;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
|
|
|||
Loading…
Reference in a new issue