mirror of
https://github.com/g4klx/ircDDBGateway.git
synced 2026-04-06 14:53:52 +00:00
Allow direct connection using XLX instead of DCS
This commit is contained in:
parent
b8ee3948ed
commit
075fa42d0c
11 changed files with 47 additions and 84 deletions
|
|
@ -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) :
|
||||
m_reflector(reflector.Clone()),
|
||||
m_xlxReflector(_T("")),
|
||||
m_isXlx(false),
|
||||
m_repeater(repeater.Clone()),
|
||||
m_handler(protoHandler),
|
||||
m_yourAddress(address),
|
||||
|
|
@ -78,6 +80,11 @@ m_rptCall2()
|
|||
m_linkState = DCS_LINKED;
|
||||
} else {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
@ -634,10 +641,10 @@ bool CDCSHandler::processInt(CConnectData& connect, CD_TYPE type)
|
|||
return false;
|
||||
|
||||
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)
|
||||
m_destination->linkUp(DP_DCS, m_reflector);
|
||||
m_destination->linkUp(DP_DCS, GET_DISP_REFLECTOR(this));
|
||||
|
||||
m_tryTimer.stop();
|
||||
m_stateChange = true;
|
||||
|
|
@ -651,16 +658,16 @@ bool CDCSHandler::processInt(CConnectData& connect, CD_TYPE type)
|
|||
return false;
|
||||
|
||||
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)
|
||||
m_destination->linkRefused(DP_DCS, m_reflector);
|
||||
m_destination->linkRefused(DP_DCS, GET_DISP_REFLECTOR(this));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
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)
|
||||
m_destination->linkFailed(DP_DCS, m_reflector, false);
|
||||
|
|
@ -675,10 +682,10 @@ bool CDCSHandler::processInt(CConnectData& connect, CD_TYPE type)
|
|||
return false;
|
||||
|
||||
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)
|
||||
m_destination->linkFailed(DP_DCS, m_reflector, false);
|
||||
m_destination->linkFailed(DP_DCS, GET_DISP_REFLECTOR(this), false);
|
||||
|
||||
m_stateChange = true;
|
||||
}
|
||||
|
|
@ -706,20 +713,20 @@ bool CDCSHandler::clockInt(unsigned int ms)
|
|||
|
||||
switch (m_linkState) {
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
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) {
|
||||
CConnectData reply(m_gatewayType, m_repeater, m_reflector, CT_LINK1, m_yourAddress, m_yourPort);
|
||||
m_handler->writeConnect(reply);
|
||||
|
|
@ -844,7 +851,7 @@ void CDCSHandler::writeStatus(wxFFile& file)
|
|||
wxString text;
|
||||
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,
|
||||
reflector->m_repeater.c_str(), reflector->m_reflector.c_str());
|
||||
reflector->m_repeater.c_str(), GET_DISP_REFLECTOR(reflector).c_str());
|
||||
file.Write(text);
|
||||
}
|
||||
break;
|
||||
|
|
@ -854,7 +861,7 @@ void CDCSHandler::writeStatus(wxFFile& file)
|
|||
wxString text;
|
||||
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,
|
||||
reflector->m_repeater.c_str(), reflector->m_reflector.c_str());
|
||||
reflector->m_repeater.c_str(), GET_DISP_REFLECTOR(reflector).c_str());
|
||||
file.Write(text);
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@
|
|||
#include <wx/wx.h>
|
||||
#include <wx/ffile.h>
|
||||
|
||||
#define GET_DISP_REFLECTOR(refl) (refl->m_isXlx ? refl->m_xlxReflector : refl->m_reflector)
|
||||
|
||||
enum DCS_STATE {
|
||||
DCS_LINKING,
|
||||
DCS_LINKED,
|
||||
|
|
@ -109,6 +111,8 @@ private:
|
|||
static CCallsignList* m_blackList;
|
||||
|
||||
wxString m_reflector;
|
||||
wxString m_xlxReflector;
|
||||
bool m_isXlx;
|
||||
wxString m_repeater;
|
||||
CDCSProtocolHandler* m_handler;
|
||||
in_addr m_yourAddress;
|
||||
|
|
|
|||
|
|
@ -141,7 +141,6 @@ const wxString KEY_DCS_ENABLED = wxT("dcsEnabled");
|
|||
const wxString KEY_CCS_ENABLED = wxT("ccsEnabled");
|
||||
const wxString KEY_CCS_HOST = wxT("ccsHost");
|
||||
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_STARNET_BAND1 = wxT("starNetBand1");
|
||||
const wxString KEY_STARNET_CALLSIGN1 = wxT("starNetCallsign1");
|
||||
|
|
@ -267,8 +266,7 @@ const bool DEFAULT_DCS_ENABLED = true;
|
|||
const bool DEFAULT_CCS_ENABLED = true;
|
||||
const wxString DEFAULT_CCS_HOST = wxT("CCS704 ");
|
||||
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=GetReflectorHostname");
|
||||
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_STARNET_BAND = wxEmptyString;
|
||||
const wxString DEFAULT_STARNET_CALLSIGN = wxEmptyString;
|
||||
const wxString DEFAULT_STARNET_LOGOFF = wxEmptyString;
|
||||
|
|
@ -422,7 +420,6 @@ m_dcsEnabled(DEFAULT_DCS_ENABLED),
|
|||
m_ccsEnabled(DEFAULT_CCS_ENABLED),
|
||||
m_ccsHost(DEFAULT_CCS_HOST),
|
||||
m_xlxEnabled(DEFAULT_XLX_ENABLED),
|
||||
m_xlxOverrideLocal(DEFAULT_XLX_OVERRIDE_LOCAL),
|
||||
m_xlxHostsFileUrl(DEFAULT_XLX_HOSTS_FILE_URL),
|
||||
m_starNet1Band(DEFAULT_STARNET_BAND),
|
||||
m_starNet1Callsign(DEFAULT_STARNET_CALLSIGN),
|
||||
|
|
@ -761,9 +758,7 @@ m_y(DEFAULT_WINDOW_Y)
|
|||
m_config->Read(m_name + KEY_CCS_HOST, &m_ccsHost, DEFAULT_CCS_HOST);
|
||||
|
||||
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_STARNET_BAND1, &m_starNet1Band, DEFAULT_STARNET_BAND);
|
||||
|
|
@ -1045,7 +1040,6 @@ m_dcsEnabled(DEFAULT_DCS_ENABLED),
|
|||
m_ccsEnabled(DEFAULT_CCS_ENABLED),
|
||||
m_ccsHost(DEFAULT_CCS_HOST),
|
||||
m_xlxEnabled(DEFAULT_XLX_ENABLED),
|
||||
m_xlxOverrideLocal(DEFAULT_XLX_OVERRIDE_LOCAL),
|
||||
m_xlxHostsFileUrl(DEFAULT_XLX_HOSTS_FILE_URL),
|
||||
m_starNet1Band(DEFAULT_STARNET_BAND),
|
||||
m_starNet1Callsign(DEFAULT_STARNET_CALLSIGN),
|
||||
|
|
@ -1438,9 +1432,6 @@ m_y(DEFAULT_WINDOW_Y)
|
|||
} else if (key.IsSameAs(KEY_XLX_ENABLED)) {
|
||||
val.ToLong(&temp1);
|
||||
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)) {
|
||||
m_xlxHostsFileUrl = val;
|
||||
} else if (key.IsSameAs(KEY_STARNET_BAND1)) {
|
||||
|
|
@ -1968,17 +1959,15 @@ void CIRCDDBGatewayConfig::setDCS(bool dcsEnabled, bool ccsEnabled, const wxStri
|
|||
m_ccsHost = ccsHost;
|
||||
}
|
||||
|
||||
void CIRCDDBGatewayConfig::getXLX(bool& xlxEnabled, bool& xlxOverrideLocal, wxString& xlxHostsFileUrl)
|
||||
void CIRCDDBGatewayConfig::getXLX(bool& xlxEnabled, wxString& xlxHostsFileUrl)
|
||||
{
|
||||
xlxEnabled = m_xlxEnabled;
|
||||
xlxOverrideLocal = m_xlxOverrideLocal;
|
||||
xlxHostsFileUrl = m_xlxHostsFileUrl;
|
||||
}
|
||||
|
||||
void CIRCDDBGatewayConfig::setXLX(bool xlxEnabled, bool xlxOverrideLocal, wxString xlxHostsFileUrl)
|
||||
void CIRCDDBGatewayConfig::setXLX(bool xlxEnabled, wxString xlxHostsFileUrl)
|
||||
{
|
||||
m_xlxEnabled = xlxEnabled;
|
||||
m_xlxOverrideLocal = xlxOverrideLocal;
|
||||
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_HOST, m_ccsHost);
|
||||
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_STARNET_BAND1, m_starNet1Band);
|
||||
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=%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_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_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);
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ public:
|
|||
void getDCS(bool& dcsEnabled, bool& ccsEnabled, wxString& ccsHost) const;
|
||||
void setDCS(bool dcsEnabled, bool ccsEnabled, const wxString& ccsHost);
|
||||
|
||||
void getXLX(bool& xlxEnabled, bool& xlxOverrideLocal, wxString& xlxHostsFileUrl);
|
||||
void setXLX(bool xlxEnabled, bool xlxOverrideLocal, wxString xlxHostsFileUrl);
|
||||
void getXLX(bool& xlxEnabled, wxString& xlxHostsFileUrl);
|
||||
void setXLX(bool xlxEnabled, wxString xlxHostsFileUrl);
|
||||
|
||||
#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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue