mirror of
https://github.com/g4klx/DMRGateway
synced 2025-12-21 21:45:39 +08:00
Abort the voice prompt if network traffic appears on the same slot.
This commit is contained in:
@@ -909,6 +909,8 @@ int CDMRGateway::run()
|
|||||||
// Check that the rewritten slot is free to use.
|
// Check that the rewritten slot is free to use.
|
||||||
slotNo = data.getSlotNo();
|
slotNo = data.getSlotNo();
|
||||||
if (m_status[slotNo] == DMRGWS_NONE || m_status[slotNo] == DMRGWS_DMRNETWORK1) {
|
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_repeater->write(data);
|
||||||
m_status[slotNo] = DMRGWS_DMRNETWORK1;
|
m_status[slotNo] = DMRGWS_DMRNETWORK1;
|
||||||
timer[slotNo]->setTimeout(netTimeout);
|
timer[slotNo]->setTimeout(netTimeout);
|
||||||
@@ -957,6 +959,8 @@ int CDMRGateway::run()
|
|||||||
// Check that the rewritten slot is free to use.
|
// Check that the rewritten slot is free to use.
|
||||||
slotNo = data.getSlotNo();
|
slotNo = data.getSlotNo();
|
||||||
if (m_status[slotNo] == DMRGWS_NONE || m_status[slotNo] == DMRGWS_DMRNETWORK2) {
|
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_repeater->write(data);
|
||||||
m_status[slotNo] = DMRGWS_DMRNETWORK2;
|
m_status[slotNo] = DMRGWS_DMRNETWORK2;
|
||||||
timer[slotNo]->setTimeout(netTimeout);
|
timer[slotNo]->setTimeout(netTimeout);
|
||||||
@@ -1005,6 +1009,8 @@ int CDMRGateway::run()
|
|||||||
// Check that the rewritten slot is free to use.
|
// Check that the rewritten slot is free to use.
|
||||||
slotNo = data.getSlotNo();
|
slotNo = data.getSlotNo();
|
||||||
if (m_status[slotNo] == DMRGWS_NONE || m_status[slotNo] == DMRGWS_DMRNETWORK3) {
|
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_repeater->write(data);
|
||||||
m_status[slotNo] = DMRGWS_DMRNETWORK3;
|
m_status[slotNo] = DMRGWS_DMRNETWORK3;
|
||||||
timer[slotNo]->setTimeout(netTimeout);
|
timer[slotNo]->setTimeout(netTimeout);
|
||||||
@@ -1053,6 +1059,8 @@ int CDMRGateway::run()
|
|||||||
// Check that the rewritten slot is free to use.
|
// Check that the rewritten slot is free to use.
|
||||||
slotNo = data.getSlotNo();
|
slotNo = data.getSlotNo();
|
||||||
if (m_status[slotNo] == DMRGWS_NONE || m_status[slotNo] == DMRGWS_DMRNETWORK4) {
|
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_repeater->write(data);
|
||||||
m_status[slotNo] = DMRGWS_DMRNETWORK4;
|
m_status[slotNo] = DMRGWS_DMRNETWORK4;
|
||||||
timer[slotNo]->setTimeout(netTimeout);
|
timer[slotNo]->setTimeout(netTimeout);
|
||||||
@@ -1101,6 +1109,8 @@ int CDMRGateway::run()
|
|||||||
// Check that the rewritten slot is free to use.
|
// Check that the rewritten slot is free to use.
|
||||||
slotNo = data.getSlotNo();
|
slotNo = data.getSlotNo();
|
||||||
if (m_status[slotNo] == DMRGWS_NONE || m_status[slotNo] == DMRGWS_DMRNETWORK5) {
|
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_repeater->write(data);
|
||||||
m_status[slotNo] = DMRGWS_DMRNETWORK5;
|
m_status[slotNo] = DMRGWS_DMRNETWORK5;
|
||||||
timer[slotNo]->setTimeout(netTimeout);
|
timer[slotNo]->setTimeout(netTimeout);
|
||||||
|
|||||||
11
DynVoice.cpp
11
DynVoice.cpp
@@ -162,6 +162,17 @@ void CDynVoice::unlinked()
|
|||||||
createVoice(words);
|
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)
|
void CDynVoice::createVoice(const std::vector<std::string>& words)
|
||||||
{
|
{
|
||||||
unsigned int ambeLength = 0U;
|
unsigned int ambeLength = 0U;
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ public:
|
|||||||
|
|
||||||
bool read(CDMRData& data);
|
bool read(CDMRData& data);
|
||||||
|
|
||||||
|
void abort();
|
||||||
|
|
||||||
void clock(unsigned int ms);
|
void clock(unsigned int ms);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -172,3 +172,9 @@ void CRewriteDynTGRF::tgChange(unsigned int slot, unsigned int tg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CRewriteDynTGRF::stopVoice(unsigned int slot)
|
||||||
|
{
|
||||||
|
if (slot == m_slot && m_voice != NULL)
|
||||||
|
m_voice->abort();
|
||||||
|
}
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ public:
|
|||||||
|
|
||||||
virtual PROCESS_RESULT process(CDMRData& data, bool trace);
|
virtual PROCESS_RESULT process(CDMRData& data, bool trace);
|
||||||
|
|
||||||
|
void stopVoice(unsigned int slot);
|
||||||
|
|
||||||
void tgChange(unsigned int slot, unsigned int tg);
|
void tgChange(unsigned int slot, unsigned int tg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user