Add SelfOnly to YSF.

This commit is contained in:
Jonathan Naylor
2017-08-15 10:11:05 +01:00
parent b3c0e68b23
commit 8b2544ba85
6 changed files with 58 additions and 3 deletions

View File

@@ -122,6 +122,7 @@ m_dmrTXHang(4U),
m_fusionEnabled(false), m_fusionEnabled(false),
m_fusionLowDeviation(false), m_fusionLowDeviation(false),
m_fusionRemoteGateway(false), m_fusionRemoteGateway(false),
m_fusionSelfOnly(false),
m_fusionSQLEnabled(false), m_fusionSQLEnabled(false),
m_fusionSQL(0U), m_fusionSQL(0U),
m_p25Enabled(false), m_p25Enabled(false),
@@ -459,6 +460,8 @@ bool CConf::read()
m_fusionSQL = (unsigned int)::atoi(value); m_fusionSQL = (unsigned int)::atoi(value);
} else if (::strcmp(key, "RemoteGateway") == 0) } else if (::strcmp(key, "RemoteGateway") == 0)
m_fusionRemoteGateway = ::atoi(value) == 1; m_fusionRemoteGateway = ::atoi(value) == 1;
else if (::strcmp(key, "SelfOnly") == 0)
m_fusionSelfOnly = ::atoi(value) == 1;
} else if (section == SECTION_P25) { } else if (section == SECTION_P25) {
if (::strcmp(key, "Enable") == 0) if (::strcmp(key, "Enable") == 0)
m_p25Enabled = ::atoi(value) == 1; m_p25Enabled = ::atoi(value) == 1;
@@ -935,6 +938,11 @@ bool CConf::getFusionRemoteGateway() const
return m_fusionRemoteGateway; return m_fusionRemoteGateway;
} }
bool CConf::getFusionSelfOnly() const
{
return m_fusionSelfOnly;
}
bool CConf::getFusionSQLEnabled() const bool CConf::getFusionSQLEnabled() const
{ {
return m_fusionSQLEnabled; return m_fusionSQLEnabled;

2
Conf.h
View File

@@ -117,6 +117,7 @@ public:
bool getFusionEnabled() const; bool getFusionEnabled() const;
bool getFusionLowDeviation() const; bool getFusionLowDeviation() const;
bool getFusionRemoteGateway() const; bool getFusionRemoteGateway() const;
bool getFusionSelfOnly() const;
bool getFusionSQLEnabled() const; bool getFusionSQLEnabled() const;
unsigned char getFusionSQL() const; unsigned char getFusionSQL() const;
@@ -275,6 +276,7 @@ private:
bool m_fusionEnabled; bool m_fusionEnabled;
bool m_fusionLowDeviation; bool m_fusionLowDeviation;
bool m_fusionRemoteGateway; bool m_fusionRemoteGateway;
bool m_fusionSelfOnly;
bool m_fusionSQLEnabled; bool m_fusionSQLEnabled;
unsigned char m_fusionSQL; unsigned char m_fusionSQL;

View File

@@ -86,6 +86,7 @@ TXHang=4
[System Fusion] [System Fusion]
Enable=1 Enable=1
LowDeviation=0 LowDeviation=0
SelfOnly=0
#DSQ=1 #DSQ=1
RemoteGateway=0 RemoteGateway=0

View File

@@ -408,17 +408,19 @@ 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 selfOnly = m_conf.getFusionSelfOnly();
bool sqlEnabled = m_conf.getFusionSQLEnabled(); bool sqlEnabled = m_conf.getFusionSQLEnabled();
unsigned char sql = m_conf.getFusionSQL(); 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(" Self Only: %s", selfOnly ? "yes" : "no");
LogInfo(" DSQ: %s", sqlEnabled ? "yes" : "no"); LogInfo(" DSQ: %s", sqlEnabled ? "yes" : "no");
if (sqlEnabled) if (sqlEnabled)
LogInfo(" DSQ Value: %u", sql); 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, selfOnly, m_ysfNetwork, m_display, m_timeout, m_duplex, lowDeviation, remoteGateway, rssi);
ysf->setSQL(sqlEnabled, sql); ysf->setSQL(sqlEnabled, sql);
} }

View File

@@ -23,8 +23,10 @@
// #define DUMP_YSF // #define DUMP_YSF
CYSFControl::CYSFControl(const std::string& callsign, CYSFNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, bool lowDeviation, bool remoteGateway, CRSSIInterpolator* rssiMapper) : CYSFControl::CYSFControl(const std::string& callsign, bool selfOnly, CYSFNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, bool lowDeviation, bool remoteGateway, CRSSIInterpolator* rssiMapper) :
m_callsign(NULL), m_callsign(NULL),
m_selfCallsign(NULL),
m_selfOnly(selfOnly),
m_network(network), m_network(network),
m_display(display), m_display(display),
m_duplex(duplex), m_duplex(duplex),
@@ -81,6 +83,12 @@ m_fp(NULL)
for (unsigned int i = 0U; i < YSF_CALLSIGN_LENGTH; i++) for (unsigned int i = 0U; i < YSF_CALLSIGN_LENGTH; i++)
m_callsign[i] = node.at(i); m_callsign[i] = node.at(i);
m_selfCallsign = new unsigned char[YSF_CALLSIGN_LENGTH];
::memset(m_selfCallsign, 0x00U, YSF_CALLSIGN_LENGTH);
for (unsigned int i = 0U; i < callsign.length(); i++)
m_selfCallsign[i] = callsign.at(i);
} }
CYSFControl::~CYSFControl() CYSFControl::~CYSFControl()
@@ -88,6 +96,7 @@ CYSFControl::~CYSFControl()
delete[] m_netSource; delete[] m_netSource;
delete[] m_netDest; delete[] m_netDest;
delete[] m_callsign; delete[] m_callsign;
delete[] m_selfCallsign;
} }
void CYSFControl::setSQL(bool on, unsigned char value) void CYSFControl::setSQL(bool on, unsigned char value)
@@ -201,6 +210,12 @@ bool CYSFControl::processVWData(bool valid, unsigned char *data)
m_rfSource = m_rfPayload.getSource(); m_rfSource = m_rfPayload.getSource();
if (m_selfOnly) {
bool ret = checkCallsign(m_rfSource);
if (!ret)
return false;
}
unsigned char cm = m_lastFICH.getCM(); unsigned char cm = m_lastFICH.getCM();
if (cm == YSF_CM_GROUP) if (cm == YSF_CM_GROUP)
m_rfDest = (unsigned char*)"ALL "; m_rfDest = (unsigned char*)"ALL ";
@@ -375,6 +390,12 @@ bool CYSFControl::processDNData(bool valid, unsigned char *data)
m_rfSource = m_rfPayload.getSource(); m_rfSource = m_rfPayload.getSource();
if (m_selfOnly) {
bool ret = checkCallsign(m_rfSource);
if (!ret)
return false;
}
unsigned char cm = m_lastFICH.getCM(); unsigned char cm = m_lastFICH.getCM();
if (cm == YSF_CM_GROUP) if (cm == YSF_CM_GROUP)
m_rfDest = (unsigned char*)"ALL "; m_rfDest = (unsigned char*)"ALL ";
@@ -584,6 +605,12 @@ bool CYSFControl::processDNData(bool valid, unsigned char *data)
if (m_rfSource == NULL || m_rfDest == NULL) if (m_rfSource == NULL || m_rfDest == NULL)
return false; return false;
if (m_selfOnly) {
bool ret = checkCallsign(m_rfSource);
if (!ret)
return false;
}
m_rfFrames = 0U; m_rfFrames = 0U;
m_rfErrs = 0U; m_rfErrs = 0U;
m_rfBits = 1U; m_rfBits = 1U;
@@ -697,6 +724,12 @@ bool CYSFControl::processFRData(bool valid, unsigned char *data)
m_rfSource = m_rfPayload.getSource(); m_rfSource = m_rfPayload.getSource();
if (m_selfOnly) {
bool ret = checkCallsign(m_rfSource);
if (!ret)
return false;
}
unsigned char cm = m_lastFICH.getCM(); unsigned char cm = m_lastFICH.getCM();
if (cm == YSF_CM_GROUP) if (cm == YSF_CM_GROUP)
m_rfDest = (unsigned char*)"ALL "; m_rfDest = (unsigned char*)"ALL ";
@@ -1163,3 +1196,8 @@ void CYSFControl::closeFile()
m_fp = NULL; m_fp = NULL;
} }
} }
bool CYSFControl::checkCallsign(const unsigned char* callsign) const
{
return ::memcmp(callsign, m_selfCallsign, ::strlen((char*)m_selfCallsign)) == 0;
}

View File

@@ -35,7 +35,7 @@
class CYSFControl { class CYSFControl {
public: 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, bool selfOnly, CYSFNetwork* network, CDisplay* display, unsigned int timeout, bool duplex, bool lowDeviation, bool remoteGateway, CRSSIInterpolator* rssiMapper);
~CYSFControl(); ~CYSFControl();
void setSQL(bool on, unsigned char value); void setSQL(bool on, unsigned char value);
@@ -48,6 +48,8 @@ public:
private: private:
unsigned char* m_callsign; unsigned char* m_callsign;
unsigned char* m_selfCallsign;
bool m_selfOnly;
CYSFNetwork* m_network; CYSFNetwork* m_network;
CDisplay* m_display; CDisplay* m_display;
bool m_duplex; bool m_duplex;
@@ -101,6 +103,8 @@ private:
bool openFile(); bool openFile();
bool writeFile(const unsigned char* data); bool writeFile(const unsigned char* data);
void closeFile(); void closeFile();
bool checkCallsign(const unsigned char* callsign) const;
}; };
#endif #endif