Add SelfOnly to P25 based on the DMR Id.

This commit is contained in:
Jonathan Naylor
2017-08-15 10:30:05 +01:00
parent 6ae4735598
commit cf0c70087d
6 changed files with 28 additions and 3 deletions

View File

@@ -126,6 +126,7 @@ m_fusionSQLEnabled(false),
m_fusionSQL(0U),
m_p25Enabled(false),
m_p25NAC(0x293U),
m_p25SelfOnly(false),
m_dstarNetworkEnabled(false),
m_dstarGatewayAddress(),
m_dstarGatewayPort(0U),
@@ -466,6 +467,8 @@ bool CConf::read()
m_p25NAC = (unsigned int)::strtoul(value, NULL, 16);
else if (::strcmp(key, "OverrideUIDCheck") == 0)
m_p25OverrideUID = ::atoi(value) == 1;
else if (::strcmp(key, "SelfOnly") == 0)
m_p25SelfOnly = ::atoi(value) == 1;
} else if (section == SECTION_DSTAR_NETWORK) {
if (::strcmp(key, "Enable") == 0)
m_dstarNetworkEnabled = ::atoi(value) == 1;
@@ -1090,6 +1093,11 @@ bool CConf::getP25OverrideUID() const
return m_p25OverrideUID;
}
bool CConf::getP25SelfOnly() const
{
return m_p25SelfOnly;
}
std::string CConf::getTFTSerialPort() const
{
return m_tftSerialPort;

2
Conf.h
View File

@@ -123,6 +123,7 @@ public:
// The P25 section
bool getP25Enabled() const;
unsigned int getP25NAC() const;
bool getP25SelfOnly() const;
// The D-Star Network section
bool getDStarNetworkEnabled() const;
@@ -280,6 +281,7 @@ private:
bool m_p25Enabled;
unsigned int m_p25NAC;
bool m_p25SelfOnly;
bool m_dstarNetworkEnabled;
std::string m_dstarGatewayAddress;

View File

@@ -92,6 +92,7 @@ RemoteGateway=0
[P25]
Enable=1
NAC=293
SelfOnly=0
OverrideUIDCheck=0
[D-Star Network]

View File

@@ -425,13 +425,17 @@ int CMMDVMHost::run()
CP25Control* p25 = NULL;
if (m_p25Enabled) {
unsigned int nac = m_conf.getP25NAC();
unsigned int id = m_conf.getDMRId();
bool uidOverride = m_conf.getP25OverrideUID();
bool selfOnly = m_conf.getP25SelfOnly();
LogInfo("P25 Parameters");
LogInfo(" NAC: $%03X", nac);
LogInfo(" Id: %u", id);
LogInfo(" UID Override: %s", uidOverride ? "yes" : "no");
LogInfo(" Self Only: %s", selfOnly ? "yes" : "no");
p25 = new CP25Control(nac, uidOverride, m_p25Network, m_display, m_timeout, m_duplex, m_lookup, rssi);
p25 = new CP25Control(nac, id, selfOnly, uidOverride, m_p25Network, m_display, m_timeout, m_duplex, m_lookup, rssi);
}
setMode(MODE_IDLE);

View File

@@ -35,8 +35,10 @@ const unsigned char BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U
#define WRITE_BIT(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7])
#define READ_BIT(p,i) (p[(i)>>3] & BIT_MASK_TABLE[(i)&7])
CP25Control::CP25Control(unsigned int nac, bool uidOverride, CP25Network* network, CDisplay* display, unsigned int timeout, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssiMapper) :
CP25Control::CP25Control(unsigned int nac, unsigned int id, bool selfOnly, bool uidOverride, CP25Network* network, CDisplay* display, unsigned int timeout, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssiMapper) :
m_nac(nac),
m_id(id),
m_selfOnly(selfOnly),
m_uidOverride(uidOverride),
m_network(network),
m_display(display),
@@ -234,6 +236,12 @@ bool CP25Control::writeModem(unsigned char* data, unsigned int len)
if (m_rfState == RS_RF_LISTENING) {
unsigned int srcId = m_rfData.getSrcId();
if (m_selfOnly) {
if (srcId != m_id)
return false;
}
bool grp = m_rfData.getLCF() == P25_LCF_GROUP;
unsigned int dstId = m_rfData.getDstId();
std::string source = m_lookup->find(srcId);

View File

@@ -36,7 +36,7 @@
class CP25Control {
public:
CP25Control(unsigned int nac, bool uidOverride, CP25Network* network, CDisplay* display, unsigned int timeout, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssiMapper);
CP25Control(unsigned int nac, unsigned int id, bool selfOly, bool uidOverride, CP25Network* network, CDisplay* display, unsigned int timeout, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssiMapper);
~CP25Control();
bool writeModem(unsigned char* data, unsigned int len);
@@ -47,6 +47,8 @@ public:
private:
unsigned int m_nac;
unsigned int m_id;
bool m_selfOnly;
bool m_uidOverride;
CP25Network* m_network;
CDisplay* m_display;