diff options
Diffstat (limited to 'gr-blocks')
48 files changed, 176 insertions, 2021 deletions
diff --git a/gr-blocks/CMakeLists.txt b/gr-blocks/CMakeLists.txt index 548e8a7afd..34fac58823 100644 --- a/gr-blocks/CMakeLists.txt +++ b/gr-blocks/CMakeLists.txt @@ -46,40 +46,6 @@ GR_SET_GLOBAL(GR_BLOCKS_INCLUDE_DIRS if(ENABLE_GR_BLOCKS) ######################################################################## -# Setup CPack components -######################################################################## -include(GrPackage) -CPACK_SET(CPACK_COMPONENT_GROUP_BLOCKS_DESCRIPTION "GNU Radio Basic Blocks") - -CPACK_COMPONENT("blocks_runtime" - GROUP "Blocks" - DISPLAY_NAME "Runtime" - DESCRIPTION "Runtime" - DEPENDS "runtime_runtime" -) - -CPACK_COMPONENT("blocks_devel" - GROUP "Blocks" - DISPLAY_NAME "Development" - DESCRIPTION "C++ headers, package config, import libraries" - DEPENDS "runtime_devel" -) - -CPACK_COMPONENT("blocks_python" - GROUP "Blocks" - DISPLAY_NAME "Python" - DESCRIPTION "Python modules for runtime; GRC xml files" - DEPENDS "runtime_python;blocks_runtime" -) - -CPACK_COMPONENT("blocks_swig" - GROUP "Blocks" - DISPLAY_NAME "SWIG" - DESCRIPTION "SWIG development .i files" - DEPENDS "runtime_swig;blocks_python;blocks_devel" -) - -######################################################################## # Add subdirectories ######################################################################## add_subdirectory(include/gnuradio/blocks) @@ -89,7 +55,6 @@ add_subdirectory(lib) #endif(ENABLE_TESTING) if(ENABLE_PYTHON) add_subdirectory(python/blocks) - add_subdirectory(python/grc_gnuradio) add_subdirectory(swig) add_subdirectory(grc) add_subdirectory(docs) @@ -107,7 +72,6 @@ configure_file( install( FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-blocks.pc DESTINATION ${GR_LIBRARY_DIR}/pkgconfig - COMPONENT "blocks_devel" ) endif(ENABLE_GR_BLOCKS) diff --git a/gr-blocks/examples/CMakeLists.txt b/gr-blocks/examples/CMakeLists.txt index 8be56d0b9d..850672e404 100644 --- a/gr-blocks/examples/CMakeLists.txt +++ b/gr-blocks/examples/CMakeLists.txt @@ -22,9 +22,8 @@ install( matrix_multiplexer.grc peak_detector2.grc vector_source_with_tags.grc - test_stream_mux_tags.grc + test_stream_mux_tags.grc DESTINATION ${GR_PKG_DATA_DIR}/examples/blocks - COMPONENT "runtime_python" ) add_subdirectory(metadata) diff --git a/gr-blocks/examples/ctrlport/CMakeLists.txt b/gr-blocks/examples/ctrlport/CMakeLists.txt index 23d2db129f..c9b39bcaaa 100644 --- a/gr-blocks/examples/ctrlport/CMakeLists.txt +++ b/gr-blocks/examples/ctrlport/CMakeLists.txt @@ -26,12 +26,10 @@ install( simple_copy.grc usrp_source_control.grc DESTINATION ${GR_PKG_DATA_DIR}/examples/ctrlport - COMPONENT "runtime_python" ) GR_PYTHON_INSTALL(PROGRAMS simple_copy_controller.py usrp_source_controller.py DESTINATION ${GR_PKG_DATA_DIR}/examples/ctrlport - COMPONENT "runtime_python" ) diff --git a/gr-blocks/examples/ctrlport/comparing_resamplers.grc b/gr-blocks/examples/ctrlport/comparing_resamplers.grc index eea9ab6ccd..e5cc973de0 100644 --- a/gr-blocks/examples/ctrlport/comparing_resamplers.grc +++ b/gr-blocks/examples/ctrlport/comparing_resamplers.grc @@ -290,10 +290,10 @@ </param> </block> <block> - <key>fractional_resampler_xx</key> + <key>mmse_resampler_xx</key> <param> <key>id</key> - <value>fractional_resampler_xx_0</value> + <value>mmse_resampler_xx_0</value> </param> <param> <key>_enabled</key> @@ -332,7 +332,7 @@ </param> <param> <key>name</key> - <value>fractional_resamp</value> + <value>mmse_resamp</value> </param> <param> <key>desc</key> @@ -371,7 +371,7 @@ </connection> <connection> <source_block_id>channels_channel_model_0</source_block_id> - <sink_block_id>fractional_resampler_xx_0</sink_block_id> + <sink_block_id>mmse_resampler_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> @@ -382,7 +382,7 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>fractional_resampler_xx_0</source_block_id> + <source_block_id>mmse_resampler_xx_0</source_block_id> <sink_block_id>probe_frac_resamp</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-blocks/examples/ctrlport/usrp_sink_controller.py b/gr-blocks/examples/ctrlport/usrp_sink_controller.py index d8c38e36f2..ec687d80e1 100755 --- a/gr-blocks/examples/ctrlport/usrp_sink_controller.py +++ b/gr-blocks/examples/ctrlport/usrp_sink_controller.py @@ -3,28 +3,22 @@ import sys import pmt from gnuradio.ctrlport.GNURadioControlPortClient import GNURadioControlPortClient -from optparse import OptionParser +from argparse import ArgumentParser -parser = OptionParser(usage="%prog: [options]") -parser.add_option("-H", "--host", type="string", default="localhost", - help="Hostname to connect to (default=%default)") -parser.add_option("-p", "--port", type="int", default=9090, - help="Port of Controlport instance on host (default=%default)") -parser.add_option("-a", "--alias", type="string", default="gr uhd usrp sink0", - help="The UHD block's alias to control (default=%default)") -options, args = parser.parse_args() - -if(len(args) < 2): - sys.stderr.write('Not enough arguments: usrp_source_controller.py [options] <command> <value>\n') - sys.stderr.write('See the "UHD Interface" section of the manual for available commands.\n\n') - sys.exit(1) +parser = ArgumentParser() +parser.add_argument("-H", "--host", default="localhost", + help="Hostname to connect to (default=%(default)r)") +parser.add_argument("-p", "--port", type=int, default=9090, + help="Port of Controlport instance on host (default=%(default)r)") +parser.add_argument("-a", "--alias", default="gr uhd usrp sink0", + help="The UHD block's alias to control (default=%(default)r)") +parser.add_argument("command", metavar="COMMAND") +parser.add_argument("value", metavar="VALUE") +args = parser.parse_args() port = 'command' -alias = options.alias -hostname = options.host -portnum = options.port -cmd = args[0] -val = args[1] +cmd = args.command +val = args.value if(cmd == "tune" or cmd == "time"): sys.stderr.write("This application currently does not support the 'tune' or 'time' UHD " @@ -35,8 +29,8 @@ elif(cmd == "antenna"): else: val = pmt.from_double(float(val)) -argv = [None, hostname, portnum] +argv = [None, args.host, args.port] radiosys = GNURadioControlPortClient(argv=argv, rpcmethod='thrift') radio = radiosys.client -radio.postMessage(alias, port, pmt.cons(pmt.intern(cmd), val)) +radio.postMessage(args.alias, port, pmt.cons(pmt.intern(cmd), val)) diff --git a/gr-blocks/examples/ctrlport/usrp_source_controller.py b/gr-blocks/examples/ctrlport/usrp_source_controller.py index 02d30a9d37..78c5ae66aa 100755 --- a/gr-blocks/examples/ctrlport/usrp_source_controller.py +++ b/gr-blocks/examples/ctrlport/usrp_source_controller.py @@ -3,28 +3,22 @@ import sys import pmt from gnuradio.ctrlport.GNURadioControlPortClient import GNURadioControlPortClient -from optparse import OptionParser +from argparse import ArgumentParser -parser = OptionParser(usage="%prog: [options]") -parser.add_option("-H", "--host", type="string", default="localhost", - help="Hostname to connect to (default=%default)") -parser.add_option("-p", "--port", type="int", default=9090, - help="Port of Controlport instance on host (default=%default)") -parser.add_option("-a", "--alias", type="string", default="gr uhd usrp source0", - help="The UHD block's alias to control (default=%default)") -options, args = parser.parse_args() - -if(len(args) < 2): - sys.stderr.write('Not enough arguments: usrp_source_controller.py [options] <command> <value>\n') - sys.stderr.write('See the "UHD Interface" section of the manual for available commands.\n\n') - sys.exit(1) +parser = ArgumentParser() +parser.add_argument("-H", "--host", default="localhost", + help="Hostname to connect to (default=%(default)r)") +parser.add_argument("-p", "--port", type=int, default=9090, + help="Port of Controlport instance on host (default=%(default)r)") +parser.add_argument("-a", "--alias", default="gr uhd usrp source0", + help="The UHD block's alias to control (default=%(default)r)") +parser.add_argument("command", metavar="COMMAND") +parser.add_argument("value", metavar="VALUE") +args = parser.parse_args() port = 'command' -alias = options.alias -hostname = options.host -portnum = options.port -cmd = args[0] -val = args[1] +cmd = args.command +val = args.value if(cmd == "tune" or cmd == "time"): sys.stderr.write("This application currently does not support the 'tune' or 'time' UHD " @@ -35,8 +29,8 @@ if(cmd == "antenna"): else: val = pmt.from_double(float(val)) -argv = [None, hostname, portnum] +argv = [None, args.host, args.port] radiosys = GNURadioControlPortClient(argv=argv, rpcmethod='thrift') radio = radiosys.client -radio.postMessage(alias, port, pmt.cons(pmt.intern(cmd), val)) +radio.postMessage(args.alias, port, pmt.cons(pmt.intern(cmd), val)) diff --git a/gr-blocks/examples/metadata/CMakeLists.txt b/gr-blocks/examples/metadata/CMakeLists.txt index 8d7bbe79e0..418b2d2594 100644 --- a/gr-blocks/examples/metadata/CMakeLists.txt +++ b/gr-blocks/examples/metadata/CMakeLists.txt @@ -26,5 +26,4 @@ install( file_metadata_vector_sink.grc file_metadata_vector_source.grc DESTINATION ${GR_PKG_DATA_DIR}/examples/metadata - COMPONENT "runtime_python" ) diff --git a/gr-blocks/examples/msg_passing/CMakeLists.txt b/gr-blocks/examples/msg_passing/CMakeLists.txt index 9c24355f7f..9965ce878a 100644 --- a/gr-blocks/examples/msg_passing/CMakeLists.txt +++ b/gr-blocks/examples/msg_passing/CMakeLists.txt @@ -23,5 +23,4 @@ install( FILES strobe.grc DESTINATION ${GR_PKG_DATA_DIR}/examples/msg_passing - COMPONENT "runtime_python" ) diff --git a/gr-blocks/examples/tags/CMakeLists.txt b/gr-blocks/examples/tags/CMakeLists.txt index 142b5cde6c..52cf4662bb 100644 --- a/gr-blocks/examples/tags/CMakeLists.txt +++ b/gr-blocks/examples/tags/CMakeLists.txt @@ -22,6 +22,4 @@ include(GrPython) GR_PYTHON_INSTALL(PROGRAMS test_file_tags.py DESTINATION ${GR_PKG_DATA_DIR}/examples/tags - COMPONENT "blocks_python" ) - diff --git a/gr-blocks/grc/CMakeLists.txt b/gr-blocks/grc/CMakeLists.txt index 96a715a7e4..2dd1481a47 100644 --- a/gr-blocks/grc/CMakeLists.txt +++ b/gr-blocks/grc/CMakeLists.txt @@ -28,4 +28,4 @@ if(NOT ENABLE_GR_CTRLPORT) ) endif(NOT ENABLE_GR_CTRLPORT) -install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR} COMPONENT "blocks_python") +install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR}) diff --git a/gr-blocks/grc/blks2_error_rate.xml b/gr-blocks/grc/blks2_error_rate.xml deleted file mode 100644 index c71739f914..0000000000 --- a/gr-blocks/grc/blks2_error_rate.xml +++ /dev/null @@ -1,70 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Error Rate: -## Custom blks2 block -################################################### - --> -<block> - <name>Error Rate</name> - <key>blks2_error_rate</key> - <category>[Core]/Deprecated</category> - <import>from grc_gnuradio import blks2 as grc_blks2</import> - <make>grc_blks2.error_rate( - type=$type, - win_size=$win_size, - bits_per_symbol=$bits_per_symbol, -)</make> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Bit Error Rate</name> - <key>'BER'</key> - <opt>hide_bps:</opt> - </option> - <option> - <name>Symbol Error Rate</name> - <key>'SER'</key> - <opt>hide_bps:all</opt> - </option> - </param> - <param> - <name>Window Size</name> - <key>win_size</key> - <value>1000</value> - <type>int</type> - </param> - <param> - <name>Bits per Symbol</name> - <key>bits_per_symbol</key> - <value>2</value> - <type>int</type> - <hide>$type.hide_bps</hide> - </param> - <sink> - <name>ref</name> - <type>byte</type> - </sink> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>float</type> - </source> - <doc> -Calculate the bit error rate (BER) or the symbol error rate (SER) over a number of samples given by the window size. \ -The actual window size will start at size one and grow to the full window size as new samples arrive. \ -Once the window has reached full size, old samples are shifted out of the window and new samples shfited in. - -The error block compares the input byte stream to the reference byte stream. \ -For example, the reference byte stream could be the input to a modulator, \ -and the input byte stream could be the output of a modulator. - -Each byte in the incoming stream represents one symbol. \ -The bits per symbol parameter is only useful for calculating the BER. - </doc> -</block> diff --git a/gr-blocks/grc/blks2_selector.xml b/gr-blocks/grc/blks2_selector.xml deleted file mode 100644 index 3442b2cdb8..0000000000 --- a/gr-blocks/grc/blks2_selector.xml +++ /dev/null @@ -1,98 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Selector: -## Custom blks2 block -################################################### - --> -<block> - <name>Selector</name> - <key>blks2_selector</key> - <category>[Core]/Deprecated</category> - <import>from grc_gnuradio import blks2 as grc_blks2</import> - <make>grc_blks2.selector( - item_size=$type.size*$vlen, - num_inputs=$num_inputs, - num_outputs=$num_outputs, - input_index=$input_index, - output_index=$output_index, -)</make> - <callback>set_input_index(int($input_index))</callback> - <callback>set_output_index(int($output_index))</callback> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>size:gr.sizeof_gr_complex</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>size:gr.sizeof_float</opt> - </option> - <option> - <name>Int</name> - <key>int</key> - <opt>size:gr.sizeof_int</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>size:gr.sizeof_short</opt> - </option> - <option> - <name>Byte</name> - <key>byte</key> - <opt>size:gr.sizeof_char</opt> - </option> - </param> - <param> - <name>Num Inputs</name> - <key>num_inputs</key> - <value>2</value> - <type>int</type> - </param> - <param> - <name>Num Outputs</name> - <key>num_outputs</key> - <value>2</value> - <type>int</type> - </param> - <param> - <name>Input Index</name> - <key>input_index</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Output Index</name> - <key>output_index</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Vec Length</name> - <key>vlen</key> - <value>1</value> - <type>int</type> - </param> - <check>$vlen > 0</check> - <sink> - <name>in</name> - <type>$type</type> - <vlen>$vlen</vlen> - <nports>$num_inputs</nports> - </sink> - <source> - <name>out</name> - <type>$type</type> - <vlen>$vlen</vlen> - <nports>$num_outputs</nports> - </source> - <doc> -Connect the sink at input index to the source at output index. Leave all other ports disconnected. - </doc> -</block> diff --git a/gr-blocks/grc/blks2_tcp_sink.xml b/gr-blocks/grc/blks2_tcp_sink.xml deleted file mode 100644 index 2bff7e6d45..0000000000 --- a/gr-blocks/grc/blks2_tcp_sink.xml +++ /dev/null @@ -1,90 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##TCP Sink: Custom blks2 block -################################################### - --> -<block> - <name>TCP Sink</name> - <key>blks2_tcp_sink</key> - <category>[Core]/Deprecated</category> - <import>from grc_gnuradio import blks2 as grc_blks2</import> - <make>grc_blks2.tcp_sink( - itemsize=$type.size*$vlen, - addr=$addr, - port=$port, - server=$server, -)</make> - <param> - <name>Input Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>size:gr.sizeof_gr_complex</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>size:gr.sizeof_float</opt> - </option> - <option> - <name>Int</name> - <key>int</key> - <opt>size:gr.sizeof_int</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>size:gr.sizeof_short</opt> - </option> - <option> - <name>Byte</name> - <key>byte</key> - <opt>size:gr.sizeof_char</opt> - </option> - </param> - <param> - <name>Address</name> - <key>addr</key> - <value>127.0.0.1</value> - <type>string</type> - </param> - <param> - <name>Port</name> - <key>port</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Mode</name> - <key>server</key> - <value>False</value> - <type>enum</type> - <option> - <name>Server</name> - <key>True</key> - </option> - <option> - <name>Client</name> - <key>False</key> - </option> - </param> - <param> - <name>Vec Length</name> - <key>vlen</key> - <value>1</value> - <type>int</type> - </param> - <check>$vlen > 0</check> - <sink> - <name>in</name> - <type>$type</type> - <vlen>$vlen</vlen> - </sink> - <doc> -In client mode, we attempt to connect to a server at the given address and port. \ -In server mode, we bind a socket to the given address and port and accept the first client. - </doc> -</block> diff --git a/gr-blocks/grc/blks2_tcp_source.xml b/gr-blocks/grc/blks2_tcp_source.xml deleted file mode 100644 index f6cc41015f..0000000000 --- a/gr-blocks/grc/blks2_tcp_source.xml +++ /dev/null @@ -1,90 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##TCP Source: Custom blks2 block -################################################### - --> -<block> - <name>TCP Source</name> - <key>blks2_tcp_source</key> - <category>[Core]/Deprecated</category> - <import>from grc_gnuradio import blks2 as grc_blks2</import> - <make>grc_blks2.tcp_source( - itemsize=$type.size*$vlen, - addr=$addr, - port=$port, - server=$server, -)</make> - <param> - <name>Output Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>size:gr.sizeof_gr_complex</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>size:gr.sizeof_float</opt> - </option> - <option> - <name>Int</name> - <key>int</key> - <opt>size:gr.sizeof_int</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>size:gr.sizeof_short</opt> - </option> - <option> - <name>Byte</name> - <key>byte</key> - <opt>size:gr.sizeof_char</opt> - </option> - </param> - <param> - <name>Address</name> - <key>addr</key> - <value>127.0.0.1</value> - <type>string</type> - </param> - <param> - <name>Port</name> - <key>port</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Mode</name> - <key>server</key> - <value>True</value> - <type>enum</type> - <option> - <name>Server</name> - <key>True</key> - </option> - <option> - <name>Client</name> - <key>False</key> - </option> - </param> - <param> - <name>Vec Length</name> - <key>vlen</key> - <value>1</value> - <type>int</type> - </param> - <check>$vlen > 0</check> - <source> - <name>out</name> - <type>$type</type> - <vlen>$vlen</vlen> - </source> - <doc> -In client mode, we attempt to connect to a server at the given address and port. \ -In server mode, we bind a socket to the given address and port and accept the first client. - </doc> -</block> diff --git a/gr-blocks/grc/blks2_valve.xml b/gr-blocks/grc/blks2_valve.xml deleted file mode 100644 index c3f25163b2..0000000000 --- a/gr-blocks/grc/blks2_valve.xml +++ /dev/null @@ -1,73 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Valve: -## Custom blks2 block -################################################### - --> -<block> - <name>Valve</name> - <key>blks2_valve</key> - <category>[Core]/Deprecated</category> - <import>from grc_gnuradio import blks2 as grc_blks2</import> - <make>grc_blks2.valve(item_size=$type.size*$vlen, open=bool($open))</make> - <callback>set_open(bool($open))</callback> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>size:gr.sizeof_gr_complex</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>size:gr.sizeof_float</opt> - </option> - <option> - <name>Int</name> - <key>int</key> - <opt>size:gr.sizeof_int</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>size:gr.sizeof_short</opt> - </option> - <option> - <name>Byte</name> - <key>byte</key> - <opt>size:gr.sizeof_char</opt> - </option> - </param> - <param> - <name>Open</name> - <key>open</key> - <value>0</value> - <type>raw</type> - </param> - <param> - <name>Vec Length</name> - <key>vlen</key> - <value>1</value> - <type>int</type> - </param> - <check>$vlen > 0</check> - <sink> - <name>in</name> - <type>$type</type> - <vlen>$vlen</vlen> - <nports>$num_inputs</nports> - </sink> - <source> - <name>out</name> - <type>$type</type> - <vlen>$vlen</vlen> - <nports>$num_outputs</nports> - </source> - <doc> -Connect output to input when valve is closed (not open). - </doc> -</block> diff --git a/gr-blocks/grc/blocks_message_burst_source.xml b/gr-blocks/grc/blocks_message_burst_source.xml deleted file mode 100644 index 7eaef2c514..0000000000 --- a/gr-blocks/grc/blocks_message_burst_source.xml +++ /dev/null @@ -1,59 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Message Burst Source (the sink port is a message) -################################################### - --> -<block> - <name>Message Burst Source</name> - <key>blocks_message_burst_source</key> - <category>[Core]/Deprecated</category> - <import>from gnuradio import blocks</import> - <make>blocks.message_burst_source($type.size*$vlen, $(id)_msgq_in)</make> - <param> - <name>Output Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>size:gr.sizeof_gr_complex</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>size:gr.sizeof_float</opt> - </option> - <option> - <name>Int</name> - <key>int</key> - <opt>size:gr.sizeof_int</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>size:gr.sizeof_short</opt> - </option> - <option> - <name>Byte</name> - <key>byte</key> - <opt>size:gr.sizeof_char</opt> - </option> - </param> - <param> - <name>Vec Length</name> - <key>vlen</key> - <value>1</value> - <type>int</type> - </param> - <check>$vlen > 0</check> - <sink> - <name>in</name> - <type>msg</type> - </sink> - <source> - <name>out</name> - <type>$type</type> - <vlen>$vlen</vlen> - </source> -</block> diff --git a/gr-blocks/grc/blocks_message_sink.xml b/gr-blocks/grc/blocks_message_sink.xml deleted file mode 100644 index 0f6de7b4e5..0000000000 --- a/gr-blocks/grc/blocks_message_sink.xml +++ /dev/null @@ -1,73 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Message Sink (the source port is a message) -################################################### - --> -<block> - <name>Message Sink</name> - <key>blocks_message_sink</key> - <category>[Core]/Deprecated</category> - <import>from gnuradio import blocks</import> - <make>blocks.message_sink($type.size*$vlen, $(id)_msgq_out, $dont_block)</make> - <param> - <name>Input Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>size:gr.sizeof_gr_complex</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>size:gr.sizeof_float</opt> - </option> - <option> - <name>Int</name> - <key>int</key> - <opt>size:gr.sizeof_int</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>size:gr.sizeof_short</opt> - </option> - <option> - <name>Byte</name> - <key>byte</key> - <opt>size:gr.sizeof_char</opt> - </option> - </param> - <param> - <name>Don't Block</name> - <key>dont_block</key> - <value>False</value> - <type>enum</type> - <option> - <name>Don't Block</name> - <key>True</key> - </option> - <option> - <name>Block</name> - <key>False</key> - </option> - </param> - <param> - <name>Vec Length</name> - <key>vlen</key> - <value>1</value> - <type>int</type> - </param> - <check>$vlen > 0</check> - <sink> - <name>in</name> - <type>$type</type> - <vlen>$vlen</vlen> - </sink> - <source> - <name>out</name> - <type>msg</type> - </source> -</block> diff --git a/gr-blocks/grc/blocks_message_source.xml b/gr-blocks/grc/blocks_message_source.xml deleted file mode 100644 index ecf049b9de..0000000000 --- a/gr-blocks/grc/blocks_message_source.xml +++ /dev/null @@ -1,59 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Message Source (the sink port is a message) -################################################### - --> -<block> - <name>Message Source</name> - <key>blocks_message_source</key> - <category>[Core]/Deprecated</category> - <import>from gnuradio import blocks</import> - <make>blocks.message_source($type.size*$vlen, $(id)_msgq_in)</make> - <param> - <name>Output Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>size:gr.sizeof_gr_complex</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>size:gr.sizeof_float</opt> - </option> - <option> - <name>Int</name> - <key>int</key> - <opt>size:gr.sizeof_int</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>size:gr.sizeof_short</opt> - </option> - <option> - <name>Byte</name> - <key>byte</key> - <opt>size:gr.sizeof_char</opt> - </option> - </param> - <param> - <name>Vec Length</name> - <key>vlen</key> - <value>1</value> - <type>int</type> - </param> - <check>$vlen > 0</check> - <sink> - <name>in</name> - <type>msg</type> - </sink> - <source> - <name>out</name> - <type>$type</type> - <vlen>$vlen</vlen> - </source> -</block> diff --git a/gr-blocks/include/gnuradio/blocks/CMakeLists.txt b/gr-blocks/include/gnuradio/blocks/CMakeLists.txt index 60734714af..6f4915b9ef 100644 --- a/gr-blocks/include/gnuradio/blocks/CMakeLists.txt +++ b/gr-blocks/include/gnuradio/blocks/CMakeLists.txt @@ -121,11 +121,8 @@ install(FILES keep_one_in_n.h lfsr_32k_source_s.h message_debug.h - message_sink.h - message_source.h message_strobe.h message_strobe_random.h - message_burst_source.h multiply_cc.h multiply_ff.h multiply_conjugate_cc.h @@ -194,7 +191,6 @@ install(FILES wavfile_sink.h wavfile_source.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio/blocks - COMPONENT "blocks_devel" ) if(ENABLE_GR_CTRLPORT) @@ -206,6 +202,5 @@ install(FILES ctrlport_probe2_i.h ctrlport_probe2_b.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio/blocks - COMPONENT "blocks_devel" ) endif(ENABLE_GR_CTRLPORT) diff --git a/gr-blocks/include/gnuradio/blocks/message_burst_source.h b/gr-blocks/include/gnuradio/blocks/message_burst_source.h deleted file mode 100644 index ea2838c7a6..0000000000 --- a/gr-blocks/include/gnuradio/blocks/message_burst_source.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012-2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_MESSAGE_BURST_SOURCE_H -#define INCLUDED_GR_MESSAGE_BURST_SOURCE_H - -#include <gnuradio/blocks/api.h> -#include <gnuradio/sync_block.h> -#include <gnuradio/msg_queue.h> - -namespace gr { - namespace blocks { - - /*! - * \brief Turn received messages into a stream and tag them for UHD to send. - * \ingroup deprecated_blk - */ - class BLOCKS_API message_burst_source : virtual public sync_block - { - public: - // gr::blocks::message_source::sptr - typedef boost::shared_ptr<message_burst_source> sptr; - - static sptr make(size_t itemsize, int msgq_limit); - static sptr make(size_t itemsize, gr::msg_queue::sptr msgq); - - virtual gr::msg_queue::sptr msgq() const = 0; - }; - - } /* namespace blocks */ -} /* namespace gr */ - -#endif /* INCLUDED_GR_MESSAGE_BURST_SOURCE_H */ diff --git a/gr-blocks/include/gnuradio/blocks/message_sink.h b/gr-blocks/include/gnuradio/blocks/message_sink.h deleted file mode 100644 index 9b61bfa30b..0000000000 --- a/gr-blocks/include/gnuradio/blocks/message_sink.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_MESSAGE_SINK_H -#define INCLUDED_GR_MESSAGE_SINK_H - -#include <gnuradio/blocks/api.h> -#include <gnuradio/sync_block.h> -#include <gnuradio/msg_queue.h> - -namespace gr { - namespace blocks { - - /*! - * \brief Gather received items into messages and insert into msgq - * \ingroup deprecated_blk - */ - class BLOCKS_API message_sink : virtual public sync_block - { - public: - // gr::blocks::message_sink::sptr - typedef boost::shared_ptr<message_sink> sptr; - - static sptr make(size_t itemsize, gr::msg_queue::sptr msgq, bool dont_block); - static sptr make(size_t itemsize, gr::msg_queue::sptr msgq, bool dont_block, - const std::string& lengthtagname); - - }; - - } /* namespace blocks */ -} /* namespace gr */ - -#endif /* INCLUDED_GR_MESSAGE_SINK_H */ diff --git a/gr-blocks/include/gnuradio/blocks/message_source.h b/gr-blocks/include/gnuradio/blocks/message_source.h deleted file mode 100644 index c249fc34d7..0000000000 --- a/gr-blocks/include/gnuradio/blocks/message_source.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_MESSAGE_SOURCE_H -#define INCLUDED_GR_MESSAGE_SOURCE_H - -#include <gnuradio/blocks/api.h> -#include <gnuradio/sync_block.h> -#include <gnuradio/msg_queue.h> - -namespace gr { - namespace blocks { - - /*! - * \brief Turn received messages into a stream - * \ingroup deprecated_blk - */ - class BLOCKS_API message_source : virtual public sync_block - { - public: - // gr::blocks::message_source::sptr - typedef boost::shared_ptr<message_source> sptr; - - static sptr make(size_t itemsize, int msgq_limit=0); - static sptr make(size_t itemsize, gr::msg_queue::sptr msgq); - static sptr make(size_t itemsize, gr::msg_queue::sptr msgq, - const std::string& lengthtagname); - - virtual gr::msg_queue::sptr msgq() const = 0; - }; - - } /* namespace blocks */ -} /* namespace gr */ - -#endif /* INCLUDED_GR_MESSAGE_SOURCE_H */ diff --git a/gr-blocks/lib/CMakeLists.txt b/gr-blocks/lib/CMakeLists.txt index e6eabd8f99..5cc2e1e1da 100644 --- a/gr-blocks/lib/CMakeLists.txt +++ b/gr-blocks/lib/CMakeLists.txt @@ -140,11 +140,8 @@ list(APPEND gr_blocks_sources keep_one_in_n_impl.cc lfsr_32k_source_s_impl.cc message_debug_impl.cc - message_sink_impl.cc - message_source_impl.cc message_strobe_impl.cc message_strobe_random_impl.cc - message_burst_source_impl.cc multiply_cc_impl.cc multiply_ff_impl.cc multiply_conjugate_cc_impl.cc @@ -258,7 +255,7 @@ add_library(gnuradio-blocks SHARED ${gr_blocks_sources}) add_dependencies(gnuradio-blocks blocks_generated_includes) target_link_libraries(gnuradio-blocks ${blocks_libs}) -GR_LIBRARY_FOO(gnuradio-blocks RUNTIME_COMPONENT "blocks_runtime" DEVEL_COMPONENT "blocks_devel") +GR_LIBRARY_FOO(gnuradio-blocks) if(ENABLE_STATIC_LIBS) # Remove controlport-specific source files from staticlibs build @@ -289,7 +286,7 @@ if(ENABLE_STATIC_LIBS) endif(NOT WIN32) install(TARGETS gnuradio-blocks_static - ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "blocks_devel" # .lib file + ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file ) endif(ENABLE_STATIC_LIBS) diff --git a/gr-blocks/lib/message_burst_source_impl.cc b/gr-blocks/lib/message_burst_source_impl.cc deleted file mode 100644 index 0ce0a9284f..0000000000 --- a/gr-blocks/lib/message_burst_source_impl.cc +++ /dev/null @@ -1,149 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012-2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "message_burst_source_impl.h" -#include <gnuradio/io_signature.h> -#include <cstdio> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <string.h> -#include <gnuradio/tags.h> - -namespace gr { - namespace blocks { - - message_burst_source::sptr - message_burst_source::make(size_t itemsize, int msgq_limit) - { - return gnuradio::get_initial_sptr - (new message_burst_source_impl(itemsize, msgq_limit)); - } - - message_burst_source::sptr - message_burst_source::make(size_t itemsize, msg_queue::sptr msgq) - { - return gnuradio::get_initial_sptr - (new message_burst_source_impl(itemsize, msgq)); - } - - message_burst_source_impl::message_burst_source_impl(size_t itemsize, int msgq_limit) - : sync_block("message_burst_source", - io_signature::make(0, 0, 0), - io_signature::make(1, 1, itemsize)), - d_itemsize(itemsize), d_msgq(msg_queue::make(msgq_limit)), - d_msg_offset(0), d_eof(false) - { - std::stringstream id; - id << name() << unique_id(); - d_me = pmt::string_to_symbol(id.str()); - } - - message_burst_source_impl::message_burst_source_impl(size_t itemsize, msg_queue::sptr msgq) - : sync_block("message_burst_source", - io_signature::make(0, 0, 0), - io_signature::make(1, 1, itemsize)), - d_itemsize(itemsize), d_msgq(msgq), - d_msg_offset(0), d_eof(false) - { - std::stringstream id; - id << name() << unique_id(); - d_me = pmt::string_to_symbol(id.str()); - } - - message_burst_source_impl::~message_burst_source_impl() - { - } - - int - message_burst_source_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - char *out = (char*)output_items[0]; - int nn = 0; - - uint64_t abs_sample_count = nitems_written(0); - - while(nn < noutput_items) { - if(d_msg) { - // - // Consume whatever we can from the current message - // - - int mm = std::min(noutput_items - nn, - (int)((d_msg->length() - d_msg_offset) / d_itemsize)); - memcpy(out, &(d_msg->msg()[d_msg_offset]), mm * d_itemsize); - - nn += mm; - out += mm * d_itemsize; - d_msg_offset += mm * d_itemsize; - assert(d_msg_offset <= d_msg->length()); - - if(d_msg_offset == d_msg->length()) { - if(d_msg->type() == 1) // type == 1 sets EOF - d_eof = true; - d_msg.reset(); - //tag end of burst - add_item_tag(0, //stream ID - abs_sample_count+nn-1, //sample number - pmt::string_to_symbol("tx_eob"), - pmt::from_bool(1), - d_me); //block src id - } - } - else { - // - // No current message - // - if(d_msgq->empty_p() && nn > 0) { // no more messages in the queue, return what we've got - break; - } - - if(d_eof) - return -1; - - d_msg = d_msgq->delete_head(); // block, waiting for a message - d_msg_offset = 0; - //tag start of burst - add_item_tag(0, //stream ID - abs_sample_count+nn, //sample number - pmt::string_to_symbol("tx_sob"), - pmt::from_bool(1), - d_me); //block src id - - if((d_msg->length() % d_itemsize) != 0) - throw std::runtime_error("msg length is not a multiple of d_itemsize"); - } - } - - return nn; - } - - } /* namespace blocks */ -} /* namespace gr */ diff --git a/gr-blocks/lib/message_burst_source_impl.h b/gr-blocks/lib/message_burst_source_impl.h deleted file mode 100644 index a389a23942..0000000000 --- a/gr-blocks/lib/message_burst_source_impl.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012-2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_MESSAGE_BURST_SOURCE_IMPL_H -#define INCLUDED_GR_MESSAGE_BURST_SOURCE_IMPL_H - -#include <gnuradio/blocks/message_burst_source.h> -#include <gnuradio/message.h> - -namespace gr { - namespace blocks { - - class message_burst_source_impl : public message_burst_source - { - private: - size_t d_itemsize; - msg_queue::sptr d_msgq; - message::sptr d_msg; - unsigned d_msg_offset; - bool d_eof; - - pmt::pmt_t d_me; - - public: - message_burst_source_impl(size_t itemsize, int msgq_limit); - message_burst_source_impl(size_t itemsize, msg_queue::sptr msgq); - ~message_burst_source_impl(); - - msg_queue::sptr msgq() const { return d_msgq; } - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace blocks */ -} /* namespace gr */ - -#endif /* INCLUDED_GR_MESSAGE_BURST_SOURCE_IMPL_H */ diff --git a/gr-blocks/lib/message_sink_impl.cc b/gr-blocks/lib/message_sink_impl.cc deleted file mode 100644 index 3dc4102c48..0000000000 --- a/gr-blocks/lib/message_sink_impl.cc +++ /dev/null @@ -1,132 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "message_sink_impl.h" -#include <gnuradio/io_signature.h> -#include <cstdio> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <string.h> - -namespace gr { - namespace blocks { - - message_sink::sptr - message_sink::make(size_t itemsize, msg_queue::sptr msgq, bool dont_block) - { - return gnuradio::get_initial_sptr - (new message_sink_impl(itemsize, msgq, dont_block)); - } - - message_sink::sptr - message_sink::make(size_t itemsize, msg_queue::sptr msgq, bool dont_block, - const std::string& lengthtagname) - { - return gnuradio::get_initial_sptr - (new message_sink_impl(itemsize, msgq, dont_block, lengthtagname)); - } - - message_sink_impl::message_sink_impl(size_t itemsize, msg_queue::sptr msgq, bool dont_block) - : sync_block("message_sink", - io_signature::make(1, 1, itemsize), - io_signature::make(0, 0, 0)), - d_itemsize(itemsize), d_msgq(msgq), d_dont_block(dont_block), - d_tags(false), d_items_read(0) - { - } - - message_sink_impl::message_sink_impl(size_t itemsize, msg_queue::sptr msgq, bool dont_block, - const std::string& lengthtagname) - : sync_block("message_sink", - io_signature::make(1, 1, itemsize), - io_signature::make(0, 0, 0)), - d_itemsize(itemsize), d_msgq(msgq), d_dont_block(dont_block), - d_tags(true), d_lengthtagname(lengthtagname), d_items_read(0) - { - } - - message_sink_impl::~message_sink_impl() - { - } - - int - message_sink_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - const char *in = (const char *) input_items[0]; - - if (d_tags) { - long packet_length = 0; - std::vector<tag_t> tags; - this->get_tags_in_range(tags, 0, d_items_read, d_items_read+1); - //const size_t ninput_items = noutput_items; //assumption for sync block, this can change - for (unsigned int i = 0; i < tags.size(); i++) { - if (pmt::symbol_to_string(tags[i].key) == d_lengthtagname) { - packet_length = pmt::to_long(tags[i].value); - } - } - assert(packet_length != 0); - - // FIXME run this multiple times if input_items >= N * packet_length - if (noutput_items >= packet_length ) { - // If the message queue is full we drop the packet. - if (!d_msgq->full_p()) { - message::sptr msg = message::make(0, // msg type - d_itemsize, // arg1 for other end - packet_length, // arg2 for other end (redundant) - packet_length * d_itemsize); // len of msg - memcpy(msg->msg(), in, packet_length * d_itemsize); - d_msgq->handle(msg); // send it - } - d_items_read += packet_length; - return packet_length; - } else { - return 0; - } - } else { - // If the queue if full we drop all the data we got. - if (!d_msgq->full_p()) { - // build a message to hold whatever we've got - message::sptr msg = message::make(0, // msg type - d_itemsize, // arg1 for other end - noutput_items, // arg2 for other end (redundant) - noutput_items * d_itemsize); // len of msg - memcpy(msg->msg(), in, noutput_items * d_itemsize); - - d_msgq->handle(msg); // send it - } - - return noutput_items; - } - } - - } /* namespace blocks */ -} /* namespace gr */ - diff --git a/gr-blocks/lib/message_sink_impl.h b/gr-blocks/lib/message_sink_impl.h deleted file mode 100644 index e0ae3d00c0..0000000000 --- a/gr-blocks/lib/message_sink_impl.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_MESSAGE_SINK_IMPL_H -#define INCLUDED_GR_MESSAGE_SINK_IMPL_H - -#include <gnuradio/blocks/message_sink.h> - -namespace gr { - namespace blocks { - - class message_sink_impl : public message_sink - { - private: - size_t d_itemsize; - msg_queue::sptr d_msgq; - bool d_dont_block; - bool d_tags; - std::string d_lengthtagname; - uint64_t d_items_read; - - public: - message_sink_impl(size_t itemsize, msg_queue::sptr msgq, bool dont_block); - message_sink_impl(size_t itemsize, msg_queue::sptr msgq, bool dont_block, - const std::string& lengthtagname); - - ~message_sink_impl(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace blocks */ -} /* namespace gr */ - -#endif /* INCLUDED_GR_MESSAGE_SINK_IMPL_H */ diff --git a/gr-blocks/lib/message_source_impl.cc b/gr-blocks/lib/message_source_impl.cc deleted file mode 100644 index b4e9ba6ed7..0000000000 --- a/gr-blocks/lib/message_source_impl.cc +++ /dev/null @@ -1,151 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2010,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "message_source_impl.h" -#include <gnuradio/io_signature.h> -#include <cstdio> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <string.h> - -namespace gr { - namespace blocks { - - message_source::sptr - message_source::make(size_t itemsize, int msgq_limit) - { - return gnuradio::get_initial_sptr - (new message_source_impl(itemsize, msgq_limit)); - } - - message_source::sptr - message_source::make(size_t itemsize, msg_queue::sptr msgq) - { - return gnuradio::get_initial_sptr - (new message_source_impl(itemsize, msgq)); - } - - message_source::sptr - message_source::make(size_t itemsize, msg_queue::sptr msgq, - const std::string& lengthtagname) - { - return gnuradio::get_initial_sptr - (new message_source_impl(itemsize, msgq, lengthtagname)); - } - - message_source_impl::message_source_impl(size_t itemsize, int msgq_limit) - : sync_block("message_source", - io_signature::make(0, 0, 0), - io_signature::make(1, 1, itemsize)), - d_itemsize(itemsize), d_msgq(msg_queue::make(msgq_limit)), - d_msg_offset(0), d_eof(false), d_tags(false) - { - } - - message_source_impl::message_source_impl(size_t itemsize, msg_queue::sptr msgq) - : sync_block("message_source", - io_signature::make(0, 0, 0), - io_signature::make(1, 1, itemsize)), - d_itemsize(itemsize), d_msgq(msgq), - d_msg_offset(0), d_eof(false), d_tags(false) - { - } - - message_source_impl::message_source_impl(size_t itemsize, msg_queue::sptr msgq, - const std::string& lengthtagname) - : sync_block("message_source", - io_signature::make(0, 0, 0), - io_signature::make(1, 1, itemsize)), - d_itemsize(itemsize), d_msgq(msgq), d_msg_offset(0), d_eof(false), - d_tags(true), d_lengthtagname(lengthtagname) - { - } - - message_source_impl::~message_source_impl() - { - } - - int - message_source_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - char *out = (char*)output_items[0]; - int nn = 0; - - while(nn < noutput_items) { - if (d_msg){ - // - // Consume whatever we can from the current message - // - int mm = std::min(noutput_items - nn, (int)((d_msg->length() - d_msg_offset) / d_itemsize)); - memcpy (out, &(d_msg->msg()[d_msg_offset]), mm * d_itemsize); - - if (d_tags && (d_msg_offset == 0)) { - const uint64_t offset = this->nitems_written(0) + nn; - pmt::pmt_t key = pmt::string_to_symbol(d_lengthtagname); - pmt::pmt_t value = pmt::from_long(d_msg->length()); - this->add_item_tag(0, offset, key, value); - } - nn += mm; - out += mm * d_itemsize; - d_msg_offset += mm * d_itemsize; - assert(d_msg_offset <= d_msg->length()); - - if (d_msg_offset == d_msg->length()){ - if (d_msg->type() == 1) // type == 1 sets EOF - d_eof = true; - d_msg.reset(); - } - } - else { - // - // No current message - // - if (d_msgq->empty_p() && nn > 0){ // no more messages in the queue, return what we've got - break; - } - - if (d_eof) - return -1; - - d_msg = d_msgq->delete_head(); // block, waiting for a message - d_msg_offset = 0; - - if ((d_msg->length() % d_itemsize) != 0) - throw std::runtime_error("msg length is not a multiple of d_itemsize"); - } - - } - - return nn; - } - - } /* namespace blocks */ -} /* namespace gr */ diff --git a/gr-blocks/lib/message_source_impl.h b/gr-blocks/lib/message_source_impl.h deleted file mode 100644 index bbc8f728d5..0000000000 --- a/gr-blocks/lib/message_source_impl.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_MESSAGE_SOURCE_IMPL_H -#define INCLUDED_GR_MESSAGE_SOURCE_IMPL_H - -#include <gnuradio/blocks/message_source.h> -#include <gnuradio/message.h> - -namespace gr { - namespace blocks { - - class message_source_impl : public message_source - { - private: - size_t d_itemsize; - msg_queue::sptr d_msgq; - message::sptr d_msg; - unsigned d_msg_offset; - bool d_eof; - bool d_tags; - // FIXME: Is this adequate tagname length. - std::string d_lengthtagname; - - public: - message_source_impl(size_t itemsize, int msgq_limit); - message_source_impl(size_t itemsize, msg_queue::sptr msgq); - message_source_impl(size_t itemsize, msg_queue::sptr msgq, - const std::string& lengthtagname); - - ~message_source_impl(); - - msg_queue::sptr msgq() const { return d_msgq; } - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace blocks */ -} /* namespace gr */ - -#endif /* INCLUDED_GR_MESSAGE_SOURCE_IMPL_H */ diff --git a/gr-blocks/lib/nlog10_ff_impl.cc b/gr-blocks/lib/nlog10_ff_impl.cc index bed2da4d0d..5bc234f2cb 100644 --- a/gr-blocks/lib/nlog10_ff_impl.cc +++ b/gr-blocks/lib/nlog10_ff_impl.cc @@ -26,6 +26,7 @@ #include "nlog10_ff_impl.h" #include <gnuradio/io_signature.h> +#include <volk/volk.h> namespace gr { namespace blocks { @@ -39,8 +40,23 @@ namespace gr { : sync_block("nlog10_ff", io_signature::make (1, 1, sizeof(float)*vlen), io_signature::make (1, 1, sizeof(float)*vlen)), - d_n(n), d_vlen(vlen), d_k(k) + d_vlen(vlen) { + setk(k); + setn(n); + //TODO message handlers + } + + void + nlog10_ff_impl::setk(float k) + { + d_k = k; + } + + void + nlog10_ff_impl::setn(float n) + { + d_prefactor = n / log2f(10.0f); } int @@ -51,12 +67,14 @@ namespace gr { const float *in = (const float *) input_items[0]; float *out = (float *) output_items[0]; int noi = noutput_items * d_vlen; - float n = d_n; - float k = d_k; - - for (int i = 0; i < noi; i++) - out[i] = n * log10(std::max(in[i], (float) 1e-18)) + k; + volk_32f_log2_32f(out, in, noi); + volk_32f_s32f_multiply_32f(out, out, d_prefactor, noi); + if(d_k != 0.0f) { + for(int i = 0; i < noi; ++i) { + out[i] += d_k; + } + } return noutput_items; } diff --git a/gr-blocks/lib/nlog10_ff_impl.h b/gr-blocks/lib/nlog10_ff_impl.h index dd260bea1f..21c64d42f5 100644 --- a/gr-blocks/lib/nlog10_ff_impl.h +++ b/gr-blocks/lib/nlog10_ff_impl.h @@ -30,12 +30,14 @@ namespace gr { class BLOCKS_API nlog10_ff_impl : public nlog10_ff { - float d_n; + float d_prefactor; size_t d_vlen; float d_k; public: nlog10_ff_impl(float n, size_t vlen, float k); + void setn(float n); + void setk(float k); int work(int noutput_items, gr_vector_const_void_star &input_items, diff --git a/gr-blocks/lib/pdu_to_tagged_stream_impl.cc b/gr-blocks/lib/pdu_to_tagged_stream_impl.cc index aec5d335c4..0c48442fa7 100644 --- a/gr-blocks/lib/pdu_to_tagged_stream_impl.cc +++ b/gr-blocks/lib/pdu_to_tagged_stream_impl.cc @@ -52,10 +52,7 @@ namespace gr { int pdu_to_tagged_stream_impl::calculate_output_stream_length(const gr_vector_int &) { if (d_curr_len == 0) { - /* FIXME: This blocking call is far from ideal but is the best we - * can do at the moment - */ - pmt::pmt_t msg(delete_head_blocking(PDU_PORT_ID, 100)); + pmt::pmt_t msg(delete_head_nowait(PDU_PORT_ID)); if (msg.get() == NULL) { return 0; } diff --git a/gr-blocks/lib/tcp_server_sink_impl.h b/gr-blocks/lib/tcp_server_sink_impl.h index d10f3b95b8..ea1aa3e84a 100644 --- a/gr-blocks/lib/tcp_server_sink_impl.h +++ b/gr-blocks/lib/tcp_server_sink_impl.h @@ -39,7 +39,7 @@ namespace gr { boost::asio::io_service d_io_service; gr::thread::thread d_io_serv_thread; boost::asio::ip::tcp::endpoint d_endpoint; - std::auto_ptr<boost::asio::ip::tcp::socket> d_socket; + std::unique_ptr<boost::asio::ip::tcp::socket> d_socket; std::set<boost::asio::ip::tcp::socket *> d_sockets; boost::asio::ip::tcp::acceptor d_acceptor; diff --git a/gr-blocks/python/blocks/CMakeLists.txt b/gr-blocks/python/blocks/CMakeLists.txt index 19d808b1dd..afb860a075 100644 --- a/gr-blocks/python/blocks/CMakeLists.txt +++ b/gr-blocks/python/blocks/CMakeLists.txt @@ -26,7 +26,6 @@ GR_PYTHON_INSTALL( parse_file_metadata.py stream_to_vector_decimator.py DESTINATION ${GR_PYTHON_DIR}/gnuradio/blocks - COMPONENT "blocks_python" ) ######################################################################## diff --git a/gr-blocks/python/blocks/qa_logger.py b/gr-blocks/python/blocks/qa_logger.py new file mode 100644 index 0000000000..d2b6b3ee5e --- /dev/null +++ b/gr-blocks/python/blocks/qa_logger.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python +# +# Copyright 2016 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr, gr_unittest, blocks + +class test_logger (gr_unittest.TestCase): + + def setUp(self): + pass + + def tearDown(self): + pass + + def set_and_assert_log_level(self, block, level): + block.set_log_level(level) + self.assertEqual(block.log_level(), level) + + def test_log_level_for_block(self): + # Test the python API for getting and setting log levels of individual block + # go through all of the documented log_levels + ns = blocks.null_source(1) + self.set_and_assert_log_level(ns, "notset") + self.set_and_assert_log_level(ns, "debug") + self.set_and_assert_log_level(ns, "info") + self.set_and_assert_log_level(ns, "notice") + self.set_and_assert_log_level(ns, "warn") + self.set_and_assert_log_level(ns, "error") + self.set_and_assert_log_level(ns, "crit") + self.set_and_assert_log_level(ns, "alert") + self.set_and_assert_log_level(ns, "emerg") + # There's a couple of special cases. "off" == "notset" (specific to gr) + # and "fatal" == "emerg" (built in to log4cpp) + ns.set_log_level("off") + self.assertEqual(ns.log_level(), "notset") + ns.set_log_level("fatal") + self.assertEqual(ns.log_level(), "emerg") + # Make sure exception is throw on bogus data + self.assertRaises(RuntimeError, ns.set_log_level, "11") + + + def test_log_level_for_tb(self): + # Test the python API for getting and setting log levels for a top_block + nsrc = blocks.null_source(4) + nsnk = blocks.null_sink(4) + # Set all log levels to a known state + nsrc.set_log_level("debug") + nsnk.set_log_level("debug") + tb = gr.top_block() + tb.connect(nsrc, nsnk) + # confirm that the tb has log_level of first block + self.assertEqual(tb.log_level(), "debug") + # confirm that changing tb log_level propagates to connected blocks + tb.set_log_level("alert") + self.assertEqual(tb.log_level(), "alert") + self.assertEqual(nsrc.log_level(), "alert") + self.assertEqual(nsnk.log_level(), "alert") + + def test_log_level_for_hier_block(self): + # Test the python API for getting and setting log levels for hier blocks + nsrc = blocks.null_source(4) + nsnk = blocks.null_sink(4) + b = blocks.stream_to_vector_decimator(4, 1, 1, 1) # just a random hier block that exists + tb = gr.top_block() + tb.connect(nsrc, b, nsnk) + tb.set_log_level("debug") + self.assertEqual(tb.log_level(), "debug") + self.assertEqual(nsrc.log_level(), "debug") + self.assertEqual(nsnk.log_level(), "debug") + self.assertEqual(b.one_in_n.log_level(), "debug") + tb.set_log_level("alert") + self.assertEqual(tb.log_level(), "alert") + self.assertEqual(nsrc.log_level(), "alert") + self.assertEqual(nsnk.log_level(), "alert") + self.assertEqual(b.one_in_n.log_level(), "alert") + +if __name__ == '__main__': + gr_unittest.run(test_logger, "test_logger.xml") diff --git a/gr-blocks/python/blocks/qa_message.py b/gr-blocks/python/blocks/qa_message.py index 1d677007b4..1d0380d44c 100755 --- a/gr-blocks/python/blocks/qa_message.py +++ b/gr-blocks/python/blocks/qa_message.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2010,2013 Free Software Foundation, Inc. +# Copyright 2004,2010,2013,2016 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -100,35 +100,6 @@ class test_message(gr_unittest.TestCase): tb.run() self.assertEquals(input_data, dst.data()) - def test_301(self): - # Use itemsize, limit constructor - src = blocks.message_source(gr.sizeof_char) - dst = blocks.vector_sink_b() - tb = gr.top_block() - tb.connect(src, dst) - src.msgq().insert_tail(gr.message_from_string('01234')) - src.msgq().insert_tail(gr.message_from_string('5')) - src.msgq().insert_tail(gr.message_from_string('')) - src.msgq().insert_tail(gr.message_from_string('6789')) - src.msgq().insert_tail(gr.message(1)) # send EOF - tb.run() - self.assertEquals(tuple(map(ord, '0123456789')), dst.data()) - - def test_302(self): - # Use itemsize, msgq constructor - msgq = gr.msg_queue() - src = blocks.message_source(gr.sizeof_char, msgq) - dst = blocks.vector_sink_b() - tb = gr.top_block() - tb.connect(src, dst) - src.msgq().insert_tail(gr.message_from_string('01234')) - src.msgq().insert_tail(gr.message_from_string('5')) - src.msgq().insert_tail(gr.message_from_string('')) - src.msgq().insert_tail(gr.message_from_string('6789')) - src.msgq().insert_tail(gr.message(1)) # send EOF - tb.run() - self.assertEquals(tuple(map(ord, '0123456789')), dst.data()) - def test_debug_401(self): msg = pmt.intern("TESTING") src = blocks.message_strobe(msg, 500) diff --git a/gr-blocks/python/blocks/qa_message_tags.py b/gr-blocks/python/blocks/qa_message_tags.py deleted file mode 100644 index 0d4f77bf9f..0000000000 --- a/gr-blocks/python/blocks/qa_message_tags.py +++ /dev/null @@ -1,27 +0,0 @@ -import time - -from gnuradio import gr, gr_unittest, blocks - -class test_message_tags (gr_unittest.TestCase): - - def test_1 (self): - data = ('hello', 'you', 'there') - tx_msgq = gr.msg_queue() - rx_msgq = gr.msg_queue() - for d in data: - tx_msgq.insert_tail(gr.message_from_string(d)) - tx_msgq.insert_tail(gr.message(1)) # send EOF - tb = gr.top_block() - src = blocks.message_source(gr.sizeof_char, tx_msgq, "packet_length") - snk = blocks.message_sink(gr.sizeof_char, rx_msgq, False, "packet_length") - tb.connect(src, snk) - tb.start() - time.sleep(1) - tb.stop() - for d in data: - msg = rx_msgq.delete_head() - contents = msg.to_string() - self.assertEqual(d, contents) - -if __name__ == '__main__': - gr_unittest.run(test_message_tags, "test_message_tags.xml") diff --git a/gr-blocks/python/blocks/qa_nlog10.py b/gr-blocks/python/blocks/qa_nlog10.py index 0194e85d48..c925479f59 100755 --- a/gr-blocks/python/blocks/qa_nlog10.py +++ b/gr-blocks/python/blocks/qa_nlog10.py @@ -31,15 +31,15 @@ class test_nlog10(gr_unittest.TestCase): self.tb = None def test_001(self): - src_data = (-10, 0, 10, 100, 1000, 10000, 100000) - expected_result = (-180, -180, 10, 20, 30, 40, 50) + src_data = (1, 10, 100, 1000, 10000, 100000) + expected_result = (0, 10, 20, 30, 40, 50) src = blocks.vector_source_f(src_data) op = blocks.nlog10_ff(10) dst = blocks.vector_sink_f() self.tb.connect (src, op, dst) self.tb.run() result_data = dst.data() - self.assertFloatTuplesAlmostEqual (expected_result, result_data) + self.assertFloatTuplesAlmostEqual (expected_result, result_data, 5) if __name__ == '__main__': diff --git a/gr-blocks/python/blocks/qa_pdu.py b/gr-blocks/python/blocks/qa_pdu.py index bbee3605ba..79d39df48b 100755 --- a/gr-blocks/python/blocks/qa_pdu.py +++ b/gr-blocks/python/blocks/qa_pdu.py @@ -55,18 +55,17 @@ class test_pdu(gr_unittest.TestCase): self.tb.connect(src, snk2) self.tb.connect(src, snk3) self.tb.msg_connect(snk3, "pdus", dbg, "store") - self.tb.start() # make our reference and message pmts port = pmt.intern("pdus") msg = pmt.cons( pmt.PMT_NIL, pmt.make_u8vector(16, 0xFF)) # post the message - src.to_basic_block()._post(port, msg) # eww, what's that smell? + src.to_basic_block()._post(port, msg) + src.to_basic_block()._post(pmt.intern("system"), + pmt.cons(pmt.intern("done"), pmt.PMT_T)) - while dbg.num_messages() < 1: - time.sleep(0.1) - self.tb.stop() + self.tb.start() self.tb.wait() # Get the vector of data from the vector sink @@ -98,11 +97,11 @@ class test_pdu(gr_unittest.TestCase): msg = pmt.cons( pmt.PMT_NIL, pmt.init_f32vector(10, src_data)) src.to_basic_block()._post(port, msg) + src.to_basic_block()._post(pmt.intern("system"), + pmt.cons(pmt.intern("done"), pmt.PMT_T)) self.tb.start() - #ideally, would wait until we get ten samples - time.sleep(0.2) - self.tb.stop() + self.tb.wait() self.assertEqual(src_data, list(snk.data()) ) @@ -125,9 +124,6 @@ class test_pdu(gr_unittest.TestCase): self.tb.connect(src, s2ts, ts2pdu) self.tb.msg_connect(ts2pdu, "pdus", dbg, "store") self.tb.start() - while dbg.num_messages() < 1: - time.sleep(0.1) - self.tb.stop() self.tb.wait() result_msg = dbg.get_message(0) metadata = pmt.to_python(pmt.car(result_msg)) @@ -138,4 +134,3 @@ class test_pdu(gr_unittest.TestCase): if __name__ == '__main__': gr_unittest.run(test_pdu, "test_pdu.xml") - diff --git a/gr-blocks/python/grc_gnuradio/CMakeLists.txt b/gr-blocks/python/grc_gnuradio/CMakeLists.txt deleted file mode 100644 index 9ff1240997..0000000000 --- a/gr-blocks/python/grc_gnuradio/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. - -######################################################################## - -include(GrPython) - -GR_PYTHON_INSTALL( - FILES __init__.py - DESTINATION ${GR_PYTHON_DIR}/grc_gnuradio - COMPONENT "blocks_python" -) - -GR_PYTHON_INSTALL(FILES - blks2/__init__.py - blks2/error_rate.py - blks2/selector.py - blks2/tcp.py - DESTINATION ${GR_PYTHON_DIR}/grc_gnuradio/blks2 - COMPONENT "blocks_python" -) diff --git a/gr-blocks/python/grc_gnuradio/README b/gr-blocks/python/grc_gnuradio/README deleted file mode 100644 index 897eed65ca..0000000000 --- a/gr-blocks/python/grc_gnuradio/README +++ /dev/null @@ -1,11 +0,0 @@ -This is the grc_gnuradio module. -It contains supplemental python modules that grc uses at runtime. -The supplemental modules are meant to mimic modules in gnuradio. -These will be phased-out as new functionaility is merged into gnuradio. - -The blk2s module wraps many blocks in blks2 and gives them streaming outputs. -Will be phased-out by new message passing implementations. -Other blks2 blocks will hopefully make their way into blks2impl. - -The wxgui module contains a top_block + wxgui frame. -Will be phased-out by gui.py in wxgui and a new top block template. diff --git a/gr-blocks/python/grc_gnuradio/__init__.py b/gr-blocks/python/grc_gnuradio/__init__.py deleted file mode 100644 index 8b13789179..0000000000 --- a/gr-blocks/python/grc_gnuradio/__init__.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/gr-blocks/python/grc_gnuradio/blks2/__init__.py b/gr-blocks/python/grc_gnuradio/blks2/__init__.py deleted file mode 100644 index d3c8210834..0000000000 --- a/gr-blocks/python/grc_gnuradio/blks2/__init__.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2008-2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from selector import selector, valve -from error_rate import error_rate -from tcp import tcp_source, tcp_sink - -try: - from packet import options, packet_encoder, packet_decoder, \ - packet_mod_b, packet_mod_s, packet_mod_i, packet_mod_f, packet_mod_c, \ - packet_demod_b, packet_demod_s, packet_demod_i, packet_demod_f, packet_demod_c -except ImportError: - pass # only available if gr-digital is install diff --git a/gr-blocks/python/grc_gnuradio/blks2/error_rate.py b/gr-blocks/python/grc_gnuradio/blks2/error_rate.py deleted file mode 100644 index df03f551b3..0000000000 --- a/gr-blocks/python/grc_gnuradio/blks2/error_rate.py +++ /dev/null @@ -1,143 +0,0 @@ -# Copyright 2008 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -default_win_size = 1000 - -from gnuradio import gr -from gnuradio import blocks -import gnuradio.gr.gr_threading as _threading -import numpy - -#generate 1s counts array -_1s_counts = [sum([1&(i>>j) for j in range(8)]) for i in range(2**8)] - -class input_watcher(_threading.Thread): - """ - Read samples from the message queue and hand them to the callback. - """ - - def __init__(self, msgq, callback): - self._msgq = msgq - self._callback = callback - _threading.Thread.__init__(self) - self.setDaemon(1) - self.keep_running = True - self.start() - - def run(self): - r = '' - while True: - msg = self._msgq.delete_head() - itemsize = int(msg.arg1()) - nitems = int(msg.arg2()) - s = r + msg.to_string() - i = (nitems-nitems%2)*itemsize - r = s[i:] - s = s[:i] - samples = numpy.fromstring(s, numpy.int8) - self._callback(samples) - -class error_rate(gr.hier_block2): - """ - Sample the incoming data streams (byte) and calculate the bit or symbol error rate. - Write the running rate to the output data stream (float). - """ - - def __init__(self, type='BER', win_size=default_win_size, bits_per_symbol=2): - """ - Error rate constructor. - - Args: - type: a string 'BER' or 'SER' - win_size: the number of samples to calculate over - bits_per_symbol: the number of information bits per symbol (BER only) - """ - #init - gr.hier_block2.__init__( - self, 'error_rate', - gr.io_signature(2, 2, gr.sizeof_char), - gr.io_signature(1, 1, gr.sizeof_float), - ) - - print "Warning: the blks2.error_rate is deprecated." - - assert type in ('BER', 'SER') - self._max_samples = win_size - self._bits_per_symbol = bits_per_symbol - #setup message queue - msg_source = blocks.message_source(gr.sizeof_float, 1) - self._msgq_source = msg_source.msgq() - msgq_sink = gr.msg_queue(2) - msg_sink = blocks.message_sink(gr.sizeof_char, msgq_sink, False) #False -> blocking - inter = blocks.interleave(gr.sizeof_char) - #start thread - self._num_errs = 0 - self._err_index = 0 - self._num_samps = 0 - self._err_array = numpy.zeros(self._max_samples, numpy.int8) - if type == 'BER': - input_watcher(msgq_sink, self._handler_ber) - elif type == 'SER': - input_watcher(msgq_sink, self._handler_ser) - #connect - self.connect(msg_source, self) - self.connect((self, 0), (inter, 0)) - self.connect((self, 1), (inter, 1)) - self.connect(inter, msg_sink) - - def _handler_ber(self, samples): - num = len(samples)/2 - arr = numpy.zeros(num, numpy.float32) - for i in range(num): - old_err = self._err_array[self._err_index] - #record error - self._err_array[self._err_index] = _1s_counts[samples[i*2] ^ samples[i*2 + 1]] - self._num_errs = self._num_errs + self._err_array[self._err_index] - old_err - #increment index - self._err_index = (self._err_index + 1)%self._max_samples - self._num_samps = min(self._num_samps + 1, self._max_samples) - #write sample - arr[i] = float(self._num_errs)/float(self._num_samps*self._bits_per_symbol) - #write message - msg = gr.message_from_string(arr.tostring(), 0, gr.sizeof_float, num) - self._msgq_source.insert_tail(msg) - - def _handler_ser(self, samples): - num = len(samples)/2 - arr = numpy.zeros(num, numpy.float32) - for i in range(num): - old_err = self._err_array[self._err_index] - #record error - ref = samples[i*2] - res = samples[i*2 + 1] - if ref == res: - self._err_array[self._err_index] = 0 - else: - self._err_array[self._err_index] = 1 - #update number of errors - self._num_errs = self._num_errs + self._err_array[self._err_index] - old_err - #increment index - self._err_index = (self._err_index + 1)%self._max_samples - self._num_samps = min(self._num_samps + 1, self._max_samples) - #write sample - arr[i] = float(self._num_errs)/float(self._num_samps) - #write message - msg = gr.message_from_string(arr.tostring(), 0, gr.sizeof_float, num) - self._msgq_source.insert_tail(msg) diff --git a/gr-blocks/python/grc_gnuradio/blks2/selector.py b/gr-blocks/python/grc_gnuradio/blks2/selector.py deleted file mode 100644 index 0a74309688..0000000000 --- a/gr-blocks/python/grc_gnuradio/blks2/selector.py +++ /dev/null @@ -1,147 +0,0 @@ -# -# Copyright 2008,2013 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr -from gnuradio import blocks - -class selector(gr.hier_block2): - """A hier2 block with N inputs and M outputs, where data is only forwarded through input n to output m.""" - def __init__(self, item_size, num_inputs, num_outputs, input_index, output_index): - """ - Selector constructor. - - Args: - item_size: the size of the gr data stream in bytes - num_inputs: the number of inputs (integer) - num_outputs: the number of outputs (integer) - input_index: the index for the source data - output_index: the index for the destination data - """ - gr.hier_block2.__init__( - self, 'selector', - gr.io_signature(num_inputs, num_inputs, item_size), - gr.io_signature(num_outputs, num_outputs, item_size), - ) - - print "Warning: the blks2.selector block is deprecated." - - #terminator blocks for unused inputs and outputs - self.input_terminators = [blocks.null_sink(item_size) for i in range(num_inputs)] - self.output_terminators = [blocks.head(item_size, 0) for i in range(num_outputs)] - self.copy = blocks.copy(item_size) - #connections - for i in range(num_inputs): self.connect((self, i), self.input_terminators[i]) - for i in range(num_outputs): self.connect(blocks.null_source(item_size), - self.output_terminators[i], (self, i)) - self.item_size = item_size - self.input_index = input_index - self.output_index = output_index - self.num_inputs = num_inputs - self.num_outputs = num_outputs - self._connect_current() - - def _indexes_valid(self): - """ - Are the input and output indexes within range of the number of inputs and outputs? - - Returns: - true if input index and output index are in range - """ - return self.input_index in range(self.num_inputs) and self.output_index in range(self.num_outputs) - - def _connect_current(self): - """If the input and output indexes are valid: - disconnect the blocks at the input and output index from their terminators, - and connect them to one another. Then connect the terminators to one another.""" - if self._indexes_valid(): - self.disconnect((self, self.input_index), self.input_terminators[self.input_index]) - self.disconnect(self.output_terminators[self.output_index], (self, self.output_index)) - self.connect((self, self.input_index), self.copy) - self.connect(self.copy, (self, self.output_index)) - self.connect(self.output_terminators[self.output_index], self.input_terminators[self.input_index]) - - def _disconnect_current(self): - """If the input and output indexes are valid: - disconnect the blocks at the input and output index from one another, - and the terminators at the input and output index from one another. - Reconnect the blocks to the terminators.""" - if self._indexes_valid(): - self.disconnect((self, self.input_index), self.copy) - self.disconnect(self.copy, (self, self.output_index)) - self.disconnect(self.output_terminators[self.output_index], self.input_terminators[self.input_index]) - self.connect((self, self.input_index), self.input_terminators[self.input_index]) - self.connect(self.output_terminators[self.output_index], (self, self.output_index)) - - def set_input_index(self, input_index): - """ - Change the block to the new input index if the index changed. - - Args: - input_index: the new input index - """ - if self.input_index != input_index: - self.lock() - self._disconnect_current() - self.input_index = input_index - self._connect_current() - self.unlock() - - def set_output_index(self, output_index): - """ - Change the block to the new output index if the index changed. - - Args: - output_index: the new output index - """ - if self.output_index != output_index: - self.lock() - self._disconnect_current() - self.output_index = output_index - self._connect_current() - self.unlock() - -class valve(selector): - """Wrapper for selector with 1 input and 1 output.""" - - def __init__(self, item_size, open): - """ - Constructor for valve. - - Args: - item_size: the size of the gr data stream in bytes - open: true if initial valve state is open - """ - if open: output_index = -1 - else: output_index = 0 - selector.__init__(self, item_size, 1, 1, 0, output_index) - - print "Warning: the blks2.valve block is deprecated." - - def set_open(self, open): - """ - Callback to set open state. - - Args: - open: true to set valve state to open - """ - if open: output_index = -1 - else: output_index = 0 - self.set_output_index(output_index) diff --git a/gr-blocks/python/grc_gnuradio/blks2/tcp.py b/gr-blocks/python/grc_gnuradio/blks2/tcp.py deleted file mode 100644 index 6ae24d3a7b..0000000000 --- a/gr-blocks/python/grc_gnuradio/blks2/tcp.py +++ /dev/null @@ -1,74 +0,0 @@ -# -# Copyright 2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, blocks -import socket -import os - -def _get_sock_fd(addr, port, server): - """ - Get the file descriptor for the socket. - As a client, block on connect, dup the socket descriptor. - As a server, block on accept, dup the client descriptor. - - Args: - addr: the ip address string - port: the tcp port number - server: true for server mode, false for client mode - - Returns: - the file descriptor number - """ - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - if server: - sock.bind((addr, port)) - sock.listen(1) - clientsock, address = sock.accept() - return os.dup(clientsock.fileno()) - else: - sock.connect((addr, port)) - return os.dup(sock.fileno()) - -class tcp_source(gr.hier_block2): - def __init__(self, itemsize, addr, port, server=True): - #init hier block - gr.hier_block2.__init__( - self, 'tcp_source', - gr.io_signature(0, 0, 0), - gr.io_signature(1, 1, itemsize), - ) - fd = _get_sock_fd(addr, port, server) - self.connect(blocks.file_descriptor_source(itemsize, fd), self) - - print "Warning: the blks2.tcp_source block is deprecated." - -class tcp_sink(gr.hier_block2): - def __init__(self, itemsize, addr, port, server=False): - #init hier block - gr.hier_block2.__init__( - self, 'tcp_sink', - gr.io_signature(1, 1, itemsize), - gr.io_signature(0, 0, 0), - ) - fd = _get_sock_fd(addr, port, server) - self.connect(self, blocks.file_descriptor_sink(itemsize, fd)) - - print "Warning: the blks2.tcp_sink block is deprecated." diff --git a/gr-blocks/swig/CMakeLists.txt b/gr-blocks/swig/CMakeLists.txt index d64c347919..d5e9a8a725 100644 --- a/gr-blocks/swig/CMakeLists.txt +++ b/gr-blocks/swig/CMakeLists.txt @@ -73,8 +73,7 @@ foreach(swigfile ${GR_SWIG_BLOCK_IFILES}) GR_SWIG_INSTALL( TARGETS ${swigfile} DESTINATION ${GR_PYTHON_DIR}/gnuradio/blocks - COMPONENT "blocks_python") - + ) list(APPEND SWIGFILES ${swigfile}.i) list(APPEND SWIGDOCFILES ${CMAKE_CURRENT_BINARY_DIR}/${swigfile}_doc.i) endforeach(swigfile) @@ -84,12 +83,10 @@ install( ${SWIGFILES} ${SWIGDOCFILES} DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig - COMPONENT "blocks_swig" ) # Install the Python file that pulls in the swig built files. GR_PYTHON_INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/blocks_swig.py DESTINATION ${GR_PYTHON_DIR}/gnuradio/blocks - COMPONENT "blocks_python" ) diff --git a/gr-blocks/swig/blocks_swig0.i b/gr-blocks/swig/blocks_swig0.i index 66e6ca10f8..48551ab06c 100644 --- a/gr-blocks/swig/blocks_swig0.i +++ b/gr-blocks/swig/blocks_swig0.i @@ -44,11 +44,8 @@ #include "gnuradio/blocks/file_meta_source.h" #include "gnuradio/blocks/head.h" #include "gnuradio/blocks/message_debug.h" -#include "gnuradio/blocks/message_sink.h" -#include "gnuradio/blocks/message_source.h" #include "gnuradio/blocks/message_strobe.h" #include "gnuradio/blocks/message_strobe_random.h" -#include "gnuradio/blocks/message_burst_source.h" #include "gnuradio/blocks/nop.h" #include "gnuradio/blocks/null_sink.h" #include "gnuradio/blocks/null_source.h" @@ -70,11 +67,8 @@ %include "gnuradio/blocks/file_meta_source.h" %include "gnuradio/blocks/head.h" %include "gnuradio/blocks/message_debug.h" -%include "gnuradio/blocks/message_sink.h" -%include "gnuradio/blocks/message_source.h" %include "gnuradio/blocks/message_strobe.h" %include "gnuradio/blocks/message_strobe_random.h" -%include "gnuradio/blocks/message_burst_source.h" %include "gnuradio/blocks/nop.h" %include "gnuradio/blocks/null_sink.h" %include "gnuradio/blocks/null_source.h" @@ -93,11 +87,8 @@ GR_SWIG_BLOCK_MAGIC2(blocks, file_meta_sink); GR_SWIG_BLOCK_MAGIC2(blocks, file_meta_source); GR_SWIG_BLOCK_MAGIC2(blocks, head); GR_SWIG_BLOCK_MAGIC2(blocks, message_debug); -GR_SWIG_BLOCK_MAGIC2(blocks, message_sink); -GR_SWIG_BLOCK_MAGIC2(blocks, message_source); GR_SWIG_BLOCK_MAGIC2(blocks, message_strobe); GR_SWIG_BLOCK_MAGIC2(blocks, message_strobe_random); -GR_SWIG_BLOCK_MAGIC2(blocks, message_burst_source); GR_SWIG_BLOCK_MAGIC2(blocks, nop); GR_SWIG_BLOCK_MAGIC2(blocks, null_sink); GR_SWIG_BLOCK_MAGIC2(blocks, null_source); |