Add P252DMR Reflector option to P25Gateway

This commit is contained in:
Doug McLain 2020-06-18 00:56:34 -04:00
parent b4c15971ac
commit 36f090b29f
6 changed files with 41 additions and 0 deletions

View File

@ -151,6 +151,10 @@ bool CConf::read()
m_networkParrotAddress = value; m_networkParrotAddress = value;
else if (::strcmp(key, "ParrotPort") == 0) else if (::strcmp(key, "ParrotPort") == 0)
m_networkParrotPort = (unsigned int)::atoi(value); 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) else if (::strcmp(key, "Startup") == 0)
m_networkStartup = (unsigned int)::atoi(value); m_networkStartup = (unsigned int)::atoi(value);
else if (::strcmp(key, "InactivityTimeout") == 0) else if (::strcmp(key, "InactivityTimeout") == 0)
@ -260,6 +264,16 @@ unsigned int CConf::getNetworkParrotPort() const
return m_networkParrotPort; return m_networkParrotPort;
} }
std::string CConf::getNetworkP252DMRAddress() const
{
return m_networkP252DMRAddress;
}
unsigned int CConf::getNetworkP252DMRPort() const
{
return m_networkP252DMRPort;
}
unsigned int CConf::getNetworkStartup() const unsigned int CConf::getNetworkStartup() const
{ {
return m_networkStartup; return m_networkStartup;

View File

@ -57,6 +57,8 @@ public:
unsigned int getNetworkReloadTime() const; unsigned int getNetworkReloadTime() const;
std::string getNetworkParrotAddress() const; std::string getNetworkParrotAddress() const;
unsigned int getNetworkParrotPort() const; unsigned int getNetworkParrotPort() const;
std::string getNetworkP252DMRAddress() const;
unsigned int getNetworkP252DMRPort() const;
unsigned int getNetworkStartup() const; unsigned int getNetworkStartup() const;
unsigned int getNetworkInactivityTimeout() const; unsigned int getNetworkInactivityTimeout() const;
bool getNetworkDebug() const; bool getNetworkDebug() const;
@ -89,6 +91,8 @@ private:
unsigned int m_networkReloadTime; unsigned int m_networkReloadTime;
std::string m_networkParrotAddress; std::string m_networkParrotAddress;
unsigned int m_networkParrotPort; unsigned int m_networkParrotPort;
std::string m_networkP252DMRAddress;
unsigned int m_networkP252DMRPort;
unsigned int m_networkStartup; unsigned int m_networkStartup;
unsigned int m_networkInactivityTimeout; unsigned int m_networkInactivityTimeout;
bool m_networkDebug; bool m_networkDebug;

View File

@ -198,6 +198,8 @@ void CP25Gateway::run()
CReflectors reflectors(m_conf.getNetworkHosts1(), m_conf.getNetworkHosts2(), m_conf.getNetworkReloadTime()); CReflectors reflectors(m_conf.getNetworkHosts1(), m_conf.getNetworkHosts2(), m_conf.getNetworkReloadTime());
if (m_conf.getNetworkParrotPort() > 0U) if (m_conf.getNetworkParrotPort() > 0U)
reflectors.setParrot(m_conf.getNetworkParrotAddress(), m_conf.getNetworkParrotPort()); reflectors.setParrot(m_conf.getNetworkParrotAddress(), m_conf.getNetworkParrotPort());
if (m_conf.getNetworkP252DMRPort() > 0U)
reflectors.setP252DMR(m_conf.getNetworkP252DMRAddress(), m_conf.getNetworkP252DMRPort());
reflectors.load(); reflectors.load();
CDMRLookup* lookup = new CDMRLookup(m_conf.getLookupName(), m_conf.getLookupTime()); CDMRLookup* lookup = new CDMRLookup(m_conf.getLookupName(), m_conf.getLookupTime());

View File

@ -25,6 +25,8 @@ HostsFile2=./private/P25Hosts.txt
ReloadTime=60 ReloadTime=60
ParrotAddress=127.0.0.1 ParrotAddress=127.0.0.1
ParrotPort=42011 ParrotPort=42011
P252DMRAddress=127.0.0.1
P252DMRPort=42012
# Startup=10100 # Startup=10100
InactivityTimeout=10 InactivityTimeout=10
Debug=0 Debug=0

View File

@ -52,6 +52,12 @@ void CReflectors::setParrot(const std::string& address, unsigned int port)
m_parrotPort = port; m_parrotPort = port;
} }
void CReflectors::setP252DMR(const std::string& address, unsigned int port)
{
m_p252dmrAddress = address;
m_p252dmrPort = port;
}
bool CReflectors::load() bool CReflectors::load()
{ {
// Clear out the old reflector list // Clear out the old reflector list
@ -134,6 +140,16 @@ bool CReflectors::load()
m_reflectors.push_back(refl); m_reflectors.push_back(refl);
LogInfo("Loaded P25 parrot (TG%u)", refl->m_id); LogInfo("Loaded P25 parrot (TG%u)", refl->m_id);
} }
// Add the P252DMR entry
if (m_p252dmrPort > 0U) {
CP25Reflector* refl = new CP25Reflector;
refl->m_id = 10U;
refl->m_address = CUDPSocket::lookup(m_p252dmrAddress);
refl->m_port = m_p252dmrPort;
m_reflectors.push_back(refl);
LogInfo("Loaded P25 parrot (TG%u)", refl->m_id);
}
size = m_reflectors.size(); size = m_reflectors.size();
if (size == 0U) if (size == 0U)

View File

@ -45,6 +45,7 @@ public:
~CReflectors(); ~CReflectors();
void setParrot(const std::string& address, unsigned int port); void setParrot(const std::string& address, unsigned int port);
void setP252DMR(const std::string& address, unsigned int port);
bool load(); bool load();
@ -57,6 +58,8 @@ private:
std::string m_hostsFile2; std::string m_hostsFile2;
std::string m_parrotAddress; std::string m_parrotAddress;
unsigned int m_parrotPort; unsigned int m_parrotPort;
std::string m_p252dmrAddress;
unsigned int m_p252dmrPort;
std::vector<CP25Reflector*> m_reflectors; std::vector<CP25Reflector*> m_reflectors;
CTimer m_timer; CTimer m_timer;
}; };