implement missing parrot delay timer; fix bad implementation where parrot frames were only played if network packets were received (this logic changed when threaded network Rx was implemented);

pull/51/head
Bryan Biedenkapp 2 years ago
parent 1ef806fef1
commit a8adeeaad7

@ -82,6 +82,7 @@ FNENetwork::FNENetwork(HostFNE* host, const std::string& address, uint16_t port,
m_p25Enabled(p25),
m_nxdnEnabled(nxdn),
m_parrotDelay(parrotDelay),
m_parrotDelayTimer(1000U, 0U, parrotDelay),
m_parrotGrantDemand(parrotGrantDemand),
m_ridLookup(nullptr),
m_tidLookup(nullptr),
@ -209,22 +210,6 @@ void FNENetwork::processNetwork()
return;
}
}
else {
// if the DMR handler has parrot frames to playback, playback a frame
if (m_tagDMR->hasParrotFrames()) {
m_tagDMR->playbackParrot();
}
// if the P25 handler has parrot frames to playback, playback a frame
if (m_tagP25->hasParrotFrames()) {
m_tagP25->playbackParrot();
}
// if the NXDN handler has parrot frames to playback, playback a frame
if (m_tagNXDN->hasParrotFrames()) {
m_tagNXDN->playbackParrot();
}
}
}
/// <summary>
@ -276,6 +261,29 @@ void FNENetwork::clock(uint32_t ms)
m_maintainenceTimer.start();
}
m_parrotDelayTimer.clock(ms);
if (m_parrotDelayTimer.isRunning() && m_parrotDelayTimer.hasExpired()) {
// if the DMR handler has parrot frames to playback, playback a frame
if (m_tagDMR->hasParrotFrames()) {
m_tagDMR->playbackParrot();
}
// if the P25 handler has parrot frames to playback, playback a frame
if (m_tagP25->hasParrotFrames()) {
m_tagP25->playbackParrot();
}
// if the NXDN handler has parrot frames to playback, playback a frame
if (m_tagNXDN->hasParrotFrames()) {
m_tagNXDN->playbackParrot();
}
}
if (!m_tagDMR->hasParrotFrames() && !m_tagP25->hasParrotFrames() && !m_tagNXDN->hasParrotFrames() &&
m_parrotDelayTimer.isRunning() && m_parrotDelayTimer.hasExpired()) {
m_parrotDelayTimer.stop();
}
}
/// <summary>

@ -263,6 +263,7 @@ namespace network
bool m_nxdnEnabled;
uint32_t m_parrotDelay;
Timer m_parrotDelayTimer;
bool m_parrotGrantDemand;
lookups::RadioIdLookup* m_ridLookup;

@ -149,8 +149,8 @@ bool TagDMRData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
if (tg.config().parrot()) {
if (m_parrotFrames.size() > 0) {
m_parrotFramesReady = true;
Thread::sleep(m_network->m_parrotDelay);
LogMessage(LOG_NET, "DMR, Parrot Playback will Start, peer = %u, srcId = %u", peerId, srcId);
m_network->m_parrotDelayTimer.start();
}
}

@ -122,8 +122,8 @@ bool TagNXDNData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerI
if (tg.config().parrot()) {
if (m_parrotFrames.size() > 0) {
m_parrotFramesReady = true;
Thread::sleep(m_network->m_parrotDelay);
LogMessage(LOG_NET, "NXDN, Parrot Playback will Start, peer = %u, srcId = %u", peerId, srcId);
m_network->m_parrotDelayTimer.start();
}
}

@ -180,8 +180,8 @@ bool TagP25Data::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
if (m_parrotFrames.size() > 0) {
m_parrotFramesReady = true;
m_parrotFirstFrame = true;
Thread::sleep(m_network->m_parrotDelay);
LogMessage(LOG_NET, "P25, Parrot Playback will Start, peer = %u, srcId = %u", peerId, srcId);
m_network->m_parrotDelayTimer.start();
}
}

Loading…
Cancel
Save

Powered by TurnKey Linux.