diff options
author | Johnathan Corgan | 2013-02-17 10:02:06 -0800 |
---|---|---|
committer | Johnathan Corgan | 2013-02-17 10:02:06 -0800 |
commit | 0dcdc099ecbb01e72b0c5935437f154e47763055 (patch) | |
tree | 971994be1cf182d9cbce3dc410ea25472077373b | |
parent | cad684190e1e286284a30d6e65ce384753ac9589 (diff) | |
download | gnuradio-0dcdc099ecbb01e72b0c5935437f154e47763055.tar.gz gnuradio-0dcdc099ecbb01e72b0c5935437f154e47763055.tar.bz2 gnuradio-0dcdc099ecbb01e72b0c5935437f154e47763055.zip |
core: fix gr_message_debug for printing PDUs
-rw-r--r-- | gnuradio-core/src/lib/io/gr_message_debug.cc | 9 | ||||
-rw-r--r-- | gnuradio-core/src/lib/io/gr_message_debug.h | 13 | ||||
-rwxr-xr-x | gnuradio-core/src/python/gnuradio/gr/qa_pdu.py | 2 | ||||
-rw-r--r-- | grc/blocks/gr_message_debug.xml | 2 |
4 files changed, 20 insertions, 6 deletions
diff --git a/gnuradio-core/src/lib/io/gr_message_debug.cc b/gnuradio-core/src/lib/io/gr_message_debug.cc index 1327c31ba..9eb1bb639 100644 --- a/gnuradio-core/src/lib/io/gr_message_debug.cc +++ b/gnuradio-core/src/lib/io/gr_message_debug.cc @@ -59,10 +59,10 @@ gr_message_debug::store(pmt::pmt_t msg) } void -gr_message_debug::print_verbose(pmt::pmt_t msg) +gr_message_debug::print_pdu(pmt::pmt_t pdu) { - pmt::pmt_t meta = pmt::pmt_car(msg); - pmt::pmt_t vector = pmt::pmt_cdr(msg); + pmt::pmt_t meta = pmt::pmt_car(pdu); + pmt::pmt_t vector = pmt::pmt_cdr(pdu); std::cout << "* MESSAGE DEBUG PRINT PDU VERBOSE *\n"; pmt::pmt_print(meta); size_t len = pmt::pmt_length(vector); @@ -110,6 +110,9 @@ gr_message_debug::gr_message_debug() message_port_register_in(pmt::mp("store")); set_msg_handler(pmt::mp("store"), boost::bind(&gr_message_debug::store, this, _1)); + + message_port_register_in(pmt::mp("print_pdu")); + set_msg_handler(pmt::mp("print_pdu"), boost::bind(&gr_message_debug::print_pdu, this, _1)); } gr_message_debug::~gr_message_debug() diff --git a/gnuradio-core/src/lib/io/gr_message_debug.h b/gnuradio-core/src/lib/io/gr_message_debug.h index 6e6e5103c..f1374e806 100644 --- a/gnuradio-core/src/lib/io/gr_message_debug.h +++ b/gnuradio-core/src/lib/io/gr_message_debug.h @@ -55,7 +55,18 @@ class GR_CORE_API gr_message_debug : public gr_block * \param msg A pmt message passed from the scheduler's message handling. */ void print(pmt::pmt_t msg); - void print_verbose(pmt::pmt_t msg); + + /*! + * \brief PDU formatted messages received in this port are printed to stdout. + * + * This port receives messages from the scheduler's message handling + * mechanism and prints it to stdout. This message handler function + * is only meant to be used by the scheduler to handle messages + * posted to port 'print'. + * + * \param pdu A PDU message passed from the scheduler's message handling. + */ + void print_pdu(pmt::pmt_t pdu); /*! * \brief Messages received in this port are stored in a vector. diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pdu.py b/gnuradio-core/src/python/gnuradio/gr/qa_pdu.py index 572d8b186..c1110c10b 100755 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pdu.py +++ b/gnuradio-core/src/python/gnuradio/gr/qa_pdu.py @@ -46,7 +46,7 @@ class test_pdu(gr_unittest.TestCase): # Test that the right number of ports exist. pi = dbg.message_ports_in() po = dbg.message_ports_out() - self.assertEqual(pmt.pmt_length(pi), 2) + self.assertEqual(pmt.pmt_length(pi), 3) self.assertEqual(pmt.pmt_length(po), 0) pi = snk3.message_ports_in() diff --git a/grc/blocks/gr_message_debug.xml b/grc/blocks/gr_message_debug.xml index 4d73fbd9c..964f95756 100644 --- a/grc/blocks/gr_message_debug.xml +++ b/grc/blocks/gr_message_debug.xml @@ -20,7 +20,7 @@ <optional>1</optional> </sink> <sink> - <name>print_pdu_verbose</name> + <name>print_pdu</name> <type>message</type> <optional>1</optional> </sink> |