Option to filter callsigns without DMR ID from YSF

This commit is contained in:
Marius Petrescu, YO2LOJ 2019-05-11 21:02:16 +03:00 committed by GitHub
parent e375e1f515
commit 7e39ea2a71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 37 additions and 13 deletions

View File

@ -240,6 +240,8 @@ bool CConf::read()
m_dmrIdLookupFile = value;
else if (::strcmp(key, "Time") == 0)
m_dmrIdLookupTime = (unsigned int)::atoi(value);
if (::strcmp(key, "DropUnknown") == 0)
m_dmrDropUnknown = ::atoi(value) == 1;
} else if (section == SECTION_LOG) {
if (::strcmp(key, "FilePath") == 0)
m_logFilePath = value;
@ -517,6 +519,11 @@ unsigned int CConf::getDMRIdLookupTime() const
return m_dmrIdLookupTime;
}
bool CConf::getDMRDropUnknown() const
{
return m_dmrDropUnknown;
}
unsigned int CConf::getLogDisplayLevel() const
{
return m_logDisplayLevel;

View File

@ -79,6 +79,7 @@ public:
// The DMR Id section
std::string getDMRIdLookupFile() const;
unsigned int getDMRIdLookupTime() const;
bool getDMRDropUnknown() const;
// The Log section
unsigned int getLogDisplayLevel() const;
@ -141,6 +142,7 @@ private:
std::string m_dmrIdLookupFile;
unsigned int m_dmrIdLookupTime;
bool m_dmrDropUnknown;
unsigned int m_logDisplayLevel;
unsigned int m_logFileLevel;

View File

@ -292,6 +292,7 @@ int CYSF2DMR::run()
m_lookup = new CDMRLookup(lookupFile, reloadTime);
m_lookup->read();
m_dropUnknown = m_conf.getDMRDropUnknown();
if (m_dmrpc)
m_dmrflco = FLCO_USER_USER;
@ -581,21 +582,33 @@ int CYSF2DMR::run()
m_dmrNetwork->reset(2U); // OE1KBC fix
m_srcid = findYSFID(ysfSrc, true);
m_conv.putYSFHeader();
m_ysfFrames = 0U;
if (m_dropUnknown == 0 || m_srcid != 0) {
ysfWatchdog.start();
m_dmrNetwork->reset(2U); // OE1KBC fix
m_conv.putYSFHeader();
m_ysfFrames = 0U;
}
else
{
LogMessage("Dropped source without DMR ID: %s", ysfSrc.c_str());
}
}
} else if (fi == YSF_FI_TERMINATOR) {
ysfWatchdog.stop();
int extraFrames = (m_hangTime / 100U) - m_ysfFrames - 2U;
for (int i = 0U; i < extraFrames; i++)
m_conv.putDummyYSF();
LogMessage("YSF received end of voice transmission, %.1f seconds", float(m_ysfFrames) / 10.0F);
m_conv.putYSFEOT();
m_ysfFrames = 0U;
if (m_dropUnknown == 0 || m_srcid != 0) {
ysfWatchdog.stop();
int extraFrames = (m_hangTime / 100U) - m_ysfFrames - 2U;
for (int i = 0U; i < extraFrames; i++)
m_conv.putDummyYSF();
LogMessage("YSF received end of voice transmission, %.1f seconds", float(m_ysfFrames) / 10.0F);
m_conv.putYSFEOT();
m_ysfFrames = 0U;
}
} else if (fi == YSF_FI_COMMUNICATIONS) {
ysfWatchdog.start();
m_conv.putYSF(buffer + 35U);
m_ysfFrames++;
if (m_dropUnknown == 0 || m_srcid != 0) {
ysfWatchdog.start();
m_conv.putYSF(buffer + 35U);
m_ysfFrames++;
}
}
}
@ -1255,7 +1268,7 @@ unsigned int CYSF2DMR::findYSFID(std::string cs, bool showdst)
dmrpc = false;
if (id == 0) {
id = m_defsrcid;
if (m_dropUnknown == 0) id = m_defsrcid;
if (showdst)
LogMessage("Not DMR ID found, using default ID: %u, DstID: %s%u", id, dmrpc ? "" : "TG ", m_dstid);
else

View File

@ -107,6 +107,7 @@ private:
bool m_remoteGateway;
unsigned int m_hangTime;
bool m_firstSync;
bool m_dropUnknown;
bool createDMRNetwork();
void createGPS();

View File

@ -46,6 +46,7 @@ Debug=0
[DMR Id Lookup]
File=DMRIds.dat
Time=24
DropUnknown=0
[Log]
# Logging levels, 0=No logging