diff --git a/gr-jay/grc/CMakeLists.txt b/gr-jay/grc/CMakeLists.txt index 4da64d5..c8768b2 100644 --- a/gr-jay/grc/CMakeLists.txt +++ b/gr-jay/grc/CMakeLists.txt @@ -26,5 +26,6 @@ install(FILES jay_add.xml jay_peak_detect.xml jay_message_debug.xml - jay_peak_manager.xml DESTINATION share/gnuradio/grc/blocks + jay_peak_manager.xml + jay_squelch.xml DESTINATION share/gnuradio/grc/blocks ) diff --git a/gr-jay/grc/jay_message_debug.xml b/gr-jay/grc/jay_message_debug.xml index b0dbf38..59dd2cd 100644 --- a/gr-jay/grc/jay_message_debug.xml +++ b/gr-jay/grc/jay_message_debug.xml @@ -1,6 +1,6 @@ - Message Debug + Jay's Message Debug jay_message_debug [jay] import jay diff --git a/gr-jay/include/jay/CMakeLists.txt b/gr-jay/include/jay/CMakeLists.txt index 40e3715..5bf7de1 100644 --- a/gr-jay/include/jay/CMakeLists.txt +++ b/gr-jay/include/jay/CMakeLists.txt @@ -30,5 +30,6 @@ install(FILES bit_packer.h add.h peak_detect.h - message_debug.h DESTINATION include/jay + message_debug.h + squelch.h DESTINATION include/jay ) diff --git a/gr-jay/lib/CMakeLists.txt b/gr-jay/lib/CMakeLists.txt index 27f3588..f6aec3e 100644 --- a/gr-jay/lib/CMakeLists.txt +++ b/gr-jay/lib/CMakeLists.txt @@ -34,7 +34,8 @@ list(APPEND jay_sources bit_packer_impl.cc add_impl.cc peak_detect_impl.cc - message_debug_impl.cc ) + message_debug_impl.cc + squelch_impl.cc ) set(jay_sources "${jay_sources}" PARENT_SCOPE) if(NOT jay_sources) diff --git a/gr-jay/lib/message_debug_impl.cc b/gr-jay/lib/message_debug_impl.cc index 1f9e7ea..cd23490 100644 --- a/gr-jay/lib/message_debug_impl.cc +++ b/gr-jay/lib/message_debug_impl.cc @@ -55,7 +55,47 @@ namespace gr { */ message_debug_impl::~message_debug_impl() { - } + } + + void message_debug_impl::print_pair(pmt::pmt_t pair) + { + pmt::pmt_t key = pmt::car(pair); + pmt::pmt_t val = pmt::cdr(pair); + if (pmt::is_integer(val)) + { + fprintf(stderr, "[%s=%d]", pmt::symbol_to_string(key).c_str(), (int) pmt::to_long(val)); + } + else if (pmt::is_real(val)) + { + fprintf(stderr, "[%s=%f]", pmt::symbol_to_string(key).c_str(), pmt::to_float(val)); + } + else if (pmt::is_bool(val)) + { + fprintf(stderr, "[%s=%d]", pmt::symbol_to_string(key).c_str(), pmt::to_bool(val)); + } + fprintf(stderr, "\n"); + } + + void message_debug_impl::set_msg(pmt::pmt_t msg) + { + if (pmt::is_pair(msg)) + { + print_pair(msg); + } + else if (pmt::is_dict(msg)) + { + pmt::pmt_t items = pmt::dict_items(msg); + for (int i = 0; i < pmt::length(items); i++) + { + pmt::pmt_t pair = pmt::nth(i, items); + print_pair(pair); + } + } + else + { + fprintf(stderr, "%s\n", pmt::symbol_to_string(msg).c_str()); + } + } void message_debug_impl::forecast (int noutput_items, gr_vector_int &ninput_items_required) diff --git a/gr-jay/lib/message_debug_impl.h b/gr-jay/lib/message_debug_impl.h index 350cc98..4902580 100644 --- a/gr-jay/lib/message_debug_impl.h +++ b/gr-jay/lib/message_debug_impl.h @@ -33,40 +33,8 @@ namespace gr { pmt::pmt_t m_msg_port_in; pmt::pmt_t m_msg_port_out; - void set_msg(pmt::pmt_t msg) - { - if (pmt::is_dict(msg)) - { - pmt::pmt_t items = pmt::dict_items(msg); - for (int i=0; i < pmt::length(items); i++) - { - pmt::pmt_t pair = pmt::nth(i, items); - - pmt::pmt_t key = pmt::car(pair); - pmt::pmt_t val = pmt::cdr(pair); - if (pmt::is_integer(val)) - { - fprintf(stderr, "[%s=%d]", pmt::symbol_to_string(key).c_str(), (int)pmt::to_long(val)); - } - else if (pmt::is_real(val)) - { - fprintf(stderr, "[%s=%f]", pmt::symbol_to_string(key).c_str(), pmt::to_float(val)); - } - else if (pmt::is_bool(val)) - { - fprintf(stderr, "[%s=%d]", pmt::symbol_to_string(key).c_str(), pmt::to_bool(val)); - } - - } - fprintf(stderr, "\n"); - - } - else - { - fprintf(stderr, "%s\n", pmt::symbol_to_string(msg).c_str()); - } - } - + void print_pair(pmt::pmt_t pair); + public: message_debug_impl(); ~message_debug_impl(); @@ -78,6 +46,8 @@ namespace gr { gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); + + void set_msg(pmt::pmt_t msg); }; } // namespace jay diff --git a/gr-jay/python/CMakeLists.txt b/gr-jay/python/CMakeLists.txt index 3ca1735..ec920ff 100644 --- a/gr-jay/python/CMakeLists.txt +++ b/gr-jay/python/CMakeLists.txt @@ -51,3 +51,4 @@ GR_ADD_TEST(qa_add ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_add.py) GR_ADD_TEST(qa_peak_detect ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_peak_detect.py) GR_ADD_TEST(qa_message_debug ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_message_debug.py) GR_ADD_TEST(qa_peak_manager ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_peak_manager.py) +GR_ADD_TEST(qa_squelch ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_squelch.py) diff --git a/gr-jay/swig/jay_swig.i b/gr-jay/swig/jay_swig.i index 7e059ac..136e0e1 100644 --- a/gr-jay/swig/jay_swig.i +++ b/gr-jay/swig/jay_swig.i @@ -16,6 +16,7 @@ #include "jay/add.h" #include "jay/peak_detect.h" #include "jay/message_debug.h" +#include "jay/squelch.h" %} @@ -36,3 +37,5 @@ GR_SWIG_BLOCK_MAGIC2(jay, add); GR_SWIG_BLOCK_MAGIC2(jay, peak_detect); %include "jay/message_debug.h" GR_SWIG_BLOCK_MAGIC2(jay, message_debug); +%include "jay/squelch.h" +GR_SWIG_BLOCK_MAGIC2(jay, squelch);