Allow direct connection using XLX instead of DCS

This commit is contained in:
Geoffrey Merck F4FXL - KC3FRA 2019-03-23 08:17:42 +01:00
parent b8ee3948ed
commit 075fa42d0c
11 changed files with 47 additions and 84 deletions

View file

@ -39,6 +39,8 @@ CCallsignList* CDCSHandler::m_blackList = NULL;
CDCSHandler::CDCSHandler(IReflectorCallback* handler, const wxString& reflector, const wxString& repeater, CDCSProtocolHandler* protoHandler, const in_addr& address, unsigned int port, DIRECTION direction) : CDCSHandler::CDCSHandler(IReflectorCallback* handler, const wxString& reflector, const wxString& repeater, CDCSProtocolHandler* protoHandler, const in_addr& address, unsigned int port, DIRECTION direction) :
m_reflector(reflector.Clone()), m_reflector(reflector.Clone()),
m_xlxReflector(_T("")),
m_isXlx(false),
m_repeater(repeater.Clone()), m_repeater(repeater.Clone()),
m_handler(protoHandler), m_handler(protoHandler),
m_yourAddress(address), m_yourAddress(address),
@ -78,6 +80,11 @@ m_rptCall2()
m_linkState = DCS_LINKED; m_linkState = DCS_LINKED;
} else { } else {
m_linkState = DCS_LINKING; m_linkState = DCS_LINKING;
m_isXlx = m_reflector.StartsWith(_T("XLX"));
if(m_isXlx) {
m_xlxReflector = m_reflector.Clone();
m_reflector = _T("DCS") + m_reflector.Right(m_reflector.length() - 3);
}
m_tryTimer.start(); m_tryTimer.start();
} }
} }
@ -634,10 +641,10 @@ bool CDCSHandler::processInt(CConnectData& connect, CD_TYPE type)
return false; return false;
if (m_linkState == DCS_LINKING) { if (m_linkState == DCS_LINKING) {
wxLogMessage(wxT("DCS ACK message received from %s"), m_reflector.c_str()); wxLogMessage(wxT("DCS ACK message received from %s"), GET_DISP_REFLECTOR(this).c_str());
if (m_direction == DIR_OUTGOING && m_destination != NULL) if (m_direction == DIR_OUTGOING && m_destination != NULL)
m_destination->linkUp(DP_DCS, m_reflector); m_destination->linkUp(DP_DCS, GET_DISP_REFLECTOR(this));
m_tryTimer.stop(); m_tryTimer.stop();
m_stateChange = true; m_stateChange = true;
@ -651,16 +658,16 @@ bool CDCSHandler::processInt(CConnectData& connect, CD_TYPE type)
return false; return false;
if (m_linkState == DCS_LINKING) { if (m_linkState == DCS_LINKING) {
wxLogMessage(wxT("DCS NAK message received from %s"), m_reflector.c_str()); wxLogMessage(wxT("DCS NAK message received from %s"), GET_DISP_REFLECTOR(this).c_str());
if (m_direction == DIR_OUTGOING && m_destination != NULL) if (m_direction == DIR_OUTGOING && m_destination != NULL)
m_destination->linkRefused(DP_DCS, m_reflector); m_destination->linkRefused(DP_DCS, GET_DISP_REFLECTOR(this));
return true; return true;
} }
if (m_linkState == DCS_UNLINKING) { if (m_linkState == DCS_UNLINKING) {
wxLogMessage(wxT("DCS NAK message received from %s"), m_reflector.c_str()); wxLogMessage(wxT("DCS NAK message received from %s"), GET_DISP_REFLECTOR(this).c_str());
if (m_direction == DIR_OUTGOING && m_destination != NULL) if (m_direction == DIR_OUTGOING && m_destination != NULL)
m_destination->linkFailed(DP_DCS, m_reflector, false); m_destination->linkFailed(DP_DCS, m_reflector, false);
@ -675,10 +682,10 @@ bool CDCSHandler::processInt(CConnectData& connect, CD_TYPE type)
return false; return false;
if (m_linkState == DCS_LINKED) { if (m_linkState == DCS_LINKED) {
wxLogMessage(wxT("DCS disconnect message received from %s"), m_reflector.c_str()); wxLogMessage(wxT("DCS disconnect message received from %s"), GET_DISP_REFLECTOR(this).c_str());
if (m_direction == DIR_OUTGOING && m_destination != NULL) if (m_direction == DIR_OUTGOING && m_destination != NULL)
m_destination->linkFailed(DP_DCS, m_reflector, false); m_destination->linkFailed(DP_DCS, GET_DISP_REFLECTOR(this), false);
m_stateChange = true; m_stateChange = true;
} }
@ -706,20 +713,20 @@ bool CDCSHandler::clockInt(unsigned int ms)
switch (m_linkState) { switch (m_linkState) {
case DCS_LINKING: case DCS_LINKING:
wxLogMessage(wxT("DCS link to %s has failed to connect"), m_reflector.c_str()); wxLogMessage(wxT("DCS link to %s has failed to connect"), GET_DISP_REFLECTOR(this).c_str());
break; break;
case DCS_LINKED: case DCS_LINKED:
wxLogMessage(wxT("DCS link to %s has failed (poll inactivity)"), m_reflector.c_str()); wxLogMessage(wxT("DCS link to %s has failed (poll inactivity)"), GET_DISP_REFLECTOR(this).c_str());
break; break;
case DCS_UNLINKING: case DCS_UNLINKING:
wxLogMessage(wxT("DCS link to %s has failed to disconnect cleanly"), m_reflector.c_str()); wxLogMessage(wxT("DCS link to %s has failed to disconnect cleanly"), GET_DISP_REFLECTOR(this).c_str());
break; break;
default: default:
break; break;
} }
if (m_direction == DIR_OUTGOING) { if (m_direction == DIR_OUTGOING) {
bool reconnect = m_destination->linkFailed(DP_DCS, m_reflector, true); bool reconnect = m_destination->linkFailed(DP_DCS, GET_DISP_REFLECTOR(this), true);
if (reconnect) { if (reconnect) {
CConnectData reply(m_gatewayType, m_repeater, m_reflector, CT_LINK1, m_yourAddress, m_yourPort); CConnectData reply(m_gatewayType, m_repeater, m_reflector, CT_LINK1, m_yourAddress, m_yourPort);
m_handler->writeConnect(reply); m_handler->writeConnect(reply);
@ -844,7 +851,7 @@ void CDCSHandler::writeStatus(wxFFile& file)
wxString text; wxString text;
text.Printf(wxT("%04d-%02d-%02d %02d:%02d:%02d: DCS link - Type: Repeater Rptr: %s Refl: %s Dir: Outgoing\n"), text.Printf(wxT("%04d-%02d-%02d %02d:%02d:%02d: DCS link - Type: Repeater Rptr: %s Refl: %s Dir: Outgoing\n"),
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
reflector->m_repeater.c_str(), reflector->m_reflector.c_str()); reflector->m_repeater.c_str(), GET_DISP_REFLECTOR(reflector).c_str());
file.Write(text); file.Write(text);
} }
break; break;
@ -854,7 +861,7 @@ void CDCSHandler::writeStatus(wxFFile& file)
wxString text; wxString text;
text.Printf(wxT("%04d-%02d-%02d %02d:%02d:%02d: DCS link - Type: Repeater Rptr: %s Refl: %s Dir: Incoming\n"), text.Printf(wxT("%04d-%02d-%02d %02d:%02d:%02d: DCS link - Type: Repeater Rptr: %s Refl: %s Dir: Incoming\n"),
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
reflector->m_repeater.c_str(), reflector->m_reflector.c_str()); reflector->m_repeater.c_str(), GET_DISP_REFLECTOR(reflector).c_str());
file.Write(text); file.Write(text);
} }
break; break;

View file

@ -39,6 +39,8 @@
#include <wx/wx.h> #include <wx/wx.h>
#include <wx/ffile.h> #include <wx/ffile.h>
#define GET_DISP_REFLECTOR(refl) (refl->m_isXlx ? refl->m_xlxReflector : refl->m_reflector)
enum DCS_STATE { enum DCS_STATE {
DCS_LINKING, DCS_LINKING,
DCS_LINKED, DCS_LINKED,
@ -109,6 +111,8 @@ private:
static CCallsignList* m_blackList; static CCallsignList* m_blackList;
wxString m_reflector; wxString m_reflector;
wxString m_xlxReflector;
bool m_isXlx;
wxString m_repeater; wxString m_repeater;
CDCSProtocolHandler* m_handler; CDCSProtocolHandler* m_handler;
in_addr m_yourAddress; in_addr m_yourAddress;

View file

@ -141,7 +141,6 @@ const wxString KEY_DCS_ENABLED = wxT("dcsEnabled");
const wxString KEY_CCS_ENABLED = wxT("ccsEnabled"); const wxString KEY_CCS_ENABLED = wxT("ccsEnabled");
const wxString KEY_CCS_HOST = wxT("ccsHost"); const wxString KEY_CCS_HOST = wxT("ccsHost");
const wxString KEY_XLX_ENABLED = wxT("xlxEnabled"); const wxString KEY_XLX_ENABLED = wxT("xlxEnabled");
const wxString KEY_XLX_OVERRIDE_LOCAL = wxT("xlxOverrideLocal");
const wxString KEY_XLX_HOSTS_FILE_URL = wxT("xlxHostsFileUrl"); const wxString KEY_XLX_HOSTS_FILE_URL = wxT("xlxHostsFileUrl");
const wxString KEY_STARNET_BAND1 = wxT("starNetBand1"); const wxString KEY_STARNET_BAND1 = wxT("starNetBand1");
const wxString KEY_STARNET_CALLSIGN1 = wxT("starNetCallsign1"); const wxString KEY_STARNET_CALLSIGN1 = wxT("starNetCallsign1");
@ -267,8 +266,7 @@ const bool DEFAULT_DCS_ENABLED = true;
const bool DEFAULT_CCS_ENABLED = true; const bool DEFAULT_CCS_ENABLED = true;
const wxString DEFAULT_CCS_HOST = wxT("CCS704 "); const wxString DEFAULT_CCS_HOST = wxT("CCS704 ");
const bool DEFAULT_XLX_ENABLED = true; const bool DEFAULT_XLX_ENABLED = true;
const bool DEFAULT_XLX_OVERRIDE_LOCAL = true; const wxString DEFAULT_XLX_HOSTS_FILE_URL = _T("http://xlxapi.rlx.lu/api.php?do=GetXLXDMRMaster");//we use the XLXDMRMaster list because it starts with XLX instead of DCS, XRF etc ....
const wxString DEFAULT_XLX_HOSTS_FILE_URL = _T("http://xlxapi.rlx.lu/api.php?do=GetReflectorHostname");
const wxString DEFAULT_STARNET_BAND = wxEmptyString; const wxString DEFAULT_STARNET_BAND = wxEmptyString;
const wxString DEFAULT_STARNET_CALLSIGN = wxEmptyString; const wxString DEFAULT_STARNET_CALLSIGN = wxEmptyString;
const wxString DEFAULT_STARNET_LOGOFF = wxEmptyString; const wxString DEFAULT_STARNET_LOGOFF = wxEmptyString;
@ -422,7 +420,6 @@ m_dcsEnabled(DEFAULT_DCS_ENABLED),
m_ccsEnabled(DEFAULT_CCS_ENABLED), m_ccsEnabled(DEFAULT_CCS_ENABLED),
m_ccsHost(DEFAULT_CCS_HOST), m_ccsHost(DEFAULT_CCS_HOST),
m_xlxEnabled(DEFAULT_XLX_ENABLED), m_xlxEnabled(DEFAULT_XLX_ENABLED),
m_xlxOverrideLocal(DEFAULT_XLX_OVERRIDE_LOCAL),
m_xlxHostsFileUrl(DEFAULT_XLX_HOSTS_FILE_URL), m_xlxHostsFileUrl(DEFAULT_XLX_HOSTS_FILE_URL),
m_starNet1Band(DEFAULT_STARNET_BAND), m_starNet1Band(DEFAULT_STARNET_BAND),
m_starNet1Callsign(DEFAULT_STARNET_CALLSIGN), m_starNet1Callsign(DEFAULT_STARNET_CALLSIGN),
@ -762,8 +759,6 @@ m_y(DEFAULT_WINDOW_Y)
m_config->Read(m_name + KEY_XLX_ENABLED, &m_xlxEnabled, DEFAULT_XLX_ENABLED); m_config->Read(m_name + KEY_XLX_ENABLED, &m_xlxEnabled, DEFAULT_XLX_ENABLED);
m_config->Read(m_name + KEY_XLX_OVERRIDE_LOCAL, &m_xlxOverrideLocal, DEFAULT_XLX_OVERRIDE_LOCAL);
m_config->Read(m_name + KEY_XLX_HOSTS_FILE_URL, &m_xlxHostsFileUrl, DEFAULT_XLX_HOSTS_FILE_URL); m_config->Read(m_name + KEY_XLX_HOSTS_FILE_URL, &m_xlxHostsFileUrl, DEFAULT_XLX_HOSTS_FILE_URL);
m_config->Read(m_name + KEY_STARNET_BAND1, &m_starNet1Band, DEFAULT_STARNET_BAND); m_config->Read(m_name + KEY_STARNET_BAND1, &m_starNet1Band, DEFAULT_STARNET_BAND);
@ -1045,7 +1040,6 @@ m_dcsEnabled(DEFAULT_DCS_ENABLED),
m_ccsEnabled(DEFAULT_CCS_ENABLED), m_ccsEnabled(DEFAULT_CCS_ENABLED),
m_ccsHost(DEFAULT_CCS_HOST), m_ccsHost(DEFAULT_CCS_HOST),
m_xlxEnabled(DEFAULT_XLX_ENABLED), m_xlxEnabled(DEFAULT_XLX_ENABLED),
m_xlxOverrideLocal(DEFAULT_XLX_OVERRIDE_LOCAL),
m_xlxHostsFileUrl(DEFAULT_XLX_HOSTS_FILE_URL), m_xlxHostsFileUrl(DEFAULT_XLX_HOSTS_FILE_URL),
m_starNet1Band(DEFAULT_STARNET_BAND), m_starNet1Band(DEFAULT_STARNET_BAND),
m_starNet1Callsign(DEFAULT_STARNET_CALLSIGN), m_starNet1Callsign(DEFAULT_STARNET_CALLSIGN),
@ -1438,9 +1432,6 @@ m_y(DEFAULT_WINDOW_Y)
} else if (key.IsSameAs(KEY_XLX_ENABLED)) { } else if (key.IsSameAs(KEY_XLX_ENABLED)) {
val.ToLong(&temp1); val.ToLong(&temp1);
m_xlxEnabled = temp1 == 1L; m_xlxEnabled = temp1 == 1L;
} else if (key.IsSameAs(KEY_XLX_OVERRIDE_LOCAL)) {
val.ToLong(&temp1);
m_xlxOverrideLocal = temp1 == 1L;
} else if (key.IsSameAs(KEY_XLX_HOSTS_FILE_URL)) { } else if (key.IsSameAs(KEY_XLX_HOSTS_FILE_URL)) {
m_xlxHostsFileUrl = val; m_xlxHostsFileUrl = val;
} else if (key.IsSameAs(KEY_STARNET_BAND1)) { } else if (key.IsSameAs(KEY_STARNET_BAND1)) {
@ -1968,17 +1959,15 @@ void CIRCDDBGatewayConfig::setDCS(bool dcsEnabled, bool ccsEnabled, const wxStri
m_ccsHost = ccsHost; m_ccsHost = ccsHost;
} }
void CIRCDDBGatewayConfig::getXLX(bool& xlxEnabled, bool& xlxOverrideLocal, wxString& xlxHostsFileUrl) void CIRCDDBGatewayConfig::getXLX(bool& xlxEnabled, wxString& xlxHostsFileUrl)
{ {
xlxEnabled = m_xlxEnabled; xlxEnabled = m_xlxEnabled;
xlxOverrideLocal = m_xlxOverrideLocal;
xlxHostsFileUrl = m_xlxHostsFileUrl; xlxHostsFileUrl = m_xlxHostsFileUrl;
} }
void CIRCDDBGatewayConfig::setXLX(bool xlxEnabled, bool xlxOverrideLocal, wxString xlxHostsFileUrl) void CIRCDDBGatewayConfig::setXLX(bool xlxEnabled, wxString xlxHostsFileUrl)
{ {
m_xlxEnabled = xlxEnabled; m_xlxEnabled = xlxEnabled;
m_xlxOverrideLocal = xlxOverrideLocal;
m_xlxHostsFileUrl = xlxHostsFileUrl; m_xlxHostsFileUrl = xlxHostsFileUrl;
} }
@ -2419,7 +2408,6 @@ bool CIRCDDBGatewayConfig::write()
m_config->Write(m_name + KEY_CCS_ENABLED, m_ccsEnabled); m_config->Write(m_name + KEY_CCS_ENABLED, m_ccsEnabled);
m_config->Write(m_name + KEY_CCS_HOST, m_ccsHost); m_config->Write(m_name + KEY_CCS_HOST, m_ccsHost);
m_config->Write(m_name + KEY_XLX_ENABLED, m_xlxEnabled); m_config->Write(m_name + KEY_XLX_ENABLED, m_xlxEnabled);
m_config->Write(m_name + KEY_XLX_OVERRIDE_LOCAL, m_xlxOverrideLocal);
m_config->Write(m_name + KEY_XLX_HOSTS_FILE_URL, m_xlxHostsFileUrl); m_config->Write(m_name + KEY_XLX_HOSTS_FILE_URL, m_xlxHostsFileUrl);
m_config->Write(m_name + KEY_STARNET_BAND1, m_starNet1Band); m_config->Write(m_name + KEY_STARNET_BAND1, m_starNet1Band);
m_config->Write(m_name + KEY_STARNET_CALLSIGN1, m_starNet1Callsign); m_config->Write(m_name + KEY_STARNET_CALLSIGN1, m_starNet1Callsign);
@ -2630,7 +2618,6 @@ bool CIRCDDBGatewayConfig::write()
buffer.Printf(wxT("%s=%d"), KEY_CCS_ENABLED.c_str(), m_ccsEnabled ? 1 : 0); file.AddLine(buffer); buffer.Printf(wxT("%s=%d"), KEY_CCS_ENABLED.c_str(), m_ccsEnabled ? 1 : 0); file.AddLine(buffer);
buffer.Printf(wxT("%s=%s"), KEY_CCS_HOST.c_str(), m_ccsHost.c_str()); file.AddLine(buffer); buffer.Printf(wxT("%s=%s"), KEY_CCS_HOST.c_str(), m_ccsHost.c_str()); file.AddLine(buffer);
buffer.Printf(wxT("%s=%d"), KEY_XLX_ENABLED.c_str(), m_xlxEnabled ? 1 : 0); file.AddLine(buffer); buffer.Printf(wxT("%s=%d"), KEY_XLX_ENABLED.c_str(), m_xlxEnabled ? 1 : 0); file.AddLine(buffer);
buffer.Printf(wxT("%s=%d"), KEY_XLX_OVERRIDE_LOCAL.c_str(), m_xlxOverrideLocal ? 1 : 0); file.AddLine(buffer);
buffer.Printf(wxT("%s=%s"), KEY_XLX_HOSTS_FILE_URL.c_str(), m_xlxHostsFileUrl.c_str()); file.AddLine(buffer); buffer.Printf(wxT("%s=%s"), KEY_XLX_HOSTS_FILE_URL.c_str(), m_xlxHostsFileUrl.c_str()); file.AddLine(buffer);
buffer.Printf(wxT("%s=%s"), KEY_STARNET_BAND1.c_str(), m_starNet1Band.c_str()); file.AddLine(buffer); buffer.Printf(wxT("%s=%s"), KEY_STARNET_BAND1.c_str(), m_starNet1Band.c_str()); file.AddLine(buffer);
buffer.Printf(wxT("%s=%s"), KEY_STARNET_CALLSIGN1.c_str(), m_starNet1Callsign.c_str()); file.AddLine(buffer); buffer.Printf(wxT("%s=%s"), KEY_STARNET_CALLSIGN1.c_str(), m_starNet1Callsign.c_str()); file.AddLine(buffer);

View file

@ -71,8 +71,8 @@ public:
void getDCS(bool& dcsEnabled, bool& ccsEnabled, wxString& ccsHost) const; void getDCS(bool& dcsEnabled, bool& ccsEnabled, wxString& ccsHost) const;
void setDCS(bool dcsEnabled, bool ccsEnabled, const wxString& ccsHost); void setDCS(bool dcsEnabled, bool ccsEnabled, const wxString& ccsHost);
void getXLX(bool& xlxEnabled, bool& xlxOverrideLocal, wxString& xlxHostsFileUrl); void getXLX(bool& xlxEnabled, wxString& xlxHostsFileUrl);
void setXLX(bool xlxEnabled, bool xlxOverrideLocal, wxString xlxHostsFileUrl); void setXLX(bool xlxEnabled, wxString xlxHostsFileUrl);
#if defined(DEXTRA_LINK) || defined(DCS_LINK) #if defined(DEXTRA_LINK) || defined(DCS_LINK)
void getStarNet1(wxString& band, wxString& callsign, wxString& logoff, wxString& info, wxString& permanent, unsigned int& userTimeout, unsigned int& groupTimeout, STARNET_CALLSIGN_SWITCH& callsignSwitch, bool& txMsgSwitch, wxString& reflector) const; void getStarNet1(wxString& band, wxString& callsign, wxString& logoff, wxString& info, wxString& permanent, unsigned int& userTimeout, unsigned int& groupTimeout, STARNET_CALLSIGN_SWITCH& callsignSwitch, bool& txMsgSwitch, wxString& reflector) const;

View file

@ -34,11 +34,10 @@ BEGIN_EVENT_TABLE(CXLXSet, wxPanel)
END_EVENT_TABLE() END_EVENT_TABLE()
CXLXSet::CXLXSet(wxWindow* parent, int id, const wxString& title, bool xlxEnabled, bool xlxOverrideLocal, const wxString& xlxHostsFileUrl) : CXLXSet::CXLXSet(wxWindow* parent, int id, const wxString& title, bool xlxEnabled, const wxString& xlxHostsFileUrl) :
wxPanel(parent, id), wxPanel(parent, id),
m_title(title), m_title(title),
m_xlxEnabled(NULL), m_xlxEnabled(NULL),
m_xlxOverrideLocal(NULL),
m_xlxHostsFileUrl(NULL) m_xlxHostsFileUrl(NULL)
{ {
wxFlexGridSizer* sizer = new wxFlexGridSizer(2); wxFlexGridSizer* sizer = new wxFlexGridSizer(2);
@ -52,15 +51,6 @@ m_xlxHostsFileUrl(NULL)
sizer->Add(m_xlxEnabled, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE); sizer->Add(m_xlxEnabled, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE);
m_xlxEnabled->SetSelection(xlxEnabled ? 1 : 0); m_xlxEnabled->SetSelection(xlxEnabled ? 1 : 0);
wxStaticText* xlxOverrideLocalLabel = new wxStaticText(this, -1, _("Override local hosts files"));
sizer->Add(xlxOverrideLocalLabel, 0, wxALL | wxALIGN_RIGHT, BORDER_SIZE);
m_xlxOverrideLocal = new wxChoice(this, CHOICE_ENABLED, wxDefaultPosition, wxSize(CONTROL_WIDTH, -1));
m_xlxOverrideLocal->Append(_("No"));
m_xlxOverrideLocal->Append(_("Yes"));
sizer->Add(m_xlxOverrideLocal, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE);
m_xlxOverrideLocal->SetSelection(xlxOverrideLocal ? 1 : 0);
wxStaticText* xlxHostsFileUrlLabel = new wxStaticText(this, -1, _("Hosts file URL")); wxStaticText* xlxHostsFileUrlLabel = new wxStaticText(this, -1, _("Hosts file URL"));
sizer->Add(xlxHostsFileUrlLabel, 0, wxALL | wxALIGN_RIGHT, BORDER_SIZE); sizer->Add(xlxHostsFileUrlLabel, 0, wxALL | wxALIGN_RIGHT, BORDER_SIZE);
@ -89,10 +79,6 @@ bool CXLXSet::Validate()
if (n == wxNOT_FOUND) if (n == wxNOT_FOUND)
return false; return false;
n = m_xlxOverrideLocal->GetCurrentSelection();
if (n == wxNOT_FOUND)
return false;
// TODO F4FXL try to figure out why below symbols are not found under ubuntu // TODO F4FXL try to figure out why below symbols are not found under ubuntu
/*wxString value = m_xlxHostsFileUrl->GetValue(); /*wxString value = m_xlxHostsFileUrl->GetValue();
wxURL url(value); wxURL url(value);
@ -102,14 +88,6 @@ bool CXLXSet::Validate()
return true; return true;
} }
bool CXLXSet::getXLXOverrideLocal() const
{
int c = m_xlxEnabled->GetCurrentSelection();
if (c == wxNOT_FOUND)
return false;
return c == 1;
}
bool CXLXSet::getXLXEnabled() const bool CXLXSet::getXLXEnabled() const
{ {

View file

@ -23,13 +23,12 @@
class CXLXSet : public wxPanel { class CXLXSet : public wxPanel {
public: public:
CXLXSet(wxWindow* parent, int id, const wxString& title, bool xlxEnabled, bool xlxOverrideLocal, const wxString& xlxHostsFileUrl); CXLXSet(wxWindow* parent, int id, const wxString& title, bool xlxEnabled, const wxString& xlxHostsFileUrl);
virtual ~CXLXSet(); virtual ~CXLXSet();
virtual bool Validate(); virtual bool Validate();
virtual bool getXLXEnabled() const; virtual bool getXLXEnabled() const;
virtual bool getXLXOverrideLocal() const;
virtual wxString getXLXHostsFileUrl() const; virtual wxString getXLXHostsFileUrl() const;
virtual void onEnabled(wxCommandEvent& event); virtual void onEnabled(wxCommandEvent& event);
@ -37,7 +36,6 @@ public:
private: private:
wxString m_title; wxString m_title;
wxChoice* m_xlxEnabled; wxChoice* m_xlxEnabled;
wxChoice* m_xlxOverrideLocal;
wxTextCtrl* m_xlxHostsFileUrl; wxTextCtrl* m_xlxHostsFileUrl;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()

View file

@ -889,8 +889,8 @@ void CIRCDDBGatewayApp::createThread()
bool xlxEnabled; bool xlxEnabled;
bool xlxOverrideLocal; bool xlxOverrideLocal;
wxString xlxHostsFileUrl; wxString xlxHostsFileUrl;
m_config->getXLX(xlxEnabled, xlxOverrideLocal, xlxHostsFileUrl); m_config->getXLX(xlxEnabled, xlxHostsFileUrl);
wxLogInfo(wxT("XLX enabled: %d, Override Local %d, Hosts file url: %s"), int(xlxEnabled), int(xlxOverrideLocal), xlxHostsFileUrl.c_str()); wxLogInfo(wxT("XLX enabled: %d, Hosts file url: %s"), int(xlxEnabled), xlxHostsFileUrl.c_str());
if (repeaterBand1.Len() > 1U || repeaterBand2.Len() > 1U || if (repeaterBand1.Len() > 1U || repeaterBand2.Len() > 1U ||
repeaterBand3.Len() > 1U || repeaterBand4.Len() > 1U) { repeaterBand3.Len() > 1U || repeaterBand4.Len() > 1U) {
@ -960,7 +960,7 @@ void CIRCDDBGatewayApp::createThread()
thread->setDExtra(dextraEnabled, dextraMaxDongles); thread->setDExtra(dextraEnabled, dextraMaxDongles);
thread->setDCS(dcsEnabled); thread->setDCS(dcsEnabled);
thread->setCCS(ccsEnabled, ccsHost); thread->setCCS(ccsEnabled, ccsHost);
thread->setXLX(xlxEnabled, xlxOverrideLocal, xlxEnabled ? CXLXHostsFileDownloader::Download(xlxHostsFileUrl) : wxString(wxEmptyString)); thread->setXLX(xlxEnabled, xlxEnabled ? CXLXHostsFileDownloader::Download(xlxHostsFileUrl) : wxString(wxEmptyString));
thread->setInfoEnabled(infoEnabled); thread->setInfoEnabled(infoEnabled);
thread->setEchoEnabled(echoEnabled); thread->setEchoEnabled(echoEnabled);
thread->setDTMFEnabled(dtmfEnabled); thread->setDTMFEnabled(dtmfEnabled);

View file

@ -876,10 +876,9 @@ bool CIRCDDBGatewayAppD::createThread()
wxLogInfo(wxT("DCS enabled: %d, CCS enabled: %d, server: %s"), int(dcsEnabled), int(ccsEnabled), ccsHost.c_str()); wxLogInfo(wxT("DCS enabled: %d, CCS enabled: %d, server: %s"), int(dcsEnabled), int(ccsEnabled), ccsHost.c_str());
bool xlxEnabled; bool xlxEnabled;
bool xlxOverrideLocal;
wxString xlxHostsFileUrl; wxString xlxHostsFileUrl;
config.getXLX(xlxEnabled, xlxOverrideLocal, xlxHostsFileUrl); config.getXLX(xlxEnabled, xlxHostsFileUrl);
wxLogInfo(wxT("XLX enabled: %d, Override Local %d, Hosts file url: %s"), int(xlxEnabled), int(xlxOverrideLocal), xlxHostsFileUrl.c_str()); wxLogInfo(wxT("XLX enabled: %d, Override Local %d, Hosts file url: %s"), int(xlxEnabled), xlxHostsFileUrl.c_str());
if (repeaterBand1.Len() > 1U || repeaterBand2.Len() > 1U || if (repeaterBand1.Len() > 1U || repeaterBand2.Len() > 1U ||
repeaterBand3.Len() > 1U || repeaterBand4.Len() > 1U) { repeaterBand3.Len() > 1U || repeaterBand4.Len() > 1U) {
@ -948,7 +947,7 @@ bool CIRCDDBGatewayAppD::createThread()
m_thread->setDExtra(dextraEnabled, dextraMaxDongles); m_thread->setDExtra(dextraEnabled, dextraMaxDongles);
m_thread->setDCS(dcsEnabled); m_thread->setDCS(dcsEnabled);
m_thread->setCCS(ccsEnabled, ccsHost); m_thread->setCCS(ccsEnabled, ccsHost);
m_thread->setXLX(xlxEnabled, xlxOverrideLocal, xlxEnabled ? CXLXHostsFileDownloader::Download(xlxHostsFileUrl): wxString(wxEmptyString)); m_thread->setXLX(xlxEnabled, xlxEnabled ? CXLXHostsFileDownloader::Download(xlxHostsFileUrl): wxString(wxEmptyString));
m_thread->setInfoEnabled(infoEnabled); m_thread->setInfoEnabled(infoEnabled);
m_thread->setEchoEnabled(echoEnabled); m_thread->setEchoEnabled(echoEnabled);
m_thread->setDTMFEnabled(dtmfEnabled); m_thread->setDTMFEnabled(dtmfEnabled);

View file

@ -583,11 +583,10 @@ void CIRCDDBGatewayThread::setDCS(bool enabled)
m_dcsEnabled = enabled; m_dcsEnabled = enabled;
} }
void CIRCDDBGatewayThread::setXLX(bool enabled, bool overrideLocal, const wxString& xlxHostsFileName) void CIRCDDBGatewayThread::setXLX(bool enabled, const wxString& xlxHostsFileName)
{ {
m_xlxEnabled = enabled; m_xlxEnabled = enabled;
m_xlxHostsFileName = xlxHostsFileName; m_xlxHostsFileName = xlxHostsFileName;
m_xlxOverrideLocal = overrideLocal;
} }
void CIRCDDBGatewayThread::setCCS(bool enabled, const wxString& host) void CIRCDDBGatewayThread::setCCS(bool enabled, const wxString& host)
@ -1118,9 +1117,7 @@ void CIRCDDBGatewayThread::loadGateways()
void CIRCDDBGatewayThread::loadReflectors() void CIRCDDBGatewayThread::loadReflectors()
{ {
if(m_xlxEnabled && !m_xlxOverrideLocal) {
loadXLXReflectors(); loadXLXReflectors();
}
if (m_dplusEnabled) { if (m_dplusEnabled) {
wxFileName fileName(wxFileName::GetHomeDir(), DPLUS_HOSTS_FILE_NAME); wxFileName fileName(wxFileName::GetHomeDir(), DPLUS_HOSTS_FILE_NAME);
@ -1163,10 +1160,6 @@ void CIRCDDBGatewayThread::loadReflectors()
if (fileName.IsFileReadable()) if (fileName.IsFileReadable())
loadDCSReflectors(fileName.GetFullPath()); loadDCSReflectors(fileName.GetFullPath());
} }
if(m_xlxEnabled && m_xlxOverrideLocal) {
loadXLXReflectors();
}
} }
void CIRCDDBGatewayThread::loadDExtraReflectors(const wxString& fileName) void CIRCDDBGatewayThread::loadDExtraReflectors(const wxString& fileName)
@ -1284,10 +1277,10 @@ void CIRCDDBGatewayThread::loadXLXReflectors()
reflector.Truncate(LONG_CALLSIGN_LENGTH - 1U); reflector.Truncate(LONG_CALLSIGN_LENGTH - 1U);
reflector.Append(wxT("G")); reflector.Append(wxT("G"));
if(m_dcsEnabled && reflector.StartsWith(wxT("DCS"))) //if(m_dcsEnabled && reflector.StartsWith(wxT("DCS")))
m_cache.updateGateway(reflector, addrText, DP_DCS, lock, true); m_cache.updateGateway(reflector, addrText, DP_DCS, lock, true);
else if(m_dextraEnabled && reflector.StartsWith(wxT("XRF"))) //else if(m_dextraEnabled && reflector.StartsWith(wxT("XRF")))
m_cache.updateGateway(reflector, addrText, DP_DEXTRA, lock, true); // m_cache.updateGateway(reflector, addrText, DP_DEXTRA, lock, true);
count++; count++;
} }

View file

@ -61,7 +61,7 @@ public:
virtual void setDExtra(bool enabled, unsigned int maxDongles); virtual void setDExtra(bool enabled, unsigned int maxDongles);
virtual void setDPlus(bool enabled, unsigned int maxDongles, const wxString& login); virtual void setDPlus(bool enabled, unsigned int maxDongles, const wxString& login);
virtual void setDCS(bool enabled); virtual void setDCS(bool enabled);
virtual void setXLX(bool enabled, bool overrideLocal, const wxString& fileName); virtual void setXLX(bool enabled, const wxString& fileName);
virtual void setCCS(bool enabled, const wxString& host); virtual void setCCS(bool enabled, const wxString& host);
virtual void setLog(bool enabled); virtual void setLog(bool enabled);
virtual void setAPRSWriter(CAPRSWriter* writer); virtual void setAPRSWriter(CAPRSWriter* writer);
@ -109,7 +109,6 @@ private:
wxString m_dplusLogin; wxString m_dplusLogin;
bool m_dcsEnabled; bool m_dcsEnabled;
bool m_xlxEnabled; bool m_xlxEnabled;
bool m_xlxOverrideLocal;
wxString m_xlxHostsFileName; wxString m_xlxHostsFileName;
bool m_ccsEnabled; bool m_ccsEnabled;
wxString m_ccsHost; wxString m_ccsHost;

View file

@ -104,9 +104,8 @@ m_miscellaneous(NULL)
m_config->getDCS(dcsEnabled, ccsEnabled, ccsHost); m_config->getDCS(dcsEnabled, ccsEnabled, ccsHost);
bool xlxEnabled; bool xlxEnabled;
bool xlxOverrideLocal;
wxString xlxHostsFileUrl; wxString xlxHostsFileUrl;
m_config->getXLX(xlxEnabled, xlxOverrideLocal, xlxHostsFileUrl); m_config->getXLX(xlxEnabled, xlxHostsFileUrl);
GATEWAY_TYPE gatewayType; GATEWAY_TYPE gatewayType;
wxString gatewayCallsign, gatewayAddress, icomAddress, hbAddress, description1, description2, url; wxString gatewayCallsign, gatewayAddress, icomAddress, hbAddress, description1, description2, url;
@ -212,7 +211,7 @@ m_miscellaneous(NULL)
m_dcs = new CDCSSet(noteBook, -1, APPLICATION_NAME, dcsEnabled, ccsEnabled, ccsHost); m_dcs = new CDCSSet(noteBook, -1, APPLICATION_NAME, dcsEnabled, ccsEnabled, ccsHost);
noteBook->AddPage(m_dcs, _("DCS and CCS"), false); noteBook->AddPage(m_dcs, _("DCS and CCS"), false);
m_xlx = new CXLXSet(noteBook, -1, APPLICATION_NAME, xlxEnabled, xlxOverrideLocal, xlxHostsFileUrl); m_xlx = new CXLXSet(noteBook, -1, APPLICATION_NAME, xlxEnabled, xlxHostsFileUrl);
noteBook->AddPage(m_xlx, _("XLX Hosts File"), false); noteBook->AddPage(m_xlx, _("XLX Hosts File"), false);
#if defined(DEXTRA_LINK) || defined(DCS_LINK) #if defined(DEXTRA_LINK) || defined(DCS_LINK)
@ -526,9 +525,8 @@ void CIRCDDBGatewayConfigFrame::onSave(wxCommandEvent&)
m_config->setDCS(dcsEnabled, ccsEnabled, ccsHost); m_config->setDCS(dcsEnabled, ccsEnabled, ccsHost);
bool xlxEnabled = m_xlx->getXLXEnabled(); bool xlxEnabled = m_xlx->getXLXEnabled();
bool xlxOverrideLocal = m_xlx->getXLXOverrideLocal();
wxString xlxHostsFileUrl = m_xlx->getXLXHostsFileUrl(); wxString xlxHostsFileUrl = m_xlx->getXLXHostsFileUrl();
m_config->setXLX(xlxEnabled, xlxOverrideLocal, xlxHostsFileUrl); m_config->setXLX(xlxEnabled, xlxHostsFileUrl);
wxString starNetBand1 = m_starNet1->getBand(); wxString starNetBand1 = m_starNet1->getBand();
wxString starNetCallsign1 = m_starNet1->getCallsign(); wxString starNetCallsign1 = m_starNet1->getCallsign();