mirror of
https://github.com/ShaYmez/NXDNClients.git
synced 2024-11-22 23:38:37 -05:00
Add NXDN2DMR pseudo reflector (TG20)
This commit is contained in:
parent
15d58a18dc
commit
0ff1dafe75
@ -56,6 +56,8 @@ m_networkHosts2(),
|
||||
m_networkReloadTime(0U),
|
||||
m_networkParrotAddress("127.0.0.1"),
|
||||
m_networkParrotPort(0U),
|
||||
m_networkNXDN2DMRAddress("127.0.0.1"),
|
||||
m_networkNXDN2DMRPort(0U),
|
||||
m_networkStartup(9999U),
|
||||
m_networkInactivityTimeout(0U),
|
||||
m_networkDebug(false)
|
||||
@ -149,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, "NXDN2DMRAddress") == 0)
|
||||
m_networkNXDN2DMRAddress = value;
|
||||
else if (::strcmp(key, "NXDN2DMRPort") == 0)
|
||||
m_networkNXDN2DMRPort = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "Startup") == 0)
|
||||
m_networkStartup = (unsigned short)::atoi(value);
|
||||
else if (::strcmp(key, "InactivityTimeout") == 0)
|
||||
@ -258,6 +264,16 @@ unsigned int CConf::getNetworkParrotPort() const
|
||||
return m_networkParrotPort;
|
||||
}
|
||||
|
||||
std::string CConf::getNetworkNXDN2DMRAddress() const
|
||||
{
|
||||
return m_networkNXDN2DMRAddress;
|
||||
}
|
||||
|
||||
unsigned int CConf::getNetworkNXDN2DMRPort() const
|
||||
{
|
||||
return m_networkNXDN2DMRPort;
|
||||
}
|
||||
|
||||
unsigned short CConf::getNetworkStartup() const
|
||||
{
|
||||
return m_networkStartup;
|
||||
|
@ -58,6 +58,8 @@ public:
|
||||
unsigned int getNetworkReloadTime() const;
|
||||
std::string getNetworkParrotAddress() const;
|
||||
unsigned int getNetworkParrotPort() const;
|
||||
std::string getNetworkNXDN2DMRAddress() const;
|
||||
unsigned int getNetworkNXDN2DMRPort() const;
|
||||
unsigned short getNetworkStartup() const;
|
||||
unsigned int getNetworkInactivityTimeout() const;
|
||||
bool getNetworkDebug() const;
|
||||
@ -87,6 +89,8 @@ private:
|
||||
unsigned int m_networkReloadTime;
|
||||
std::string m_networkParrotAddress;
|
||||
unsigned int m_networkParrotPort;
|
||||
std::string m_networkNXDN2DMRAddress;
|
||||
unsigned int m_networkNXDN2DMRPort;
|
||||
unsigned short m_networkStartup;
|
||||
unsigned int m_networkInactivityTimeout;
|
||||
bool m_networkDebug;
|
||||
|
@ -184,6 +184,8 @@ void CNXDNGateway::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.getNetworkNXDN2DMRPort() > 0U)
|
||||
reflectors.setNXDN2DMR(m_conf.getNetworkNXDN2DMRAddress(), m_conf.getNetworkNXDN2DMRPort());
|
||||
reflectors.load();
|
||||
|
||||
CNXDNLookup* lookup = new CNXDNLookup(m_conf.getLookupName(), m_conf.getLookupTime());
|
||||
|
@ -26,6 +26,8 @@ HostsFile2=./private/NXDNHosts.txt
|
||||
ReloadTime=60
|
||||
ParrotAddress=127.0.0.1
|
||||
ParrotPort=42021
|
||||
NXDN2DMRAddress=127.0.0.1
|
||||
NXDN2DMRPort=42022
|
||||
Startup=10200
|
||||
InactivityTimeout=10
|
||||
Debug=0
|
||||
|
@ -52,6 +52,12 @@ void CReflectors::setParrot(const std::string& address, unsigned int port)
|
||||
m_parrotPort = port;
|
||||
}
|
||||
|
||||
void CReflectors::setNXDN2DMR(const std::string& address, unsigned int port)
|
||||
{
|
||||
m_nxdn2dmrAddress = address;
|
||||
m_nxdn2dmrPort = port;
|
||||
}
|
||||
|
||||
bool CReflectors::load()
|
||||
{
|
||||
// Clear out the old reflector list
|
||||
@ -131,6 +137,16 @@ bool CReflectors::load()
|
||||
LogInfo("Loaded NXDN parrot (TG%u)", refl->m_id);
|
||||
}
|
||||
|
||||
// Add the NXDN2DMR entry
|
||||
if (m_nxdn2dmrPort > 0U) {
|
||||
CNXDNReflector* refl = new CNXDNReflector;
|
||||
refl->m_id = 20U;
|
||||
refl->m_address = CUDPSocket::lookup(m_nxdn2dmrAddress);
|
||||
refl->m_port = m_nxdn2dmrPort;
|
||||
m_reflectors.push_back(refl);
|
||||
LogInfo("Loaded NXDN2DMR reflector (TG%u)", refl->m_id);
|
||||
}
|
||||
|
||||
size = m_reflectors.size();
|
||||
if (size == 0U)
|
||||
return false;
|
||||
|
@ -45,6 +45,7 @@ public:
|
||||
~CReflectors();
|
||||
|
||||
void setParrot(const std::string& address, unsigned int port);
|
||||
void setNXDN2DMR(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_nxdn2dmrAddress;
|
||||
unsigned int m_nxdn2dmrPort;
|
||||
std::vector<CNXDNReflector*> m_reflectors;
|
||||
CTimer m_timer;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user