mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-22 16:25:45 +08:00
Add SelfOnly to P25 based on the DMR Id.
This commit is contained in:
8
Conf.cpp
8
Conf.cpp
@@ -126,6 +126,7 @@ m_fusionSQLEnabled(false),
|
|||||||
m_fusionSQL(0U),
|
m_fusionSQL(0U),
|
||||||
m_p25Enabled(false),
|
m_p25Enabled(false),
|
||||||
m_p25NAC(0x293U),
|
m_p25NAC(0x293U),
|
||||||
|
m_p25SelfOnly(false),
|
||||||
m_dstarNetworkEnabled(false),
|
m_dstarNetworkEnabled(false),
|
||||||
m_dstarGatewayAddress(),
|
m_dstarGatewayAddress(),
|
||||||
m_dstarGatewayPort(0U),
|
m_dstarGatewayPort(0U),
|
||||||
@@ -466,6 +467,8 @@ bool CConf::read()
|
|||||||
m_p25NAC = (unsigned int)::strtoul(value, NULL, 16);
|
m_p25NAC = (unsigned int)::strtoul(value, NULL, 16);
|
||||||
else if (::strcmp(key, "OverrideUIDCheck") == 0)
|
else if (::strcmp(key, "OverrideUIDCheck") == 0)
|
||||||
m_p25OverrideUID = ::atoi(value) == 1;
|
m_p25OverrideUID = ::atoi(value) == 1;
|
||||||
|
else if (::strcmp(key, "SelfOnly") == 0)
|
||||||
|
m_p25SelfOnly = ::atoi(value) == 1;
|
||||||
} else if (section == SECTION_DSTAR_NETWORK) {
|
} else if (section == SECTION_DSTAR_NETWORK) {
|
||||||
if (::strcmp(key, "Enable") == 0)
|
if (::strcmp(key, "Enable") == 0)
|
||||||
m_dstarNetworkEnabled = ::atoi(value) == 1;
|
m_dstarNetworkEnabled = ::atoi(value) == 1;
|
||||||
@@ -1090,6 +1093,11 @@ bool CConf::getP25OverrideUID() const
|
|||||||
return m_p25OverrideUID;
|
return m_p25OverrideUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CConf::getP25SelfOnly() const
|
||||||
|
{
|
||||||
|
return m_p25SelfOnly;
|
||||||
|
}
|
||||||
|
|
||||||
std::string CConf::getTFTSerialPort() const
|
std::string CConf::getTFTSerialPort() const
|
||||||
{
|
{
|
||||||
return m_tftSerialPort;
|
return m_tftSerialPort;
|
||||||
|
|||||||
2
Conf.h
2
Conf.h
@@ -123,6 +123,7 @@ public:
|
|||||||
// The P25 section
|
// The P25 section
|
||||||
bool getP25Enabled() const;
|
bool getP25Enabled() const;
|
||||||
unsigned int getP25NAC() const;
|
unsigned int getP25NAC() const;
|
||||||
|
bool getP25SelfOnly() const;
|
||||||
|
|
||||||
// The D-Star Network section
|
// The D-Star Network section
|
||||||
bool getDStarNetworkEnabled() const;
|
bool getDStarNetworkEnabled() const;
|
||||||
@@ -280,6 +281,7 @@ private:
|
|||||||
|
|
||||||
bool m_p25Enabled;
|
bool m_p25Enabled;
|
||||||
unsigned int m_p25NAC;
|
unsigned int m_p25NAC;
|
||||||
|
bool m_p25SelfOnly;
|
||||||
|
|
||||||
bool m_dstarNetworkEnabled;
|
bool m_dstarNetworkEnabled;
|
||||||
std::string m_dstarGatewayAddress;
|
std::string m_dstarGatewayAddress;
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ RemoteGateway=0
|
|||||||
[P25]
|
[P25]
|
||||||
Enable=1
|
Enable=1
|
||||||
NAC=293
|
NAC=293
|
||||||
|
SelfOnly=0
|
||||||
OverrideUIDCheck=0
|
OverrideUIDCheck=0
|
||||||
|
|
||||||
[D-Star Network]
|
[D-Star Network]
|
||||||
|
|||||||
@@ -425,13 +425,17 @@ int CMMDVMHost::run()
|
|||||||
CP25Control* p25 = NULL;
|
CP25Control* p25 = NULL;
|
||||||
if (m_p25Enabled) {
|
if (m_p25Enabled) {
|
||||||
unsigned int nac = m_conf.getP25NAC();
|
unsigned int nac = m_conf.getP25NAC();
|
||||||
|
unsigned int id = m_conf.getDMRId();
|
||||||
bool uidOverride = m_conf.getP25OverrideUID();
|
bool uidOverride = m_conf.getP25OverrideUID();
|
||||||
|
bool selfOnly = m_conf.getP25SelfOnly();
|
||||||
|
|
||||||
LogInfo("P25 Parameters");
|
LogInfo("P25 Parameters");
|
||||||
LogInfo(" NAC: $%03X", nac);
|
LogInfo(" NAC: $%03X", nac);
|
||||||
|
LogInfo(" Id: %u", id);
|
||||||
LogInfo(" UID Override: %s", uidOverride ? "yes" : "no");
|
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);
|
setMode(MODE_IDLE);
|
||||||
|
|||||||
@@ -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 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])
|
#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_nac(nac),
|
||||||
|
m_id(id),
|
||||||
|
m_selfOnly(selfOnly),
|
||||||
m_uidOverride(uidOverride),
|
m_uidOverride(uidOverride),
|
||||||
m_network(network),
|
m_network(network),
|
||||||
m_display(display),
|
m_display(display),
|
||||||
@@ -234,6 +236,12 @@ bool CP25Control::writeModem(unsigned char* data, unsigned int len)
|
|||||||
|
|
||||||
if (m_rfState == RS_RF_LISTENING) {
|
if (m_rfState == RS_RF_LISTENING) {
|
||||||
unsigned int srcId = m_rfData.getSrcId();
|
unsigned int srcId = m_rfData.getSrcId();
|
||||||
|
|
||||||
|
if (m_selfOnly) {
|
||||||
|
if (srcId != m_id)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool grp = m_rfData.getLCF() == P25_LCF_GROUP;
|
bool grp = m_rfData.getLCF() == P25_LCF_GROUP;
|
||||||
unsigned int dstId = m_rfData.getDstId();
|
unsigned int dstId = m_rfData.getDstId();
|
||||||
std::string source = m_lookup->find(srcId);
|
std::string source = m_lookup->find(srcId);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
class CP25Control {
|
class CP25Control {
|
||||||
public:
|
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();
|
~CP25Control();
|
||||||
|
|
||||||
bool writeModem(unsigned char* data, unsigned int len);
|
bool writeModem(unsigned char* data, unsigned int len);
|
||||||
@@ -47,6 +47,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned int m_nac;
|
unsigned int m_nac;
|
||||||
|
unsigned int m_id;
|
||||||
|
bool m_selfOnly;
|
||||||
bool m_uidOverride;
|
bool m_uidOverride;
|
||||||
CP25Network* m_network;
|
CP25Network* m_network;
|
||||||
CDisplay* m_display;
|
CDisplay* m_display;
|
||||||
|
|||||||
Reference in New Issue
Block a user