Start the voice timer after the end of the transmission.

This commit is contained in:
Jonathan Naylor 2018-03-20 22:23:06 +00:00
parent ca206115ff
commit 74f3674cff
3 changed files with 16 additions and 9 deletions

View File

@ -258,7 +258,8 @@ void CNXDNGateway::run()
// From the MMDVM to the reflector or control data
len = localNetwork.read(buffer, address, port);
if (len > 0U) {
if (buffer[0U] == 0x81U || buffer[0U] == 0x83U) {
// Only process the beginning and ending blocks here
if ((buffer[0U] == 0x81U || buffer[0U] == 0x83U) && (buffer[5U] == 0x01U || buffer[5U] == 0x08U)) {
grp = (buffer[7U] & 0x20U) == 0x20U;
srcId = (buffer[8U] << 8) & 0xFF00U;
@ -314,6 +315,12 @@ void CNXDNGateway::run()
lostTimer.start();
}
}
// If it's the end of the transmission, start the voice
if (buffer[5U] == 0x08U) {
if (voice != NULL)
voice->eof();
}
}
// If we're linked and we have a network, send it on

View File

@ -255,9 +255,6 @@ void CVoice::createVoice(unsigned int tg, const std::vector<std::string>& words)
createTrailer(true, tg);
delete[] ambeData;
m_status = VS_WAITING;
m_timer.start();
}
unsigned int CVoice::read(unsigned char* data)
@ -288,11 +285,14 @@ unsigned int CVoice::read(unsigned char* data)
return 0U;
}
void CVoice::abort()
void CVoice::eof()
{
m_status = VS_NONE;
m_voiceLength = 0U;
m_sent = 0U;
if (m_voiceLength == 0U)
return;
m_status = VS_WAITING;
m_timer.start();
}
void CVoice::clock(unsigned int ms)

View File

@ -49,7 +49,7 @@ public:
unsigned int read(unsigned char* data);
void abort();
void eof();
void clock(unsigned int ms);