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