Add the software version and other cleanups.
This commit is contained in:
parent
e1faa2a00b
commit
42ce6251ae
8 changed files with 65 additions and 3 deletions
24
YSFParrot/Version.h
Normal file
24
YSFParrot/Version.h
Normal file
|
@ -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
|
|
@ -20,6 +20,7 @@
|
|||
#include "YSFParrot.h"
|
||||
#include "Parrot.h"
|
||||
#include "Network.h"
|
||||
#include "Version.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
@ -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];
|
||||
|
||||
|
|
|
@ -147,6 +147,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="StopWatch.h" />
|
||||
<ClInclude Include="Version.h" />
|
||||
<ClInclude Include="YSFParrot.h" />
|
||||
<ClInclude Include="RingBuffer.h" />
|
||||
<ClInclude Include="Timer.h" />
|
||||
|
|
|
@ -38,6 +38,9 @@
|
|||
<ClInclude Include="StopWatch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Version.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="UDPSocket.cpp">
|
||||
|
|
24
YSFReflector/Version.h
Normal file
24
YSFReflector/Version.h
Normal file
|
@ -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
|
|
@ -19,6 +19,7 @@
|
|||
#include "YSFReflector.h"
|
||||
#include "StopWatch.h"
|
||||
#include "Network.h"
|
||||
#include "Version.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
@ -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<CYSFRepeater*>::iterator it = m_repeaters.begin(); it != m_repeaters.end(); ++it) {
|
||||
for (std::vector<CYSFRepeater*>::iterator it = m_repeaters.begin(); it != m_repeaters.end(); ++it)
|
||||
(*it)->m_timer.clock(ms);
|
||||
|
||||
for (std::vector<CYSFRepeater*>::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);
|
||||
|
|
|
@ -152,6 +152,7 @@
|
|||
<ClInclude Include="Timer.h" />
|
||||
<ClInclude Include="UDPSocket.h" />
|
||||
<ClInclude Include="Utils.h" />
|
||||
<ClInclude Include="Version.h" />
|
||||
<ClInclude Include="YSFDefines.h" />
|
||||
<ClInclude Include="YSFReflector.h" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -35,6 +35,9 @@
|
|||
<ClInclude Include="StopWatch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Version.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Network.cpp">
|
||||
|
|
Loading…
Reference in a new issue