1
0
Fork 0

Re-do the FCS reflectors a little to include a description.

ycs232-kbc
Jonathan Naylor 7 years ago
parent 0d777da182
commit c1789ffd0f

@ -216,16 +216,17 @@ bool CConf::read()
} else if (section == SECTION_FCS_NETWORK) {
if (::strcmp(key, "Enable") == 0)
m_fcsNetworkEnabled = ::atoi(value) == 1;
else if (::strcmp(key, "Entries") == 0) {
char* p = ::strtok(value, ",\r\n");
while (p != NULL) {
if (::strlen(p) > 0U) {
for (unsigned int i = 0U; p[i] != 0; i++)
p[i] = ::toupper(p[i]);
std::string name = std::string(p);
m_fcsNetworkEntries.push_back(name);
else if (::strcmp(key, "Entry") == 0) {
char* p1 = ::strtok(value, ",");
char* p2 = ::strtok(NULL, "\r\n");
if (p1 != NULL && p2 != NULL) {
if (::strlen(p1) > 0U && ::strlen(p2) > 0U) {
for (unsigned int i = 0U; p1[i] != 0; i++)
p1[i] = ::toupper(p1[i]);
std::string name = std::string(p1);
std::string desc = std::string(p2);
m_fcsNetworkEntries.push_back(std::make_pair(name, desc));
}
p = ::strtok(NULL, ",\r\n");
}
} else if (::strcmp(key, "Port") == 0)
m_fcsNetworkPort = (unsigned int)::atoi(value);
@ -427,7 +428,7 @@ bool CConf::getFCSNetworkEnabled() const
return m_fcsNetworkEnabled;
}
std::vector<std::string> CConf::getFCSNetworkEntries() const
std::vector<std::pair<std::string, std::string>> CConf::getFCSNetworkEntries() const
{
return m_fcsNetworkEntries;
}

@ -81,7 +81,7 @@ public:
// The FCS Network section
bool getFCSNetworkEnabled() const;
std::vector<std::string> getFCSNetworkEntries() const;
std::vector<std::pair<std::string, std::string>> getFCSNetworkEntries() const;
unsigned int getFCSNetworkPort() const;
private:
@ -130,7 +130,7 @@ private:
unsigned int m_ysfNetworkYSF2DMRPort;
bool m_fcsNetworkEnabled;
std::vector<std::string> m_fcsNetworkEntries;
std::vector<std::pair<std::string, std::string>> m_fcsNetworkEntries;
unsigned int m_fcsNetworkPort;
};

@ -157,9 +157,9 @@ void CWiresX::setYSF2DMR(const std::string& address, unsigned int port)
m_reflectors.setYSF2DMR(address, port);
}
void CWiresX::addFCSRoom(const std::string& name)
void CWiresX::addFCSRoom(const std::pair<std::string, std::string>& entry)
{
m_reflectors.addFCSRoom(name);
m_reflectors.addFCSRoom(entry);
}
bool CWiresX::start()

@ -49,7 +49,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);
void addFCSRoom(const std::string& name);
void addFCSRoom(const std::pair<std::string, std::string>& entry);
bool start();

@ -465,8 +465,8 @@ void CYSFGateway::createWiresX(CYSFNetwork* rptNetwork)
if (port > 0U)
m_wiresX->setYSF2DMR(address, port);
std::vector<std::string> entries = m_conf.getFCSNetworkEntries();
for (std::vector<std::string>::const_iterator it = entries.cbegin(); it != entries.cend(); ++it)
std::vector<std::pair<std::string, std::string>> entries = m_conf.getFCSNetworkEntries();
for (std::vector<std::pair<std::string, std::string>>::const_iterator it = entries.cbegin(); it != entries.cend(); ++it)
m_wiresX->addFCSRoom(*it);
m_reflectors->load();

@ -53,5 +53,6 @@ YSF2DMRPort=42013
[FCS Network]
Enable=1
# Entries=FCS00120,FCS00215
# Entry=FCS00199,FCS001 Echo
# Entry=FCS00299,FCS002 Echo
Port=42001

@ -83,9 +83,9 @@ void CYSFReflectors::setYSF2DMR(const std::string& address, unsigned int port)
m_YSF2DMRPort = port;
}
void CYSFReflectors::addFCSRoom(const std::string& name)
void CYSFReflectors::addFCSRoom(const std::pair<std::string, std::string>& entry)
{
m_fcsRooms.push_back(name);
m_fcsRooms.push_back(entry);
}
bool CYSFReflectors::load()
@ -170,16 +170,17 @@ bool CYSFReflectors::load()
}
unsigned int id = 10U;
for (std::vector<std::string>::const_iterator it = m_fcsRooms.cbegin(); it != m_fcsRooms.cend(); ++it, id++) {
for (std::vector<std::pair<std::string, std::string>>::const_iterator it = m_fcsRooms.cbegin(); it != m_fcsRooms.cend(); ++it, id++) {
char text[10U];
::sprintf(text, "%05u", id);
std::string name = *it;
std::string name = it->first;
std::string desc = it->second;
CYSFReflector* refl = new CYSFReflector;
refl->m_id = text;
refl->m_name = name;
refl->m_desc = name;
refl->m_desc = desc;
refl->m_port = 0U;
refl->m_count = "000";
refl->m_type = YT_FCS;

@ -59,7 +59,7 @@ public:
void setParrot(const std::string& address, unsigned int port);
void setYSF2DMR(const std::string& address, unsigned int port);
void addFCSRoom(const std::string& name);
void addFCSRoom(const std::pair<std::string, std::string>& entry);
bool load();
@ -80,7 +80,7 @@ private:
unsigned int m_parrotPort;
std::string m_YSF2DMRAddress;
unsigned int m_YSF2DMRPort;
std::vector<std::string> m_fcsRooms;
std::vector<std::pair<std::string, std::string>> m_fcsRooms;
std::vector<CYSFReflector*> m_newReflectors;
std::vector<CYSFReflector*> m_currReflectors;
std::vector<CYSFReflector*> m_search;

Loading…
Cancel
Save