mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 15:09:23 +08:00
Add YSF DSQ support.
This commit is contained in:
17
Conf.cpp
17
Conf.cpp
@@ -122,6 +122,8 @@ m_dmrTXHang(4U),
|
|||||||
m_fusionEnabled(false),
|
m_fusionEnabled(false),
|
||||||
m_fusionLowDeviation(false),
|
m_fusionLowDeviation(false),
|
||||||
m_fusionRemoteGateway(false),
|
m_fusionRemoteGateway(false),
|
||||||
|
m_fusionSQLEnabled(false),
|
||||||
|
m_fusionSQL(0U),
|
||||||
m_p25Enabled(false),
|
m_p25Enabled(false),
|
||||||
m_p25NAC(0x293U),
|
m_p25NAC(0x293U),
|
||||||
m_dstarNetworkEnabled(false),
|
m_dstarNetworkEnabled(false),
|
||||||
@@ -451,7 +453,10 @@ bool CConf::read()
|
|||||||
m_fusionEnabled = ::atoi(value) == 1;
|
m_fusionEnabled = ::atoi(value) == 1;
|
||||||
else if (::strcmp(key, "LowDeviation") == 0)
|
else if (::strcmp(key, "LowDeviation") == 0)
|
||||||
m_fusionLowDeviation = ::atoi(value) == 1;
|
m_fusionLowDeviation = ::atoi(value) == 1;
|
||||||
else if (::strcmp(key, "RemoteGateway") == 0)
|
else if (::strcmp(key, "DSQ") == 0) {
|
||||||
|
m_fusionSQLEnabled = true;
|
||||||
|
m_fusionSQL = (unsigned int)::atoi(value);
|
||||||
|
} else if (::strcmp(key, "RemoteGateway") == 0)
|
||||||
m_fusionRemoteGateway = ::atoi(value) == 1;
|
m_fusionRemoteGateway = ::atoi(value) == 1;
|
||||||
} else if (section == SECTION_P25) {
|
} else if (section == SECTION_P25) {
|
||||||
if (::strcmp(key, "Enable") == 0)
|
if (::strcmp(key, "Enable") == 0)
|
||||||
@@ -927,6 +932,16 @@ bool CConf::getFusionRemoteGateway() const
|
|||||||
return m_fusionRemoteGateway;
|
return m_fusionRemoteGateway;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CConf::getFusionSQLEnabled() const
|
||||||
|
{
|
||||||
|
return m_fusionSQLEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char CConf::getFusionSQL() const
|
||||||
|
{
|
||||||
|
return m_fusionSQL;
|
||||||
|
}
|
||||||
|
|
||||||
bool CConf::getP25Enabled() const
|
bool CConf::getP25Enabled() const
|
||||||
{
|
{
|
||||||
return m_p25Enabled;
|
return m_p25Enabled;
|
||||||
|
|||||||
16
Conf.h
16
Conf.h
@@ -114,9 +114,11 @@ public:
|
|||||||
unsigned int getDMRTXHang() const;
|
unsigned int getDMRTXHang() const;
|
||||||
|
|
||||||
// The System Fusion section
|
// The System Fusion section
|
||||||
bool getFusionEnabled() const;
|
bool getFusionEnabled() const;
|
||||||
bool getFusionLowDeviation() const;
|
bool getFusionLowDeviation() const;
|
||||||
bool getFusionRemoteGateway() const;
|
bool getFusionRemoteGateway() const;
|
||||||
|
bool getFusionSQLEnabled() const;
|
||||||
|
unsigned char getFusionSQL() const;
|
||||||
|
|
||||||
// The P25 section
|
// The P25 section
|
||||||
bool getP25Enabled() const;
|
bool getP25Enabled() const;
|
||||||
@@ -269,9 +271,11 @@ private:
|
|||||||
unsigned int m_dmrCallHang;
|
unsigned int m_dmrCallHang;
|
||||||
unsigned int m_dmrTXHang;
|
unsigned int m_dmrTXHang;
|
||||||
|
|
||||||
bool m_fusionEnabled;
|
bool m_fusionEnabled;
|
||||||
bool m_fusionLowDeviation;
|
bool m_fusionLowDeviation;
|
||||||
bool m_fusionRemoteGateway;
|
bool m_fusionRemoteGateway;
|
||||||
|
bool m_fusionSQLEnabled;
|
||||||
|
unsigned char m_fusionSQL;
|
||||||
|
|
||||||
bool m_p25Enabled;
|
bool m_p25Enabled;
|
||||||
unsigned int m_p25NAC;
|
unsigned int m_p25NAC;
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ TXHang=4
|
|||||||
[System Fusion]
|
[System Fusion]
|
||||||
Enable=1
|
Enable=1
|
||||||
LowDeviation=0
|
LowDeviation=0
|
||||||
|
#DSQ=1
|
||||||
RemoteGateway=0
|
RemoteGateway=0
|
||||||
|
|
||||||
[P25]
|
[P25]
|
||||||
|
|||||||
@@ -408,12 +408,18 @@ int CMMDVMHost::run()
|
|||||||
if (m_ysfEnabled) {
|
if (m_ysfEnabled) {
|
||||||
bool lowDeviation = m_conf.getFusionLowDeviation();
|
bool lowDeviation = m_conf.getFusionLowDeviation();
|
||||||
bool remoteGateway = m_conf.getFusionRemoteGateway();
|
bool remoteGateway = m_conf.getFusionRemoteGateway();
|
||||||
|
bool sqlEnabled = m_conf.getFusionSQLEnabled();
|
||||||
|
unsigned char sql = m_conf.getFusionSQL();
|
||||||
|
|
||||||
LogInfo("YSF Parameters");
|
LogInfo("YSF Parameters");
|
||||||
LogInfo(" Low Deviation: %s", lowDeviation ? "yes" : "no");
|
LogInfo(" Low Deviation: %s", lowDeviation ? "yes" : "no");
|
||||||
LogInfo(" Remote Gateway: %s", remoteGateway ? "yes" : "no");
|
LogInfo(" Remote Gateway: %s", remoteGateway ? "yes" : "no");
|
||||||
|
LogInfo(" DSQ: %s", sqlEnabled ? "yes" : "no");
|
||||||
|
if (sqlEnabled)
|
||||||
|
LogInfo(" DSQ Value: %u", sql);
|
||||||
|
|
||||||
ysf = new CYSFControl(m_callsign, m_ysfNetwork, m_display, m_timeout, m_duplex, lowDeviation, remoteGateway, rssi);
|
ysf = new CYSFControl(m_callsign, m_ysfNetwork, m_display, m_timeout, m_duplex, lowDeviation, remoteGateway, rssi);
|
||||||
|
ysf->setSQL(sqlEnabled, sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
CP25Control* p25 = NULL;
|
CP25Control* p25 = NULL;
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ m_display(display),
|
|||||||
m_duplex(duplex),
|
m_duplex(duplex),
|
||||||
m_lowDeviation(lowDeviation),
|
m_lowDeviation(lowDeviation),
|
||||||
m_remoteGateway(remoteGateway),
|
m_remoteGateway(remoteGateway),
|
||||||
|
m_sqlEnabled(false),
|
||||||
|
m_sqlValue(0U),
|
||||||
m_queue(5000U, "YSF Control"),
|
m_queue(5000U, "YSF Control"),
|
||||||
m_rfState(RS_RF_LISTENING),
|
m_rfState(RS_RF_LISTENING),
|
||||||
m_netState(RS_NET_IDLE),
|
m_netState(RS_NET_IDLE),
|
||||||
@@ -95,6 +97,12 @@ CYSFControl::~CYSFControl()
|
|||||||
delete[] m_callsign;
|
delete[] m_callsign;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CYSFControl::setSQL(bool on, unsigned char value)
|
||||||
|
{
|
||||||
|
m_sqlEnabled = on;
|
||||||
|
m_sqlValue = value;
|
||||||
|
}
|
||||||
|
|
||||||
bool CYSFControl::writeModem(unsigned char *data, unsigned int len)
|
bool CYSFControl::writeModem(unsigned char *data, unsigned int len)
|
||||||
{
|
{
|
||||||
assert(data != NULL);
|
assert(data != NULL);
|
||||||
@@ -143,6 +151,14 @@ bool CYSFControl::writeModem(unsigned char *data, unsigned int len)
|
|||||||
if (fi == YSF_FI_TERMINATOR)
|
if (fi == YSF_FI_TERMINATOR)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (m_sqlEnabled) {
|
||||||
|
bool sql = fich.getSQL();
|
||||||
|
unsigned char value = fich.getSQ();
|
||||||
|
|
||||||
|
if (!sql || value != m_sqlValue)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
m_rfFrames = 0U;
|
m_rfFrames = 0U;
|
||||||
m_rfErrs = 0U;
|
m_rfErrs = 0U;
|
||||||
m_rfBits = 1U;
|
m_rfBits = 1U;
|
||||||
@@ -207,6 +223,11 @@ bool CYSFControl::writeModem(unsigned char *data, unsigned int len)
|
|||||||
LogMessage("YSF, received RF header from ?????????? to ??????????");
|
LogMessage("YSF, received RF header from ?????????? to ??????????");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove any DSQ information
|
||||||
|
fich.setSQL(false);
|
||||||
|
fich.setSQ(0U);
|
||||||
|
fich.encode(data + 2U);
|
||||||
|
|
||||||
data[0U] = TAG_DATA;
|
data[0U] = TAG_DATA;
|
||||||
data[1U] = 0x00U;
|
data[1U] = 0x00U;
|
||||||
|
|
||||||
@@ -233,6 +254,11 @@ bool CYSFControl::writeModem(unsigned char *data, unsigned int len)
|
|||||||
|
|
||||||
m_rfPayload.processHeaderData(data + 2U);
|
m_rfPayload.processHeaderData(data + 2U);
|
||||||
|
|
||||||
|
// Remove any DSQ information
|
||||||
|
fich.setSQL(false);
|
||||||
|
fich.setSQ(0U);
|
||||||
|
fich.encode(data + 2U);
|
||||||
|
|
||||||
data[0U] = TAG_EOT;
|
data[0U] = TAG_EOT;
|
||||||
data[1U] = 0x00U;
|
data[1U] = 0x00U;
|
||||||
|
|
||||||
@@ -347,6 +373,11 @@ bool CYSFControl::writeModem(unsigned char *data, unsigned int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove any DSQ information
|
||||||
|
fich.setSQL(false);
|
||||||
|
fich.setSQ(0U);
|
||||||
|
fich.encode(data + 2U);
|
||||||
|
|
||||||
data[0U] = TAG_DATA;
|
data[0U] = TAG_DATA;
|
||||||
data[1U] = 0x00U;
|
data[1U] = 0x00U;
|
||||||
|
|
||||||
@@ -515,8 +546,6 @@ void CYSFControl::writeNetwork()
|
|||||||
data[33U] = end ? TAG_EOT : TAG_DATA;
|
data[33U] = end ? TAG_EOT : TAG_DATA;
|
||||||
data[34U] = 0x00U;
|
data[34U] = 0x00U;
|
||||||
|
|
||||||
// bool send = true;
|
|
||||||
|
|
||||||
CYSFFICH fich;
|
CYSFFICH fich;
|
||||||
bool valid = fich.decode(data + 35U);
|
bool valid = fich.decode(data + 35U);
|
||||||
if (valid) {
|
if (valid) {
|
||||||
@@ -525,6 +554,10 @@ void CYSFControl::writeNetwork()
|
|||||||
unsigned char ft = fich.getFT();
|
unsigned char ft = fich.getFT();
|
||||||
unsigned char fi = fich.getFI();
|
unsigned char fi = fich.getFI();
|
||||||
|
|
||||||
|
// Add any DSQ information
|
||||||
|
fich.setSQL(m_sqlEnabled);
|
||||||
|
fich.setSQ(m_sqlValue);
|
||||||
|
|
||||||
fich.setVoIP(true);
|
fich.setVoIP(true);
|
||||||
fich.setMR(m_remoteGateway ? YSF_MR_NOT_BUSY : YSF_MR_BUSY);
|
fich.setMR(m_remoteGateway ? YSF_MR_NOT_BUSY : YSF_MR_BUSY);
|
||||||
fich.setDev(m_lowDeviation);
|
fich.setDev(m_lowDeviation);
|
||||||
@@ -587,16 +620,13 @@ void CYSFControl::writeNetwork()
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// send = insertSilence(data + 33U, n);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (send) {
|
writeQueueNet(data + 33U);
|
||||||
writeQueueNet(data + 33U);
|
|
||||||
m_packetTimer.start();
|
m_packetTimer.start();
|
||||||
m_netFrames++;
|
m_netFrames++;
|
||||||
m_netN = n;
|
m_netN = n;
|
||||||
// }
|
|
||||||
|
|
||||||
if (end) {
|
if (end) {
|
||||||
LogMessage("YSF, received network end of transmission, %.1f seconds, %u%% packet loss, BER: %.1f%%", float(m_netFrames) / 10.0F, (m_netLost * 100U) / m_netFrames, float(m_netErrs * 100U) / float(m_netBits));
|
LogMessage("YSF, received network end of transmission, %.1f seconds, %u%% packet loss, BER: %.1f%%", float(m_netFrames) / 10.0F, (m_netLost * 100U) / m_netFrames, float(m_netErrs * 100U) / float(m_netBits));
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ public:
|
|||||||
CYSFControl(const std::string& callsign, CYSFNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, bool lowDeviation, bool remoteGateway, CRSSIInterpolator* rssiMapper);
|
CYSFControl(const std::string& callsign, CYSFNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, bool lowDeviation, bool remoteGateway, CRSSIInterpolator* rssiMapper);
|
||||||
~CYSFControl();
|
~CYSFControl();
|
||||||
|
|
||||||
|
void setSQL(bool on, unsigned char value);
|
||||||
|
|
||||||
bool writeModem(unsigned char* data, unsigned int len);
|
bool writeModem(unsigned char* data, unsigned int len);
|
||||||
|
|
||||||
unsigned int readModem(unsigned char* data);
|
unsigned int readModem(unsigned char* data);
|
||||||
@@ -50,6 +52,8 @@ private:
|
|||||||
bool m_duplex;
|
bool m_duplex;
|
||||||
bool m_lowDeviation;
|
bool m_lowDeviation;
|
||||||
bool m_remoteGateway;
|
bool m_remoteGateway;
|
||||||
|
bool m_sqlEnabled;
|
||||||
|
unsigned char m_sqlValue;
|
||||||
CRingBuffer<unsigned char> m_queue;
|
CRingBuffer<unsigned char> m_queue;
|
||||||
RPT_RF_STATE m_rfState;
|
RPT_RF_STATE m_rfState;
|
||||||
RPT_NET_STATE m_netState;
|
RPT_NET_STATE m_netState;
|
||||||
|
|||||||
24
YSFFICH.cpp
24
YSFFICH.cpp
@@ -204,6 +204,16 @@ bool CYSFFICH::getDev() const
|
|||||||
return (m_fich[2U] & 0x40U) == 0x40U;
|
return (m_fich[2U] & 0x40U) == 0x40U;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CYSFFICH::getSQL() const
|
||||||
|
{
|
||||||
|
return (m_fich[3U] & 0x80U) == 0x80U;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char CYSFFICH::getSQ() const
|
||||||
|
{
|
||||||
|
return m_fich[3U] & 0x7FU;
|
||||||
|
}
|
||||||
|
|
||||||
void CYSFFICH::setMR(unsigned char mr)
|
void CYSFFICH::setMR(unsigned char mr)
|
||||||
{
|
{
|
||||||
m_fich[2U] &= 0xC7U;
|
m_fich[2U] &= 0xC7U;
|
||||||
@@ -225,3 +235,17 @@ void CYSFFICH::setDev(bool on)
|
|||||||
else
|
else
|
||||||
m_fich[2U] &= 0xBFU;
|
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)
|
||||||
|
{
|
||||||
|
m_fich[3U] &= 0x80U;
|
||||||
|
m_fich[3U] |= sq & 0x7FU;
|
||||||
|
}
|
||||||
|
|||||||
@@ -37,10 +37,14 @@ public:
|
|||||||
unsigned char getDT() const;
|
unsigned char getDT() const;
|
||||||
unsigned char getMR() const;
|
unsigned char getMR() const;
|
||||||
bool getDev() const;
|
bool getDev() const;
|
||||||
|
bool getSQL() const;
|
||||||
|
unsigned char getSQ() const;
|
||||||
|
|
||||||
void setMR(unsigned char mr);
|
void setMR(unsigned char mr);
|
||||||
void setVoIP(bool set);
|
void setVoIP(bool set);
|
||||||
void setDev(bool set);
|
void setDev(bool set);
|
||||||
|
void setSQL(bool set);
|
||||||
|
void setSQ(unsigned char sq);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned char* m_fich;
|
unsigned char* m_fich;
|
||||||
|
|||||||
Reference in New Issue
Block a user