mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-20 22:45:44 +08:00
Add more DMR beacon parameters.
This commit is contained in:
22
Conf.cpp
22
Conf.cpp
@@ -110,7 +110,9 @@ m_dstarErrorReply(true),
|
||||
m_dstarRemoteGateway(false),
|
||||
m_dstarModeHang(10U),
|
||||
m_dmrEnabled(false),
|
||||
m_dmrBeacons(0U),
|
||||
m_dmrBeacons(false),
|
||||
m_dmrBeaconInterval(60U),
|
||||
m_dmrBeaconDuration(3U),
|
||||
m_dmrId(0U),
|
||||
m_dmrColorCode(2U),
|
||||
m_dmrSelfOnly(false),
|
||||
@@ -423,7 +425,11 @@ bool CConf::read()
|
||||
if (::strcmp(key, "Enable") == 0)
|
||||
m_dmrEnabled = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "Beacons") == 0)
|
||||
m_dmrBeacons = (unsigned int)::atoi(value);
|
||||
m_dmrBeacons = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "BeaconInterval") == 0)
|
||||
m_dmrBeaconInterval = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "BeaconDuration") == 0)
|
||||
m_dmrBeaconDuration = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "Id") == 0)
|
||||
m_dmrId = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "ColorCode") == 0)
|
||||
@@ -928,11 +934,21 @@ bool CConf::getDMREnabled() const
|
||||
return m_dmrEnabled;
|
||||
}
|
||||
|
||||
unsigned int CConf::getDMRBeacons() const
|
||||
bool CConf::getDMRBeacons() const
|
||||
{
|
||||
return m_dmrBeacons;
|
||||
}
|
||||
|
||||
unsigned int CConf::getDMRBeaconInterval() const
|
||||
{
|
||||
return m_dmrBeaconInterval;
|
||||
}
|
||||
|
||||
unsigned int CConf::getDMRBeaconDuration() const
|
||||
{
|
||||
return m_dmrBeaconDuration;
|
||||
}
|
||||
|
||||
unsigned int CConf::getDMRId() const
|
||||
{
|
||||
return m_dmrId;
|
||||
|
||||
8
Conf.h
8
Conf.h
@@ -103,7 +103,9 @@ public:
|
||||
|
||||
// The DMR section
|
||||
bool getDMREnabled() const;
|
||||
unsigned int getDMRBeacons() const;
|
||||
bool getDMRBeacons() const;
|
||||
unsigned int getDMRBeaconInterval() const;
|
||||
unsigned int getDMRBeaconDuration() const;
|
||||
unsigned int getDMRId() const;
|
||||
unsigned int getDMRColorCode() const;
|
||||
bool getDMREmbeddedLCOnly() const;
|
||||
@@ -278,7 +280,9 @@ private:
|
||||
unsigned int m_dstarModeHang;
|
||||
|
||||
bool m_dmrEnabled;
|
||||
unsigned int m_dmrBeacons;
|
||||
bool m_dmrBeacons;
|
||||
unsigned int m_dmrBeaconInterval;
|
||||
unsigned int m_dmrBeaconDuration;
|
||||
unsigned int m_dmrId;
|
||||
unsigned int m_dmrColorCode;
|
||||
bool m_dmrSelfOnly;
|
||||
|
||||
@@ -78,6 +78,8 @@ RemoteGateway=0
|
||||
[DMR]
|
||||
Enable=1
|
||||
Beacons=0
|
||||
BeaconInterval=60
|
||||
BeaconDuration=3
|
||||
ColorCode=1
|
||||
SelfOnly=0
|
||||
EmbeddedLCOnly=0
|
||||
|
||||
@@ -144,7 +144,6 @@ m_dmrNetModeHang(3U),
|
||||
m_ysfNetModeHang(3U),
|
||||
m_p25NetModeHang(3U),
|
||||
m_modeTimer(1000U),
|
||||
m_dmrBeaconTimer(1000U),
|
||||
m_dmrTXTimer(1000U),
|
||||
m_cwIdTimer(1000U),
|
||||
m_duplex(false),
|
||||
@@ -364,6 +363,9 @@ int CMMDVMHost::run()
|
||||
dstar = new CDStarControl(m_callsign, module, selfOnly, ackReply, ackTime, errorReply, blackList, m_dstarNetwork, m_display, m_timeout, m_duplex, remoteGateway, rssi);
|
||||
}
|
||||
|
||||
CTimer dmrBeaconIntervalTimer(1000U);
|
||||
CTimer dmrBeaconDurationTimer(1000U);
|
||||
|
||||
CDMRControl* dmr = NULL;
|
||||
if (m_dmrEnabled) {
|
||||
unsigned int id = m_conf.getDMRId();
|
||||
@@ -379,7 +381,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();
|
||||
bool dmrBeacons = m_conf.getDMRBeacons();
|
||||
|
||||
if (txHang > m_dmrRFModeHang)
|
||||
txHang = m_dmrRFModeHang;
|
||||
@@ -413,10 +415,17 @@ 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();
|
||||
if (dmrBeacons) {
|
||||
unsigned int dmrBeaconInterval = m_conf.getDMRBeaconInterval();
|
||||
unsigned int dmrBeaconDuration = m_conf.getDMRBeaconDuration();
|
||||
|
||||
LogInfo(" DMR Roaming Beacon Interval: %us", dmrBeaconInterval);
|
||||
LogInfo(" DMR Roaming Beacon Duration: %us", dmrBeaconDuration);
|
||||
|
||||
dmrBeaconDurationTimer.setTimeout(dmrBeaconDuration);
|
||||
|
||||
dmrBeaconIntervalTimer.setTimeout(dmrBeaconInterval);
|
||||
dmrBeaconIntervalTimer.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);
|
||||
@@ -466,8 +475,6 @@ 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);
|
||||
@@ -523,13 +530,13 @@ int CMMDVMHost::run()
|
||||
if (ret) {
|
||||
m_modeTimer.setTimeout(m_dmrRFModeHang);
|
||||
setMode(MODE_DMR);
|
||||
dmrBeaconTimer.stop();
|
||||
dmrBeaconDurationTimer.stop();
|
||||
}
|
||||
} else {
|
||||
m_modeTimer.setTimeout(m_dmrRFModeHang);
|
||||
setMode(MODE_DMR);
|
||||
dmr->writeModemSlot1(data, len);
|
||||
dmrBeaconTimer.stop();
|
||||
dmrBeaconDurationTimer.stop();
|
||||
}
|
||||
} else if (m_mode == MODE_DMR) {
|
||||
if (m_duplex && !m_modem->hasTX()) {
|
||||
@@ -541,7 +548,7 @@ int CMMDVMHost::run()
|
||||
} else {
|
||||
bool ret = dmr->writeModemSlot1(data, len);
|
||||
if (ret) {
|
||||
dmrBeaconTimer.stop();
|
||||
dmrBeaconDurationTimer.stop();
|
||||
m_modeTimer.start();
|
||||
if (m_duplex)
|
||||
m_dmrTXTimer.start();
|
||||
@@ -560,13 +567,13 @@ int CMMDVMHost::run()
|
||||
if (ret) {
|
||||
m_modeTimer.setTimeout(m_dmrRFModeHang);
|
||||
setMode(MODE_DMR);
|
||||
dmrBeaconTimer.stop();
|
||||
dmrBeaconDurationTimer.stop();
|
||||
}
|
||||
} else {
|
||||
m_modeTimer.setTimeout(m_dmrRFModeHang);
|
||||
setMode(MODE_DMR);
|
||||
dmr->writeModemSlot2(data, len);
|
||||
dmrBeaconTimer.stop();
|
||||
dmrBeaconDurationTimer.stop();
|
||||
}
|
||||
} else if (m_mode == MODE_DMR) {
|
||||
if (m_duplex && !m_modem->hasTX()) {
|
||||
@@ -578,7 +585,7 @@ int CMMDVMHost::run()
|
||||
} else {
|
||||
bool ret = dmr->writeModemSlot2(data, len);
|
||||
if (ret) {
|
||||
dmrBeaconTimer.stop();
|
||||
dmrBeaconDurationTimer.stop();
|
||||
m_modeTimer.start();
|
||||
if (m_duplex)
|
||||
m_dmrTXTimer.start();
|
||||
@@ -658,7 +665,7 @@ int CMMDVMHost::run()
|
||||
m_dmrTXTimer.start();
|
||||
}
|
||||
m_modem->writeDMRData1(data, len);
|
||||
dmrBeaconTimer.stop();
|
||||
dmrBeaconDurationTimer.stop();
|
||||
m_modeTimer.start();
|
||||
} else if (m_mode != MODE_LOCKOUT) {
|
||||
LogWarning("DMR data received when in mode %u", m_mode);
|
||||
@@ -680,7 +687,7 @@ int CMMDVMHost::run()
|
||||
m_dmrTXTimer.start();
|
||||
}
|
||||
m_modem->writeDMRData2(data, len);
|
||||
dmrBeaconTimer.stop();
|
||||
dmrBeaconDurationTimer.stop();
|
||||
m_modeTimer.start();
|
||||
} else if (m_mode != MODE_LOCKOUT) {
|
||||
LogWarning("DMR data received when in mode %u", m_mode);
|
||||
@@ -765,19 +772,19 @@ int CMMDVMHost::run()
|
||||
}
|
||||
}
|
||||
|
||||
m_dmrBeaconTimer.clock(ms);
|
||||
if (m_dmrBeaconTimer.isRunning() && m_dmrBeaconTimer.hasExpired()) {
|
||||
dmrBeaconIntervalTimer.clock(ms);
|
||||
if (dmrBeaconIntervalTimer.isRunning() && dmrBeaconIntervalTimer.hasExpired()) {
|
||||
if (m_mode == MODE_IDLE && !m_modem->hasTX()) {
|
||||
setMode(MODE_DMR);
|
||||
m_dmrBeaconTimer.start();
|
||||
dmrBeaconTimer.start();
|
||||
dmrBeaconIntervalTimer.start();
|
||||
dmrBeaconDurationTimer.start();
|
||||
}
|
||||
}
|
||||
|
||||
dmrBeaconTimer.clock(ms);
|
||||
if (dmrBeaconTimer.isRunning() && dmrBeaconTimer.hasExpired()) {
|
||||
dmrBeaconDurationTimer.clock(ms);
|
||||
if (dmrBeaconDurationTimer.isRunning() && dmrBeaconDurationTimer.hasExpired()) {
|
||||
setMode(MODE_IDLE);
|
||||
dmrBeaconTimer.stop();
|
||||
dmrBeaconDurationTimer.stop();
|
||||
}
|
||||
|
||||
m_dmrTXTimer.clock(ms);
|
||||
|
||||
@@ -59,7 +59,6 @@ private:
|
||||
unsigned int m_ysfNetModeHang;
|
||||
unsigned int m_p25NetModeHang;
|
||||
CTimer m_modeTimer;
|
||||
CTimer m_dmrBeaconTimer;
|
||||
CTimer m_dmrTXTimer;
|
||||
CTimer m_cwIdTimer;
|
||||
bool m_duplex;
|
||||
|
||||
Reference in New Issue
Block a user