Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P25 Trunking Message Improvements #820

Merged
merged 22 commits into from
Jun 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
error messages
  • Loading branch information
robotastic committed Jun 1, 2023
commit ac54d36783b7d8d24f2e2ecf9b8c76ffc133cbf0
27 changes: 15 additions & 12 deletions lib/op25_repeater/lib/p25_frame_assembler_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ p25_frame_assembler_impl::general_work (int noutput_items,
terminate_call = true;
p2tdma.reset_call_terminated();
}

tdma_src_id = p2tdma.get_ptt_src_id();
tdma_grp_id = p2tdma.get_ptt_grp_id();

if (rc > -1) {
p25p2_queue_msg(rc);
Expand All @@ -171,9 +168,6 @@ p25_frame_assembler_impl::general_work (int noutput_items,
terminate_call = true;
p1fdma.reset_call_terminated();
}

fdma_src_id = p1fdma.get_curr_src_id();
fdma_grp_id = p1fdma.get_curr_grp_id();
}

int amt_produce = 0;
Expand All @@ -185,12 +179,12 @@ p25_frame_assembler_impl::general_work (int noutput_items,

//BOOST_LOG_TRIVIAL(trace) << "P25 Frame Assembler - output_queue: " << output_queue.size() << " noutput_items: " << noutput_items << " ninput_items: " << ninput_items[0];

if (amt_produce > 0) {
if (amt_produce >= 32768) {
BOOST_LOG_TRIVIAL(error) << "P25 Frame Assembler - output_queue size: " << output_queue.size() << " max size: " << output_queue.max_size() << " limiting amt_produce to 32767 ";
amt_produce = 32767; // buffer limit is 32768, see gnuradio/gnuradio-runtime/lib/../include/gnuradio/buffer.h:186
}
tdma_src_id = p2tdma.get_ptt_src_id();
tdma_grp_id = p2tdma.get_ptt_grp_id();
fdma_src_id = p1fdma.get_curr_src_id();
fdma_grp_id = p1fdma.get_curr_grp_id();

BOOST_LOG_TRIVIAL(info) << "TDMA grp id: " << tdma_grp_id;

// If a SRC wasn't received on the voice channel since the last check, it will be -1
if (fdma_src_id > 0) {
Expand All @@ -217,6 +211,15 @@ p25_frame_assembler_impl::general_work (int noutput_items,
BOOST_LOG_TRIVIAL(info) << " Both TDMA and FDMA GRP IDs are set. TDMA: " << tdma_grp_id << " FDMA: " << fdma_grp_id;
}



if (amt_produce > 0) {
if (amt_produce >= 32768) {
BOOST_LOG_TRIVIAL(error) << "P25 Frame Assembler - output_queue size: " << output_queue.size() << " max size: " << output_queue.max_size() << " limiting amt_produce to 32767 ";

amt_produce = 32767; // buffer limit is 32768, see gnuradio/gnuradio-runtime/lib/../include/gnuradio/buffer.h:186
}

for (int i = 0; i < amt_produce; i++) {
out[i] = output_queue[i];
}
Expand Down
10 changes: 9 additions & 1 deletion lib/op25_repeater/lib/p25p2_tdma.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ bool p25p2_tdma::rx_sym(uint8_t sym)
terminate_call = false;
src_id = -1;
grp_id = -1;
fprintf(stderr, "Setting GRP ID to -1\n");
return p2framer.rx_sym(sym);
}

Expand Down Expand Up @@ -160,7 +161,8 @@ long p25p2_tdma::get_ptt_src_id() {
long p25p2_tdma::get_ptt_grp_id() {
long addr = grp_id;
grp_id = -1;
return grp_id;
fprintf(stderr, "Getting GRP ID %ld and setting it back to -1\n", addr);
return addr;
}

p25p2_tdma::~p25p2_tdma() // destructor
Expand Down Expand Up @@ -261,6 +263,8 @@ void p25p2_tdma::handle_mac_ptt(const uint8_t byte_buf[], const unsigned int len

src_id = srcaddr;
grp_id = grpaddr;

fprintf(stderr, "MAC PTT src_id=%u, grp_id=%u\n", src_id, grp_id);
std::string s = "{\"srcaddr\" : " + std::to_string(srcaddr) + ", \"grpaddr\": " + std::to_string(grpaddr) + "}";
send_msg(s, -3);
reset_vb();
Expand All @@ -280,6 +284,10 @@ void p25p2_tdma::handle_mac_end_ptt(const uint8_t byte_buf[], const unsigned int
uint32_t srcaddr = (byte_buf[13] << 16) + (byte_buf[14] << 8) + byte_buf[15];
uint16_t grpaddr = (byte_buf[16] << 8) + byte_buf[17];

src_id = srcaddr;
grp_id = grpaddr;

fprintf(stderr, "MAC END PTT src_id=%u, grp_id=%u\n", src_id, grp_id);
if (d_debug >= 10)
fprintf(stderr, "%s MAC_END_PTT: colorcd=0x%03x, srcaddr=%u, grpaddr=%u, rs_errs=%d\n", logts.get(d_msgq_id), colorcd, srcaddr, grpaddr, rs_errs);

Expand Down
1 change: 1 addition & 0 deletions trunk-recorder/recorders/p25_recorder_decode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ void p25_recorder_decode::reset() {
reset_block(slicer);
reset_block(levels);
reset_block(wav_sink);
op25_frame_assembler->clear();
}

gr::op25_repeater::p25_frame_assembler::sptr p25_recorder_decode::get_transmission_sink() {
Expand Down