From 1718ea5f3eed294de2c5d025858a8fdd33f5188d Mon Sep 17 00:00:00 2001 From: gisforgirard Date: Tue, 2 May 2023 17:45:22 -0400 Subject: [PATCH 01/11] Update p25_frame_assembler_impl.cc this is the actual crash fix i kept messing up, for real this time --- lib/op25_repeater/lib/p25_frame_assembler_impl.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/op25_repeater/lib/p25_frame_assembler_impl.cc b/lib/op25_repeater/lib/p25_frame_assembler_impl.cc index a49f39512..106e2a35f 100644 --- a/lib/op25_repeater/lib/p25_frame_assembler_impl.cc +++ b/lib/op25_repeater/lib/p25_frame_assembler_impl.cc @@ -183,6 +183,10 @@ 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) << "just saved you from a crash, amt_produce = " << amt_produce; + amt_produce = 32767; // buffer limit is 32768, see gnuradio/gnuradio-runtime/lib/../include/gnuradio/buffer.h:186 + } long src_id = p1fdma.get_curr_src_id(); long grp_id = p1fdma.get_curr_grp_id(); // If a SRC wasn't received on the voice channel since the last check, it will be -1 @@ -254,4 +258,4 @@ p25_frame_assembler_impl::general_work (int noutput_items, } } } /* namespace op25_repeater */ -} /* namespace gr */ \ No newline at end of file +} /* namespace gr */ From 9be8181e4e1f5c917085af76fdb66780559e9505 Mon Sep 17 00:00:00 2001 From: Luke Berndt Date: Thu, 4 May 2023 21:23:21 -0400 Subject: [PATCH 02/11] Update p25_frame_assembler_impl.cc --- lib/op25_repeater/lib/p25_frame_assembler_impl.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/op25_repeater/lib/p25_frame_assembler_impl.cc b/lib/op25_repeater/lib/p25_frame_assembler_impl.cc index 106e2a35f..a6947ddce 100644 --- a/lib/op25_repeater/lib/p25_frame_assembler_impl.cc +++ b/lib/op25_repeater/lib/p25_frame_assembler_impl.cc @@ -184,7 +184,8 @@ p25_frame_assembler_impl::general_work (int noutput_items, if (amt_produce > 0) { if (amt_produce >= 32768) { - BOOST_LOG_TRIVIAL(error) << "just saved you from a crash, amt_produce = " << amt_produce; + 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 } long src_id = p1fdma.get_curr_src_id(); From d62f678166ca274a95cbd9b36d802fe6b0d48b09 Mon Sep 17 00:00:00 2001 From: Luke Berndt Date: Thu, 4 May 2023 22:17:22 -0400 Subject: [PATCH 03/11] Setup Trunk Message queues for each system --- trunk-recorder/main.cc | 27 +++++++++++++++------------ trunk-recorder/systems/p25_parser.cc | 4 ++-- trunk-recorder/systems/p25_parser.h | 4 +++- trunk-recorder/systems/system.h | 4 ++-- trunk-recorder/systems/system_impl.cc | 5 +++++ trunk-recorder/systems/system_impl.h | 3 ++- 6 files changed, 29 insertions(+), 18 deletions(-) diff --git a/trunk-recorder/main.cc b/trunk-recorder/main.cc index 7584cb815..0ad217612 100644 --- a/trunk-recorder/main.cc +++ b/trunk-recorder/main.cc @@ -62,7 +62,6 @@ #include #include #include -#include #include #include @@ -83,7 +82,7 @@ std::map unit_affiliations; std::vector calls; gr::top_block_sptr tb; -gr::msg_queue::sptr msg_queue; + volatile sig_atomic_t exit_flag = 0; int exit_code = EXIT_SUCCESS; @@ -1462,9 +1461,13 @@ void monitor_messages() { plugman_poll_one(); - msg = msg_queue->delete_head_nowait(); - if (msg != 0) { +for (vector::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) { sys_num = msg->arg1(); sys = find_system(sys_num); @@ -1477,7 +1480,7 @@ void monitor_messages() { } if (sys->get_system_type() == "p25") { - trunk_messages = p25_parser->parse_message(msg); + trunk_messages = p25_parser->parse_message(msg, sys); handle_message(trunk_messages, sys); } } @@ -1487,7 +1490,9 @@ void monitor_messages() { } msg.reset(); - } else { + } + } +} current_time = time(NULL); if ((current_time - management_timestamp) >= 1.0) { @@ -1498,9 +1503,7 @@ void monitor_messages() { boost::this_thread::sleep(boost::posix_time::milliseconds(10)); // usleep(1000 * 10); - } - - current_time = time(NULL); + float decode_rate_check_time_diff = current_time - last_decode_rate_check; @@ -1652,7 +1655,7 @@ bool setup_systems() { system->smartnet_trunking = make_smartnet_trunking(control_channel_freq, source->get_center(), source->get_rate(), - msg_queue, + system->get_msg_queue(), system->get_sys_num()); tb->connect(source->get_src_block(), 0, system->smartnet_trunking, 0); } @@ -1663,7 +1666,7 @@ bool setup_systems() { system->p25_trunking = make_p25_trunking(control_channel_freq, source->get_center(), source->get_rate(), - msg_queue, + system->get_msg_queue(), system->get_qpsk_mod(), system->get_sys_num()); tb->connect(source->get_src_block(), 0, system->p25_trunking, 0); @@ -1736,7 +1739,7 @@ int main(int argc, char **argv) { tb = gr::make_top_block("Trunking"); tb->start(); tb->lock(); - msg_queue = gr::msg_queue::make(100); + smartnet_parser = new SmartnetParser(); // this has to eventually be generic; p25_parser = new P25Parser(); diff --git a/trunk-recorder/systems/p25_parser.cc b/trunk-recorder/systems/p25_parser.cc index 619cdd8cc..92b360442 100644 --- a/trunk-recorder/systems/p25_parser.cc +++ b/trunk-recorder/systems/p25_parser.cc @@ -885,11 +885,11 @@ void printbincharpad(char c) { // std::cout << " | "; } -std::vector P25Parser::parse_message(gr::message::sptr msg) { +std::vector P25Parser::parse_message(gr::message::sptr msg, System *system) { std::vector messages; long type = msg->type(); - int sys_num = msg->arg1(); + int sys_num = system->get_sys_num(); TrunkMessage message; message.message_type = UNKNOWN; message.source = -1; diff --git a/trunk-recorder/systems/p25_parser.h b/trunk-recorder/systems/p25_parser.h index 0537df730..e753b73ca 100644 --- a/trunk-recorder/systems/p25_parser.h +++ b/trunk-recorder/systems/p25_parser.h @@ -5,6 +5,8 @@ #include #include #include +#include "system.h" +#include "system_impl.h" #include #include #include @@ -35,7 +37,7 @@ class P25Parser : public TrunkParser { void print_bitset(boost::dynamic_bitset<> &tsbk); void add_channel(int chan_id, Channel chan, int sys_num); double channel_id_to_frequency(int chan_id, int sys_num); - std::vector parse_message(gr::message::sptr msg); + std::vector parse_message(gr::message::sptr msg, System *system); }; #endif diff --git a/trunk-recorder/systems/system.h b/trunk-recorder/systems/system.h index 12106d575..4c5eba0f4 100644 --- a/trunk-recorder/systems/system.h +++ b/trunk-recorder/systems/system.h @@ -4,6 +4,7 @@ #include "../unit_tags.h" #include #include +#include #include //#include "../source.h" #include "parser.h" @@ -92,7 +93,7 @@ class System { virtual int get_max_dev() = 0; virtual void set_filter_width(double f) = 0; virtual double get_filter_width() = 0; - + virtual gr::msg_queue::sptr get_msg_queue() = 0; virtual std::string get_system_type() = 0; virtual unsigned long get_sys_id() = 0; virtual unsigned long get_wacn() = 0; @@ -132,7 +133,6 @@ class System { virtual std::vector get_channels() = 0; virtual std::vector get_control_channels() = 0; virtual std::vector get_talkgroups() = 0; - virtual void set_bandplan(std::string) = 0; virtual std::string get_bandplan() = 0; virtual void set_bandfreq(int) = 0; diff --git a/trunk-recorder/systems/system_impl.cc b/trunk-recorder/systems/system_impl.cc index acff168b0..cd7b8f84e 100644 --- a/trunk-recorder/systems/system_impl.cc +++ b/trunk-recorder/systems/system_impl.cc @@ -99,6 +99,7 @@ System_impl::System_impl(int sys_num) { retune_attempts = 0; message_count = 0; decode_rate = 0; + msg_queue = gr::msg_queue::make(100); } void System_impl::set_xor_mask(unsigned long sys_id, unsigned long wacn, unsigned long nac) { @@ -140,6 +141,10 @@ bool System_impl::update_status(TrunkMessage message) { return false; } + gr::msg_queue::sptr System_impl::get_msg_queue() { + return msg_queue; + } + const char *System_impl::get_xor_mask() { return xor_mask; } diff --git a/trunk-recorder/systems/system_impl.h b/trunk-recorder/systems/system_impl.h index 61b516b4c..264e01de2 100644 --- a/trunk-recorder/systems/system_impl.h +++ b/trunk-recorder/systems/system_impl.h @@ -151,7 +151,7 @@ class System_impl : public System { int get_max_dev(); void set_filter_width(double f); double get_filter_width(); - + gr::msg_queue::sptr get_msg_queue(); std::string get_system_type(); unsigned long get_sys_id(); unsigned long get_wacn(); @@ -191,6 +191,7 @@ class System_impl : public System { std::vector get_channels(); std::vector get_control_channels(); std::vector get_talkgroups(); + gr::msg_queue::sptr msg_queue; System_impl(int sys_id); void set_bandplan(std::string); std::string get_bandplan(); From 49d06ba6838461b43355d46bd3062d08cde4f030 Mon Sep 17 00:00:00 2001 From: Luke Berndt Date: Fri, 5 May 2023 17:01:02 -0400 Subject: [PATCH 04/11] It builds --- .../include/op25_repeater/frame_assembler.h | 2 +- .../op25_repeater/p25_frame_assembler.h | 2 +- lib/op25_repeater/lib/frame_assembler_impl.cc | 8 +++--- lib/op25_repeater/lib/frame_assembler_impl.h | 2 +- .../lib/p25_frame_assembler_impl.cc | 10 +++---- .../lib/p25_frame_assembler_impl.h | 3 +-- lib/op25_repeater/lib/p25p1_fdma.cc | 6 ++--- lib/op25_repeater/lib/p25p1_fdma.h | 3 +-- lib/op25_repeater/lib/rx_sync.cc | 8 +++--- lib/op25_repeater/lib/rx_sync.h | 3 +-- .../gr_blocks/decoder_wrapper_impl.cc | 8 +++--- .../gr_blocks/decoder_wrapper_impl.h | 4 +-- .../decoders/tps_decoder_sink_impl.cc | 26 +++++++++---------- .../decoders/tps_decoder_sink_impl.h | 11 ++++---- trunk-recorder/recorders/analog_recorder.cc | 2 +- trunk-recorder/recorders/dmr_recorder_impl.cc | 2 +- .../recorders/p25_recorder_decode.cc | 2 +- trunk-recorder/systems/p25_trunking.cc | 2 +- 18 files changed, 47 insertions(+), 57 deletions(-) diff --git a/lib/op25_repeater/include/op25_repeater/frame_assembler.h b/lib/op25_repeater/include/op25_repeater/frame_assembler.h index ebbbd7dee..d5b4d2f69 100644 --- a/lib/op25_repeater/include/op25_repeater/frame_assembler.h +++ b/lib/op25_repeater/include/op25_repeater/frame_assembler.h @@ -50,7 +50,7 @@ namespace gr { * class. op25_repeater::frame_assembler::make is the public interface for * creating new instances. */ - static sptr make(int sys_num, const char* options, int debug, int msgq_id, gr::msg_queue::sptr queue); + static sptr make(const char* options, int debug, int msgq_id, gr::msg_queue::sptr queue); virtual void set_xormask(const char*p) {} virtual void set_nac(int nac) {} virtual void set_slotid(int slotid) {} diff --git a/lib/op25_repeater/include/op25_repeater/p25_frame_assembler.h b/lib/op25_repeater/include/op25_repeater/p25_frame_assembler.h index 781764410..70aee5333 100644 --- a/lib/op25_repeater/include/op25_repeater/p25_frame_assembler.h +++ b/lib/op25_repeater/include/op25_repeater/p25_frame_assembler.h @@ -52,7 +52,7 @@ namespace gr { * class. op25_repeater::p25_frame_assembler::make is the public interface for * creating new instances. */ - static sptr make(int sys_num, int silence_frames, const char* udp_host, int port, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, bool do_audio_output, bool do_phase2_tdma, bool do_nocrypt); + static sptr make(int silence_frames, const char* udp_host, int port, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, bool do_audio_output, bool do_phase2_tdma, bool do_nocrypt); virtual void set_xormask(const char*p) {} virtual void set_nac(int nac) {} virtual void set_slotid(int slotid) {} diff --git a/lib/op25_repeater/lib/frame_assembler_impl.cc b/lib/op25_repeater/lib/frame_assembler_impl.cc index cb63ad98f..8146b604e 100644 --- a/lib/op25_repeater/lib/frame_assembler_impl.cc +++ b/lib/op25_repeater/lib/frame_assembler_impl.cc @@ -71,10 +71,10 @@ namespace gr { } frame_assembler::sptr - frame_assembler::make(int sys_num, const char* options, int debug, int msgq_id, gr::msg_queue::sptr queue) + frame_assembler::make(const char* options, int debug, int msgq_id, gr::msg_queue::sptr queue) { return gnuradio::get_initial_sptr - (new frame_assembler_impl(sys_num, options, debug, msgq_id, queue)); + (new frame_assembler_impl(options, debug, msgq_id, queue)); } /* @@ -92,7 +92,7 @@ namespace gr { /* * The private constructor */ - frame_assembler_impl::frame_assembler_impl(int sys_num, const char* options, int debug, int msgq_id, gr::msg_queue::sptr queue) + frame_assembler_impl::frame_assembler_impl(const char* options, int debug, int msgq_id, gr::msg_queue::sptr queue) : gr::block("frame_assembler", gr::io_signature::make (MIN_IN, MAX_IN, sizeof (char)), gr::io_signature::make ( 2, 2, sizeof(int16_t))), @@ -107,7 +107,7 @@ namespace gr { else if (strcasecmp(options, "subchannel") == 0) d_sync = new rx_subchannel(options, debug, msgq_id, queue); else - d_sync = new rx_sync(sys_num, options, debug, msgq_id, queue, output_queue); + d_sync = new rx_sync(options, debug, msgq_id, queue, output_queue); } int diff --git a/lib/op25_repeater/lib/frame_assembler_impl.h b/lib/op25_repeater/lib/frame_assembler_impl.h index dc08ff824..826984e4f 100644 --- a/lib/op25_repeater/lib/frame_assembler_impl.h +++ b/lib/op25_repeater/lib/frame_assembler_impl.h @@ -60,7 +60,7 @@ namespace gr { public: public: - frame_assembler_impl(int sys_num, const char* options, int debug, int msgq_id, gr::msg_queue::sptr queue); + frame_assembler_impl(const char* options, int debug, int msgq_id, gr::msg_queue::sptr queue); ~frame_assembler_impl(); // Where all the action really happens diff --git a/lib/op25_repeater/lib/p25_frame_assembler_impl.cc b/lib/op25_repeater/lib/p25_frame_assembler_impl.cc index a6947ddce..1374ca5ba 100644 --- a/lib/op25_repeater/lib/p25_frame_assembler_impl.cc +++ b/lib/op25_repeater/lib/p25_frame_assembler_impl.cc @@ -44,7 +44,7 @@ namespace gr { return; if (d_msg_queue->full_p()) return; - gr::message::sptr msg = gr::message::make_from_string(std::string((const char *)wbuf, 2), duid, d_sys_num, 0); + gr::message::sptr msg = gr::message::make_from_string(std::string((const char *)wbuf, 2), duid, 0); d_msg_queue->insert_tail(msg); } @@ -75,8 +75,8 @@ namespace gr { } p25_frame_assembler::sptr - p25_frame_assembler::make(int sys_num, int silence_frames, const char *udp_host, int port, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, bool do_audio_output, bool do_phase2_tdma, bool do_nocrypt) { - return gnuradio::get_initial_sptr(new p25_frame_assembler_impl(sys_num, silence_frames, udp_host, port, debug, do_imbe, do_output, do_msgq, queue, do_audio_output, do_phase2_tdma, do_nocrypt)); + p25_frame_assembler::make(int silence_frames, const char *udp_host, int port, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, bool do_audio_output, bool do_phase2_tdma, bool do_nocrypt) { + return gnuradio::get_initial_sptr(new p25_frame_assembler_impl(silence_frames, udp_host, port, debug, do_imbe, do_output, do_msgq, queue, do_audio_output, do_phase2_tdma, do_nocrypt)); } /* @@ -96,13 +96,13 @@ static const int MAX_IN = 1; // maximum number of input streams /* * The private constructor */ - p25_frame_assembler_impl::p25_frame_assembler_impl(int sys_num, int silence_frames, const char *udp_host, int port, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, bool do_audio_output, bool do_phase2_tdma, bool do_nocrypt) + p25_frame_assembler_impl::p25_frame_assembler_impl(int silence_frames, const char *udp_host, int port, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, bool do_audio_output, bool do_phase2_tdma, bool do_nocrypt) : gr::block("p25_frame_assembler", gr::io_signature::make (MIN_IN, MAX_IN, sizeof (char)), 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(sys_num, op25audio, debug, do_imbe, do_output, do_msgq, queue, output_queue, do_audio_output, do_nocrypt), + p1fdma(op25audio, debug, do_imbe, do_output, do_msgq, queue, output_queue, do_audio_output, do_nocrypt), d_do_audio_output(do_audio_output), d_do_phase2_tdma(do_phase2_tdma), d_do_nocrypt(do_nocrypt), diff --git a/lib/op25_repeater/lib/p25_frame_assembler_impl.h b/lib/op25_repeater/lib/p25_frame_assembler_impl.h index 964425b0f..99bd61bb7 100644 --- a/lib/op25_repeater/lib/p25_frame_assembler_impl.h +++ b/lib/op25_repeater/lib/p25_frame_assembler_impl.h @@ -54,7 +54,6 @@ namespace gr { gr::msg_queue::sptr d_msg_queue; int d_input_rate; - int d_sys_num; int d_silence_frames; int silence_frame_count; long total_produced; @@ -76,7 +75,7 @@ namespace gr { void set_phase2_tdma(bool p); public: - p25_frame_assembler_impl(int sys_num, int silence_frames, const char* udp_host, int port, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, bool do_audio_output, bool do_phase2_tdma, bool do_nocrypt); + p25_frame_assembler_impl(int silence_frames, const char* udp_host, int port, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, bool do_audio_output, bool do_phase2_tdma, bool do_nocrypt); ~p25_frame_assembler_impl(); op25_audio op25audio; diff --git a/lib/op25_repeater/lib/p25p1_fdma.cc b/lib/op25_repeater/lib/p25p1_fdma.cc index 6ddfbecc1..048ee82c7 100644 --- a/lib/op25_repeater/lib/p25p1_fdma.cc +++ b/lib/op25_repeater/lib/p25p1_fdma.cc @@ -197,7 +197,7 @@ namespace gr { fprintf(stderr, "%s p25p1_fdma::set_nac: 0x%03x\n", logts.get(d_msgq_id), d_nac); } - p25p1_fdma::p25p1_fdma(int sys_num,const op25_audio& udp, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, std::deque &output_queue, bool do_audio_output, bool do_nocrypt, int msgq_id) : + p25p1_fdma::p25p1_fdma(const op25_audio& udp, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, std::deque &output_queue, bool do_audio_output, bool do_nocrypt, int msgq_id) : write_bufp(0), d_debug(debug), d_do_imbe(do_imbe), @@ -216,7 +216,6 @@ namespace gr { ess_algid(0x80), vf_tgid(0), terminate_call(false), - d_sys_num(sys_num), p1voice_decode((debug > 0), udp, output_queue) { rx_status.error_count = 0; @@ -753,8 +752,7 @@ namespace gr { if (!d_do_msgq || d_msg_queue->full_p()) return; - gr::message::sptr msg = gr::message::make_from_string(msg_str, msg_type, d_sys_num, 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, 0); d_msg_queue->insert_tail(msg); } diff --git a/lib/op25_repeater/lib/p25p1_fdma.h b/lib/op25_repeater/lib/p25p1_fdma.h index cf95522e2..5ddd50722 100644 --- a/lib/op25_repeater/lib/p25p1_fdma.h +++ b/lib/op25_repeater/lib/p25p1_fdma.h @@ -98,7 +98,6 @@ namespace gr { long curr_grp_id; bool terminate_call; const char *d_udp_host; - int d_sys_num; int d_port; ezpwd::RS<63,55> rs8; // Reed-Solomon decoders for 8, 12 and 16 bit parity @@ -117,7 +116,7 @@ namespace gr { void set_nac(int nac); void reset_timer(); void rx_sym (const uint8_t *syms, int nsyms); - p25p1_fdma(int sys_num, const op25_audio& udp, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, std::deque &output_queue, bool do_audio_output, bool do_nocrypt, int msgq_id = 0); + p25p1_fdma(const op25_audio& udp, int debug, bool do_imbe, bool do_output, bool do_msgq, gr::msg_queue::sptr queue, std::deque &output_queue, bool do_audio_output, bool do_nocrypt, int msgq_id = 0); ~p25p1_fdma(); uint32_t load_nid(const uint8_t *syms, int nsyms, const uint64_t fs); bool load_body(const uint8_t * syms, int nsyms); diff --git a/lib/op25_repeater/lib/rx_sync.cc b/lib/op25_repeater/lib/rx_sync.cc index c532703f6..46ab1064b 100644 --- a/lib/op25_repeater/lib/rx_sync.cc +++ b/lib/op25_repeater/lib/rx_sync.cc @@ -204,7 +204,7 @@ void rx_sync::ysf_sync(const uint8_t dibitbuf[], bool& ysf_fullrate, bool& unmut fprintf(stderr, "%s ysf_sync: muting audio: dt: %d, rc: %d\n", logts.get(d_msgq_id), d_shift_reg, rc); } -rx_sync::rx_sync(int sys_num, const char * options, int debug, int msgq_id, gr::msg_queue::sptr queue, std::array, 2> &output_queue) : // constructor +rx_sync::rx_sync(const char * options, int debug, int msgq_id, gr::msg_queue::sptr queue, std::array, 2> &output_queue) : // constructor sync_timer(op25_timer(1000000)), d_symbol_count(0), d_sync_reg(0), @@ -216,16 +216,14 @@ rx_sync::rx_sync(int sys_num, const char * options, int debug, int msgq_id, gr:: d_slot_mask(3), d_slot_key(0), output_queue(output_queue), - p25fdma(sys_num, d_audio, debug, true, false, true, queue, d_output_queue[0], true, true, msgq_id), + p25fdma( d_audio, debug, true, false, true, queue, d_output_queue[0], true, true, msgq_id), p25tdma( d_audio, 0, debug, true, queue, d_output_queue[0], true, true, msgq_id), dmr(debug, msgq_id, queue), d_msgq_id(msgq_id), d_msg_queue(queue), - d_stereo(true), d_debug(debug), - d_audio(options, debug), - d_sys_num(sys_num) + d_audio(options, debug) { if (msgq_id >= 0) d_stereo = false; // single channel audio for trunking diff --git a/lib/op25_repeater/lib/rx_sync.h b/lib/op25_repeater/lib/rx_sync.h index c1c693843..9b8435e00 100644 --- a/lib/op25_repeater/lib/rx_sync.h +++ b/lib/op25_repeater/lib/rx_sync.h @@ -122,7 +122,7 @@ class rx_sync : public rx_base { void set_debug(int debug); int get_src_id(int slot); bool get_terminated(int slot); - rx_sync(int sys_num, const char * options, int debug, int msgq_id, gr::msg_queue::sptr queue, std::array, 2> &output_queue); + rx_sync(const char * options, int debug, int msgq_id, gr::msg_queue::sptr queue, std::array, 2> &output_queue); ~rx_sync(); private: @@ -171,7 +171,6 @@ class rx_sync : public rx_base { log_ts logts; std::array, 2> &output_queue; //std::deque &output_queue[]; - int d_sys_num; }; } // end namespace op25_repeater diff --git a/trunk-recorder/gr_blocks/decoder_wrapper_impl.cc b/trunk-recorder/gr_blocks/decoder_wrapper_impl.cc index 8ea03e0f2..2842d0052 100644 --- a/trunk-recorder/gr_blocks/decoder_wrapper_impl.cc +++ b/trunk-recorder/gr_blocks/decoder_wrapper_impl.cc @@ -40,17 +40,17 @@ namespace gr { namespace blocks { decoder_wrapper_impl::sptr -decoder_wrapper_impl::make(unsigned int sample_rate, int src_num, decoder_callback callback) { - return gnuradio::get_initial_sptr(new decoder_wrapper_impl(sample_rate, src_num, callback)); +decoder_wrapper_impl::make(unsigned int sample_rate, decoder_callback callback) { + return gnuradio::get_initial_sptr(new decoder_wrapper_impl(sample_rate, callback)); } -decoder_wrapper_impl::decoder_wrapper_impl(unsigned int sample_rate, int src_num, decoder_callback callback) +decoder_wrapper_impl::decoder_wrapper_impl(unsigned int sample_rate, decoder_callback callback) : hier_block2("decoder_wrapper_impl", io_signature::make(1, 1, sizeof(float)), io_signature::make(0, 0, 0)), d_callback(callback) { d_signal_decoder_sink = gr::blocks::signal_decoder_sink_impl::make(sample_rate, callback); - d_tps_decoder_sink = gr::blocks::tps_decoder_sink_impl::make(sample_rate, src_num, callback); + d_tps_decoder_sink = gr::blocks::tps_decoder_sink_impl::make(sample_rate, callback); connect(self(), 0, d_signal_decoder_sink, 0); connect(self(), 0, d_tps_decoder_sink, 0); diff --git a/trunk-recorder/gr_blocks/decoder_wrapper_impl.h b/trunk-recorder/gr_blocks/decoder_wrapper_impl.h index af97aa599..f347e79a6 100644 --- a/trunk-recorder/gr_blocks/decoder_wrapper_impl.h +++ b/trunk-recorder/gr_blocks/decoder_wrapper_impl.h @@ -50,9 +50,9 @@ class decoder_wrapper_impl : public decoder_wrapper { * \param sample_rate Sample rate [S/s] * \param bits_per_sample 16 or 8 bit, default is 16 */ - static sptr make(unsigned int sample_rate, int src_num, decoder_callback callback); + static sptr make(unsigned int sample_rate, decoder_callback callback); - decoder_wrapper_impl(unsigned int sample_rate, int src_num, decoder_callback callback); + decoder_wrapper_impl(unsigned int sample_rate, decoder_callback callback); ~decoder_wrapper_impl(); void set_mdc_enabled(bool b); diff --git a/trunk-recorder/gr_blocks/decoders/tps_decoder_sink_impl.cc b/trunk-recorder/gr_blocks/decoders/tps_decoder_sink_impl.cc index 4e30ced90..3c3cbf7e4 100644 --- a/trunk-recorder/gr_blocks/decoders/tps_decoder_sink_impl.cc +++ b/trunk-recorder/gr_blocks/decoders/tps_decoder_sink_impl.cc @@ -47,15 +47,14 @@ namespace gr { namespace blocks { tps_decoder_sink_impl::sptr -tps_decoder_sink_impl::make(unsigned int sample_rate, int src_num, decoder_callback callback) { - return gnuradio::get_initial_sptr(new tps_decoder_sink_impl(sample_rate, src_num, callback)); +tps_decoder_sink_impl::make(unsigned int sample_rate, decoder_callback callback) { + return gnuradio::get_initial_sptr(new tps_decoder_sink_impl(sample_rate, callback)); } -tps_decoder_sink_impl::tps_decoder_sink_impl(unsigned int sample_rate, int src_num, decoder_callback callback) +tps_decoder_sink_impl::tps_decoder_sink_impl(unsigned int sample_rate, decoder_callback callback) : hier_block2("tps_decoder_sink_impl", io_signature::make(1, 1, sizeof(float)), io_signature::make(0, 0, 0)), - d_src_num(src_num), d_callback(callback) { rx_queue = gr::msg_queue::make(100); @@ -80,7 +79,7 @@ std::string tps_decoder_sink_impl::to_hex(const std::string &s, bool upper, bool return result.str(); } -void tps_decoder_sink_impl::parse_p25_json(int src_num, std::string json) { +void tps_decoder_sink_impl::parse_p25_json(std::string json) { try { if (json.empty() || json.length() < 3) @@ -97,7 +96,7 @@ void tps_decoder_sink_impl::parse_p25_json(int src_num, std::string json) { log_decoder_msg(srcaddr, "TPS", SignalType::Normal); } } catch (std::exception const &e) { - BOOST_LOG_TRIVIAL(error) << "[" << std::dec << src_num << "] TPS: ERROR PROCESSING JSON: " << e.what(); + BOOST_LOG_TRIVIAL(error) << "TPS: ERROR PROCESSING JSON: " << e.what(); } } @@ -106,12 +105,11 @@ void tps_decoder_sink_impl::process_message(gr::message::sptr msg) { return; long type = msg->type(); - int src_num = msg->arg1(); - BOOST_LOG_TRIVIAL(trace) << "[" << std::dec << src_num << "] TPS MESSAGE " << std::dec << type << ": " << to_hex(msg->to_string()); + BOOST_LOG_TRIVIAL(trace) << "TPS MESSAGE " << std::dec << type << ": " << to_hex(msg->to_string()); if (type == M_P25_JSON_DATA) { - parse_p25_json(src_num, msg->to_string()); + parse_p25_json(msg->to_string()); return; } @@ -151,7 +149,7 @@ void tps_decoder_sink_impl::process_message(gr::message::sptr msg) { } b <<= 16; // for missing crc - decode_tsbk(b, nac, src_num); + decode_tsbk(b, nac); } else if (type == 12) { // # trunk: MBT std::string s1 = s.substr(0, 10); std::string s2 = s.substr(10); @@ -189,7 +187,7 @@ void tps_decoder_sink_impl::process_message(gr::message::sptr msg) { mbt_data <<= 32; // for missing crc unsigned long opcode = bitset_shift_mask(header, 32, 0x3f); unsigned long link_id = bitset_shift_mask(header, 48, 0xffffff); - decode_mbt_data(opcode, header, mbt_data, link_id, nac, src_num); + decode_mbt_data(opcode, header, mbt_data, link_id, nac); } else { // Not supported yet... } @@ -226,7 +224,7 @@ void tps_decoder_sink_impl::initialize_p25() { bool do_audio_output = 0; bool do_tdma = 0; bool do_crypt = 0; - op25_frame_assembler = gr::op25_repeater::p25_frame_assembler::make(d_src_num, silence_frames, wireshark_host, udp_port, verbosity, do_imbe, do_output, do_msgq, rx_queue, do_audio_output, do_tdma, do_crypt); + op25_frame_assembler = gr::op25_repeater::p25_frame_assembler::make(silence_frames, wireshark_host, udp_port, verbosity, do_imbe, do_output, do_msgq, rx_queue, do_audio_output, do_tdma, do_crypt); connect(self(), 0, valve, 0); connect(valve, 0, slicer, 0); @@ -243,7 +241,7 @@ unsigned long tps_decoder_sink_impl::bitset_shift_mask(boost::dynamic_bitset<> & return result; } -void tps_decoder_sink_impl::decode_mbt_data(unsigned long opcode, boost::dynamic_bitset<> &header, boost::dynamic_bitset<> &mbt_data, unsigned long sa, unsigned long nac, int sys_num) { +void tps_decoder_sink_impl::decode_mbt_data(unsigned long opcode, boost::dynamic_bitset<> &header, boost::dynamic_bitset<> &mbt_data, unsigned long sa, unsigned long nac) { long unit_id = 0; bool emergency = false; @@ -262,7 +260,7 @@ void tps_decoder_sink_impl::decode_mbt_data(unsigned long opcode, boost::dynamic } } -void tps_decoder_sink_impl::decode_tsbk(boost::dynamic_bitset<> &tsbk, unsigned long nac, int sys_num) { +void tps_decoder_sink_impl::decode_tsbk(boost::dynamic_bitset<> &tsbk, unsigned long nac) { long unit_id = 0; bool emergency = false; diff --git a/trunk-recorder/gr_blocks/decoders/tps_decoder_sink_impl.h b/trunk-recorder/gr_blocks/decoders/tps_decoder_sink_impl.h index 318720c51..6803001f1 100644 --- a/trunk-recorder/gr_blocks/decoders/tps_decoder_sink_impl.h +++ b/trunk-recorder/gr_blocks/decoders/tps_decoder_sink_impl.h @@ -40,7 +40,6 @@ namespace blocks { class tps_decoder_sink_impl : public tps_decoder_sink { private: - int d_src_num; decoder_callback d_callback; gr::op25_repeater::fsk4_demod_ff::sptr fsk4_demod; @@ -50,9 +49,9 @@ class tps_decoder_sink_impl : public tps_decoder_sink { void initialize_p25(void); void process_message(gr::message::sptr msg); - void parse_p25_json(int src_num, std::string json); - void decode_mbt_data(unsigned long opcode, boost::dynamic_bitset<> &header, boost::dynamic_bitset<> &mbt_data, unsigned long link_id, unsigned long nac, int sys_num); - void decode_tsbk(boost::dynamic_bitset<> &tsbk, unsigned long nac, int sys_num); + void parse_p25_json(std::string json); + void decode_mbt_data(unsigned long opcode, boost::dynamic_bitset<> &header, boost::dynamic_bitset<> &mbt_data, unsigned long link_id, unsigned long nac); + void decode_tsbk(boost::dynamic_bitset<> &tsbk, unsigned long nac); unsigned long bitset_shift_mask(boost::dynamic_bitset<> &tsbk, int shift, unsigned long long mask); @@ -67,9 +66,9 @@ class tps_decoder_sink_impl : public tps_decoder_sink { gr::msg_queue::sptr rx_queue; - static sptr make(unsigned int sample_rate, int src_num, decoder_callback callback); + static sptr make(unsigned int sample_rate, decoder_callback callback); - tps_decoder_sink_impl(unsigned int sample_rate, int src_num, decoder_callback callback); + tps_decoder_sink_impl(unsigned int sample_rate, decoder_callback callback); void set_enabled(bool b); diff --git a/trunk-recorder/recorders/analog_recorder.cc b/trunk-recorder/recorders/analog_recorder.cc index 8648259d7..8d4da0b2d 100644 --- a/trunk-recorder/recorders/analog_recorder.cc +++ b/trunk-recorder/recorders/analog_recorder.cc @@ -207,7 +207,7 @@ analog_recorder::analog_recorder(Source *src, Recorder_Type type) } BOOST_LOG_TRIVIAL(info) << "\t Creating decoder sink..." << std::endl; - decoder_sink = gr::blocks::decoder_wrapper_impl::make(wav_sample_rate, src->get_num(), std::bind(&analog_recorder::decoder_callback_handler, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); + decoder_sink = gr::blocks::decoder_wrapper_impl::make(wav_sample_rate, std::bind(&analog_recorder::decoder_callback_handler, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); BOOST_LOG_TRIVIAL(info) << "\t Decoder sink created!" << std::endl; // Analog audio band pass from 300 to 3000 Hz diff --git a/trunk-recorder/recorders/dmr_recorder_impl.cc b/trunk-recorder/recorders/dmr_recorder_impl.cc index 09f0ed90e..c5f5ce448 100644 --- a/trunk-recorder/recorders/dmr_recorder_impl.cc +++ b/trunk-recorder/recorders/dmr_recorder_impl.cc @@ -218,7 +218,7 @@ void dmr_recorder_impl::initialize(Source *src) { rx_queue = gr::msg_queue::make(100); int verbosity = 0; // 10 = lots of debug messages - framer = gr::op25_repeater::frame_assembler::make(0, "file:///tmp/out1.raw", verbosity, 1, rx_queue); + framer = gr::op25_repeater::frame_assembler::make("file:///tmp/out1.raw", verbosity, 1, rx_queue); // op25_frame_assembler = gr::op25_repeater::p25_frame_assembler::make(0, silence_frames, udp_host, udp_port, verbosity, do_imbe, do_output, do_msgq, rx_queue, do_audio_output, do_tdma, do_nocrypt); levels = gr::blocks::multiply_const_ff::make(1); plugin_sink = gr::blocks::plugin_wrapper_impl::make(std::bind(&dmr_recorder_impl::plugin_callback_handler, this, std::placeholders::_1, std::placeholders::_2)); diff --git a/trunk-recorder/recorders/p25_recorder_decode.cc b/trunk-recorder/recorders/p25_recorder_decode.cc index ca740418a..91c10b11e 100644 --- a/trunk-recorder/recorders/p25_recorder_decode.cc +++ b/trunk-recorder/recorders/p25_recorder_decode.cc @@ -93,7 +93,7 @@ void p25_recorder_decode::initialize(int silence_frames) { bool do_tdma = 0; bool do_nocrypt = 1; - op25_frame_assembler = gr::op25_repeater::p25_frame_assembler::make(0, silence_frames, udp_host, udp_port, verbosity, do_imbe, do_output, do_msgq, rx_queue, do_audio_output, do_tdma, do_nocrypt); + op25_frame_assembler = gr::op25_repeater::p25_frame_assembler::make(silence_frames, udp_host, udp_port, verbosity, do_imbe, do_output, do_msgq, rx_queue, do_audio_output, do_tdma, do_nocrypt); levels = gr::blocks::multiply_const_ss::make(1); diff --git a/trunk-recorder/systems/p25_trunking.cc b/trunk-recorder/systems/p25_trunking.cc index a3fdd7bd1..fb5b47e80 100644 --- a/trunk-recorder/systems/p25_trunking.cc +++ b/trunk-recorder/systems/p25_trunking.cc @@ -259,7 +259,7 @@ void p25_trunking::initialize_p25() { bool do_audio_output = 0; bool do_tdma = 0; bool do_nocrypt = 1; - op25_frame_assembler = gr::op25_repeater::p25_frame_assembler::make(sys_num, silence_frames, wireshark_host, udp_port, verbosity, do_imbe, do_output, do_msgq, rx_queue, do_audio_output, do_tdma, do_nocrypt); + op25_frame_assembler = gr::op25_repeater::p25_frame_assembler::make(silence_frames, wireshark_host, udp_port, verbosity, do_imbe, do_output, do_msgq, rx_queue, do_audio_output, do_tdma, do_nocrypt); connect(slicer, 0, op25_frame_assembler, 0); } From 93138631d96fed3aee4eb40dac7cac6a8c54ddb3 Mon Sep 17 00:00:00 2001 From: Luke Berndt Date: Sun, 7 May 2023 11:06:27 -0400 Subject: [PATCH 05/11] Update main.cc --- trunk-recorder/main.cc | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/trunk-recorder/main.cc b/trunk-recorder/main.cc index 12eaa918c..a27c7acc4 100644 --- a/trunk-recorder/main.cc +++ b/trunk-recorder/main.cc @@ -1473,25 +1473,24 @@ for (vector::iterator sys_it = systems.begin(); sys_it != systems.end( if ((system->get_system_type() == "P25") || (system->get_system_type() == "smartnet") ) { while ((msg = system->get_msg_queue()->delete_head_nowait()) != 0) { - sys_num = msg->arg1(); - sys = find_system(sys_num); - if (sys) { - sys->set_message_count(sys->get_message_count() + 1); - if (sys->get_system_type() == "smartnet") { - trunk_messages = smartnet_parser->parse_message(msg->to_string(), sys); - handle_message(trunk_messages, sys); + + system->set_message_count(sys->get_message_count() + 1); + + if (system->get_system_type() == "smartnet") { + trunk_messages = smartnet_parser->parse_message(msg->to_string(), system); + handle_message(trunk_messages, system); } - if (sys->get_system_type() == "p25") { - trunk_messages = p25_parser->parse_message(msg, sys); - handle_message(trunk_messages, sys); + if (system->get_system_type() == "p25") { + trunk_messages = p25_parser->parse_message(msg, system); + handle_message(trunk_messages, system); } - } + if (msg->type() == -1) { - BOOST_LOG_TRIVIAL(error) << "[" << sys->get_short_name() << "]\t process_data_unit timeout"; + BOOST_LOG_TRIVIAL(error) << "[" << system->get_short_name() << "]\t process_data_unit timeout"; } msg.reset(); From 9d02d331fde0538184f662e4eb7e419be3150edb Mon Sep 17 00:00:00 2001 From: Luke Berndt Date: Sun, 7 May 2023 13:05:45 -0400 Subject: [PATCH 06/11] testing --- lib/op25_repeater/lib/p25_frame_assembler_impl.cc | 7 ++++--- lib/op25_repeater/lib/p25_frame_assembler_impl.h | 1 + lib/op25_repeater/lib/p25p1_fdma.cc | 6 ++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/op25_repeater/lib/p25_frame_assembler_impl.cc b/lib/op25_repeater/lib/p25_frame_assembler_impl.cc index a16ad8a02..147fddbf1 100644 --- a/lib/op25_repeater/lib/p25_frame_assembler_impl.cc +++ b/lib/op25_repeater/lib/p25_frame_assembler_impl.cc @@ -45,7 +45,9 @@ namespace gr { if (d_msg_queue->full_p()) return; gr::message::sptr msg = gr::message::make_from_string(std::string((const char *)wbuf, 2), duid, 0); + fprintf(stderr, "Message count: %d", d_msg_queue->count()); d_msg_queue->insert_tail(msg); + fprintf(stderr, "Message count now: %d", d_msg_queue->count()); } void p25_frame_assembler_impl::set_xormask(const char*p) { @@ -102,11 +104,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(), diff --git a/lib/op25_repeater/lib/p25_frame_assembler_impl.h b/lib/op25_repeater/lib/p25_frame_assembler_impl.h index 613a75c6f..99c42de8a 100644 --- a/lib/op25_repeater/lib/p25_frame_assembler_impl.h +++ b/lib/op25_repeater/lib/p25_frame_assembler_impl.h @@ -34,6 +34,7 @@ #include "p25p1_fdma.h" #include "p25p2_tdma.h" #include "op25_audio.h" +#include "log_ts.h" typedef std::deque dibit_queue; diff --git a/lib/op25_repeater/lib/p25p1_fdma.cc b/lib/op25_repeater/lib/p25p1_fdma.cc index 03aff1616..d756e3c9c 100644 --- a/lib/op25_repeater/lib/p25p1_fdma.cc +++ b/lib/op25_repeater/lib/p25p1_fdma.cc @@ -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; @@ -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); } } @@ -782,7 +780,7 @@ 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, msg_type); //gr::message::sptr msg = gr::message::make_from_string(msg_str, get_msg_type(PROTOCOL_P25, msg_type), d_sys_num, 0); if (!d_msg_queue->full_p()) d_msg_queue->insert_tail(msg); From 876b47131c73fc5e1482e9429e564080cbd893b0 Mon Sep 17 00:00:00 2001 From: Luke Berndt Date: Sun, 7 May 2023 13:37:52 -0400 Subject: [PATCH 07/11] messaeg count --- lib/op25_repeater/lib/p25_frame_assembler_impl.cc | 2 -- lib/op25_repeater/lib/p25p1_fdma.cc | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/op25_repeater/lib/p25_frame_assembler_impl.cc b/lib/op25_repeater/lib/p25_frame_assembler_impl.cc index 147fddbf1..1b9b7ebba 100644 --- a/lib/op25_repeater/lib/p25_frame_assembler_impl.cc +++ b/lib/op25_repeater/lib/p25_frame_assembler_impl.cc @@ -45,9 +45,7 @@ namespace gr { if (d_msg_queue->full_p()) return; gr::message::sptr msg = gr::message::make_from_string(std::string((const char *)wbuf, 2), duid, 0); - fprintf(stderr, "Message count: %d", d_msg_queue->count()); d_msg_queue->insert_tail(msg); - fprintf(stderr, "Message count now: %d", d_msg_queue->count()); } void p25_frame_assembler_impl::set_xormask(const char*p) { diff --git a/lib/op25_repeater/lib/p25p1_fdma.cc b/lib/op25_repeater/lib/p25p1_fdma.cc index d756e3c9c..b720c96e4 100644 --- a/lib/op25_repeater/lib/p25p1_fdma.cc +++ b/lib/op25_repeater/lib/p25p1_fdma.cc @@ -782,8 +782,10 @@ namespace gr { gr::message::sptr msg = gr::message::make_from_string(msg_str, msg_type); //gr::message::sptr msg = gr::message::make_from_string(msg_str, get_msg_type(PROTOCOL_P25, msg_type), d_sys_num, 0); + fprintf(stderr, "Message count: %d", d_msg_queue->count()); if (!d_msg_queue->full_p()) d_msg_queue->insert_tail(msg); + fprintf(stderr, "Now Message count: %d", d_msg_queue->count()); } void p25p1_fdma::process_frame() { From 7ff8bec89849f1703fb3e9f9c6654ff1082ad047 Mon Sep 17 00:00:00 2001 From: Luke Berndt Date: Sun, 7 May 2023 13:41:29 -0400 Subject: [PATCH 08/11] duh --- lib/op25_repeater/lib/p25p1_fdma.cc | 4 ++-- trunk-recorder/main.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/op25_repeater/lib/p25p1_fdma.cc b/lib/op25_repeater/lib/p25p1_fdma.cc index b720c96e4..a2b422524 100644 --- a/lib/op25_repeater/lib/p25p1_fdma.cc +++ b/lib/op25_repeater/lib/p25p1_fdma.cc @@ -782,10 +782,10 @@ namespace gr { gr::message::sptr msg = gr::message::make_from_string(msg_str, msg_type); //gr::message::sptr msg = gr::message::make_from_string(msg_str, get_msg_type(PROTOCOL_P25, msg_type), d_sys_num, 0); - fprintf(stderr, "Message count: %d", d_msg_queue->count()); + fprintf(stderr, "Message count: %d\n", d_msg_queue->count()); if (!d_msg_queue->full_p()) d_msg_queue->insert_tail(msg); - fprintf(stderr, "Now Message count: %d", d_msg_queue->count()); + fprintf(stderr, "Now Message count: %d\n", d_msg_queue->count()); } void p25p1_fdma::process_frame() { diff --git a/trunk-recorder/main.cc b/trunk-recorder/main.cc index a27c7acc4..e88d3ebcf 100644 --- a/trunk-recorder/main.cc +++ b/trunk-recorder/main.cc @@ -1470,7 +1470,7 @@ void monitor_messages() { for (vector::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") ) { + if ((system->get_system_type() == "p25") || (system->get_system_type() == "smartnet") ) { while ((msg = system->get_msg_queue()->delete_head_nowait()) != 0) { From 6b13899ebc2cf7ae7ef1fdd20373352d6bc49774 Mon Sep 17 00:00:00 2001 From: Luke Berndt Date: Sun, 7 May 2023 13:46:28 -0400 Subject: [PATCH 09/11] fix count --- trunk-recorder/main.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/trunk-recorder/main.cc b/trunk-recorder/main.cc index e88d3ebcf..27db8bf00 100644 --- a/trunk-recorder/main.cc +++ b/trunk-recorder/main.cc @@ -1471,12 +1471,13 @@ for (vector::iterator sys_it = systems.begin(); sys_it != systems.end( 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) { + msg.reset(); + msg = system->get_msg_queue()->delete_head_nowait() + while (msg != 0) { - system->set_message_count(sys->get_message_count() + 1); + 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); @@ -1494,6 +1495,7 @@ for (vector::iterator sys_it = systems.begin(); sys_it != systems.end( } msg.reset(); + msg = system->get_msg_queue()->delete_head_nowait() } } } From 9681cbd9d12bb6df65af2a2b4e663deb1af0ae38 Mon Sep 17 00:00:00 2001 From: Luke Berndt Date: Sun, 7 May 2023 13:47:11 -0400 Subject: [PATCH 10/11] Update main.cc --- trunk-recorder/main.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trunk-recorder/main.cc b/trunk-recorder/main.cc index 27db8bf00..1b9239fe9 100644 --- a/trunk-recorder/main.cc +++ b/trunk-recorder/main.cc @@ -1472,7 +1472,7 @@ for (vector::iterator sys_it = systems.begin(); sys_it != systems.end( if ((system->get_system_type() == "p25") || (system->get_system_type() == "smartnet") ) { msg.reset(); - msg = system->get_msg_queue()->delete_head_nowait() + msg = system->get_msg_queue()->delete_head_nowait(); while (msg != 0) { @@ -1495,7 +1495,7 @@ for (vector::iterator sys_it = systems.begin(); sys_it != systems.end( } msg.reset(); - msg = system->get_msg_queue()->delete_head_nowait() + msg = system->get_msg_queue()->delete_head_nowait(); } } } From 0e70af7c3493f6b96beb2e0ca01fc6a607a84006 Mon Sep 17 00:00:00 2001 From: Luke Berndt Date: Sun, 7 May 2023 13:48:40 -0400 Subject: [PATCH 11/11] Update p25p1_fdma.cc --- lib/op25_repeater/lib/p25p1_fdma.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/op25_repeater/lib/p25p1_fdma.cc b/lib/op25_repeater/lib/p25p1_fdma.cc index a2b422524..57a3ef848 100644 --- a/lib/op25_repeater/lib/p25p1_fdma.cc +++ b/lib/op25_repeater/lib/p25p1_fdma.cc @@ -781,11 +781,9 @@ namespace gr { return; gr::message::sptr msg = gr::message::make_from_string(msg_str, msg_type); - //gr::message::sptr msg = gr::message::make_from_string(msg_str, get_msg_type(PROTOCOL_P25, msg_type), d_sys_num, 0); - fprintf(stderr, "Message count: %d\n", d_msg_queue->count()); + if (!d_msg_queue->full_p()) d_msg_queue->insert_tail(msg); - fprintf(stderr, "Now Message count: %d\n", d_msg_queue->count()); } void p25p1_fdma::process_frame() {