1
0
Fork 0

Make bleeps optional and timed after the transmission.

ycs232-kbc
Jonathan Naylor 4 years ago
parent fd06781f93
commit 556e6c9366

@ -50,6 +50,7 @@ m_myAddress(),
m_myPort(0U), m_myPort(0U),
m_rfHangTime(60U), m_rfHangTime(60U),
m_netHangTime(60U), m_netHangTime(60U),
m_bleep(true),
m_debug(false), m_debug(false),
m_daemon(false), m_daemon(false),
m_rxFrequency(0U), m_rxFrequency(0U),
@ -179,6 +180,8 @@ bool CConf::read()
m_ysfRFHangTime = m_fcsRFHangTime = m_rfHangTime = (unsigned int)::atoi(value); m_ysfRFHangTime = m_fcsRFHangTime = m_rfHangTime = (unsigned int)::atoi(value);
else if (::strcmp(key, "NetHangTime") == 0) else if (::strcmp(key, "NetHangTime") == 0)
m_ysfNetHangTime = m_fcsNetHangTime = m_netHangTime = (unsigned int)::atoi(value); m_ysfNetHangTime = m_fcsNetHangTime = m_netHangTime = (unsigned int)::atoi(value);
else if (::strcmp(key, "Bleep") == 0)
m_bleep = ::atoi(value) == 1;
else if (::strcmp(key, "Debug") == 0) else if (::strcmp(key, "Debug") == 0)
m_debug = ::atoi(value) == 1; m_debug = ::atoi(value) == 1;
else if (::strcmp(key, "Daemon") == 0) else if (::strcmp(key, "Daemon") == 0)
@ -331,6 +334,11 @@ unsigned int CConf::getMyPort() const
return m_myPort; return m_myPort;
} }
bool CConf::getBleep() const
{
return m_bleep;
}
bool CConf::getDebug() const bool CConf::getDebug() const
{ {
return m_debug; return m_debug;

@ -58,6 +58,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 getBleep() const;
bool getDebug() const; bool getDebug() const;
bool getDaemon() const; bool getDaemon() const;
@ -105,6 +106,7 @@ private:
unsigned int m_myPort; unsigned int m_myPort;
unsigned int m_rfHangTime; unsigned int m_rfHangTime;
unsigned int m_netHangTime; unsigned int m_netHangTime;
bool m_bleep;
bool m_debug; bool m_debug;
bool m_daemon; bool m_daemon;

@ -216,6 +216,7 @@ int CDGIdGateway::run()
} }
unsigned int currentDGId = 0U; unsigned int currentDGId = 0U;
bool fromRF = false;
CDGIdNetwork* dgIdNetwork[100U]; CDGIdNetwork* dgIdNetwork[100U];
for (unsigned int i = 0U; i < 100U; i++) for (unsigned int i = 0U; i < 100U; i++)
@ -397,6 +398,7 @@ int CDGIdGateway::run()
createGPS(); createGPS();
CTimer inactivityTimer(1000U); CTimer inactivityTimer(1000U);
CTimer bleepTimer(1000U, 1U);
CStopWatch stopWatch; CStopWatch stopWatch;
stopWatch.start(); stopWatch.start();
@ -438,6 +440,7 @@ int CDGIdGateway::run()
LogMessage("DG-ID set to %u (%s) via RF", dgId, desc.c_str()); LogMessage("DG-ID set to %u (%s) via RF", dgId, desc.c_str());
currentDGId = dgId; currentDGId = dgId;
state = DS_NOTLINKED; state = DS_NOTLINKED;
fromRF = true;
} }
if (m_gps != NULL) if (m_gps != NULL)
@ -464,10 +467,8 @@ int CDGIdGateway::run()
if ((buffer[34U] & 0x01U) == 0x01U) { if ((buffer[34U] & 0x01U) == 0x01U) {
if (m_gps != NULL) if (m_gps != NULL)
m_gps->reset(); m_gps->reset();
if (nPips > 0U) { if (nPips > 0U && fromRF)
sendPips(nPips); bleepTimer.start();
nPips = 0U;
}
} }
} }
} }
@ -493,6 +494,7 @@ int CDGIdGateway::run()
LogMessage("DG-ID set to %u (%s) via Network", i, desc.c_str()); LogMessage("DG-ID set to %u (%s) via Network", i, desc.c_str());
currentDGId = i; currentDGId = i;
state = DS_LINKED; state = DS_LINKED;
fromRF = false;
} }
} }
} }
@ -526,14 +528,25 @@ int CDGIdGateway::run()
state = DS_NOTLINKED; state = DS_NOTLINKED;
currentDGId = 0U; currentDGId = 0U;
inactivityTimer.stop(); inactivityTimer.stop();
if (fromRF) {
sendPips(2U); sendPips(2U);
fromRF = false;
}
}
bleepTimer.clock(ms);
if (bleepTimer.isRunning() && bleepTimer.hasExpired()) {
sendPips(nPips);
bleepTimer.stop();
nPips = 0U;
} }
if (dgIdNetwork[currentDGId] != NULL) { if (dgIdNetwork[currentDGId] != NULL) {
DGID_STATUS netState = dgIdNetwork[currentDGId]->getStatus(); DGID_STATUS netState = dgIdNetwork[currentDGId]->getStatus();
if (state != DS_LINKED && netState == DS_LINKED) if (fromRF && state != DS_LINKED && netState == DS_LINKED)
nPips = 1U; nPips = 1U;
else if (state == DS_LINKED && netState != DS_LINKED) else if (fromRF && state == DS_LINKED && netState != DS_LINKED)
nPips = 3U; nPips = 3U;
state = netState; state = netState;
} }
@ -665,5 +678,10 @@ std::string CDGIdGateway::calculateLocator()
void CDGIdGateway::sendPips(unsigned int n) void CDGIdGateway::sendPips(unsigned int n)
{ {
if (n == 0U)
return;
bool bleep = m_conf.getBleep();
if (bleep)
LogMessage("*** %u bleep!", n); LogMessage("*** %u bleep!", n);
} }

@ -1,5 +1,5 @@
[General] [General]
Callsign=G9BF Callsign=G4KLX
Suffix=RPT Suffix=RPT
# Suffix=ND # Suffix=ND
Id=1234567 Id=1234567
@ -9,6 +9,7 @@ LocalAddress=127.0.0.1
LocalPort=4200 LocalPort=4200
RFHangTime=120 RFHangTime=120
NetHangTime=120 NetHangTime=120
Bleep=1
Debug=0 Debug=0
Daemon=0 Daemon=0
@ -134,7 +135,7 @@ Debug=0
[DGId=55] [DGId=55]
# YCS Reflector YCS310 (DG-ID 80) # YCS Reflector YCS310 (DG-ID 80)
Type=YCS Type=YCS
Static=1 Static=0
Name=US-C4FM-NA Name=US-C4FM-NA
Local=42025 Local=42025
DGId=80 DGId=80

@ -19,6 +19,6 @@
#if !defined(VERSION_H) #if !defined(VERSION_H)
#define VERSION_H #define VERSION_H
const char* VERSION = "20200922"; const char* VERSION = "20200923";
#endif #endif

Loading…
Cancel
Save