The rest of the CCS removal.

This commit is contained in:
Jonathan Naylor 2018-09-19 15:24:48 +01:00
parent 9669d865b5
commit b6028afa80
10 changed files with 31 additions and 184 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2012,2013 by Jonathan Naylor G4KLX
* Copyright (C) 2012,2013,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
@ -26,72 +26,22 @@ const unsigned int CONTROL_WIDTH = 130U;
const unsigned int BORDER_SIZE = 5U;
const int CHOICE_ENABLED = 8787;
BEGIN_EVENT_TABLE(CDCSSet, wxPanel)
EVT_CHOICE(CHOICE_ENABLED, CDCSSet::onEnabled)
END_EVENT_TABLE()
CDCSSet::CDCSSet(wxWindow* parent, int id, const wxString& title, bool dcsEnabled, bool ccsEnabled, const wxString& ccsHost) :
CDCSSet::CDCSSet(wxWindow* parent, int id, const wxString& title, bool dcsEnabled) :
wxPanel(parent, id),
m_title(title),
m_dcsEnabled(NULL),
m_ccsEnabled(NULL),
m_ccsHosts(NULL)
m_enabled(NULL)
{
wxFlexGridSizer* sizer = new wxFlexGridSizer(2);
wxStaticText* dcsEnabledLabel = new wxStaticText(this, -1, wxT("DCS"));
sizer->Add(dcsEnabledLabel, 0, wxALL | wxALIGN_RIGHT, BORDER_SIZE);
wxStaticText* enabledLabel = new wxStaticText(this, -1, wxT("DCS"));
sizer->Add(enabledLabel, 0, wxALL | wxALIGN_RIGHT, BORDER_SIZE);
m_dcsEnabled = new wxChoice(this, -1, wxDefaultPosition, wxSize(CONTROL_WIDTH, -1));
m_dcsEnabled->Append(_("Disabled"));
m_dcsEnabled->Append(_("Enabled"));
sizer->Add(m_dcsEnabled, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE);
m_dcsEnabled->SetSelection(dcsEnabled ? 1 : 0);
wxStaticText* ccsEnabledLabel = new wxStaticText(this, -1, wxT("CCS"));
sizer->Add(ccsEnabledLabel, 0, wxALL | wxALIGN_RIGHT, BORDER_SIZE);
m_ccsEnabled = new wxChoice(this, CHOICE_ENABLED, wxDefaultPosition, wxSize(CONTROL_WIDTH, -1));
m_ccsEnabled->Append(_("Disabled"));
m_ccsEnabled->Append(_("Enabled"));
sizer->Add(m_ccsEnabled, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE);
m_ccsEnabled->SetSelection(ccsEnabled ? 1 : 0);
wxStaticText* ccsHostsLabel = new wxStaticText(this, -1, _("Server"));
sizer->Add(ccsHostsLabel, 0, wxALL | wxALIGN_RIGHT, BORDER_SIZE);
m_ccsHosts = new wxChoice(this, -1, wxDefaultPosition, wxSize(CONTROL_WIDTH, -1));
sizer->Add(m_ccsHosts, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE);
wxFileName fileName(wxFileName::GetHomeDir(), CCS_HOSTS_FILE_NAME);
if (!fileName.IsFileReadable()) {
#if defined(__WINDOWS__)
fileName.Assign(::wxGetCwd(), CCS_HOSTS_FILE_NAME);
#else
fileName.Assign(wxT(DATA_DIR), CCS_HOSTS_FILE_NAME);
#endif
}
CHostFile file(fileName.GetFullPath(), false);
for (unsigned int i = 0U; i < file.getCount(); i++)
m_ccsHosts->Append(file.getName(i));
if (ccsHost.IsEmpty()) {
m_ccsHosts->SetSelection(0);
} else {
bool res = m_ccsHosts->SetStringSelection(ccsHost);
if (!res)
m_ccsHosts->SetSelection(0);
}
if (ccsEnabled)
m_ccsHosts->Enable();
else
m_ccsHosts->Disable();
m_enabled = new wxChoice(this, -1, wxDefaultPosition, wxSize(CONTROL_WIDTH, -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);
SetAutoLayout(true);
@ -105,52 +55,18 @@ CDCSSet::~CDCSSet()
bool CDCSSet::Validate()
{
int n = m_dcsEnabled->GetCurrentSelection();
int n = m_enabled->GetCurrentSelection();
if (n == wxNOT_FOUND)
return false;
n = m_ccsEnabled->GetCurrentSelection();
if (n == wxNOT_FOUND)
return false;
if (m_ccsHosts->GetCurrentSelection() == wxNOT_FOUND)
return false;
return true;
}
bool CDCSSet::getDCSEnabled() const
bool CDCSSet::getEnabled() const
{
int c = m_dcsEnabled->GetCurrentSelection();
int c = m_enabled->GetCurrentSelection();
if (c == wxNOT_FOUND)
return false;
return c == 1;
}
bool CDCSSet::getCCSEnabled() const
{
int c = m_ccsEnabled->GetCurrentSelection();
if (c == wxNOT_FOUND)
return false;
return c == 1;
}
wxString CDCSSet::getCCSHost() const
{
int n = m_ccsHosts->GetSelection();
if (n == wxNOT_FOUND)
return wxEmptyString;
return m_ccsHosts->GetStringSelection();
}
void CDCSSet::onEnabled(wxCommandEvent &event)
{
int n = m_ccsEnabled->GetCurrentSelection();
if (n != 1)
m_ccsHosts->Disable();
else
m_ccsHosts->Enable();
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2012,2013 by Jonathan Naylor G4KLX
* Copyright (C) 2012,2013,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
@ -23,24 +23,16 @@
class CDCSSet : public wxPanel {
public:
CDCSSet(wxWindow* parent, int id, const wxString& title, bool dcsEnabled, bool ccsEnabled, const wxString& ccsHost);
CDCSSet(wxWindow* parent, int id, const wxString& title, bool dcsEnabled);
virtual ~CDCSSet();
virtual bool Validate();
virtual bool getDCSEnabled() const;
virtual bool getCCSEnabled() const;
virtual wxString getCCSHost() const;
virtual void onEnabled(wxCommandEvent& event);
virtual bool getEnabled() const;
private:
wxString m_title;
wxChoice* m_dcsEnabled;
wxChoice* m_ccsEnabled;
wxChoice* m_ccsHosts;
DECLARE_EVENT_TABLE()
wxChoice* m_enabled;
};
#endif

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2011,2012,2013 by Jonathan Naylor G4KLX
* Copyright (C) 2011,2012,2013,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
@ -303,9 +303,6 @@ void CRemoteControlRepeaterPanel::add(const CRemoteControlRepeaterData& data)
case PROTO_DCS:
m_list->SetItem(0L, 1, wxT("DCS"));
break;
case PROTO_CCS:
m_list->SetItem(0L, 1, wxT("CCS"));
break;
default:
m_list->SetItem(0L, 1, wxT("?????"));
break;

View file

@ -1,4 +1,3 @@
usr/share/opendv/CCS_Hosts.txt
usr/share/opendv/DCS_Hosts.txt
usr/share/opendv/de_DE.ambe
usr/share/opendv/de_DE.indx

View file

@ -831,10 +831,9 @@ void CIRCDDBGatewayApp::createThread()
m_config->getDPlus(dplusEnabled, dplusMaxDongles, dplusLogin);
wxLogInfo(wxT("D-Plus enabled: %d, max. dongles; %u, login: %s"), int(dplusEnabled), dplusMaxDongles, dplusLogin.c_str());
bool dcsEnabled, ccsEnabled;
wxString ccsHost;
m_config->getDCS(dcsEnabled, ccsEnabled, ccsHost);
wxLogInfo(wxT("DCS enabled: %d, CCS enabled: %d, server: %s"), int(dcsEnabled), int(ccsEnabled), ccsHost.c_str());
bool dcsEnabled;
m_config->getDCS(dcsEnabled);
wxLogInfo(wxT("DCS enabled: %d"), int(dcsEnabled));
bool xlxEnabled;
bool xlxOverrideLocal;
@ -909,7 +908,6 @@ void CIRCDDBGatewayApp::createThread()
thread->setDPlus(dplusEnabled, dplusMaxDongles, dplusLogin);
thread->setDExtra(dextraEnabled, dextraMaxDongles);
thread->setDCS(dcsEnabled);
thread->setCCS(ccsEnabled, ccsHost);
thread->setXLX(xlxEnabled, xlxOverrideLocal, xlxEnabled ? CXLXHostsFileDownloader::Download(xlxHostsFileUrl) : wxString(wxEmptyString));
thread->setInfoEnabled(infoEnabled);
thread->setEchoEnabled(echoEnabled);

View file

@ -821,10 +821,9 @@ bool CIRCDDBGatewayAppD::createThread()
config.getDPlus(dplusEnabled, dplusMaxDongles, dplusLogin);
wxLogInfo(wxT("D-Plus enabled: %d, max. dongles; %u, login: %s"), int(dplusEnabled), dplusMaxDongles, dplusLogin.c_str());
bool dcsEnabled, ccsEnabled;
wxString ccsHost;
config.getDCS(dcsEnabled, ccsEnabled, ccsHost);
wxLogInfo(wxT("DCS enabled: %d, CCS enabled: %d, server: %s"), int(dcsEnabled), int(ccsEnabled), ccsHost.c_str());
bool dcsEnabled;
config.getDCS(dcsEnabled);
wxLogInfo(wxT("DCS enabled: %d"), int(dcsEnabled));
bool xlxEnabled;
bool xlxOverrideLocal;
@ -898,7 +897,6 @@ bool CIRCDDBGatewayAppD::createThread()
m_thread->setDPlus(dplusEnabled, dplusMaxDongles, dplusLogin);
m_thread->setDExtra(dextraEnabled, dextraMaxDongles);
m_thread->setDCS(dcsEnabled);
m_thread->setCCS(ccsEnabled, ccsHost);
m_thread->setXLX(xlxEnabled, xlxOverrideLocal, xlxEnabled ? CXLXHostsFileDownloader::Download(xlxHostsFileUrl): wxString(wxEmptyString));
m_thread->setInfoEnabled(infoEnabled);
m_thread->setEchoEnabled(echoEnabled);

View file

@ -291,7 +291,6 @@ void CIRCDDBGatewayFrame::onTimer(wxTimerEvent&)
case LS_LINKED_DEXTRA:
case LS_LINKED_DPLUS:
case LS_LINKED_DCS:
case LS_LINKED_CCS:
text.Append(_(" Linked to "));
text.Append(linkCallsign);
break;

View file

@ -25,7 +25,6 @@
#include "DPlusHandler.h"
#include "HeaderLogger.h"
#include "ConnectData.h"
#include "CCSHandler.h"
#include "HeaderData.h"
#include "StatusData.h"
#include "DCSHandler.h"
@ -35,7 +34,6 @@
#include "PollData.h"
#include "AMBEData.h"
#include "HostFile.h"
#include "CCSData.h"
#include "DDData.h"
#include "Utils.h"
#include "Defs.h"
@ -84,8 +82,6 @@ m_dplusLogin(),
m_dcsEnabled(true),
m_xlxEnabled(true),
m_xlxHostsFileName(),
m_ccsEnabled(true),
m_ccsHost(),
m_infoEnabled(true),
m_echoEnabled(true),
m_dtmfEnabled(true),
@ -117,7 +113,6 @@ m_restrictList(NULL)
CDCSHandler::initialise(MAX_DCS_LINKS);
CRepeaterHandler::initialise(MAX_REPEATERS);
CStarNetHandler::initialise(MAX_STARNETS, m_name);
CCCSHandler::initialise(MAX_REPEATERS);
CAudioUnit::initialise();
}
@ -130,7 +125,6 @@ CIRCDDBGatewayThread::~CIRCDDBGatewayThread()
CDCSHandler::finalise();
CRepeaterHandler::finalise();
CStarNetHandler::finalise();
CCCSHandler::finalise();
CAudioUnit::finalise();
}
@ -313,11 +307,6 @@ void CIRCDDBGatewayThread::run()
CDDHandler::setIRC(m_irc);
}
wxString ccsAddress = m_ccsEnabled ? m_gatewayAddress : LOOPBACK_ADDRESS;
CCCSHandler::setLocalAddress(ccsAddress);
CCCSHandler::setHeaderLogger(headerLogger);
CCCSHandler::setHost(m_ccsHost);
if (m_remoteEnabled && !m_remotePassword.IsEmpty() && m_remotePort > 0U) {
m_remote = new CRemoteHandler(m_remotePassword, m_remotePort, m_gatewayAddress);
bool res = m_remote->open();
@ -360,7 +349,6 @@ void CIRCDDBGatewayThread::run()
processDPlus();
processDCS();
processG2();
CCCSHandler::process();
if (m_ddModeEnabled)
processDD();
@ -378,7 +366,6 @@ void CIRCDDBGatewayThread::run()
CDCSHandler::clock(ms);
CStarNetHandler::clock(ms);
CDDHandler::clock(ms);
CCCSHandler::clock(ms);
m_statusTimer2.clock(ms);
@ -397,8 +384,7 @@ void CIRCDDBGatewayThread::run()
bool ret1 = CDExtraHandler::stateChange();
bool ret2 = CDPlusHandler::stateChange();
bool ret3 = CDCSHandler::stateChange();
bool ret4 = CCCSHandler::stateChange();
if (ret1 || ret2 || ret3 || ret4)
if (ret1 || ret2 || ret3)
writeStatus();
m_statusTimer1.start();
@ -423,7 +409,6 @@ void CIRCDDBGatewayThread::run()
CDExtraHandler::unlink();
CDPlusHandler::unlink();
CDCSHandler::unlink();
CCCSHandler::disconnect();
if (m_ddModeEnabled)
CDDHandler::finalise();
@ -580,31 +565,6 @@ void CIRCDDBGatewayThread::setXLX(bool enabled, bool overrideLocal, const wxStri
m_xlxOverrideLocal = overrideLocal;
}
void CIRCDDBGatewayThread::setCCS(bool enabled, const wxString& host)
{
m_ccsEnabled = enabled;
wxFileName fileName(wxFileName::GetHomeDir(), CCS_HOSTS_FILE_NAME);
if (!fileName.IsFileReadable()) {
wxLogMessage(wxT("File %s not readable"), fileName.GetFullPath().c_str());
#if defined(__WINDOWS__)
fileName.Assign(::wxGetCwd(), CCS_HOSTS_FILE_NAME);
#else
fileName.Assign(wxT(DATA_DIR), CCS_HOSTS_FILE_NAME);
#endif
if (!fileName.IsFileReadable()) {
wxLogMessage(wxT("File %s not readable"), fileName.GetFullPath().c_str());
m_ccsEnabled = false;
return;
}
}
CHostFile hostFile(fileName.GetFullPath(), true);
m_ccsHost = hostFile.getAddress(host);
}
void CIRCDDBGatewayThread::setLog(bool enabled)
{
m_logEnabled = enabled;
@ -1298,7 +1258,6 @@ void CIRCDDBGatewayThread::writeStatus()
CDExtraHandler::writeStatus(file);
CDPlusHandler::writeStatus(file);
CDCSHandler::writeStatus(file);
CCCSHandler::writeStatus(file);
file.Close();
}
@ -1318,7 +1277,6 @@ CIRCDDBGatewayStatusData* CIRCDDBGatewayThread::getStatus() const
if (ret) {
wxString incoming1 = CDExtraHandler::getIncoming(callsign);
wxString incoming2 = CDCSHandler::getIncoming(callsign);
wxString incoming3 = CCCSHandler::getIncoming(callsign);
wxString incoming;
if (!incoming1.IsEmpty()) {
@ -1329,10 +1287,6 @@ CIRCDDBGatewayStatusData* CIRCDDBGatewayThread::getStatus() const
incoming.Append(incoming2);
incoming.Append(wxT(" "));
}
if (!incoming3.IsEmpty()) {
incoming.Append(incoming3);
incoming.Append(wxT(" "));
}
status->setRepeater(i, callsign, linkStatus, linkCallsign, incoming);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2013,2015 by Jonathan Naylor G4KLX
* Copyright (C) 2010-2013,2015,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
@ -59,7 +59,6 @@ public:
virtual void setDPlus(bool enabled, unsigned int maxDongles, const wxString& login);
virtual void setDCS(bool enabled);
virtual void setXLX(bool enabled, bool overrideLocal, const wxString& fileName);
virtual void setCCS(bool enabled, const wxString& host);
virtual void setLog(bool enabled);
virtual void setAPRSWriter(CAPRSWriter* writer);
virtual void setInfoEnabled(bool enabled);
@ -105,8 +104,6 @@ private:
bool m_xlxEnabled;
bool m_xlxOverrideLocal;
wxString m_xlxHostsFileName;
bool m_ccsEnabled;
wxString m_ccsHost;
bool m_infoEnabled;
bool m_echoEnabled;
bool m_dtmfEnabled;

View file

@ -98,9 +98,8 @@ m_miscellaneous(NULL)
bool dplusEnabled;
m_config->getDPlus(dplusEnabled, maxDPlusDongles, dplusLogin);
bool dcsEnabled, ccsEnabled;
wxString ccsHost;
m_config->getDCS(dcsEnabled, ccsEnabled, ccsHost);
bool dcsEnabled;
m_config->getDCS(dcsEnabled);
bool xlxEnabled;
bool xlxOverrideLocal;
@ -208,8 +207,8 @@ m_miscellaneous(NULL)
m_dplus = new CDPlusSet(noteBook, -1, APPLICATION_NAME, dplusEnabled, maxDPlusDongles, MAX_DPLUS_LINKS, dplusLogin);
noteBook->AddPage(m_dplus, wxT("D-Plus"), false);
m_dcs = new CDCSSet(noteBook, -1, APPLICATION_NAME, dcsEnabled, ccsEnabled, ccsHost);
noteBook->AddPage(m_dcs, _("DCS and CCS"), false);
m_dcs = new CDCSSet(noteBook, -1, APPLICATION_NAME, dcsEnabled);
noteBook->AddPage(m_dcs, _("DCS"), false);
m_xlx = new CXLXSet(noteBook, -1, APPLICATION_NAME, xlxEnabled, xlxOverrideLocal, xlxHostsFileUrl);
noteBook->AddPage(m_xlx, _("XLX Hosts File"), false);
@ -512,9 +511,7 @@ void CIRCDDBGatewayConfigFrame::onSave(wxCommandEvent&)
m_config->setDPlus(dplusEnabled, maxDPlusDongles, dplusLogin);
bool dcsEnabled = m_dcs->getDCSEnabled();
bool ccsEnabled = m_dcs->getCCSEnabled();
wxString ccsHost = m_dcs->getCCSHost();
m_config->setDCS(dcsEnabled, ccsEnabled, ccsHost);
m_config->setDCS(dcsEnabled);
bool xlxEnabled = m_xlx->getXLXEnabled();
bool xlxOverrideLocal = m_xlx->getXLXOverrideLocal();