From 5b56230b795846065295a7b3a90a714b76bf9e31 Mon Sep 17 00:00:00 2001 From: aaknitt Date: Sat, 26 Feb 2022 22:04:15 -0600 Subject: [PATCH 1/5] add printouts to p25_parser.cc for patch debugging --- trunk-recorder/systems/p25_parser.cc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/trunk-recorder/systems/p25_parser.cc b/trunk-recorder/systems/p25_parser.cc index 97f521af4..558ec7ef8 100644 --- a/trunk-recorder/systems/p25_parser.cc +++ b/trunk-recorder/systems/p25_parser.cc @@ -977,6 +977,29 @@ std::vector P25Parser::parse_message(gr::message::sptr msg) { // self.trunked_systems[nac].decode_mbt_data(opcode, header << 16, mbt_data // << 32) } + else if (type == 18){ + uint8_t opcode = (uint8_t)s[0]; + uint8_t mfrid = (uint8_t)s[1]; + BOOST_LOG_TRIVIAL(debug) <<"FOUND A TYPE 18 TDMA PDU MESSAGE WITH OPCODE " << opcode <<" AND MFRID "<< mfrid; + BOOST_LOG_TRIVIAL(debug) << s; + boost::dynamic_bitset<> b((s.length() + 2) * 8); + for (unsigned int i = 0; i < s.length(); ++i) { + unsigned char c = (unsigned char)s[i]; + b <<= 8; + + for (int j = 0; j < 8; j++) { + if (c & 0x1) { + b[j] = 1; + } else { + b[j] = 0; + } + c >>= 1; + } + } + b <<= 16; // for missing crc + BOOST_LOG_TRIVIAL(debug) << b; + //return decode_tdma(b, nac, sys_num); + } messages.push_back(message); return messages; } From 7a2a2a07d0fcffcdc966cd3a341e2e92080ce6be Mon Sep 17 00:00:00 2001 From: aaknitt Date: Sun, 27 Feb 2022 19:11:55 -0600 Subject: [PATCH 2/5] additional debug printout --- trunk-recorder/systems/p25_parser.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/trunk-recorder/systems/p25_parser.cc b/trunk-recorder/systems/p25_parser.cc index 558ec7ef8..45b777f26 100644 --- a/trunk-recorder/systems/p25_parser.cc +++ b/trunk-recorder/systems/p25_parser.cc @@ -621,6 +621,7 @@ std::vector P25Parser::decode_tsbk(boost::dynamic_bitset<> &tsbk, BOOST_LOG_TRIVIAL(debug) << "tsbk2f\tUnit Deregistration ACK\tSource ID: " << std::setw(7) << si; } else if (opcode == 0x30) { unsigned long mfrid = bitset_shift_mask(tsbk, 80, 0xff); + BOOST_LOG_TRIVIAL(debug) << "Opcode 0x30 with mfrid " << mfrid; if (mfrid == 0xA4) { // GRG_EXENC_CMD (M/A-COM patch) unsigned long grg_t = bitset_shift_mask(tsbk, 79, 0x1); unsigned long grg_g = bitset_shift_mask(tsbk, 28, 0x1); From 489feac62725f7bf8db5737583076a61ca26e2ee Mon Sep 17 00:00:00 2001 From: aaknitt Date: Sun, 27 Feb 2022 20:23:40 -0600 Subject: [PATCH 3/5] more debug output --- trunk-recorder/systems/p25_parser.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/trunk-recorder/systems/p25_parser.cc b/trunk-recorder/systems/p25_parser.cc index 45b777f26..13d9b485f 100644 --- a/trunk-recorder/systems/p25_parser.cc +++ b/trunk-recorder/systems/p25_parser.cc @@ -632,6 +632,7 @@ std::vector P25Parser::decode_tsbk(boost::dynamic_bitset<> &tsbk, unsigned long rta = bitset_shift_mask(tsbk, 16, 0xffffff); unsigned long algid = (rta >> 16) & 0xff; unsigned long ga = rta & 0xffff; + BOOST_LOG_TRIVIAL(debug)<<"grg_t: " << grg_t << " grg_g: " << grg_g << " grg_a: " << grg_a << " sg: " << sg << " ga: " << ga; if (grg_a == 1){ // Activate if (grg_g == 1){ // Group request message.message_type = PATCH_ADD; From 6e6b9c080be2e0e06ce10548db97c67beec83759 Mon Sep 17 00:00:00 2001 From: aaknitt Date: Sun, 27 Feb 2022 20:43:06 -0600 Subject: [PATCH 4/5] m/a-com patch add and delete for grg_g == 0 (unit request) in addition to existing group request (grg_a == 1) --- trunk-recorder/systems/p25_parser.cc | 29 +++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/trunk-recorder/systems/p25_parser.cc b/trunk-recorder/systems/p25_parser.cc index 13d9b485f..ac0aa046e 100644 --- a/trunk-recorder/systems/p25_parser.cc +++ b/trunk-recorder/systems/p25_parser.cc @@ -621,7 +621,6 @@ std::vector P25Parser::decode_tsbk(boost::dynamic_bitset<> &tsbk, BOOST_LOG_TRIVIAL(debug) << "tsbk2f\tUnit Deregistration ACK\tSource ID: " << std::setw(7) << si; } else if (opcode == 0x30) { unsigned long mfrid = bitset_shift_mask(tsbk, 80, 0xff); - BOOST_LOG_TRIVIAL(debug) << "Opcode 0x30 with mfrid " << mfrid; if (mfrid == 0xA4) { // GRG_EXENC_CMD (M/A-COM patch) unsigned long grg_t = bitset_shift_mask(tsbk, 79, 0x1); unsigned long grg_g = bitset_shift_mask(tsbk, 28, 0x1); @@ -632,7 +631,6 @@ std::vector P25Parser::decode_tsbk(boost::dynamic_bitset<> &tsbk, unsigned long rta = bitset_shift_mask(tsbk, 16, 0xffffff); unsigned long algid = (rta >> 16) & 0xff; unsigned long ga = rta & 0xffff; - BOOST_LOG_TRIVIAL(debug)<<"grg_t: " << grg_t << " grg_g: " << grg_g << " grg_a: " << grg_a << " sg: " << sg << " ga: " << ga; if (grg_a == 1){ // Activate if (grg_g == 1){ // Group request message.message_type = PATCH_ADD; @@ -642,13 +640,21 @@ std::vector P25Parser::decode_tsbk(boost::dynamic_bitset<> &tsbk, harris_patch_data.ga2 = ga; harris_patch_data.ga3 = ga; message.patch_data = harris_patch_data; - BOOST_LOG_TRIVIAL(debug) << "tsbk30 M/A-COM PATCH sg TGID is "< P25Parser::decode_tsbk(boost::dynamic_bitset<> &tsbk, harris_patch_data.ga2 = ga; harris_patch_data.ga3 = ga; message.patch_data = harris_patch_data; - BOOST_LOG_TRIVIAL(debug) << "tsbk30 M/A-COM PATCH DELETE for sg "< Date: Sun, 27 Feb 2022 21:41:32 -0600 Subject: [PATCH 5/5] remove debugging code --- trunk-recorder/systems/p25_parser.cc | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/trunk-recorder/systems/p25_parser.cc b/trunk-recorder/systems/p25_parser.cc index ac0aa046e..0bad43c72 100644 --- a/trunk-recorder/systems/p25_parser.cc +++ b/trunk-recorder/systems/p25_parser.cc @@ -994,29 +994,6 @@ std::vector P25Parser::parse_message(gr::message::sptr msg) { // self.trunked_systems[nac].decode_mbt_data(opcode, header << 16, mbt_data // << 32) } - else if (type == 18){ - uint8_t opcode = (uint8_t)s[0]; - uint8_t mfrid = (uint8_t)s[1]; - BOOST_LOG_TRIVIAL(debug) <<"FOUND A TYPE 18 TDMA PDU MESSAGE WITH OPCODE " << opcode <<" AND MFRID "<< mfrid; - BOOST_LOG_TRIVIAL(debug) << s; - boost::dynamic_bitset<> b((s.length() + 2) * 8); - for (unsigned int i = 0; i < s.length(); ++i) { - unsigned char c = (unsigned char)s[i]; - b <<= 8; - - for (int j = 0; j < 8; j++) { - if (c & 0x1) { - b[j] = 1; - } else { - b[j] = 0; - } - c >>= 1; - } - } - b <<= 16; // for missing crc - BOOST_LOG_TRIVIAL(debug) << b; - //return decode_tdma(b, nac, sys_num); - } messages.push_back(message); return messages; }