From 220ce15db1378cdea1feabca5e222f3733ef75a2 Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Sun, 27 Jan 2019 11:49:46 -0300 Subject: [PATCH] Wires-X upper case for YSF2NXDN and YSF2P25 --- YSF2NXDN/Conf.cpp | 12 ++++++++++-- YSF2NXDN/Conf.h | 6 ++++-- YSF2NXDN/WiresX.cpp | 12 +++++++++--- YSF2NXDN/WiresX.h | 5 +++-- YSF2NXDN/YSF2NXDN.cpp | 5 +++-- YSF2NXDN/YSF2NXDN.ini | 1 + YSF2P25/Conf.cpp | 12 ++++++++++-- YSF2P25/Conf.h | 6 ++++-- YSF2P25/WiresX.cpp | 12 +++++++++--- YSF2P25/WiresX.h | 5 +++-- YSF2P25/YSF2P25.cpp | 5 +++-- YSF2P25/YSF2P25.ini | 1 + 12 files changed, 60 insertions(+), 22 deletions(-) diff --git a/YSF2NXDN/Conf.cpp b/YSF2NXDN/Conf.cpp index 6908049..454a234 100644 --- a/YSF2NXDN/Conf.cpp +++ b/YSF2NXDN/Conf.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX - * Copyright (C) 2018 by Andy Uribe CA6JAU + * Copyright (C) 2015-2019 by Jonathan Naylor G4KLX + * Copyright (C) 2018,2019 by Andy Uribe CA6JAU * * 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 @@ -46,6 +46,7 @@ m_dstPort(0U), m_localAddress(), m_localPort(0U), m_enableWiresX(false), +m_wiresXMakeUpper(true), m_daemon(false), m_rxFrequency(0U), m_txFrequency(0U), @@ -164,6 +165,8 @@ bool CConf::read() m_localPort = (unsigned int)::atoi(value); else if (::strcmp(key, "EnableWiresX") == 0) m_enableWiresX = ::atoi(value) == 1; + else if (::strcmp(key, "WiresXMakeUpper") == 0) + m_wiresXMakeUpper = ::atoi(value) == 1; else if (::strcmp(key, "Daemon") == 0) m_daemon = ::atoi(value) == 1; } else if (section == SECTION_NXDN_NETWORK) { @@ -285,6 +288,11 @@ bool CConf::getEnableWiresX() const return m_enableWiresX; } +bool CConf::getWiresXMakeUpper() const +{ + return m_wiresXMakeUpper; +} + bool CConf::getDaemon() const { return m_daemon; diff --git a/YSF2NXDN/Conf.h b/YSF2NXDN/Conf.h index 5579646..5e4ad21 100644 --- a/YSF2NXDN/Conf.h +++ b/YSF2NXDN/Conf.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX - * Copyright (C) 2018 by Andy Uribe CA6JAU + * Copyright (C) 2015-2019 by Jonathan Naylor G4KLX + * Copyright (C) 2018,2019 by Andy Uribe CA6JAU * * 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 @@ -47,6 +47,7 @@ public: std::string getLocalAddress() const; unsigned int getLocalPort() const; bool getEnableWiresX() const; + bool getWiresXMakeUpper() const; bool getDaemon() const; // The NXDN Network section @@ -88,6 +89,7 @@ private: std::string m_localAddress; unsigned int m_localPort; bool m_enableWiresX; + bool m_wiresXMakeUpper; bool m_daemon; unsigned int m_rxFrequency; diff --git a/YSF2NXDN/WiresX.cpp b/YSF2NXDN/WiresX.cpp index 6af972a..357f65f 100644 --- a/YSF2NXDN/WiresX.cpp +++ b/YSF2NXDN/WiresX.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 2016,2017 by Jonathan Naylor G4KLX * Copyright (C) 2018 by Manuel Sanchez EA7EE -* Copyright (C) 2018 by Andy Uribe CA6JAU +* Copyright (C) 2018,2019 by Andy Uribe CA6JAU * * 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 @@ -49,7 +49,7 @@ const unsigned char DEFAULT_FICH[] = {0x20U, 0x00U, 0x01U, 0x00U}; const unsigned char NET_HEADER[] = "YSFD ALL "; -CWiresX::CWiresX(const std::string& callsign, const std::string& suffix, CYSFNetwork* network, std::string tgfile) : +CWiresX::CWiresX(const std::string& callsign, const std::string& suffix, CYSFNetwork* network, std::string tgfile, bool makeUpper) : m_callsign(callsign), m_node(), m_id(), @@ -68,7 +68,8 @@ m_csd3(NULL), m_status(WXSI_NONE), m_start(0U), m_search(), -m_category() +m_category(), +m_makeUpper(makeUpper) { assert(network != NULL); @@ -113,6 +114,11 @@ m_category() tgreg->m_name = std::string(p2); tgreg->m_desc = std::string(p3); + if (m_makeUpper) { + std::transform(tgreg->m_name.begin(), tgreg->m_name.end(), tgreg->m_name.begin(), ::toupper); + std::transform(tgreg->m_desc.begin(), tgreg->m_desc.end(), tgreg->m_desc.begin(), ::toupper); + } + tgreg->m_name.resize(16U, ' '); tgreg->m_desc.resize(14U, ' '); diff --git a/YSF2NXDN/WiresX.h b/YSF2NXDN/WiresX.h index 8cadce6..6ffd514 100644 --- a/YSF2NXDN/WiresX.h +++ b/YSF2NXDN/WiresX.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2016,2017 by Jonathan Naylor G4KLX * Copyright (C) 2018 by Manuel Sanchez EA7EE -* Copyright (C) 2018 by Andy Uribe CA6JAU +* Copyright (C) 2018,2019 by Andy Uribe CA6JAU * * 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 @@ -63,7 +63,7 @@ public: class CWiresX { public: - CWiresX(const std::string& callsign, const std::string& suffix, CYSFNetwork* network, std::string tgfile); + CWiresX(const std::string& callsign, const std::string& suffix, CYSFNetwork* network, std::string tgfile, bool makeUpper); ~CWiresX(); bool start(); @@ -104,6 +104,7 @@ private: std::vector m_currTGList; std::vector m_TGSearch; std::vector m_category; + bool m_makeUpper; WX_STATUS processConnect(const unsigned char* source, const unsigned char* data); void processDX(const unsigned char* source); diff --git a/YSF2NXDN/YSF2NXDN.cpp b/YSF2NXDN/YSF2NXDN.cpp index ae64620..f4f4bd1 100644 --- a/YSF2NXDN/YSF2NXDN.cpp +++ b/YSF2NXDN/YSF2NXDN.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2016,2017 by Jonathan Naylor G4KLX -* Copyright (C) 2018 by Andy Uribe CA6JAU +* Copyright (C) 2018,2019 by Andy Uribe CA6JAU * Copyright (C) 2018 by Manuel Sanchez EA7EE * * This program is free software; you can redistribute it and/or modify @@ -280,7 +280,8 @@ int CYSF2NXDN::run() // CWiresX Control Object if (enableWiresX) { - m_wiresX = new CWiresX(m_callsign, m_suffix, m_ysfNetwork, TGList); + bool makeUpper = m_conf.getWiresXMakeUpper(); + m_wiresX = new CWiresX(m_callsign, m_suffix, m_ysfNetwork, TGList, makeUpper); m_dtmf = new CDTMF; } diff --git a/YSF2NXDN/YSF2NXDN.ini b/YSF2NXDN/YSF2NXDN.ini index e64180c..0d9218f 100644 --- a/YSF2NXDN/YSF2NXDN.ini +++ b/YSF2NXDN/YSF2NXDN.ini @@ -15,6 +15,7 @@ DstPort=42000 LocalAddress=127.0.0.1 LocalPort=42014 EnableWiresX=1 +WiresXMakeUpper=1 Daemon=0 [NXDN Network] diff --git a/YSF2P25/Conf.cpp b/YSF2P25/Conf.cpp index c28e76e..27ed043 100644 --- a/YSF2P25/Conf.cpp +++ b/YSF2P25/Conf.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX - * Copyright (C) 2018 by Andy Uribe CA6JAU + * Copyright (C) 2015-2019 by Jonathan Naylor G4KLX + * Copyright (C) 2018,2019 by Andy Uribe CA6JAU * * 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 @@ -45,6 +45,7 @@ m_dstPort(0U), m_localAddress(), m_localPort(0U), m_enableWiresX(false), +m_wiresXMakeUpper(true), m_daemon(false), m_networkDebug(false), m_rxFrequency(0U), @@ -146,6 +147,8 @@ bool CConf::read() m_localPort = (unsigned int)::atoi(value); else if (::strcmp(key, "EnableWiresX") == 0) m_enableWiresX = ::atoi(value) == 1; + else if (::strcmp(key, "WiresXMakeUpper") == 0) + m_wiresXMakeUpper = ::atoi(value) == 1; else if (::strcmp(key, "Daemon") == 0) m_daemon = ::atoi(value) == 1; else if (::strcmp(key, "Debug") == 0) @@ -239,6 +242,11 @@ bool CConf::getEnableWiresX() const return m_enableWiresX; } +bool CConf::getWiresXMakeUpper() const +{ + return m_wiresXMakeUpper; +} + bool CConf::getDaemon() const { return m_daemon; diff --git a/YSF2P25/Conf.h b/YSF2P25/Conf.h index dc2a551..ff50c09 100644 --- a/YSF2P25/Conf.h +++ b/YSF2P25/Conf.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX - * Copyright (C) 2018 by Andy Uribe CA6JAU + * Copyright (C) 2015-2019 by Jonathan Naylor G4KLX + * Copyright (C) 2018,2019 by Andy Uribe CA6JAU * * 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 @@ -44,6 +44,7 @@ public: std::string getLocalAddress() const; unsigned int getLocalPort() const; bool getEnableWiresX() const; + bool getWiresXMakeUpper() const; bool getDaemon() const; bool getNetworkDebug() const; @@ -76,6 +77,7 @@ private: std::string m_localAddress; unsigned int m_localPort; bool m_enableWiresX; + bool m_wiresXMakeUpper; bool m_daemon; bool m_networkDebug; diff --git a/YSF2P25/WiresX.cpp b/YSF2P25/WiresX.cpp index 6af972a..357f65f 100644 --- a/YSF2P25/WiresX.cpp +++ b/YSF2P25/WiresX.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 2016,2017 by Jonathan Naylor G4KLX * Copyright (C) 2018 by Manuel Sanchez EA7EE -* Copyright (C) 2018 by Andy Uribe CA6JAU +* Copyright (C) 2018,2019 by Andy Uribe CA6JAU * * 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 @@ -49,7 +49,7 @@ const unsigned char DEFAULT_FICH[] = {0x20U, 0x00U, 0x01U, 0x00U}; const unsigned char NET_HEADER[] = "YSFD ALL "; -CWiresX::CWiresX(const std::string& callsign, const std::string& suffix, CYSFNetwork* network, std::string tgfile) : +CWiresX::CWiresX(const std::string& callsign, const std::string& suffix, CYSFNetwork* network, std::string tgfile, bool makeUpper) : m_callsign(callsign), m_node(), m_id(), @@ -68,7 +68,8 @@ m_csd3(NULL), m_status(WXSI_NONE), m_start(0U), m_search(), -m_category() +m_category(), +m_makeUpper(makeUpper) { assert(network != NULL); @@ -113,6 +114,11 @@ m_category() tgreg->m_name = std::string(p2); tgreg->m_desc = std::string(p3); + if (m_makeUpper) { + std::transform(tgreg->m_name.begin(), tgreg->m_name.end(), tgreg->m_name.begin(), ::toupper); + std::transform(tgreg->m_desc.begin(), tgreg->m_desc.end(), tgreg->m_desc.begin(), ::toupper); + } + tgreg->m_name.resize(16U, ' '); tgreg->m_desc.resize(14U, ' '); diff --git a/YSF2P25/WiresX.h b/YSF2P25/WiresX.h index 8cadce6..6ffd514 100644 --- a/YSF2P25/WiresX.h +++ b/YSF2P25/WiresX.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2016,2017 by Jonathan Naylor G4KLX * Copyright (C) 2018 by Manuel Sanchez EA7EE -* Copyright (C) 2018 by Andy Uribe CA6JAU +* Copyright (C) 2018,2019 by Andy Uribe CA6JAU * * 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 @@ -63,7 +63,7 @@ public: class CWiresX { public: - CWiresX(const std::string& callsign, const std::string& suffix, CYSFNetwork* network, std::string tgfile); + CWiresX(const std::string& callsign, const std::string& suffix, CYSFNetwork* network, std::string tgfile, bool makeUpper); ~CWiresX(); bool start(); @@ -104,6 +104,7 @@ private: std::vector m_currTGList; std::vector m_TGSearch; std::vector m_category; + bool m_makeUpper; WX_STATUS processConnect(const unsigned char* source, const unsigned char* data); void processDX(const unsigned char* source); diff --git a/YSF2P25/YSF2P25.cpp b/YSF2P25/YSF2P25.cpp index 04b0d0e..398496b 100644 --- a/YSF2P25/YSF2P25.cpp +++ b/YSF2P25/YSF2P25.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2016,2017 by Jonathan Naylor G4KLX -* Copyright (C) 2018 by Andy Uribe CA6JAU +* Copyright (C) 2018,2019 by Andy Uribe CA6JAU * Copyright (C) 2018 by Manuel Sanchez EA7EE * * This program is free software; you can redistribute it and/or modify @@ -334,7 +334,8 @@ int CYSF2P25::run() // CWiresX Control Object if (enableWiresX) { - m_wiresX = new CWiresX(m_callsign, suffix, m_ysfNetwork, TGList); + bool makeUpper = m_conf.getWiresXMakeUpper(); + m_wiresX = new CWiresX(m_callsign, suffix, m_ysfNetwork, TGList, makeUpper); m_dtmf = new CDTMF; } diff --git a/YSF2P25/YSF2P25.ini b/YSF2P25/YSF2P25.ini index 70a1c24..63d3ae0 100644 --- a/YSF2P25/YSF2P25.ini +++ b/YSF2P25/YSF2P25.ini @@ -12,6 +12,7 @@ DstPort=42000 LocalAddress=127.0.0.1 LocalPort=42015 EnableWiresX=1 +WiresXMakeUpper=1 Daemon=0 Debug=0