add virtual rtlsdr source and move both to 'Sources' category in GRC

gr3.6
Dimitri Stolnikov 11 years ago
parent fd83f5f33f
commit b7c06541c3
  1. 2
      grc/CMakeLists.txt
  2. 24
      grc/gen_osmosdr_blocks.py
  3. 13
      grc/osmosdr_block_tree.xml

@ -32,6 +32,7 @@ macro(GEN_BLOCK_XML _generator _xml_block)
)
endmacro(GEN_BLOCK_XML)
GEN_BLOCK_XML(gen_osmosdr_blocks.py rtlsdr_source_c.xml)
GEN_BLOCK_XML(gen_osmosdr_blocks.py osmosdr_source_c.xml)
#GEN_BLOCK_XML(gen_osmosdr_blocks.py osmosdr_sink_c.xml)
@ -39,7 +40,6 @@ add_custom_target(osmosdr_grc_xml_blocks ALL DEPENDS ${xml_blocks})
install(FILES
${xml_blocks}
osmosdr_block_tree.xml
# DESTINATION ${GRC_BLOCKS_DIR}
DESTINATION share/gnuradio/grc/blocks
)

@ -21,8 +21,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
MAIN_TMPL = """\
<?xml version="1.0"?>
<block>
<name>OsmoSDR $sourk.title()</name>
<key>osmosdr_$(sourk)_c</key>
<name>$(title) $sourk.title()</name>
<key>$(prefix)_$(sourk)_c</key>
<category>Sources</category>
<throttle>1</throttle>
<import>import osmosdr</import>
<make>osmosdr.$(sourk)_c( args="nchan=" + str(\$nchan) + " " + \$args )
@ -147,6 +148,7 @@ Otherwise, the user should specify one of the possible antenna choices.
See the OsmoSDR project page for more detailed documentation:
http://sdr.osmocom.org/trac/
http://sdr.osmocom.org/trac/wiki/GrOsmoSDR
http://sdr.osmocom.org/trac/wiki/rtl-sdr
</doc>
</block>
"""
@ -211,13 +213,25 @@ def parse_tmpl(_tmpl, **kwargs):
max_num_channels = 5
import os.path
if __name__ == '__main__':
import sys
for file in sys.argv[1:]:
if file.endswith ('source_c.xml'):
head, tail = os.path.split(file)
if tail.startswith('rtlsdr'):
title = 'RTLSDR (official)'
prefix = 'rtlsdr'
elif tail.startswith('osmosdr'):
title = 'OsmoSDR'
prefix = 'osmosdr'
else: raise Exception, 'file %s has wrong syntax!'%tail
if tail.endswith ('source_c.xml'):
sourk = 'source'
dir = 'out'
elif file.endswith ('sink_c.xml'):
elif tail.endswith ('sink_c.xml'):
sourk = 'sink'
dir = 'in'
else: raise Exception, 'is %s a source or sink?'%file
@ -226,6 +240,8 @@ if __name__ == '__main__':
open(file, 'w').write(parse_tmpl(MAIN_TMPL,
max_nchan=max_num_channels,
params=params,
title=title,
prefix=prefix,
sourk=sourk,
dir=dir,
))

@ -1,13 +0,0 @@
<?xml version="1.0"?>
<!--
###################################################
##Block Tree for OsmoSDR blocks.
###################################################
-->
<cat>
<name></name> <!-- Blank for Root Name -->
<cat>
<name>OsmoSDR</name>
<block>osmosdr_source_c</block>
</cat>
</cat>
Loading…
Cancel
Save