Adding pseudo YSF2DMR reflector
This commit is contained in:
parent
a56716d0c5
commit
fe410b937a
8 changed files with 57 additions and 1 deletions
|
@ -67,6 +67,8 @@ m_networkHosts(),
|
|||
m_networkReloadTime(0U),
|
||||
m_networkParrotAddress("127.0.0.1"),
|
||||
m_networkParrotPort(0U),
|
||||
m_networkYSF2DMRAddress("127.0.0.1"),
|
||||
m_networkYSF2DMRPort(0U),
|
||||
m_networkStartup(),
|
||||
m_networkInactivityTimeout(0U),
|
||||
m_networkRevert(false),
|
||||
|
@ -186,6 +188,10 @@ bool CConf::read()
|
|||
m_networkParrotAddress = value;
|
||||
else if (::strcmp(key, "ParrotPort") == 0)
|
||||
m_networkParrotPort = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "YSF2DMRAddress") == 0)
|
||||
m_networkYSF2DMRAddress = value;
|
||||
else if (::strcmp(key, "YSF2DMRPort") == 0)
|
||||
m_networkYSF2DMRPort = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "Startup") == 0)
|
||||
m_networkStartup = value;
|
||||
else if (::strcmp(key, "InactivityTimeout") == 0)
|
||||
|
@ -352,6 +358,16 @@ unsigned int CConf::getNetworkParrotPort() const
|
|||
return m_networkParrotPort;
|
||||
}
|
||||
|
||||
std::string CConf::getNetworkYSF2DMRAddress() const
|
||||
{
|
||||
return m_networkYSF2DMRAddress;
|
||||
}
|
||||
|
||||
unsigned int CConf::getNetworkYSF2DMRPort() const
|
||||
{
|
||||
return m_networkYSF2DMRPort;
|
||||
}
|
||||
|
||||
std::string CConf::getNetworkStartup() const
|
||||
{
|
||||
return m_networkStartup;
|
||||
|
|
|
@ -69,6 +69,8 @@ public:
|
|||
unsigned int getNetworkReloadTime() const;
|
||||
std::string getNetworkParrotAddress() const;
|
||||
unsigned int getNetworkParrotPort() const;
|
||||
std::string getNetworkYSF2DMRAddress() const;
|
||||
unsigned int getNetworkYSF2DMRPort() const;
|
||||
std::string getNetworkStartup() const;
|
||||
unsigned int getNetworkInactivityTimeout() const;
|
||||
bool getNetworkRevert() const;
|
||||
|
@ -110,6 +112,8 @@ private:
|
|||
unsigned int m_networkReloadTime;
|
||||
std::string m_networkParrotAddress;
|
||||
unsigned int m_networkParrotPort;
|
||||
std::string m_networkYSF2DMRAddress;
|
||||
unsigned int m_networkYSF2DMRPort;
|
||||
std::string m_networkStartup;
|
||||
unsigned int m_networkInactivityTimeout;
|
||||
bool m_networkRevert;
|
||||
|
|
|
@ -74,6 +74,12 @@ void CReflectors::setParrot(const std::string& address, unsigned int port)
|
|||
m_parrotPort = port;
|
||||
}
|
||||
|
||||
void CReflectors::setYSF2DMR(const std::string& address, unsigned int port)
|
||||
{
|
||||
m_YSF2DMRAddress = address;
|
||||
m_YSF2DMRPort = port;
|
||||
}
|
||||
|
||||
bool CReflectors::load()
|
||||
{
|
||||
for (std::vector<CYSFReflector*>::iterator it = m_newReflectors.begin(); it != m_newReflectors.end(); ++it)
|
||||
|
@ -135,6 +141,19 @@ bool CReflectors::load()
|
|||
LogInfo("Loaded YSF parrot");
|
||||
}
|
||||
|
||||
// Add the YSF2DMR entry
|
||||
if (m_YSF2DMRPort > 0U) {
|
||||
CYSFReflector* refl = new CYSFReflector;
|
||||
refl->m_id = "00002";
|
||||
refl->m_name = "YSF2DMR ";
|
||||
refl->m_desc = "Link YSF2DMR ";
|
||||
refl->m_address = CUDPSocket::lookup(m_YSF2DMRAddress);
|
||||
refl->m_port = m_YSF2DMRPort;
|
||||
refl->m_count = "000";
|
||||
m_newReflectors.push_back(refl);
|
||||
LogInfo("Loaded YSF2DMR");
|
||||
}
|
||||
|
||||
size = m_newReflectors.size();
|
||||
if (size == 0U)
|
||||
return false;
|
||||
|
|
|
@ -50,7 +50,8 @@ public:
|
|||
CReflectors(const std::string& hostsFile, unsigned int reloadTime);
|
||||
~CReflectors();
|
||||
|
||||
void setParrot(const std::string& address, unsigned int port);
|
||||
void setParrot(const std::string& address, unsigned int port);
|
||||
void setYSF2DMR(const std::string& address, unsigned int port);
|
||||
|
||||
bool load();
|
||||
|
||||
|
@ -68,6 +69,8 @@ private:
|
|||
std::string m_hostsFile;
|
||||
std::string m_parrotAddress;
|
||||
unsigned int m_parrotPort;
|
||||
std::string m_YSF2DMRAddress;
|
||||
unsigned int m_YSF2DMRPort;
|
||||
std::vector<CYSFReflector*> m_newReflectors;
|
||||
std::vector<CYSFReflector*> m_currReflectors;
|
||||
std::vector<CYSFReflector*> m_search;
|
||||
|
|
|
@ -152,6 +152,11 @@ void CWiresX::setParrot(const std::string& address, unsigned int port)
|
|||
m_reflectors.setParrot(address, port);
|
||||
}
|
||||
|
||||
void CWiresX::setYSF2DMR(const std::string& address, unsigned int port)
|
||||
{
|
||||
m_reflectors.setYSF2DMR(address, port);
|
||||
}
|
||||
|
||||
bool CWiresX::start()
|
||||
{
|
||||
bool ret = m_reflectors.load();
|
||||
|
|
|
@ -47,6 +47,7 @@ public:
|
|||
|
||||
void setInfo(const std::string& name, unsigned int txFrequency, unsigned int rxFrequency);
|
||||
void setParrot(const std::string& address, unsigned int port);
|
||||
void setYSF2DMR(const std::string& address, unsigned int port);
|
||||
|
||||
bool start();
|
||||
|
||||
|
|
|
@ -221,6 +221,12 @@ int CYSFGateway::run()
|
|||
if (port > 0U)
|
||||
m_wiresX->setParrot(address, port);
|
||||
|
||||
address = m_conf.getNetworkYSF2DMRAddress();
|
||||
port = m_conf.getNetworkYSF2DMRPort();
|
||||
|
||||
if (port > 0U)
|
||||
m_wiresX->setYSF2DMR(address, port);
|
||||
|
||||
m_wiresX->start();
|
||||
|
||||
if (!startup.empty()) {
|
||||
|
|
|
@ -40,6 +40,8 @@ Hosts=./YSFHosts.txt
|
|||
ReloadTime=60
|
||||
ParrotAddress=127.0.0.1
|
||||
ParrotPort=42012
|
||||
YSF2DMRAddress=127.0.0.1
|
||||
YSF2DMRPort=42013
|
||||
# Startup=
|
||||
InactivityTimeout=10
|
||||
# Revert=0
|
||||
|
|
Loading…
Reference in a new issue