1
0
Fork 0

Allow forcing of Wires-X test to upper case.

ycs232-kbc
Jonathan Naylor 6 years ago
parent 46dcb79ee2
commit 013de54c5a

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX * Copyright (C) 2015-2019 by Jonathan Naylor G4KLX
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -47,6 +47,7 @@ m_rptAddress(),
m_rptPort(0U), m_rptPort(0U),
m_myAddress(), m_myAddress(),
m_myPort(0U), m_myPort(0U),
m_wiresXMakeUpper(true),
m_daemon(false), m_daemon(false),
m_rxFrequency(0U), m_rxFrequency(0U),
m_txFrequency(0U), m_txFrequency(0U),
@ -159,6 +160,8 @@ bool CConf::read()
m_myAddress = value; m_myAddress = value;
else if (::strcmp(key, "LocalPort") == 0) else if (::strcmp(key, "LocalPort") == 0)
m_myPort = (unsigned int)::atoi(value); m_myPort = (unsigned int)::atoi(value);
else if (::strcmp(key, "WiresXMakeUpper") == 0)
m_wiresXMakeUpper = ::atoi(value) == 1;
else if (::strcmp(key, "Daemon") == 0) else if (::strcmp(key, "Daemon") == 0)
m_daemon = ::atoi(value) == 1; m_daemon = ::atoi(value) == 1;
} else if (section == SECTION_INFO) { } else if (section == SECTION_INFO) {
@ -291,6 +294,11 @@ unsigned int CConf::getMyPort() const
return m_myPort; return m_myPort;
} }
bool CConf::getWiresXMakeUpper() const
{
return m_wiresXMakeUpper;
}
bool CConf::getDaemon() const bool CConf::getDaemon() const
{ {
return m_daemon; return m_daemon;

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX * Copyright (C) 2015-2019 by Jonathan Naylor G4KLX
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -37,6 +37,7 @@ public:
unsigned int getRptPort() const; unsigned int getRptPort() const;
std::string getMyAddress() const; std::string getMyAddress() const;
unsigned int getMyPort() const; unsigned int getMyPort() const;
bool getWiresXMakeUpper() const;
bool getDaemon() const; bool getDaemon() const;
// The Info section // The Info section
@ -102,6 +103,7 @@ private:
unsigned int m_rptPort; unsigned int m_rptPort;
std::string m_myAddress; std::string m_myAddress;
unsigned int m_myPort; unsigned int m_myPort;
bool m_wiresXMakeUpper;
bool m_daemon; bool m_daemon;
unsigned int m_rxFrequency; unsigned int m_rxFrequency;

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2016,2017,2018 by Jonathan Naylor G4KLX * Copyright (C) 2016-2019 by Jonathan Naylor G4KLX
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -233,8 +233,9 @@ int CYSFGateway::run()
std::string fileName = m_conf.getYSFNetworkHosts(); std::string fileName = m_conf.getYSFNetworkHosts();
unsigned int reloadTime = m_conf.getYSFNetworkReloadTime(); unsigned int reloadTime = m_conf.getYSFNetworkReloadTime();
bool wiresXMakeUpper = m_conf.getWiresXMakeUpper();
m_reflectors = new CYSFReflectors(fileName, reloadTime); m_reflectors = new CYSFReflectors(fileName, reloadTime, wiresXMakeUpper);
m_reflectors->reload(); m_reflectors->reload();
createWiresX(&rptNetwork); createWiresX(&rptNetwork);

@ -7,6 +7,7 @@ RptAddress=127.0.0.1
RptPort=3200 RptPort=3200
LocalAddress=127.0.0.1 LocalAddress=127.0.0.1
LocalPort=4200 LocalPort=4200
WiresXMakeUpper=1
Daemon=0 Daemon=0
[Info] [Info]

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2016,2017,2018 by Jonathan Naylor G4KLX * Copyright (C) 2016-2019 by Jonathan Naylor G4KLX
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -26,7 +26,7 @@
#include <cstring> #include <cstring>
#include <cctype> #include <cctype>
CYSFReflectors::CYSFReflectors(const std::string& hostsFile, unsigned int reloadTime) : CYSFReflectors::CYSFReflectors(const std::string& hostsFile, unsigned int reloadTime, bool makeUpper) :
m_hostsFile(hostsFile), m_hostsFile(hostsFile),
m_parrotAddress(), m_parrotAddress(),
m_parrotPort(0U), m_parrotPort(0U),
@ -40,6 +40,7 @@ m_fcsRooms(),
m_newReflectors(), m_newReflectors(),
m_currReflectors(), m_currReflectors(),
m_search(), m_search(),
m_makeUpper(makeUpper),
m_timer(1000U, reloadTime * 60U) m_timer(1000U, reloadTime * 60U)
{ {
if (reloadTime > 0U) if (reloadTime > 0U)
@ -243,6 +244,13 @@ bool CYSFReflectors::load()
if (size == 0U) if (size == 0U)
return false; return false;
if (m_makeUpper) {
for (std::vector<CYSFReflector*>::iterator it = m_newReflectors.begin(); it != m_newReflectors.end(); ++it) {
std::transform((*it)->m_name.begin(), (*it)->m_name.end(), (*it)->m_name.begin(), ::toupper);
std::transform((*it)->m_desc.begin(), (*it)->m_desc.end(), (*it)->m_desc.begin(), ::toupper);
}
}
std::sort(m_newReflectors.begin(), m_newReflectors.end(), refComparison); std::sort(m_newReflectors.begin(), m_newReflectors.end(), refComparison);
return true; return true;

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2016,2017,2018 by Jonathan Naylor G4KLX * Copyright (C) 2016-2019 by Jonathan Naylor G4KLX
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -54,7 +54,7 @@ public:
class CYSFReflectors { class CYSFReflectors {
public: public:
CYSFReflectors(const std::string& hostsFile, unsigned int reloadTime); CYSFReflectors(const std::string& hostsFile, unsigned int reloadTime, bool makeUpper);
~CYSFReflectors(); ~CYSFReflectors();
void setParrot(const std::string& address, unsigned int port); void setParrot(const std::string& address, unsigned int port);
@ -90,6 +90,7 @@ private:
std::vector<CYSFReflector*> m_newReflectors; std::vector<CYSFReflector*> m_newReflectors;
std::vector<CYSFReflector*> m_currReflectors; std::vector<CYSFReflector*> m_currReflectors;
std::vector<CYSFReflector*> m_search; std::vector<CYSFReflector*> m_search;
bool m_makeUpper;
CTimer m_timer; CTimer m_timer;
}; };

Loading…
Cancel
Save