forked from sdr/gr-osmosdr
add virtual rtlsdr source and move both to 'Sources' category in GRC
This commit is contained in:
parent
fd83f5f33f
commit
b7c06541c3
|
@ -32,6 +32,7 @@ macro(GEN_BLOCK_XML _generator _xml_block)
|
||||||
)
|
)
|
||||||
endmacro(GEN_BLOCK_XML)
|
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_source_c.xml)
|
||||||
#GEN_BLOCK_XML(gen_osmosdr_blocks.py osmosdr_sink_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
|
install(FILES
|
||||||
${xml_blocks}
|
${xml_blocks}
|
||||||
osmosdr_block_tree.xml
|
|
||||||
# DESTINATION ${GRC_BLOCKS_DIR}
|
# DESTINATION ${GRC_BLOCKS_DIR}
|
||||||
DESTINATION share/gnuradio/grc/blocks
|
DESTINATION share/gnuradio/grc/blocks
|
||||||
)
|
)
|
||||||
|
|
|
@ -21,8 +21,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
MAIN_TMPL = """\
|
MAIN_TMPL = """\
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<block>
|
<block>
|
||||||
<name>OsmoSDR $sourk.title()</name>
|
<name>$(title) $sourk.title()</name>
|
||||||
<key>osmosdr_$(sourk)_c</key>
|
<key>$(prefix)_$(sourk)_c</key>
|
||||||
|
<category>Sources</category>
|
||||||
<throttle>1</throttle>
|
<throttle>1</throttle>
|
||||||
<import>import osmosdr</import>
|
<import>import osmosdr</import>
|
||||||
<make>osmosdr.$(sourk)_c( args="nchan=" + str(\$nchan) + " " + \$args )
|
<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:
|
See the OsmoSDR project page for more detailed documentation:
|
||||||
http://sdr.osmocom.org/trac/
|
http://sdr.osmocom.org/trac/
|
||||||
http://sdr.osmocom.org/trac/wiki/GrOsmoSDR
|
http://sdr.osmocom.org/trac/wiki/GrOsmoSDR
|
||||||
|
http://sdr.osmocom.org/trac/wiki/rtl-sdr
|
||||||
</doc>
|
</doc>
|
||||||
</block>
|
</block>
|
||||||
"""
|
"""
|
||||||
|
@ -211,13 +213,25 @@ def parse_tmpl(_tmpl, **kwargs):
|
||||||
|
|
||||||
max_num_channels = 5
|
max_num_channels = 5
|
||||||
|
|
||||||
|
import os.path
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import sys
|
import sys
|
||||||
for file in sys.argv[1:]:
|
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'
|
sourk = 'source'
|
||||||
dir = 'out'
|
dir = 'out'
|
||||||
elif file.endswith ('sink_c.xml'):
|
elif tail.endswith ('sink_c.xml'):
|
||||||
sourk = 'sink'
|
sourk = 'sink'
|
||||||
dir = 'in'
|
dir = 'in'
|
||||||
else: raise Exception, 'is %s a source or sink?'%file
|
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,
|
open(file, 'w').write(parse_tmpl(MAIN_TMPL,
|
||||||
max_nchan=max_num_channels,
|
max_nchan=max_num_channels,
|
||||||
params=params,
|
params=params,
|
||||||
|
title=title,
|
||||||
|
prefix=prefix,
|
||||||
sourk=sourk,
|
sourk=sourk,
|
||||||
dir=dir,
|
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…
Reference in New Issue