From 42ce6251ae0da9983f061078a5b56c5c4f212676 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Thu, 19 May 2016 17:59:49 +0100 Subject: [PATCH] Add the software version and other cleanups. --- YSFParrot/Version.h | 24 +++++++++++++++++++++++ YSFParrot/YSFParrot.cpp | 3 +++ YSFParrot/YSFParrot.vcxproj | 1 + YSFParrot/YSFParrot.vcxproj.filters | 3 +++ YSFReflector/Version.h | 24 +++++++++++++++++++++++ YSFReflector/YSFReflector.cpp | 9 ++++++--- YSFReflector/YSFReflector.vcxproj | 1 + YSFReflector/YSFReflector.vcxproj.filters | 3 +++ 8 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 YSFParrot/Version.h create mode 100644 YSFReflector/Version.h diff --git a/YSFParrot/Version.h b/YSFParrot/Version.h new file mode 100644 index 0000000..aa44328 --- /dev/null +++ b/YSFParrot/Version.h @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#if !defined(VERSION_H) +#define VERSION_H + +const char* VERSION = "20160517"; + +#endif diff --git a/YSFParrot/YSFParrot.cpp b/YSFParrot/YSFParrot.cpp index 982456d..e25c9b9 100644 --- a/YSFParrot/YSFParrot.cpp +++ b/YSFParrot/YSFParrot.cpp @@ -20,6 +20,7 @@ #include "YSFParrot.h" #include "Parrot.h" #include "Network.h" +#include "Version.h" #include #include @@ -71,6 +72,8 @@ void CYSFParrot::run() unsigned int count = 0U; bool playing = false; + ::fprintf(stdout, "Starting YSFParrot-%s\n", VERSION); + for (;;) { unsigned char buffer[200U]; diff --git a/YSFParrot/YSFParrot.vcxproj b/YSFParrot/YSFParrot.vcxproj index a5de555..590ddcf 100644 --- a/YSFParrot/YSFParrot.vcxproj +++ b/YSFParrot/YSFParrot.vcxproj @@ -147,6 +147,7 @@ + diff --git a/YSFParrot/YSFParrot.vcxproj.filters b/YSFParrot/YSFParrot.vcxproj.filters index 6ec32f5..80097de 100644 --- a/YSFParrot/YSFParrot.vcxproj.filters +++ b/YSFParrot/YSFParrot.vcxproj.filters @@ -38,6 +38,9 @@ Header Files + + Header Files + diff --git a/YSFReflector/Version.h b/YSFReflector/Version.h new file mode 100644 index 0000000..aa44328 --- /dev/null +++ b/YSFReflector/Version.h @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#if !defined(VERSION_H) +#define VERSION_H + +const char* VERSION = "20160517"; + +#endif diff --git a/YSFReflector/YSFReflector.cpp b/YSFReflector/YSFReflector.cpp index 7f07836..7ccf477 100644 --- a/YSFReflector/YSFReflector.cpp +++ b/YSFReflector/YSFReflector.cpp @@ -19,6 +19,7 @@ #include "YSFReflector.h" #include "StopWatch.h" #include "Network.h" +#include "Version.h" #include #include @@ -66,6 +67,8 @@ void CYSFReflector::run() CTimer pollTimer(1000U, 60U); pollTimer.start(); + ::fprintf(stdout, "Starting YSFReflector-%s\n", VERSION); + for (;;) { unsigned char buffer[200U]; @@ -78,8 +81,6 @@ void CYSFReflector::run() if ((*it)->m_callsign != callsign) network.writeData(buffer, (*it)->m_address, (*it)->m_port); } - } else { - ::fprintf(stdout, "Data received from an unknown repeater - %s\n", callsign.c_str()); } } @@ -118,8 +119,10 @@ void CYSFReflector::run() } // Remove any repeaters that haven't reported for a while - for (std::vector::iterator it = m_repeaters.begin(); it != m_repeaters.end(); ++it) { + for (std::vector::iterator it = m_repeaters.begin(); it != m_repeaters.end(); ++it) (*it)->m_timer.clock(ms); + + for (std::vector::iterator it = m_repeaters.begin(); it != m_repeaters.end(); ++it) { if ((*it)->m_timer.hasExpired()) { ::fprintf(stdout, "Removing %s\n", (*it)->m_callsign.c_str()); m_repeaters.erase(it); diff --git a/YSFReflector/YSFReflector.vcxproj b/YSFReflector/YSFReflector.vcxproj index 95820af..bad92ca 100644 --- a/YSFReflector/YSFReflector.vcxproj +++ b/YSFReflector/YSFReflector.vcxproj @@ -152,6 +152,7 @@ + diff --git a/YSFReflector/YSFReflector.vcxproj.filters b/YSFReflector/YSFReflector.vcxproj.filters index 2995ec7..d07cf1d 100644 --- a/YSFReflector/YSFReflector.vcxproj.filters +++ b/YSFReflector/YSFReflector.vcxproj.filters @@ -35,6 +35,9 @@ Header Files + + Header Files +