added YSFDirect
Added management of the YSFBMGateway gateway using the id 00006
This commit is contained in:
parent
2e303e55e6
commit
351e6c2d59
8 changed files with 71 additions and 2 deletions
|
@ -88,6 +88,8 @@ m_ysfNetworkYSF2NXDNAddress("127.0.0.1"),
|
|||
m_ysfNetworkYSF2NXDNPort(0U),
|
||||
m_ysfNetworkYSF2P25Address("127.0.0.1"),
|
||||
m_ysfNetworkYSF2P25Port(0U),
|
||||
m_ysfNetworkYSFDirectAddress("127.0.0.1"),
|
||||
m_ysfNetworkYSFDirectPort(0U),
|
||||
m_fcsNetworkEnabled(false),
|
||||
m_fcsNetworkFile(),
|
||||
m_fcsNetworkPort(0U),
|
||||
|
@ -274,6 +276,10 @@ bool CConf::read()
|
|||
m_ysfNetworkYSF2P25Address = value;
|
||||
else if (::strcmp(key, "YSF2P25Port") == 0)
|
||||
m_ysfNetworkYSF2P25Port = (unsigned short)::atoi(value);
|
||||
else if (::strcmp(key, "YSFDirectAddress") == 0)
|
||||
m_ysfNetworkYSFDirectAddress = value;
|
||||
else if (::strcmp(key, "YSFDirectPort") == 0)
|
||||
m_ysfNetworkYSFDirectPort = (unsigned short)::atoi(value);
|
||||
} else if (section == SECTION_FCS_NETWORK) {
|
||||
if (::strcmp(key, "Enable") == 0)
|
||||
m_fcsNetworkEnabled = ::atoi(value) == 1;
|
||||
|
@ -536,6 +542,16 @@ unsigned short CConf::getYSFNetworkYSF2P25Port() const
|
|||
return m_ysfNetworkYSF2P25Port;
|
||||
}
|
||||
|
||||
std::string CConf::getYSFNetworkYSFDirectAddress() const
|
||||
{
|
||||
return m_ysfNetworkYSFDirectAddress;
|
||||
}
|
||||
|
||||
unsigned short CConf::getYSFNetworkYSFDirectPort() const
|
||||
{
|
||||
return m_ysfNetworkYSFDirectPort;
|
||||
}
|
||||
|
||||
|
||||
bool CConf::getFCSNetworkEnabled() const
|
||||
{
|
||||
|
|
|
@ -87,6 +87,8 @@ public:
|
|||
unsigned short getYSFNetworkYSF2NXDNPort() const;
|
||||
std::string getYSFNetworkYSF2P25Address() const;
|
||||
unsigned short getYSFNetworkYSF2P25Port() const;
|
||||
std::string getYSFNetworkYSFDirectAddress() const;
|
||||
unsigned short getYSFNetworkYSFDirectPort() const;
|
||||
|
||||
// The FCS Network section
|
||||
bool getFCSNetworkEnabled() const;
|
||||
|
@ -156,6 +158,8 @@ private:
|
|||
unsigned short m_ysfNetworkYSF2NXDNPort;
|
||||
std::string m_ysfNetworkYSF2P25Address;
|
||||
unsigned short m_ysfNetworkYSF2P25Port;
|
||||
std::string m_ysfNetworkYSFDirectAddress;
|
||||
unsigned short m_ysfNetworkYSFDirectPort;
|
||||
|
||||
bool m_fcsNetworkEnabled;
|
||||
std::string m_fcsNetworkFile;
|
||||
|
|
|
@ -173,6 +173,11 @@ void CWiresX::setYSF2P25(const std::string& address, unsigned short port)
|
|||
m_reflectors.setYSF2P25(address, port);
|
||||
}
|
||||
|
||||
void CWiresX::setYSFDirect(const std::string& address, unsigned short port)
|
||||
{
|
||||
m_reflectors.setYSFDirect(address, port);
|
||||
}
|
||||
|
||||
void CWiresX::addFCSRoom(const std::string& id, const std::string& name)
|
||||
{
|
||||
m_reflectors.addFCSRoom(id, name);
|
||||
|
|
|
@ -55,6 +55,7 @@ public:
|
|||
void setYSF2DMR(const std::string& address, unsigned short port);
|
||||
void setYSF2NXDN(const std::string& address, unsigned short port);
|
||||
void setYSF2P25(const std::string& address, unsigned short port);
|
||||
void setYSFDirect(const std::string& address, unsigned short port);
|
||||
void addFCSRoom(const std::string& id, const std::string& name);
|
||||
|
||||
bool start();
|
||||
|
|
|
@ -539,6 +539,11 @@ void CYSFGateway::createWiresX(CYSFNetwork* rptNetwork)
|
|||
if (port > 0U)
|
||||
m_wiresX->setYSF2P25(address, port);
|
||||
|
||||
address = m_conf.getYSFNetworkYSFDirectAddress();
|
||||
port = m_conf.getYSFNetworkYSFDirectPort();
|
||||
if (port > 0U)
|
||||
m_wiresX->setYSFDirect(address, port);
|
||||
|
||||
std::string filename = m_conf.getFCSNetworkFile();
|
||||
if (m_fcsNetworkEnabled)
|
||||
readFCSRoomsFile(filename);
|
||||
|
@ -952,7 +957,7 @@ void CYSFGateway::processRemoteCommands()
|
|||
m_current.clear();
|
||||
m_inactivityTimer.stop();
|
||||
m_lostTimer.stop();
|
||||
m_linkType = LINK_NONE;
|
||||
m_linkType = LINK_FCS;
|
||||
|
||||
LogMessage("Connect by remote command to %s", id.c_str());
|
||||
|
||||
|
@ -961,7 +966,7 @@ void CYSFGateway::processRemoteCommands()
|
|||
m_current = id;
|
||||
m_inactivityTimer.start();
|
||||
m_lostTimer.start();
|
||||
m_linkType = LINK_FCS;
|
||||
m_linkType = LINK_NONE;
|
||||
} else {
|
||||
LogMessage("Unknown reflector - %s", id.c_str());
|
||||
}
|
||||
|
|
|
@ -60,6 +60,8 @@ YSF2NXDNAddress=127.0.0.1
|
|||
YSF2NXDNPort=42014
|
||||
YSF2P25Address=127.0.0.1
|
||||
YSF2P25Port=42015
|
||||
YSFDirectAddress=127.0.0.1
|
||||
YSFDirectPort=42016
|
||||
|
||||
[FCS Network]
|
||||
Enable=1
|
||||
|
|
|
@ -36,6 +36,8 @@ m_YSF2NXDNAddress(),
|
|||
m_YSF2NXDNPort(0U),
|
||||
m_YSF2P25Address(),
|
||||
m_YSF2P25Port(0U),
|
||||
m_YSFDirectAddress(),
|
||||
m_YSFDirectPort(0U),
|
||||
m_fcsRooms(),
|
||||
m_newReflectors(),
|
||||
m_currReflectors(),
|
||||
|
@ -100,6 +102,12 @@ void CYSFReflectors::setYSF2P25(const std::string& address, unsigned short port)
|
|||
m_YSF2P25Port = port;
|
||||
}
|
||||
|
||||
void CYSFReflectors::setYSFDirect(const std::string& address, unsigned short port)
|
||||
{
|
||||
m_YSFDirectAddress = address;
|
||||
m_YSFDirectPort = port;
|
||||
}
|
||||
|
||||
void CYSFReflectors::addFCSRoom(const std::string& id, const std::string& name)
|
||||
{
|
||||
m_fcsRooms.push_back(std::make_pair(id, name));
|
||||
|
@ -252,6 +260,31 @@ bool CYSFReflectors::load()
|
|||
}
|
||||
}
|
||||
|
||||
// Add the YSFDirect entry
|
||||
if (m_YSFDirectPort > 0U) {
|
||||
sockaddr_storage addr;
|
||||
unsigned int addrLen;
|
||||
if (CUDPSocket::lookup(m_YSFDirectAddress, m_YSFDirectPort, addr, addrLen) == 0) {
|
||||
CYSFReflector* refl = new CYSFReflector;
|
||||
refl->m_id = "00006";
|
||||
refl->m_name = "YSFDirect ";
|
||||
refl->m_desc = "Link YSFDirect";
|
||||
refl->m_addr = addr;
|
||||
refl->m_addrLen = addrLen;
|
||||
refl->m_count = "000";
|
||||
refl->m_type = YT_YSF;
|
||||
refl->m_wiresX = true;
|
||||
|
||||
m_newReflectors.push_back(refl);
|
||||
|
||||
LogInfo("Loaded YSFDirect");
|
||||
} else {
|
||||
LogWarning("Unable to resolve the address of YSFDirect");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned int id = 9U;
|
||||
for (std::vector<std::pair<std::string, std::string>>::const_iterator it1 = m_fcsRooms.cbegin(); it1 != m_fcsRooms.cend(); ++it1) {
|
||||
bool used;
|
||||
|
|
|
@ -63,6 +63,7 @@ public:
|
|||
void setYSF2DMR(const std::string& address, unsigned short port);
|
||||
void setYSF2NXDN(const std::string& address, unsigned short port);
|
||||
void setYSF2P25(const std::string& address, unsigned short port);
|
||||
void setYSFDirect(const std::string& address, unsigned short port);
|
||||
void addFCSRoom(const std::string& id, const std::string& name);
|
||||
|
||||
bool load();
|
||||
|
@ -88,6 +89,8 @@ private:
|
|||
unsigned short m_YSF2NXDNPort;
|
||||
std::string m_YSF2P25Address;
|
||||
unsigned short m_YSF2P25Port;
|
||||
std::string m_YSFDirectAddress;
|
||||
unsigned short m_YSFDirectPort;
|
||||
std::vector<std::pair<std::string, std::string>> m_fcsRooms;
|
||||
std::vector<CYSFReflector*> m_newReflectors;
|
||||
std::vector<CYSFReflector*> m_currReflectors;
|
||||
|
|
Loading…
Reference in a new issue