diff --git a/POCSAGControl.cpp b/POCSAGControl.cpp index 8154cb1..ebcf800 100644 --- a/POCSAGControl.cpp +++ b/POCSAGControl.cpp @@ -30,6 +30,7 @@ const uint32_t DATA_MASK[] = { 0x40000000U, 0x20000000U, 0x10000000U 0x00000800U}; const unsigned char ASCII_NUL = 0x00U; +const unsigned char ASCII_EOT = 0x04U; CPOCSAGControl::CPOCSAGControl(CPOCSAGNetwork* network, CDisplay* display) : m_network(network), @@ -205,7 +206,25 @@ void CPOCSAGControl::packASCII() } } - // Fill remaining space wit NUL characters. + // Add two EOT characters. + for (unsigned int i = 0U; i < 2U; i++) { + unsigned char c = ASCII_EOT; + for (unsigned int j = 0U; j < 7U; j++, c >>= 1) { + bool b = (c & MASK) == MASK; + if (b) + word |= DATA_MASK[n]; + n++; + + if (n == 20U) { + addBCHAndParity(word); + m_buffer.push_back(word); + word = 0x80000000U; + n = 0U; + } + } + } + + // Fill remaining space with NUL characters. while (n != 0U) { unsigned char c = ASCII_NUL; for (unsigned int j = 0U; j < 7U; j++, c >>= 1) {