mirror of
https://github.com/ShaYmez/P25Clients.git
synced 2024-11-22 04:11:39 -05:00
Modify the protocol and simplify the speech generation.
This commit is contained in:
parent
168cdbeec7
commit
411173efdc
@ -307,8 +307,8 @@ void CP25Gateway::run()
|
|||||||
lostTimer.start();
|
lostTimer.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (buffer[0U] == 0x6AU || buffer[0U] == 0x73U) {
|
} else if (buffer[0U] == 0x80U) {
|
||||||
if (buffer[15U] == 0x00U && speech != NULL)
|
if (speech != NULL)
|
||||||
speech->eof();
|
speech->eof();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,12 +31,63 @@
|
|||||||
const unsigned int SRC_ID = 10999U;
|
const unsigned int SRC_ID = 10999U;
|
||||||
|
|
||||||
const unsigned char REC62[] = {
|
const unsigned char REC62[] = {
|
||||||
0x62U, 0x02U, 0x02U, 0x0CU, 0x0BU, 0x35U, 0xA3U, 0x1AU, 0x65U, 0x80U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U,
|
0x62U, 0x02U, 0x02U, 0x0CU, 0x0BU, 0x1BU, 0x5AU, 0x1AU, 0x2BU, 0x80U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U,
|
||||||
0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U };
|
0x00U, 0x00U, 0x00U, 0x00U, 0x02U };
|
||||||
|
|
||||||
|
const unsigned char REC63[] = {
|
||||||
|
0x63U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x7AU };
|
||||||
|
|
||||||
|
const unsigned char REC64[] = {
|
||||||
|
0x64U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U };
|
||||||
|
|
||||||
|
const unsigned char REC65[] = {
|
||||||
|
0x65U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U };
|
||||||
|
|
||||||
|
const unsigned char REC66[] = {
|
||||||
|
0x66U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U };
|
||||||
|
|
||||||
|
const unsigned char REC67[] = {
|
||||||
|
0x67U, 0xC4U, 0x52U, 0x9BU, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U };
|
||||||
|
|
||||||
|
const unsigned char REC68[] = {
|
||||||
|
0x68U, 0x9AU, 0xECU, 0xBAU, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U };
|
||||||
|
|
||||||
|
const unsigned char REC69[] = {
|
||||||
|
0x69U, 0xB9U, 0xD8U, 0x16U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U };
|
||||||
|
|
||||||
|
const unsigned char REC6A[] = {
|
||||||
|
0x6AU, 0x00U, 0x00U, 0x06U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U };
|
||||||
|
|
||||||
const unsigned char REC6B[] = {
|
const unsigned char REC6B[] = {
|
||||||
0x6BU, 0x02U, 0x02U, 0x0CU, 0x0BU, 0x35U, 0xA3U, 0x1AU, 0x64U, 0x9CU, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U,
|
0x6BU, 0x02U, 0x02U, 0x0CU, 0x0BU, 0x1BU, 0x5AU, 0x1AU, 0x2BU, 0xACU, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U,
|
||||||
0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U };
|
0x00U, 0x00U, 0x00U, 0x00U, 0x02U };
|
||||||
|
|
||||||
|
const unsigned char REC6C[] = {
|
||||||
|
0x6CU, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0xD6U };
|
||||||
|
|
||||||
|
const unsigned char REC6D[] = {
|
||||||
|
0x6DU, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U };
|
||||||
|
|
||||||
|
const unsigned char REC6E[] = {
|
||||||
|
0x6EU, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U };
|
||||||
|
|
||||||
|
const unsigned char REC6F[] = {
|
||||||
|
0x6FU, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U };
|
||||||
|
|
||||||
|
const unsigned char REC70[] = {
|
||||||
|
0x70U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U };
|
||||||
|
|
||||||
|
const unsigned char REC71[] = {
|
||||||
|
0x71U, 0xACU, 0xB8U, 0xA4U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U };
|
||||||
|
|
||||||
|
const unsigned char REC72[] = {
|
||||||
|
0x72U, 0x9BU, 0xDCU, 0x75U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U };
|
||||||
|
|
||||||
|
const unsigned char REC73[] = {
|
||||||
|
0x73U, 0x00U, 0x00U, 0x06U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U };
|
||||||
|
|
||||||
|
const unsigned char REC80[] = {
|
||||||
|
0x80U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U };
|
||||||
|
|
||||||
CSpeech::CSpeech(CNetwork& network, const in_addr& address, unsigned int port) :
|
CSpeech::CSpeech(CNetwork& network, const in_addr& address, unsigned int port) :
|
||||||
m_network(network),
|
m_network(network),
|
||||||
@ -135,81 +186,55 @@ void CSpeech::clock(unsigned int ms)
|
|||||||
m_n = 0x63U;
|
m_n = 0x63U;
|
||||||
break;
|
break;
|
||||||
case 0x63U:
|
case 0x63U:
|
||||||
::memset(buffer, 0x00U, 14U);
|
::memcpy(buffer, REC63, 14U);
|
||||||
buffer[0U] = 0x63U;
|
|
||||||
buffer[13U] = 0x7AU;
|
|
||||||
::memcpy(buffer + 1U, m_speech + (m_pos * 11U), 11U);
|
::memcpy(buffer + 1U, m_speech + (m_pos * 11U), 11U);
|
||||||
m_network.writeData(buffer, 14U, m_address, m_port);
|
m_network.writeData(buffer, 14U, m_address, m_port);
|
||||||
m_n = 0x64U;
|
m_n = 0x64U;
|
||||||
break;
|
break;
|
||||||
case 0x64U:
|
case 0x64U:
|
||||||
::memset(buffer, 0x00U, 17U);
|
::memcpy(buffer, REC64, 17U);
|
||||||
buffer[0U] = 0x64U;
|
|
||||||
buffer[16U] = 0x02U;
|
|
||||||
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
||||||
m_network.writeData(buffer, 17U, m_address, m_port);
|
m_network.writeData(buffer, 17U, m_address, m_port);
|
||||||
m_n = 0x65U;
|
m_n = 0x65U;
|
||||||
break;
|
break;
|
||||||
case 0x65U:
|
case 0x65U:
|
||||||
::memset(buffer, 0x00U, 17U);
|
::memcpy(buffer, REC65, 17U);
|
||||||
buffer[0U] = 0x65U;
|
|
||||||
buffer[1U] = (m_id >> 16) & 0xFFU;
|
buffer[1U] = (m_id >> 16) & 0xFFU;
|
||||||
buffer[2U] = (m_id >> 8) & 0xFFU;
|
buffer[2U] = (m_id >> 8) & 0xFFU;
|
||||||
buffer[3U] = (m_id >> 0) & 0xFFU;
|
buffer[3U] = (m_id >> 0) & 0xFFU;
|
||||||
buffer[16U] = 0x02U;
|
|
||||||
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
||||||
m_network.writeData(buffer, 17U, m_address, m_port);
|
m_network.writeData(buffer, 17U, m_address, m_port);
|
||||||
m_n = 0x66U;
|
m_n = 0x66U;
|
||||||
break;
|
break;
|
||||||
case 0x66U:
|
case 0x66U:
|
||||||
::memset(buffer, 0x00U, 17U);
|
::memcpy(buffer, REC66, 17U);
|
||||||
buffer[0U] = 0x66U;
|
|
||||||
buffer[1U] = (SRC_ID >> 16) & 0xFFU;
|
buffer[1U] = (SRC_ID >> 16) & 0xFFU;
|
||||||
buffer[2U] = (SRC_ID >> 8) & 0xFFU;
|
buffer[2U] = (SRC_ID >> 8) & 0xFFU;
|
||||||
buffer[3U] = (SRC_ID >> 0) & 0xFFU;
|
buffer[3U] = (SRC_ID >> 0) & 0xFFU;
|
||||||
buffer[16U] = 0x02U;
|
|
||||||
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
||||||
m_network.writeData(buffer, 17U, m_address, m_port);
|
m_network.writeData(buffer, 17U, m_address, m_port);
|
||||||
m_n = 0x67U;
|
m_n = 0x67U;
|
||||||
break;
|
break;
|
||||||
case 0x67U:
|
case 0x67U:
|
||||||
::memset(buffer, 0x00U, 17U);
|
::memcpy(buffer, REC67, 17U);
|
||||||
buffer[0U] = 0x67U;
|
|
||||||
buffer[1U] = 0x28U; // XXX ???
|
|
||||||
buffer[2U] = 0xD6U; // XXX ???
|
|
||||||
buffer[3U] = 0x58U; // XXX ???
|
|
||||||
buffer[16U] = 0x02U;
|
|
||||||
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
||||||
m_network.writeData(buffer, 17U, m_address, m_port);
|
m_network.writeData(buffer, 17U, m_address, m_port);
|
||||||
m_n = 0x68U;
|
m_n = 0x68U;
|
||||||
break;
|
break;
|
||||||
case 0x68U:
|
case 0x68U:
|
||||||
::memset(buffer, 0x00U, 17U);
|
::memcpy(buffer, REC68, 17U);
|
||||||
buffer[0U] = 0x68U;
|
|
||||||
buffer[1U] = 0xA0U; // XXX ???
|
|
||||||
buffer[2U] = 0x81U; // XXX ???
|
|
||||||
buffer[3U] = 0x9CU; // XXX ???
|
|
||||||
buffer[16U] = 0x02U;
|
|
||||||
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
||||||
m_network.writeData(buffer, 17U, m_address, m_port);
|
m_network.writeData(buffer, 17U, m_address, m_port);
|
||||||
m_n = 0x69U;
|
m_n = 0x69U;
|
||||||
break;
|
break;
|
||||||
case 0x69U:
|
case 0x69U:
|
||||||
::memset(buffer, 0x00U, 17U);
|
::memcpy(buffer, REC69, 17U);
|
||||||
buffer[0U] = 0x69U;
|
|
||||||
buffer[1U] = 0x0EU; // XXX ???
|
|
||||||
buffer[2U] = 0x74U; // XXX ???
|
|
||||||
buffer[3U] = 0xBCU; // XXX ???
|
|
||||||
buffer[16U] = 0x02U;
|
|
||||||
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
||||||
m_network.writeData(buffer, 17U, m_address, m_port);
|
m_network.writeData(buffer, 17U, m_address, m_port);
|
||||||
m_n = 0x6AU;
|
m_n = 0x6AU;
|
||||||
break;
|
break;
|
||||||
case 0x6AU:
|
case 0x6AU:
|
||||||
::memset(buffer, 0x00U, 16U);
|
::memcpy(buffer, REC6A, 16U);
|
||||||
buffer[0U] = 0x6AU;
|
|
||||||
buffer[3U] = 0x0EU; // XXX ???
|
|
||||||
buffer[15U] = (m_pos == (m_count - 1U)) ? 0x00U : 0x02U;
|
|
||||||
::memcpy(buffer + 4U, m_speech + (m_pos * 11U), 11U);
|
::memcpy(buffer + 4U, m_speech + (m_pos * 11U), 11U);
|
||||||
m_network.writeData(buffer, 16U, m_address, m_port);
|
m_network.writeData(buffer, 16U, m_address, m_port);
|
||||||
m_n = 0x6BU;
|
m_n = 0x6BU;
|
||||||
@ -221,74 +246,49 @@ void CSpeech::clock(unsigned int ms)
|
|||||||
m_n = 0x6CU;
|
m_n = 0x6CU;
|
||||||
break;
|
break;
|
||||||
case 0x6CU:
|
case 0x6CU:
|
||||||
::memset(buffer, 0x00U, 14U);
|
::memcpy(buffer, REC6C, 14U);
|
||||||
buffer[0U] = 0x6CU;
|
|
||||||
buffer[12U] = 0x02U;
|
|
||||||
buffer[13U] = 0xF6U;
|
|
||||||
::memcpy(buffer + 1U, m_speech + (m_pos * 11U), 11U);
|
::memcpy(buffer + 1U, m_speech + (m_pos * 11U), 11U);
|
||||||
m_network.writeData(buffer, 14U, m_address, m_port);
|
m_network.writeData(buffer, 14U, m_address, m_port);
|
||||||
m_n = 0x6DU;
|
m_n = 0x6DU;
|
||||||
break;
|
break;
|
||||||
case 0x6DU:
|
case 0x6DU:
|
||||||
::memset(buffer, 0x00U, 17U);
|
::memcpy(buffer, REC6D, 17U);
|
||||||
buffer[0U] = 0x6DU;
|
|
||||||
buffer[16U] = 0x02U;
|
|
||||||
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
||||||
m_network.writeData(buffer, 17U, m_address, m_port);
|
m_network.writeData(buffer, 17U, m_address, m_port);
|
||||||
m_n = 0x6EU;
|
m_n = 0x6EU;
|
||||||
break;
|
break;
|
||||||
case 0x6EU:
|
case 0x6EU:
|
||||||
::memset(buffer, 0x00U, 17U);
|
::memcpy(buffer, REC6E, 17U);
|
||||||
buffer[0U] = 0x6EU;
|
|
||||||
buffer[16U] = 0x02U;
|
|
||||||
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
||||||
m_network.writeData(buffer, 17U, m_address, m_port);
|
m_network.writeData(buffer, 17U, m_address, m_port);
|
||||||
m_n = 0x6FU;
|
m_n = 0x6FU;
|
||||||
break;
|
break;
|
||||||
case 0x6FU:
|
case 0x6FU:
|
||||||
::memset(buffer, 0x00U, 17U);
|
::memcpy(buffer, REC6F, 17U);
|
||||||
buffer[0U] = 0x6FU;
|
|
||||||
buffer[16U] = 0x02U;
|
|
||||||
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
||||||
m_network.writeData(buffer, 17U, m_address, m_port);
|
m_network.writeData(buffer, 17U, m_address, m_port);
|
||||||
m_n = 0x70U;
|
m_n = 0x70U;
|
||||||
break;
|
break;
|
||||||
case 0x70U:
|
case 0x70U:
|
||||||
::memset(buffer, 0x00U, 17U);
|
::memcpy(buffer, REC70, 17U);
|
||||||
buffer[0U] = 0x70U;
|
|
||||||
buffer[1U] = 0x80U;
|
|
||||||
buffer[16U] = 0x02U;
|
|
||||||
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
||||||
m_network.writeData(buffer, 17U, m_address, m_port);
|
m_network.writeData(buffer, 17U, m_address, m_port);
|
||||||
m_n = 0x71U;
|
m_n = 0x71U;
|
||||||
break;
|
break;
|
||||||
case 0x71U:
|
case 0x71U:
|
||||||
::memset(buffer, 0x00U, 17U);
|
::memcpy(buffer, REC71, 17U);
|
||||||
buffer[0U] = 0x71U;
|
|
||||||
buffer[1U] = 0xACU; // XXX ???
|
|
||||||
buffer[2U] = 0xB8U; // XXX ???
|
|
||||||
buffer[3U] = 0xA4U; // XXX ???
|
|
||||||
buffer[16U] = 0x02U;
|
|
||||||
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
||||||
m_network.writeData(buffer, 17U, m_address, m_port);
|
m_network.writeData(buffer, 17U, m_address, m_port);
|
||||||
m_n = 0x72U;
|
m_n = 0x72U;
|
||||||
break;
|
break;
|
||||||
case 0x72U:
|
case 0x72U:
|
||||||
::memset(buffer, 0x00U, 17U);
|
::memcpy(buffer, REC72, 17U);
|
||||||
buffer[0U] = 0x72U;
|
|
||||||
buffer[1U] = 0x9BU; // XXX ???
|
|
||||||
buffer[2U] = 0xDCU; // XXX ???
|
|
||||||
buffer[3U] = 0x75U; // XXX ???
|
|
||||||
buffer[16U] = 0x02U;
|
|
||||||
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
::memcpy(buffer + 5U, m_speech + (m_pos * 11U), 11U);
|
||||||
m_network.writeData(buffer, 17U, m_address, m_port);
|
m_network.writeData(buffer, 17U, m_address, m_port);
|
||||||
m_n = 0x73U;
|
m_n = 0x73U;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
::memset(buffer, 0x00U, 16U);
|
::memcpy(buffer, REC73, 16U);
|
||||||
buffer[0U] = 0x73U;
|
|
||||||
buffer[3U] = 0x06U; // XXX ???
|
|
||||||
buffer[15U] = (m_pos == (m_count - 1U)) ? 0x00U : 0x02U;
|
|
||||||
::memcpy(buffer + 4U, m_speech + (m_pos * 11U), 11U);
|
::memcpy(buffer + 4U, m_speech + (m_pos * 11U), 11U);
|
||||||
m_network.writeData(buffer, 16U, m_address, m_port);
|
m_network.writeData(buffer, 16U, m_address, m_port);
|
||||||
m_n = 0x62U;
|
m_n = 0x62U;
|
||||||
@ -296,6 +296,7 @@ void CSpeech::clock(unsigned int ms)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_pos == (m_count - 1U)) {
|
if (m_pos == (m_count - 1U)) {
|
||||||
|
m_network.writeData(REC80, 17U, m_address, m_port);
|
||||||
m_state = SS_NONE;
|
m_state = SS_NONE;
|
||||||
m_id = 0U;
|
m_id = 0U;
|
||||||
return;
|
return;
|
||||||
|
@ -103,7 +103,7 @@ void CP25Parrot::run()
|
|||||||
parrot.write(buffer, len);
|
parrot.write(buffer, len);
|
||||||
watchdogTimer.start();
|
watchdogTimer.start();
|
||||||
|
|
||||||
if ((buffer[0U] == 0x6AU && buffer[15U] == 0x00U) || (buffer[0U] == 0x73U && buffer[15U] == 0x00U)) {
|
if (buffer[0U] == 0x80U) {
|
||||||
LogDebug("Received end of transmission");
|
LogDebug("Received end of transmission");
|
||||||
turnaroundTimer.start();
|
turnaroundTimer.start();
|
||||||
watchdogTimer.stop();
|
watchdogTimer.stop();
|
||||||
|
Loading…
Reference in New Issue
Block a user