- refactored
git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@500 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<block>
|
||||
<name>Message Debug</name>
|
||||
<name>Jay's Message Debug</name>
|
||||
<key>jay_message_debug</key>
|
||||
<category>[jay]</category>
|
||||
<import>import jay</import>
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user