Add locally timed DMR roaming beacons.

This commit is contained in:
Jonathan Naylor 2018-01-15 19:22:01 +00:00
parent 22ed285857
commit d3395278c6
5 changed files with 29 additions and 20 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX
* Copyright (C) 2015,2016,2017,2018 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
@ -110,7 +110,7 @@ m_dstarErrorReply(true),
m_dstarRemoteGateway(false),
m_dstarModeHang(10U),
m_dmrEnabled(false),
m_dmrBeacons(false),
m_dmrBeacons(0U),
m_dmrId(0U),
m_dmrColorCode(2U),
m_dmrSelfOnly(false),
@ -423,7 +423,7 @@ bool CConf::read()
if (::strcmp(key, "Enable") == 0)
m_dmrEnabled = ::atoi(value) == 1;
else if (::strcmp(key, "Beacons") == 0)
m_dmrBeacons = ::atoi(value) == 1;
m_dmrBeacons = (unsigned int)::atoi(value);
else if (::strcmp(key, "Id") == 0)
m_dmrId = (unsigned int)::atoi(value);
else if (::strcmp(key, "ColorCode") == 0)
@ -928,7 +928,7 @@ bool CConf::getDMREnabled() const
return m_dmrEnabled;
}
bool CConf::getDMRBeacons() const
unsigned int CConf::getDMRBeacons() const
{
return m_dmrBeacons;
}

6
Conf.h
View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX
* Copyright (C) 2015,2016,2017,2018 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
@ -103,7 +103,7 @@ public:
// The DMR section
bool getDMREnabled() const;
bool getDMRBeacons() const;
unsigned int getDMRBeacons() const;
unsigned int getDMRId() const;
unsigned int getDMRColorCode() const;
bool getDMREmbeddedLCOnly() const;
@ -278,7 +278,7 @@ private:
unsigned int m_dstarModeHang;
bool m_dmrEnabled;
bool m_dmrBeacons;
unsigned int m_dmrBeacons;
unsigned int m_dmrId;
unsigned int m_dmrColorCode;
bool m_dmrSelfOnly;

View file

@ -77,7 +77,7 @@ RemoteGateway=0
[DMR]
Enable=1
Beacons=1
Beacons=0
ColorCode=1
SelfOnly=0
EmbeddedLCOnly=0

View file

@ -144,6 +144,7 @@ m_dmrNetModeHang(3U),
m_ysfNetModeHang(3U),
m_p25NetModeHang(3U),
m_modeTimer(1000U),
m_dmrBeaconTimer(1000U),
m_dmrTXTimer(1000U),
m_cwIdTimer(1000U),
m_duplex(false),
@ -310,9 +311,6 @@ int CMMDVMHost::run()
m_cwIdTimer.start();
}
CTimer dmrBeaconTimer(1000U, 4U);
bool dmrBeaconsEnabled = m_dmrEnabled && m_conf.getDMRBeacons();
// For all modes we handle RSSI
std::string rssiMappingFile = m_conf.getModemRSSIMappingFile();
@ -381,6 +379,7 @@ int CMMDVMHost::run()
unsigned int callHang = m_conf.getDMRCallHang();
unsigned int txHang = m_conf.getDMRTXHang();
m_dmrRFModeHang = m_conf.getDMRModeHang();
unsigned int dmrBeacons = m_conf.getDMRBeacons();
if (txHang > m_dmrRFModeHang)
txHang = m_dmrRFModeHang;
@ -414,6 +413,12 @@ int CMMDVMHost::run()
LogInfo(" TX Hang: %us", txHang);
LogInfo(" Mode Hang: %us", m_dmrRFModeHang);
if (dmrBeacons > 0U) {
LogInfo(" DMR Roaming Beacons: %u mins", dmrBeacons);
m_dmrBeaconTimer.setTimeout(dmrBeacons * 60U);
m_dmrBeaconTimer.start();
}
dmr = new CDMRControl(id, colorCode, callHang, selfOnly, embeddedLCOnly, dumpTAData, prefixes, blackList, whiteList, slot1TGWhiteList, slot2TGWhiteList, m_timeout, m_modem, m_dmrNetwork, m_display, m_duplex, m_lookup, rssi);
m_dmrTXTimer.setTimeout(txHang);
@ -461,6 +466,8 @@ int CMMDVMHost::run()
p25 = new CP25Control(nac, id, selfOnly, uidOverride, m_p25Network, m_display, m_timeout, m_duplex, m_lookup, remoteGateway, rssi);
}
CTimer dmrBeaconTimer(1000U, 4U);
setMode(MODE_IDLE);
LogMessage("MMDVMHost-%s is running", VERSION);
@ -720,14 +727,6 @@ int CMMDVMHost::run()
}
}
if (m_dmrNetwork != NULL) {
bool run = m_dmrNetwork->wantsBeacon();
if (dmrBeaconsEnabled && run && m_mode == MODE_IDLE && !m_modem->hasTX()) {
setMode(MODE_DMR);
dmrBeaconTimer.start();
}
}
unsigned int ms = stopWatch.elapsed();
stopWatch.start();
@ -766,6 +765,15 @@ int CMMDVMHost::run()
}
}
m_dmrBeaconTimer.clock(ms);
if (m_dmrBeaconTimer.isRunning() && m_dmrBeaconTimer.hasExpired()) {
if (m_mode == MODE_IDLE && !m_modem->hasTX()) {
setMode(MODE_DMR);
m_dmrBeaconTimer.start();
dmrBeaconTimer.start();
}
}
dmrBeaconTimer.clock(ms);
if (dmrBeaconTimer.isRunning() && dmrBeaconTimer.hasExpired()) {
setMode(MODE_IDLE);

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX
* Copyright (C) 2015,2016,2017,2018 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
@ -59,6 +59,7 @@ private:
unsigned int m_ysfNetModeHang;
unsigned int m_p25NetModeHang;
CTimer m_modeTimer;
CTimer m_dmrBeaconTimer;
CTimer m_dmrTXTimer;
CTimer m_cwIdTimer;
bool m_duplex;