diff options
author | Dimitri Stolnikov <horiz0n@gmx.net> | 2012-06-12 21:45:01 +0200 |
---|---|---|
committer | Dimitri Stolnikov <horiz0n@gmx.net> | 2012-06-12 21:45:01 +0200 |
commit | b7c06541c33486f778fbf133b3ea0f8983dc06b2 (patch) | |
tree | b4cdf98e544518a88cef24ceca0c94eebba948b1 /grc | |
parent | fd83f5f33f5763df076198f59254291ba55d5ac8 (diff) |
add virtual rtlsdr source and move both to 'Sources' category in GRC
Diffstat (limited to 'grc')
-rw-r--r-- | grc/CMakeLists.txt | 2 | ||||
-rw-r--r-- | grc/gen_osmosdr_blocks.py | 24 | ||||
-rw-r--r-- | grc/osmosdr_block_tree.xml | 13 |
3 files changed, 21 insertions, 18 deletions
diff --git a/grc/CMakeLists.txt b/grc/CMakeLists.txt index d30761e..0f253b5 100644 --- a/grc/CMakeLists.txt +++ b/grc/CMakeLists.txt @@ -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 ) diff --git a/grc/gen_osmosdr_blocks.py b/grc/gen_osmosdr_blocks.py index ab11ed7..a36cca5 100644 --- a/grc/gen_osmosdr_blocks.py +++ b/grc/gen_osmosdr_blocks.py @@ -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, )) diff --git a/grc/osmosdr_block_tree.xml b/grc/osmosdr_block_tree.xml deleted file mode 100644 index 056cda1..0000000 --- a/grc/osmosdr_block_tree.xml +++ /dev/null @@ -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> |