diff options
27 files changed, 100 insertions, 29 deletions
diff --git a/gr-blocks/lib/socket_pdu_impl.cc b/gr-blocks/lib/socket_pdu_impl.cc index 3e483fb8a7..a467452c3f 100644 --- a/gr-blocks/lib/socket_pdu_impl.cc +++ b/gr-blocks/lib/socket_pdu_impl.cc @@ -57,7 +57,9 @@ namespace gr { } else if ((type == "TCP_SERVER") || (type == "TCP_CLIENT")) { boost::asio::ip::tcp::resolver resolver(d_io_service); - boost::asio::ip::tcp::resolver::query query(boost::asio::ip::tcp::v4(), addr, port); + boost::asio::ip::tcp::resolver::query query(boost::asio::ip::tcp::v4(), + addr, port, + boost::asio::ip::resolver_query_base::passive); d_tcp_endpoint = *resolver.resolve(query); } else if ((type == "UDP_SERVER") && ((addr.empty()) || (addr == "0.0.0.0"))) { // Bind on all interfaces @@ -68,7 +70,9 @@ namespace gr { } else if ((type == "UDP_SERVER") || (type == "UDP_CLIENT")) { boost::asio::ip::udp::resolver resolver(d_io_service); - boost::asio::ip::udp::resolver::query query(boost::asio::ip::udp::v4(), addr, port); + boost::asio::ip::udp::resolver::query query(boost::asio::ip::udp::v4(), + addr, port, + boost::asio::ip::resolver_query_base::passive); if (type == "UDP_SERVER") d_udp_endpoint = *resolver.resolve(query); diff --git a/gr-digital/grc/digital_constellation_modulator.xml b/gr-digital/grc/digital_constellation_modulator.xml index 7b7ce24e47..9905197f93 100644 --- a/gr-digital/grc/digital_constellation_modulator.xml +++ b/gr-digital/grc/digital_constellation_modulator.xml @@ -86,7 +86,7 @@ </option> </param> <param> - <name>Logging</name> + <name>Log</name> <key>log</key> <value>False</value> <type>bool</type> diff --git a/gr-digital/grc/digital_dxpsk_demod.xml b/gr-digital/grc/digital_dxpsk_demod.xml index 1c6314d305..5b26d5b8ec 100644 --- a/gr-digital/grc/digital_dxpsk_demod.xml +++ b/gr-digital/grc/digital_dxpsk_demod.xml @@ -114,7 +114,7 @@ </option> </param> <param> - <name>Logging</name> + <name>Log</name> <key>log</key> <value>False</value> <type>bool</type> diff --git a/gr-digital/grc/digital_dxpsk_mod.xml b/gr-digital/grc/digital_dxpsk_mod.xml index 08a95f1a9c..02da10028e 100644 --- a/gr-digital/grc/digital_dxpsk_mod.xml +++ b/gr-digital/grc/digital_dxpsk_mod.xml @@ -91,7 +91,7 @@ </option> </param> <param> - <name>Logging</name> + <name>Log</name> <key>log</key> <value>False</value> <type>bool</type> diff --git a/gr-digital/grc/digital_gfsk_demod.xml b/gr-digital/grc/digital_gfsk_demod.xml index ce3024d892..cbea39e63e 100644 --- a/gr-digital/grc/digital_gfsk_demod.xml +++ b/gr-digital/grc/digital_gfsk_demod.xml @@ -70,7 +70,7 @@ </option> </param> <param> - <name>Logging</name> + <name>Log</name> <key>log</key> <value>False</value> <type>bool</type> diff --git a/gr-digital/grc/digital_gfsk_mod.xml b/gr-digital/grc/digital_gfsk_mod.xml index 2d6cd1ea54..08e2c84790 100644 --- a/gr-digital/grc/digital_gfsk_mod.xml +++ b/gr-digital/grc/digital_gfsk_mod.xml @@ -49,7 +49,7 @@ </option> </param> <param> - <name>Logging</name> + <name>Log</name> <key>log</key> <value>False</value> <type>bool</type> diff --git a/gr-digital/grc/digital_gmsk_demod.xml b/gr-digital/grc/digital_gmsk_demod.xml index e037b8ea03..4d57f1a17a 100644 --- a/gr-digital/grc/digital_gmsk_demod.xml +++ b/gr-digital/grc/digital_gmsk_demod.xml @@ -63,7 +63,7 @@ </option> </param> <param> - <name>Logging</name> + <name>Log</name> <key>log</key> <value>False</value> <type>bool</type> diff --git a/gr-digital/grc/digital_gmsk_mod.xml b/gr-digital/grc/digital_gmsk_mod.xml index ede76808ad..77f52ca2f2 100644 --- a/gr-digital/grc/digital_gmsk_mod.xml +++ b/gr-digital/grc/digital_gmsk_mod.xml @@ -42,7 +42,7 @@ </option> </param> <param> - <name>Logging</name> + <name>Log</name> <key>log</key> <value>False</value> <type>bool</type> diff --git a/gr-digital/grc/digital_psk_demod.xml b/gr-digital/grc/digital_psk_demod.xml index 2e0e86ebc6..36e803ae73 100644 --- a/gr-digital/grc/digital_psk_demod.xml +++ b/gr-digital/grc/digital_psk_demod.xml @@ -120,7 +120,7 @@ </option> </param> <param> - <name>Logging</name> + <name>Log</name> <key>log</key> <value>False</value> <type>bool</type> diff --git a/gr-digital/grc/digital_psk_mod.xml b/gr-digital/grc/digital_psk_mod.xml index cafcf4e505..e7788842a8 100644 --- a/gr-digital/grc/digital_psk_mod.xml +++ b/gr-digital/grc/digital_psk_mod.xml @@ -100,7 +100,7 @@ </option> </param> <param> - <name>Logging</name> + <name>Log</name> <key>log</key> <value>False</value> <type>bool</type> diff --git a/gr-digital/grc/digital_qam_demod.xml b/gr-digital/grc/digital_qam_demod.xml index 5aaec1bd0a..21ccba856b 100644 --- a/gr-digital/grc/digital_qam_demod.xml +++ b/gr-digital/grc/digital_qam_demod.xml @@ -121,7 +121,7 @@ </option> </param> <param> - <name>Logging</name> + <name>Log</name> <key>log</key> <value>False</value> <type>bool</type> diff --git a/gr-digital/grc/digital_qam_mod.xml b/gr-digital/grc/digital_qam_mod.xml index 4d73d9a685..435ca7058e 100644 --- a/gr-digital/grc/digital_qam_mod.xml +++ b/gr-digital/grc/digital_qam_mod.xml @@ -100,7 +100,7 @@ </option> </param> <param> - <name>Logging</name> + <name>Log</name> <key>log</key> <value>False</value> <type>bool</type> diff --git a/gr-digital/python/digital/gmsk.py b/gr-digital/python/digital/gmsk.py index 9a44837002..012c91f9d0 100644 --- a/gr-digital/python/digital/gmsk.py +++ b/gr-digital/python/digital/gmsk.py @@ -66,7 +66,7 @@ class gmsk_mod(gr.hier_block2): samples_per_symbol: samples per baud >= 2 (integer) bt: Gaussian filter bandwidth * symbol time (float) verbose: Print information about modulator? (boolean) - debug: Print modulation data to files? (boolean) + log: Print modulation data to files? (boolean) """ def __init__(self, @@ -176,12 +176,12 @@ class gmsk_demod(gr.hier_block2): Args: samples_per_symbol: samples per baud (integer) - verbose: Print information about modulator? (boolean) - log: Print modualtion data to files? (boolean) gain_mu: controls rate of mu adjustment (float) mu: fractional delay [0.0, 1.0] (float) omega_relative_limit: sets max variation in omega (float) freq_error: bit rate error as a fraction (float) + verbose: Print information about modulator? (boolean) + log: Print modualtion data to files? (boolean) """ def __init__(self, diff --git a/gr-digital/python/digital/packet_utils.py b/gr-digital/python/digital/packet_utils.py index 865f3adbb4..d7aa4e66ca 100644 --- a/gr-digital/python/digital/packet_utils.py +++ b/gr-digital/python/digital/packet_utils.py @@ -113,7 +113,9 @@ def make_packet(payload, samples_per_symbol, bits_per_symbol, bits_per_symbol: (needed for padding calculation) (int) preamble: string of ascii 0's and 1's access_code: string of ascii 0's and 1's + pad_for_usrp: If true, packets are padded such that they end up a multiple of 128 samples(512 bytes) whitener_offset: offset into whitener string to use [0-16) + whitening: Whether to turn on data whitening(scrambling) (boolean) Packet will have access code at the beginning, followed by length, payload and finally CRC-32. diff --git a/gr-uhd/python/uhd/qa_uhd.py b/gr-uhd/python/uhd/qa_uhd.py index 511c098753..4df0d4273e 100644 --- a/gr-uhd/python/uhd/qa_uhd.py +++ b/gr-uhd/python/uhd/qa_uhd.py @@ -35,6 +35,14 @@ class test_uhd(gr_unittest.TestCase): They may not have a UHD device connected, etc. Don't try to run anything""" pass + def test_time_spec_t (self): + seconds = 42.0 + time = uhd.time_spec_t(seconds) + twice_time = time + time; + zero_time = time - time; + self.assertEqual(time.get_real_secs() * 2, seconds * 2 ) + self.assertEqual(time.get_real_secs() - time.get_real_secs() , 0.0) + def test_stream_args_channel_foo(self): """ Try to manipulate the stream args channels for proper swig'ing checks. diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index c98416f307..4eaef9112d 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -84,6 +84,21 @@ %include <uhd/types/time_spec.hpp> +%extend uhd::time_spec_t{ + uhd::time_spec_t __add__(const uhd::time_spec_t &what) + { + uhd::time_spec_t temp = *self; + temp += what; + return temp; + } + uhd::time_spec_t __sub__(const uhd::time_spec_t &what) + { + uhd::time_spec_t temp = *self; + temp -= what; + return temp; + } +}; + %include <uhd/types/stream_cmd.hpp> %include <uhd/types/clock_config.hpp> diff --git a/grc/base/Platform.py b/grc/base/Platform.py index 3ff80e8a03..187a50c01c 100644 --- a/grc/base/Platform.py +++ b/grc/base/Platform.py @@ -196,6 +196,7 @@ class Platform(_Element): def get_license(self): return self._license def get_website(self): return self._website def get_colors(self): return self._colors + def get_block_paths(self): return self._block_paths ############################################## # Constructors diff --git a/grc/grc_gnuradio/blks2/packet.py b/grc/grc_gnuradio/blks2/packet.py index 872f08ca2e..dde3ec722f 100644 --- a/grc/grc_gnuradio/blks2/packet.py +++ b/grc/grc_gnuradio/blks2/packet.py @@ -75,9 +75,9 @@ class packet_encoder(gr.hier_block2): Args: samples_per_symbol: number of samples per symbol bits_per_symbol: number of bits per symbol + preamble: string of ascii 0's and 1's access_code: AKA sync vector pad_for_usrp: If true, packets are padded such that they end up a multiple of 128 samples - payload_length: number of bytes in a data-stream slice """ #setup parameters self._samples_per_symbol = samples_per_symbol diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py index 0d8998753d..aa692f5ca3 100644 --- a/grc/gui/ActionHandler.py +++ b/grc/gui/ActionHandler.py @@ -115,7 +115,7 @@ class ActionHandler: Actions.FLOW_GRAPH_CLOSE, Actions.ABOUT_WINDOW_DISPLAY, Actions.FLOW_GRAPH_SCREEN_CAPTURE, Actions.HELP_WINDOW_DISPLAY, Actions.TYPES_WINDOW_DISPLAY, Actions.TOGGLE_BLOCKS_WINDOW, - Actions.TOGGLE_REPORTS_WINDOW, + Actions.TOGGLE_REPORTS_WINDOW, Actions.TOGGLE_HIDE_DISABLED_BLOCKS, ): action.set_sensitive(True) if ParseXML.xml_failures: Messages.send_xml_errors_if_any(ParseXML.xml_failures) @@ -371,6 +371,8 @@ class ActionHandler: else: self.main_window.btwin.hide() Preferences.blocks_window_visibility(visible) + elif action == Actions.TOGGLE_HIDE_DISABLED_BLOCKS: + Actions.NOTHING_SELECT() ################################################## # Param Modifications ################################################## diff --git a/grc/gui/Actions.py b/grc/gui/Actions.py index 284c78f8fc..afbeb97612 100644 --- a/grc/gui/Actions.py +++ b/grc/gui/Actions.py @@ -236,6 +236,12 @@ BLOCK_DISABLE = Action( stock_id=gtk.STOCK_DISCONNECT, keypresses=(gtk.keysyms.d, NO_MODS_MASK), ) +TOGGLE_HIDE_DISABLED_BLOCKS = ToggleAction( + label='Hide _disabled blocks', + tooltip='Toggle visibility of disabled blocks and connections', + stock_id=gtk.STOCK_MISSING_IMAGE, + keypresses=(gtk.keysyms.d, gtk.gdk.CONTROL_MASK), +) BLOCK_CREATE_HIER = Action( label='C_reate Hier', tooltip='Create hier block from selected blocks', diff --git a/grc/gui/Bars.py b/grc/gui/Bars.py index f016209383..ef8feb0a0b 100644 --- a/grc/gui/Bars.py +++ b/grc/gui/Bars.py @@ -49,6 +49,7 @@ TOOLBAR_LIST = ( None, Actions.BLOCK_ENABLE, Actions.BLOCK_DISABLE, + Actions.TOGGLE_HIDE_DISABLED_BLOCKS, None, Actions.FIND_BLOCKS, Actions.RELOAD_BLOCKS, diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py index c194dfb113..1103aa1639 100644 --- a/grc/gui/FlowGraph.py +++ b/grc/gui/FlowGraph.py @@ -37,7 +37,7 @@ class FlowGraph(Element): def __init__(self): """ - FlowGraph contructor. + FlowGraph constructor. Create a list for signal blocks and connections. Connect mouse handlers. """ Element.__init__(self) @@ -309,6 +309,8 @@ class FlowGraph(Element): window.draw_rectangle(gc, False, x, y, w, h) #draw blocks on top of connections for element in self.get_connections() + self.get_blocks(): + if Actions.TOGGLE_HIDE_DISABLED_BLOCKS.get_active() and not element.get_enabled(): + continue # skip hidden disabled blocks and connections element.draw(gc, window) #draw selected blocks on top of selected connections for selected_element in self.get_selected_connections() + self.get_selected_blocks(): @@ -374,6 +376,13 @@ class FlowGraph(Element): for element in reversed(self.get_elements()): selected_element = element.what_is_selected(coor, coor_m) if not selected_element: continue + # hidden disabled connections, blocks and their ports can not be selected + if Actions.TOGGLE_HIDE_DISABLED_BLOCKS.get_active() and ( + selected_element.is_block() and not selected_element.get_enabled() or + selected_element.is_connection() and not selected_element.get_enabled() or + selected_element.is_port() and not selected_element.get_parent().get_enabled() + ): + continue #update the selected port information if selected_element.is_port(): if not coor_m: selected_port = selected_element diff --git a/grc/gui/Messages.py b/grc/gui/Messages.py index c4706459af..2bf488bb58 100644 --- a/grc/gui/Messages.py +++ b/grc/gui/Messages.py @@ -48,7 +48,16 @@ register_messenger(sys.stdout.write) # Special functions for specific program functionalities ########################################################################### def send_init(platform): - send("""<<< Welcome to %s %s >>>\n"""%(platform.get_name(), platform.get_version())) + p = platform + send('\n'.join([ + "<<< Welcome to %s %s >>>" % (p.get_name(), p.get_version()), + "", + "Preferences file: " + p.get_prefs_file(), + "Block paths:" + ] + [ + "\t%s" % path + (" (%s)" % opath if opath != path else "") + for path, opath in p.get_block_paths().iteritems() + ]) + "\n") def send_page_switch(file_path): send('\nShowing: "%s"\n'%file_path) diff --git a/grc/gui/Platform.py b/grc/gui/Platform.py index 6a8175b9fa..db77ff2112 100644 --- a/grc/gui/Platform.py +++ b/grc/gui/Platform.py @@ -20,4 +20,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA from Element import Element class Platform(Element): - def __init__(self): Element.__init__(self) + def __init__(self, prefs_file): + Element.__init__(self) + + self._prefs_file = prefs_file + + def get_prefs_file(self): return self._prefs_file
\ No newline at end of file diff --git a/grc/gui/Preferences.py b/grc/gui/Preferences.py index c315436cae..b15fb9738b 100644 --- a/grc/gui/Preferences.py +++ b/grc/gui/Preferences.py @@ -24,7 +24,6 @@ _platform = None _config_parser = ConfigParser.ConfigParser() def file_extension(): return '.'+_platform.get_key() -def _prefs_file(): return os.path.join(os.path.expanduser('~'), file_extension()) def load(platform): global _platform @@ -32,10 +31,10 @@ def load(platform): #create sections _config_parser.add_section('main') _config_parser.add_section('files_open') - try: _config_parser.read(_prefs_file()) + try: _config_parser.read(_platform.get_prefs_file()) except: pass def save(): - try: _config_parser.write(open(_prefs_file(), 'w')) + try: _config_parser.write(open(_platform.get_prefs_file(), 'w')) except: pass ########################################################################### diff --git a/grc/python/Constants.py b/grc/python/Constants.py index 0e974df43c..79ff8bab35 100644 --- a/grc/python/Constants.py +++ b/grc/python/Constants.py @@ -25,7 +25,10 @@ _gr_prefs = gr.prefs() #setup paths PATH_SEP = {'/':':', '\\':';'}[os.path.sep] -HIER_BLOCKS_LIB_DIR = os.path.join(os.path.expanduser('~'), '.grc_gnuradio') +HIER_BLOCKS_LIB_DIR = os.environ.get('GRC_HIER_PATH', + os.path.expanduser('~/.grc_gnuradio')) +PREFS_FILE = os.environ.get('GRC_PREFS_PATH', + os.path.join(os.path.expanduser('~/.grc'))) BLOCKS_DIRS = filter( #filter blank strings lambda x: x, PATH_SEP.join([ os.environ.get('GRC_BLOCKS_PATH', ''), diff --git a/grc/python/Platform.py b/grc/python/Platform.py index f6adaf47a5..f4f55e9d16 100644 --- a/grc/python/Platform.py +++ b/grc/python/Platform.py @@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA """ import os +from collections import OrderedDict from gnuradio import gr from .. base.Platform import Platform as _Platform from .. gui.Platform import Platform as _GUIPlatform @@ -29,7 +30,7 @@ from Param import Param as _Param from Generator import Generator from Constants import \ HIER_BLOCKS_LIB_DIR, BLOCK_DTD, \ - DEFAULT_FLOW_GRAPH, BLOCKS_DIRS + DEFAULT_FLOW_GRAPH, BLOCKS_DIRS, PREFS_FILE import Constants COLORS = [(name, color) for name, key, sizeof, color in Constants.CORE_TYPES] @@ -42,8 +43,10 @@ class Platform(_Platform, _GUIPlatform): """ #ensure hier dir if not os.path.exists(HIER_BLOCKS_LIB_DIR): os.mkdir(HIER_BLOCKS_LIB_DIR) - #convert block paths to absolute paths - block_paths = set(map(os.path.abspath, BLOCKS_DIRS)) + # Convert block paths to absolute paths: + # - Create a mapping from the absolute path to what was passed in + # - Keep each unique absolute path and maintain order + block_paths = OrderedDict(map(lambda x: (os.path.abspath(x), x), BLOCKS_DIRS)) #init _Platform.__init__( self, @@ -58,7 +61,11 @@ class Platform(_Platform, _GUIPlatform): generator=Generator, colors=COLORS, ) - _GUIPlatform.__init__(self) + + _GUIPlatform.__init__( + self, + prefs_file=PREFS_FILE + ) ############################################## # Constructors |