Abort the voice prompt if network traffic appears on the same slot.

This commit is contained in:
Jonathan Naylor
2020-04-18 22:33:24 +01:00
parent 3b3243c1bf
commit 00342c763a
6 changed files with 33 additions and 2 deletions

View File

@@ -909,6 +909,8 @@ int CDMRGateway::run()
// Check that the rewritten slot is free to use.
slotNo = data.getSlotNo();
if (m_status[slotNo] == DMRGWS_NONE || m_status[slotNo] == DMRGWS_DMRNETWORK1) {
for (std::vector<CRewriteDynTGRF*>::iterator it = m_dynRF.begin(); it != m_dynRF.end(); ++it)
(*it)->stopVoice(slotNo);
m_repeater->write(data);
m_status[slotNo] = DMRGWS_DMRNETWORK1;
timer[slotNo]->setTimeout(netTimeout);
@@ -957,6 +959,8 @@ int CDMRGateway::run()
// Check that the rewritten slot is free to use.
slotNo = data.getSlotNo();
if (m_status[slotNo] == DMRGWS_NONE || m_status[slotNo] == DMRGWS_DMRNETWORK2) {
for (std::vector<CRewriteDynTGRF*>::iterator it = m_dynRF.begin(); it != m_dynRF.end(); ++it)
(*it)->stopVoice(slotNo);
m_repeater->write(data);
m_status[slotNo] = DMRGWS_DMRNETWORK2;
timer[slotNo]->setTimeout(netTimeout);
@@ -1005,6 +1009,8 @@ int CDMRGateway::run()
// Check that the rewritten slot is free to use.
slotNo = data.getSlotNo();
if (m_status[slotNo] == DMRGWS_NONE || m_status[slotNo] == DMRGWS_DMRNETWORK3) {
for (std::vector<CRewriteDynTGRF*>::iterator it = m_dynRF.begin(); it != m_dynRF.end(); ++it)
(*it)->stopVoice(slotNo);
m_repeater->write(data);
m_status[slotNo] = DMRGWS_DMRNETWORK3;
timer[slotNo]->setTimeout(netTimeout);
@@ -1053,6 +1059,8 @@ int CDMRGateway::run()
// Check that the rewritten slot is free to use.
slotNo = data.getSlotNo();
if (m_status[slotNo] == DMRGWS_NONE || m_status[slotNo] == DMRGWS_DMRNETWORK4) {
for (std::vector<CRewriteDynTGRF*>::iterator it = m_dynRF.begin(); it != m_dynRF.end(); ++it)
(*it)->stopVoice(slotNo);
m_repeater->write(data);
m_status[slotNo] = DMRGWS_DMRNETWORK4;
timer[slotNo]->setTimeout(netTimeout);
@@ -1101,6 +1109,8 @@ int CDMRGateway::run()
// Check that the rewritten slot is free to use.
slotNo = data.getSlotNo();
if (m_status[slotNo] == DMRGWS_NONE || m_status[slotNo] == DMRGWS_DMRNETWORK5) {
for (std::vector<CRewriteDynTGRF*>::iterator it = m_dynRF.begin(); it != m_dynRF.end(); ++it)
(*it)->stopVoice(slotNo);
m_repeater->write(data);
m_status[slotNo] = DMRGWS_DMRNETWORK5;
timer[slotNo]->setTimeout(netTimeout);

View File

@@ -162,6 +162,17 @@ void CDynVoice::unlinked()
createVoice(words);
}
void CDynVoice::abort()
{
for (std::vector<CDMRData*>::iterator it = m_data.begin(); it != m_data.end(); ++it)
delete* it;
m_data.clear();
m_timer.stop();
m_status = DYNVS_NONE;
}
void CDynVoice::createVoice(const std::vector<std::string>& words)
{
unsigned int ambeLength = 0U;

View File

@@ -52,6 +52,8 @@ public:
bool read(CDMRData& data);
void abort();
void clock(unsigned int ms);
private:

View File

@@ -171,4 +171,10 @@ void CRewriteDynTGRF::tgChange(unsigned int slot, unsigned int tg)
}
return;
}
}
}
void CRewriteDynTGRF::stopVoice(unsigned int slot)
{
if (slot == m_slot && m_voice != NULL)
m_voice->abort();
}

View File

@@ -35,6 +35,8 @@ public:
virtual PROCESS_RESULT process(CDMRData& data, bool trace);
void stopVoice(unsigned int slot);
void tgChange(unsigned int slot, unsigned int tg);
private:

View File

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