diff --git a/Conf.cpp b/Conf.cpp index dff7303..6d63082 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -151,8 +151,8 @@ m_fusionLowDeviation(false), m_fusionRemoteGateway(false), m_fusionSelfOnly(false), m_fusionTXHang(4U), -m_fusionSQLEnabled(false), -m_fusionSQL(0U), +m_fusionDGIdEnabled(false), +m_fusionDGId(0U), m_fusionModeHang(10U), m_p25Enabled(false), m_p25Id(0U), @@ -595,9 +595,9 @@ bool CConf::read() m_fusionEnabled = ::atoi(value) == 1; else if (::strcmp(key, "LowDeviation") == 0) m_fusionLowDeviation = ::atoi(value) == 1; - else if (::strcmp(key, "DSQ") == 0 || ::strcmp(key, "DGID") == 0) { - m_fusionSQLEnabled = true; - m_fusionSQL = (unsigned int)::atoi(value); + else if (::strcmp(key, "DGID") == 0) { + m_fusionDGIdEnabled = true; + m_fusionDGId = (unsigned int)::atoi(value); } else if (::strcmp(key, "RemoteGateway") == 0) m_fusionRemoteGateway = ::atoi(value) == 1; else if (::strcmp(key, "SelfOnly") == 0) @@ -1276,14 +1276,14 @@ bool CConf::getFusionSelfOnly() const return m_fusionSelfOnly; } -bool CConf::getFusionSQLEnabled() const +bool CConf::getFusionDGIdEnabled() const { - return m_fusionSQLEnabled; + return m_fusionDGIdEnabled; } -unsigned char CConf::getFusionSQL() const +unsigned char CConf::getFusionDGId() const { - return m_fusionSQL; + return m_fusionDGId; } unsigned int CConf::getFusionModeHang() const diff --git a/Conf.h b/Conf.h index 32ea085..a5bd860 100644 --- a/Conf.h +++ b/Conf.h @@ -142,8 +142,8 @@ public: bool getFusionRemoteGateway() const; bool getFusionSelfOnly() const; unsigned int getFusionTXHang() const; - bool getFusionSQLEnabled() const; - unsigned char getFusionSQL() const; + bool getFusionDGIdEnabled() const; + unsigned char getFusionDGId() const; unsigned int getFusionModeHang() const; // The P25 section @@ -379,8 +379,8 @@ private: bool m_fusionRemoteGateway; bool m_fusionSelfOnly; unsigned int m_fusionTXHang; - bool m_fusionSQLEnabled; - unsigned char m_fusionSQL; + bool m_fusionDGIdEnabled; + unsigned char m_fusionDGId; unsigned int m_fusionModeHang; bool m_p25Enabled; diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index daf3ce7..bb00f23 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -500,8 +500,8 @@ int CMMDVMHost::run() bool remoteGateway = m_conf.getFusionRemoteGateway(); unsigned int txHang = m_conf.getFusionTXHang(); bool selfOnly = m_conf.getFusionSelfOnly(); - bool sqlEnabled = m_conf.getFusionSQLEnabled(); - unsigned char sql = m_conf.getFusionSQL(); + bool dgIdEnabled = m_conf.getFusionDGIdEnabled(); + unsigned char dgId = m_conf.getFusionDGId(); m_ysfRFModeHang = m_conf.getFusionModeHang(); LogInfo("YSF RF Parameters"); @@ -509,13 +509,13 @@ int CMMDVMHost::run() LogInfo(" Remote Gateway: %s", remoteGateway ? "yes" : "no"); LogInfo(" TX Hang: %us", txHang); LogInfo(" Self Only: %s", selfOnly ? "yes" : "no"); - LogInfo(" DSQ: %s", sqlEnabled ? "yes" : "no"); - if (sqlEnabled) - LogInfo(" DSQ Value: %u", sql); + LogInfo(" DG-ID: %s", dgIdEnabled ? "yes" : "no"); + if (dgIdEnabled) + LogInfo(" DG-ID Value: %u", dgId); LogInfo(" Mode Hang: %us", m_ysfRFModeHang); m_ysf = new CYSFControl(m_callsign, selfOnly, m_ysfNetwork, m_display, m_timeout, m_duplex, lowDeviation, remoteGateway, rssi); - m_ysf->setSQL(sqlEnabled, sql); + m_ysf->setDGId(dgIdEnabled, dgId); } if (m_p25Enabled) { diff --git a/YSFControl.cpp b/YSFControl.cpp index bc40e10..1cddeaf 100644 --- a/YSFControl.cpp +++ b/YSFControl.cpp @@ -32,8 +32,8 @@ m_display(display), m_duplex(duplex), m_lowDeviation(lowDeviation), m_remoteGateway(remoteGateway), -m_sqlEnabled(false), -m_sqlValue(0U), +m_dgIdEnabled(false), +m_dgIdValue(0U), m_queue(5000U, "YSF Control"), m_rfState(RS_RF_LISTENING), m_netState(RS_NET_IDLE), @@ -100,10 +100,10 @@ CYSFControl::~CYSFControl() delete[] m_selfCallsign; } -void CYSFControl::setSQL(bool on, unsigned char value) +void CYSFControl::setDGId(bool on, unsigned char value) { - m_sqlEnabled = on; - m_sqlValue = value; + m_dgIdEnabled = on; + m_dgIdValue = value; } bool CYSFControl::writeModem(unsigned char *data, unsigned int len) @@ -167,23 +167,11 @@ bool CYSFControl::writeModem(unsigned char *data, unsigned int len) if (valid) m_lastFICH = fich; - // Validate the DSQ/DG-ID value if enabled - if (m_sqlEnabled) { - unsigned char cm = m_lastFICH.getCM(); - if (cm == YSF_CM_GROUP2) { - // Using the DG-ID value - unsigned char value = m_lastFICH.getSQ(); - - if (value != m_sqlValue) - return false; - } else { - // Using the DSQ value - bool sql = m_lastFICH.getSQL(); - unsigned char value = m_lastFICH.getSQ(); - - if (!sql || value != m_sqlValue) - return false; - } + // Validate the DG-ID value if enabled + if (m_dgIdEnabled) { + unsigned char value = m_lastFICH.getDGId(); + if (value != m_dgIdValue) + return false; } #ifdef notdef @@ -270,9 +258,8 @@ bool CYSFControl::processVWData(bool valid, unsigned char *data) CYSFFICH fich = m_lastFICH; - // Remove any DSQ/DG-ID information - fich.setSQL(false); - fich.setSQ(0U); + // Remove any DG-ID information + fich.setDGId(0U); fich.encode(data + 2U); data[0U] = TAG_DATA; @@ -285,14 +272,8 @@ bool CYSFControl::processVWData(bool valid, unsigned char *data) #endif if (m_duplex) { - // Add the DSQ/DG-ID information. - unsigned char cm = fich.getCM(); - if (cm == YSF_CM_GROUP2) - fich.setSQL(false); - else - fich.setSQL(m_sqlEnabled); - fich.setSQ(m_sqlValue); - + // Add the DG-ID information. + fich.setDGId(m_dgIdEnabled ? m_dgIdValue : 0U); fich.setMR(m_remoteGateway ? YSF_MR_NOT_BUSY : YSF_MR_BUSY); fich.setDev(m_lowDeviation); fich.encode(data + 2U); @@ -318,9 +299,8 @@ bool CYSFControl::processVWData(bool valid, unsigned char *data) CYSFFICH fich = m_lastFICH; - // Remove any DSQ/DG-ID information - fich.setSQL(false); - fich.setSQ(0U); + // Remove any DG-ID information + fich.setDGId(0U); fich.encode(data + 2U); data[0U] = TAG_EOT; @@ -333,14 +313,8 @@ bool CYSFControl::processVWData(bool valid, unsigned char *data) #endif if (m_duplex) { - // Add the DSQ/DG-ID information. - unsigned char cm = fich.getCM(); - if (cm == YSF_CM_GROUP2) - fich.setSQL(false); - else - fich.setSQL(m_sqlEnabled); - fich.setSQ(m_sqlValue); - + // Add the DG-ID information. + fich.setDGId(m_dgIdEnabled ? m_dgIdValue : 0U); fich.setMR(m_remoteGateway ? YSF_MR_NOT_BUSY : YSF_MR_BUSY); fich.setDev(m_lowDeviation); fich.encode(data + 2U); @@ -381,9 +355,8 @@ bool CYSFControl::processVWData(bool valid, unsigned char *data) LogDebug("YSF, V Mode 3, seq %u, AMBE FEC %u/720 (%.1f%%)", m_rfFrames % 128, errors, float(errors) / 7.2F); } - // Remove any DSQ/DG-ID information - fich.setSQL(false); - fich.setSQ(0U); + // Remove any DG-ID information + fich.setDGId(0U); fich.encode(data + 2U); data[0U] = TAG_DATA; @@ -392,14 +365,8 @@ bool CYSFControl::processVWData(bool valid, unsigned char *data) writeNetwork(data, m_rfFrames % 128U); if (m_duplex) { - // Add the DSQ/DG-ID information. - unsigned char cm = fich.getCM(); - if (cm == YSF_CM_GROUP2) - fich.setSQL(false); - else - fich.setSQL(m_sqlEnabled); - fich.setSQ(m_sqlValue); - + // Add the DG-ID information. + fich.setDGId(m_dgIdEnabled ? m_dgIdValue : 0U); fich.setMR(m_remoteGateway ? YSF_MR_NOT_BUSY : YSF_MR_BUSY); fich.setDev(m_lowDeviation); fich.encode(data + 2U); @@ -468,9 +435,8 @@ bool CYSFControl::processDNData(bool valid, unsigned char *data) CYSFFICH fich = m_lastFICH; - // Remove any DSQ/DG-ID information - fich.setSQL(false); - fich.setSQ(0U); + // Remove any DG-ID information + fich.setDGId(0U); fich.encode(data + 2U); data[0U] = TAG_DATA; @@ -483,14 +449,8 @@ bool CYSFControl::processDNData(bool valid, unsigned char *data) #endif if (m_duplex) { - // Add the DSQ/DG-ID information. - unsigned char cm = fich.getCM(); - if (cm == YSF_CM_GROUP2) - fich.setSQL(false); - else - fich.setSQL(m_sqlEnabled); - fich.setSQ(m_sqlValue); - + // Add the DG-ID information. + fich.setDGId(m_dgIdEnabled ? m_dgIdValue : 0U); fich.setMR(m_remoteGateway ? YSF_MR_NOT_BUSY : YSF_MR_BUSY); fich.setDev(m_lowDeviation); fich.encode(data + 2U); @@ -516,9 +476,8 @@ bool CYSFControl::processDNData(bool valid, unsigned char *data) CYSFFICH fich = m_lastFICH; - // Remove any DSQ/DG-ID information - fich.setSQL(false); - fich.setSQ(0U); + // Remove any DG-ID information + fich.setDGId(0U); fich.encode(data + 2U); data[0U] = TAG_EOT; @@ -531,14 +490,8 @@ bool CYSFControl::processDNData(bool valid, unsigned char *data) #endif if (m_duplex) { - // Add the DSQ/DG-ID information. - unsigned char cm = fich.getCM(); - if (cm == YSF_CM_GROUP2) - fich.setSQL(false); - else - fich.setSQL(m_sqlEnabled); - fich.setSQ(m_sqlValue); - + // Add the DG-ID information. + fich.setDGId(m_dgIdEnabled ? m_dgIdValue : 0U); fich.setMR(m_remoteGateway ? YSF_MR_NOT_BUSY : YSF_MR_BUSY); fich.setDev(m_lowDeviation); fich.encode(data + 2U); @@ -599,9 +552,8 @@ bool CYSFControl::processDNData(bool valid, unsigned char *data) CYSFFICH fich = m_lastFICH; - // Remove any DSQ/DG-ID information - fich.setSQL(false); - fich.setSQ(0U); + // Remove any DG-ID information + fich.setDGId(0U); fich.encode(data + 2U); data[0U] = TAG_DATA; @@ -610,14 +562,8 @@ bool CYSFControl::processDNData(bool valid, unsigned char *data) writeNetwork(data, m_rfFrames % 128U); if (m_duplex) { - // Add the DSQ/DG-ID information. - unsigned char cm = fich.getCM(); - if (cm == YSF_CM_GROUP2) - fich.setSQL(false); - else - fich.setSQL(m_sqlEnabled); - fich.setSQ(m_sqlValue); - + // Add the DG-ID information. + fich.setDGId(m_dgIdEnabled ? m_dgIdValue : 0U); fich.setMR(m_remoteGateway ? YSF_MR_NOT_BUSY : YSF_MR_BUSY); fich.setDev(m_lowDeviation); fich.encode(data + 2U); @@ -696,8 +642,7 @@ bool CYSFControl::processDNData(bool valid, unsigned char *data) CYSFFICH fich = m_lastFICH; fich.setFI(YSF_FI_HEADER); - fich.setSQL(false); - fich.setSQ(0U); + fich.setDGId(0U); fich.encode(buffer + 2U); unsigned char csd1[20U], csd2[20U]; @@ -718,14 +663,8 @@ bool CYSFControl::processDNData(bool valid, unsigned char *data) writeNetwork(buffer, m_rfFrames % 128U); if (m_duplex) { - // Add the DSQ/DG-ID information. - unsigned char cm = fich.getCM(); - if (cm == YSF_CM_GROUP2) - fich.setSQL(false); - else - fich.setSQL(m_sqlEnabled); - fich.setSQ(m_sqlValue); - + // Add the DG-ID information. + fich.setDGId(m_diIdEnabled ? m_dgIdValue : 0U); fich.setMR(m_remoteGateway ? YSF_MR_NOT_BUSY : YSF_MR_BUSY); fich.setDev(m_lowDeviation); fich.encode(buffer + 2U); @@ -743,9 +682,8 @@ bool CYSFControl::processDNData(bool valid, unsigned char *data) fich = m_lastFICH; - // Remove any DSQ/DG-ID information - fich.setSQL(false); - fich.setSQ(0U); + // Remove any DG-ID information + fich.setDGId(0U); fich.encode(data + 2U); data[0U] = TAG_DATA; @@ -754,14 +692,8 @@ bool CYSFControl::processDNData(bool valid, unsigned char *data) writeNetwork(data, m_rfFrames % 128U); if (m_duplex) { - // Add the DSQ/DG-ID information. - unsigned char cm = fich.getCM(); - if (cm == YSF_CM_GROUP2) - fich.setSQL(false); - else - fich.setSQL(m_sqlEnabled); - fich.setSQ(m_sqlValue); - + // Add the DG-ID information. + fich.setDGId(m_dgIdEnabled ? m_dgIdValue : 0U); fich.setMR(m_remoteGateway ? YSF_MR_NOT_BUSY : YSF_MR_BUSY); fich.setDev(m_lowDeviation); fich.encode(data + 2U); @@ -827,9 +759,8 @@ bool CYSFControl::processFRData(bool valid, unsigned char *data) CYSFFICH fich = m_lastFICH; - // Remove any DSQ/DG-ID information - fich.setSQL(false); - fich.setSQ(0U); + // Remove any DG-ID information + fich.setDGId(0U); fich.encode(data + 2U); data[0U] = TAG_DATA; @@ -842,14 +773,8 @@ bool CYSFControl::processFRData(bool valid, unsigned char *data) #endif if (m_duplex) { - // Add the DSQ/DG-ID information. - unsigned char cm = fich.getCM(); - if (cm == YSF_CM_GROUP2) - fich.setSQL(false); - else - fich.setSQL(m_sqlEnabled); - fich.setSQ(m_sqlValue); - + // Add the DG-ID information. + fich.setDGId(m_dgIdEnabled ? m_dgIdValue : 0U); fich.setMR(m_remoteGateway ? YSF_MR_NOT_BUSY : YSF_MR_BUSY); fich.setDev(m_lowDeviation); fich.encode(data + 2U); @@ -875,9 +800,8 @@ bool CYSFControl::processFRData(bool valid, unsigned char *data) CYSFFICH fich = m_lastFICH; - // Remove any DSQ/DG-ID information - fich.setSQL(false); - fich.setSQ(0U); + // Remove any DG-ID information + fich.setDGId(0U); fich.encode(data + 2U); data[0U] = TAG_EOT; @@ -890,14 +814,8 @@ bool CYSFControl::processFRData(bool valid, unsigned char *data) #endif if (m_duplex) { - // Add the DSQ/DG-ID information. - unsigned char cm = fich.getCM(); - if (cm == YSF_CM_GROUP2) - fich.setSQL(false); - else - fich.setSQL(m_sqlEnabled); - fich.setSQ(m_sqlValue); - + // Add the DG-ID information. + fich.setDGId(m_dgIdEnabled ? m_dgIdValue : 0U); fich.setMR(m_remoteGateway ? YSF_MR_NOT_BUSY : YSF_MR_BUSY); fich.setDev(m_lowDeviation); fich.encode(data + 2U); @@ -934,9 +852,8 @@ bool CYSFControl::processFRData(bool valid, unsigned char *data) CYSFFICH fich = m_lastFICH; - // Remove any DSQ/DG-ID information - fich.setSQL(false); - fich.setSQ(0U); + // Remove any DG-ID information + fich.setDGId(0U); fich.encode(data + 2U); data[0U] = TAG_DATA; @@ -945,14 +862,8 @@ bool CYSFControl::processFRData(bool valid, unsigned char *data) writeNetwork(data, m_rfFrames % 128U); if (m_duplex) { - // Add the DSQ/DG-ID information. - unsigned char cm = fich.getCM(); - if (cm == YSF_CM_GROUP2) - fich.setSQL(false); - else - fich.setSQL(m_sqlEnabled); - fich.setSQ(m_sqlValue); - + // Add the DG-ID information. + fich.setDGId(m_dgIdEnabled ? m_dgIdValue : 0U); fich.setMR(m_remoteGateway ? YSF_MR_NOT_BUSY : YSF_MR_BUSY); fich.setDev(m_lowDeviation); fich.encode(data + 2U); @@ -1093,12 +1004,8 @@ void CYSFControl::writeNetwork() ::memcpy(m_netDest, "ALL ", YSF_CALLSIGN_LENGTH); } - // Add any DSQ/DG-ID information - if (cm == YSF_CM_GROUP2) - fich.setSQL(false); - else - fich.setSQL(m_sqlEnabled); - fich.setSQ(m_sqlValue); + // Add the DG-ID information. + fich.setDGId(m_dgIdEnabled ? m_dgIdValue : 0U); if (m_remoteGateway) { fich.setVoIP(false); diff --git a/YSFControl.h b/YSFControl.h index e5702ac..eadd40f 100644 --- a/YSFControl.h +++ b/YSFControl.h @@ -38,7 +38,7 @@ public: CYSFControl(const std::string& callsign, bool selfOnly, CYSFNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, bool lowDeviation, bool remoteGateway, CRSSIInterpolator* rssiMapper); ~CYSFControl(); - void setSQL(bool on, unsigned char value); + void setDGId(bool on, unsigned char value); bool writeModem(unsigned char* data, unsigned int len); @@ -59,8 +59,8 @@ private: bool m_duplex; bool m_lowDeviation; bool m_remoteGateway; - bool m_sqlEnabled; - unsigned char m_sqlValue; + bool m_dgIdEnabled; + unsigned char m_dgIdValue; CRingBuffer m_queue; RPT_RF_STATE m_rfState; RPT_NET_STATE m_netState; diff --git a/YSFFICH.cpp b/YSFFICH.cpp index be60510..967b339 100644 --- a/YSFFICH.cpp +++ b/YSFFICH.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016,2017 by Jonathan Naylor G4KLX + * Copyright (C) 2016,2017,2019 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 @@ -214,12 +214,7 @@ bool CYSFFICH::getDev() const return (m_fich[2U] & 0x40U) == 0x40U; } -bool CYSFFICH::getSQL() const -{ - return (m_fich[3U] & 0x80U) == 0x80U; -} - -unsigned char CYSFFICH::getSQ() const +unsigned char CYSFFICH::getDGId() const { return m_fich[3U] & 0x7FU; } @@ -264,18 +259,10 @@ void CYSFFICH::setDev(bool on) m_fich[2U] &= 0xBFU; } -void CYSFFICH::setSQL(bool on) -{ - if (on) - m_fich[3U] |= 0x80U; - else - m_fich[3U] &= 0x7FU; -} - -void CYSFFICH::setSQ(unsigned char sq) +void CYSFFICH::setDGId(unsigned char id) { m_fich[3U] &= 0x80U; - m_fich[3U] |= sq & 0x7FU; + m_fich[3U] |= id & 0x7FU; } CYSFFICH& CYSFFICH::operator=(const CYSFFICH& fich) diff --git a/YSFFICH.h b/YSFFICH.h index 8a12034..b7d623c 100644 --- a/YSFFICH.h +++ b/YSFFICH.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016,2017 by Jonathan Naylor G4KLX + * Copyright (C) 2016,2017,2019 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 @@ -38,8 +38,7 @@ public: unsigned char getDT() const; unsigned char getMR() const; bool getDev() const; - bool getSQL() const; - unsigned char getSQ() const; + unsigned char getDGId() const; void setFI(unsigned char fi); void setFN(unsigned char fn); @@ -47,8 +46,7 @@ public: void setMR(unsigned char mr); void setVoIP(bool set); void setDev(bool set); - void setSQL(bool set); - void setSQ(unsigned char sq); + void setDGId(unsigned char id); CYSFFICH& operator=(const CYSFFICH& fich);