mirror of
https://github.com/ShaYmez/P25Clients.git
synced 2025-02-03 09:44:12 -05:00
Merge pull request #116 from nostar/master
Changes to make P25Gateway work with new P252DMR cross-mode utility
This commit is contained in:
commit
1621343c0a
@ -151,6 +151,10 @@ bool CConf::read()
|
||||
m_networkParrotAddress = value;
|
||||
else if (::strcmp(key, "ParrotPort") == 0)
|
||||
m_networkParrotPort = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "P252DMRAddress") == 0)
|
||||
m_networkP252DMRAddress = value;
|
||||
else if (::strcmp(key, "P252DMRPort") == 0)
|
||||
m_networkP252DMRPort = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "Startup") == 0)
|
||||
m_networkStartup = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "InactivityTimeout") == 0)
|
||||
@ -260,6 +264,16 @@ unsigned int CConf::getNetworkParrotPort() const
|
||||
return m_networkParrotPort;
|
||||
}
|
||||
|
||||
std::string CConf::getNetworkP252DMRAddress() const
|
||||
{
|
||||
return m_networkP252DMRAddress;
|
||||
}
|
||||
|
||||
unsigned int CConf::getNetworkP252DMRPort() const
|
||||
{
|
||||
return m_networkP252DMRPort;
|
||||
}
|
||||
|
||||
unsigned int CConf::getNetworkStartup() const
|
||||
{
|
||||
return m_networkStartup;
|
||||
|
@ -57,6 +57,8 @@ public:
|
||||
unsigned int getNetworkReloadTime() const;
|
||||
std::string getNetworkParrotAddress() const;
|
||||
unsigned int getNetworkParrotPort() const;
|
||||
std::string getNetworkP252DMRAddress() const;
|
||||
unsigned int getNetworkP252DMRPort() const;
|
||||
unsigned int getNetworkStartup() const;
|
||||
unsigned int getNetworkInactivityTimeout() const;
|
||||
bool getNetworkDebug() const;
|
||||
@ -89,6 +91,8 @@ private:
|
||||
unsigned int m_networkReloadTime;
|
||||
std::string m_networkParrotAddress;
|
||||
unsigned int m_networkParrotPort;
|
||||
std::string m_networkP252DMRAddress;
|
||||
unsigned int m_networkP252DMRPort;
|
||||
unsigned int m_networkStartup;
|
||||
unsigned int m_networkInactivityTimeout;
|
||||
bool m_networkDebug;
|
||||
|
@ -198,6 +198,8 @@ void CP25Gateway::run()
|
||||
CReflectors reflectors(m_conf.getNetworkHosts1(), m_conf.getNetworkHosts2(), m_conf.getNetworkReloadTime());
|
||||
if (m_conf.getNetworkParrotPort() > 0U)
|
||||
reflectors.setParrot(m_conf.getNetworkParrotAddress(), m_conf.getNetworkParrotPort());
|
||||
if (m_conf.getNetworkP252DMRPort() > 0U)
|
||||
reflectors.setP252DMR(m_conf.getNetworkP252DMRAddress(), m_conf.getNetworkP252DMRPort());
|
||||
reflectors.load();
|
||||
|
||||
CDMRLookup* lookup = new CDMRLookup(m_conf.getLookupName(), m_conf.getLookupTime());
|
||||
@ -230,6 +232,8 @@ void CP25Gateway::run()
|
||||
unsigned int currentPort = 0U;
|
||||
|
||||
unsigned int startupId = m_conf.getNetworkStartup();
|
||||
bool p252dmr_enabled = (startupId == 20) ? true : false;
|
||||
|
||||
if (startupId != 9999U) {
|
||||
CP25Reflector* reflector = reflectors.find(startupId);
|
||||
if (reflector != NULL) {
|
||||
@ -289,8 +293,11 @@ void CP25Gateway::run()
|
||||
srcId = (buffer[1U] << 16) & 0xFF0000U;
|
||||
srcId |= (buffer[2U] << 8) & 0x00FF00U;
|
||||
srcId |= (buffer[3U] << 0) & 0x0000FFU;
|
||||
|
||||
if (dstId != currentId) {
|
||||
|
||||
if(p252dmr_enabled){
|
||||
currentId = dstId;
|
||||
}
|
||||
else if (dstId != currentId) {
|
||||
CP25Reflector* reflector = NULL;
|
||||
if (dstId != 9999U)
|
||||
reflector = reflectors.find(dstId);
|
||||
|
@ -25,6 +25,8 @@ HostsFile2=./private/P25Hosts.txt
|
||||
ReloadTime=60
|
||||
ParrotAddress=127.0.0.1
|
||||
ParrotPort=42011
|
||||
P252DMRAddress=127.0.0.1
|
||||
P252DMRPort=42012
|
||||
# Startup=10100
|
||||
InactivityTimeout=10
|
||||
Debug=0
|
||||
|
@ -52,6 +52,12 @@ void CReflectors::setParrot(const std::string& address, unsigned int port)
|
||||
m_parrotPort = port;
|
||||
}
|
||||
|
||||
void CReflectors::setP252DMR(const std::string& address, unsigned int port)
|
||||
{
|
||||
m_p252dmrAddress = address;
|
||||
m_p252dmrPort = port;
|
||||
}
|
||||
|
||||
bool CReflectors::load()
|
||||
{
|
||||
// Clear out the old reflector list
|
||||
@ -134,6 +140,16 @@ bool CReflectors::load()
|
||||
m_reflectors.push_back(refl);
|
||||
LogInfo("Loaded P25 parrot (TG%u)", refl->m_id);
|
||||
}
|
||||
|
||||
// Add the P252DMR entry
|
||||
if (m_p252dmrPort > 0U) {
|
||||
CP25Reflector* refl = new CP25Reflector;
|
||||
refl->m_id = 20U;
|
||||
refl->m_address = CUDPSocket::lookup(m_p252dmrAddress);
|
||||
refl->m_port = m_p252dmrPort;
|
||||
m_reflectors.push_back(refl);
|
||||
LogInfo("Loaded P252DMR (TG%u)", refl->m_id);
|
||||
}
|
||||
|
||||
size = m_reflectors.size();
|
||||
if (size == 0U)
|
||||
|
@ -45,6 +45,7 @@ public:
|
||||
~CReflectors();
|
||||
|
||||
void setParrot(const std::string& address, unsigned int port);
|
||||
void setP252DMR(const std::string& address, unsigned int port);
|
||||
|
||||
bool load();
|
||||
|
||||
@ -57,6 +58,8 @@ private:
|
||||
std::string m_hostsFile2;
|
||||
std::string m_parrotAddress;
|
||||
unsigned int m_parrotPort;
|
||||
std::string m_p252dmrAddress;
|
||||
unsigned int m_p252dmrPort;
|
||||
std::vector<CP25Reflector*> m_reflectors;
|
||||
CTimer m_timer;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user