Skip to content

Commit

Permalink
Merge pull request #806 from robotastic/fix-p25-parse
Browse files Browse the repository at this point in the history
Fix p25 parse
  • Loading branch information
robotastic authored May 7, 2023
2 parents dd20c8a + 93a5755 commit f7ece07
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
5 changes: 2 additions & 3 deletions lib/op25_repeater/lib/p25_frame_assembler_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,10 @@ static const int MAX_IN = 1; // maximum number of input streams
gr::io_signature::make ((do_output) ? 1 : 0, (do_output) ? 1 : 0, (do_audio_output && do_output) ? sizeof(int16_t) : ((do_output) ? sizeof(char) : 0 ))),
d_do_imbe(do_imbe),
d_do_output(do_output),
p1fdma(op25audio, logts, debug, do_imbe, do_output, do_msgq, queue, output_queue, do_audio_output, do_nocrypt),
p1fdma(op25audio, logts, debug, do_imbe, do_output, do_msgq, queue, output_queue, do_audio_output),
d_do_audio_output(do_audio_output),
d_do_phase2_tdma(do_phase2_tdma),
d_do_nocrypt(do_nocrypt),
p2tdma(op25audio, logts, 0, debug, do_msgq, queue, output_queue, do_audio_output, do_nocrypt),
p2tdma(op25audio, logts, 0, debug, do_msgq, queue, output_queue, do_audio_output),
d_do_msgq(do_msgq),
d_msg_queue(queue),
output_queue(),
Expand Down
1 change: 1 addition & 0 deletions lib/op25_repeater/lib/p25_frame_assembler_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "p25p1_fdma.h"
#include "p25p2_tdma.h"
#include "op25_audio.h"
#include "log_ts.h"

typedef std::deque<uint8_t> dibit_queue;

Expand Down
8 changes: 3 additions & 5 deletions lib/op25_repeater/lib/p25p1_fdma.cc
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,6 @@ namespace gr {
int p = 0;
if (!d_do_msgq)
return;
if (d_msg_queue->full_p())
return;
assert (len+2 <= (int)sizeof(wbuf));
wbuf[p++] = (nac >> 8) & 0xff;
wbuf[p++] = nac & 0xff;
Expand Down Expand Up @@ -752,7 +750,7 @@ namespace gr {
}
} else {
std::string encr = "{\"encrypted\": " + std::to_string(1) + ", \"algid\": " + std::to_string(ess_algid) + ", \"keyid\": " + std::to_string(ess_keyid) + "}";
send_msg(encr, M_P25_JSON_DATA);
//send_msg(encr, M_P25_JSON_DATA);
}
}

Expand Down Expand Up @@ -782,8 +780,8 @@ namespace gr {
if (!d_do_msgq)
return;

gr::message::sptr msg = gr::message::make_from_string(msg_str, msg_type, 0);
//gr::message::sptr msg = gr::message::make_from_string(msg_str, get_msg_type(PROTOCOL_P25, msg_type), d_sys_num, 0);
gr::message::sptr msg = gr::message::make_from_string(msg_str, msg_type);

if (!d_msg_queue->full_p())
d_msg_queue->insert_tail(msg);
}
Expand Down
12 changes: 6 additions & 6 deletions trunk-recorder/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1470,13 +1470,12 @@ void monitor_messages() {
for (vector<System *>::iterator sys_it = systems.begin(); sys_it != systems.end(); sys_it++) {
System_impl *system = (System_impl *)*sys_it;

if ((system->get_system_type() == "P25") || (system->get_system_type() == "smartnet") ) {

while ((msg = system->get_msg_queue()->delete_head_nowait()) != 0) {



system->set_message_count(sys->get_message_count() + 1);
if ((system->get_system_type() == "p25") || (system->get_system_type() == "smartnet") ) {
msg.reset();
msg = system->get_msg_queue()->delete_head_nowait();
while (msg != 0) {
system->set_message_count(system->get_message_count() + 1);

if (system->get_system_type() == "smartnet") {
trunk_messages = smartnet_parser->parse_message(msg->to_string(), system);
Expand All @@ -1494,6 +1493,7 @@ for (vector<System *>::iterator sys_it = systems.begin(); sys_it != systems.end(
}

msg.reset();
msg = system->get_msg_queue()->delete_head_nowait();
}
}
}
Expand Down

0 comments on commit f7ece07

Please sign in to comment.