diff options
135 files changed, 204 insertions, 5701 deletions
diff --git a/cmake/Modules/FindICE-3.5.cmake b/cmake/Modules/FindICE-3.5.cmake deleted file mode 100644 index f3dbb08003..0000000000 --- a/cmake/Modules/FindICE-3.5.cmake +++ /dev/null @@ -1,127 +0,0 @@ -# Override the search path for ICE; useful for manually installed libs. -# set(ICE_MANUAL_INSTALL_PATH /opt/Ice-3.5.0/) - -message(STATUS "Checking for Ice-3.5") - -FIND_PATH( - ICE_CONFIG_INCLUDE_DIR - NAMES IceUtil/Config.h - HINTS ${ICE_MANUAL_INSTALL_PATH}/include/ ${CMAKE_INSTALL_PREFIX}/include/ -) - -if(ICE_CONFIG_INCLUDE_DIR) - file(STRINGS "${ICE_CONFIG_INCLUDE_DIR}/IceUtil/Config.h" - ICE_STRING_VERSION REGEX "ICE_STRING_VERSION") - string(REGEX MATCH "3.5" ICE_FOUND ${ICE_STRING_VERSION}) - if(ICE_FOUND) - set(ICE_FOUND TRUE) - endif(ICE_FOUND) -endif(ICE_CONFIG_INCLUDE_DIR) - -if(NOT ICE_FOUND) - message(STATUS " package 'Ice-3.5' not found") - -else(NOT ICE_FOUND) - message(STATUS " ICE 3.5 Include directory found: ${ICE_CONFIG_INCLUDE_DIR}") - - # Prepare the path hint for the libraries based on the include - # directory found. - string(REGEX REPLACE "/include" "" ICE_PATH ${ICE_CONFIG_INCLUDE_DIR}) - - FIND_PATH( - ICE_INCLUDE_DIR - NAMES IceUtil/IceUtil.h Ice/Ice.h - NO_DEFAULT_PATH - HINTS ${ICE_PATH}/include - ) - - set(ICE_LIBRARY ) - - if(APPLE) - set(ICE_LIB_PREFIX "Zeroc") - else() - set(ICE_LIB_PREFIX "") - endif(APPLE) - - FIND_LIBRARY( - ICE_ICE ${ICE_LIB_PREFIX}Ice - HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 - ) - FIND_LIBRARY( - ICE_ICESTORM ${ICE_LIB_PREFIX}IceStorm - HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 - ) - FIND_LIBRARY( - ICE_ICEGRID ${ICE_LIB_PREFIX}IceGrid - HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 - ) - FIND_LIBRARY( - ICE_ICEUTIL ${ICE_LIB_PREFIX}IceUtil - HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 - ) - FIND_LIBRARY( - ICE_GLACIER2 Glacier2 - HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 - ) - - FIND_LIBRARY( - ICE_PTHREAD NAMES pthread pthread-2.13 - HINTS ${CMAKE_INSTALL_PREFIX}/lib64/ ${CMAKE_INSTALL_PREFIX}/lib/ - HINTS ${PC_ICE_LIBDIR} ${PC_ICE_LIBRARY_DIRS} /lib/i386-linux-gnu /lib/x86_64-linux-gnu /usr/lib /lib /lib64 - ENV LD_LIBRARY_PATH - ) - - set(ICE_FOUND FALSE) - - message(STATUS " libIce: ${ICE_ICE}") - message(STATUS " libIceUtil: ${ICE_ICEUTIL}") - - # Make sure we have these two libs in particular - # - me might expand this list requirement in the future - if(ICE_ICE AND ICE_ICEUTIL) - list(APPEND ICE_LIBRARY - ${ICE_ICE} - ${ICE_ICEUTIL} - ) - - if(CMAKE_CROSSCOMPILING) - # When cross-compiling, we set up the environment/toolchain to put - # the right slice2cpp/py in the path. We just need to grab that here. - FIND_PROGRAM(ICE_SLICE2CPP slice2cpp) - FIND_PROGRAM(ICE_SLICE2PY slice2py) - - # We also don't need to look for Python in this case, so just - # force this to TRUE here. - set(ICE_FOUND TRUE) - - else(CMAKE_CROSSCOMPILING) - - FIND_PROGRAM(ICE_SLICE2CPP slice2cpp - HINTS ${CMAKE_INSTALL_PREFIX}/bin ${ICE_MANUAL_INSTALL_PATH}/bin/) - FIND_PROGRAM(ICE_SLICE2PY slice2py - HINTS ${CMAKE_INSTALL_PREFIX}/bin ${ICE_MANUAL_INSTALL_PATH}/bin/) - - # Check that the ICE Python package is installed - include(GrPython) - GR_PYTHON_CHECK_MODULE("Ice >= 3.5" Ice "Ice.stringVersion() >= '3.5.0'" PYTHON_ICE_FOUND) - if(PYTHON_ICE_FOUND) - set(ICE_FOUND TRUE) - endif(PYTHON_ICE_FOUND) - endif(CMAKE_CROSSCOMPILING) - - message(STATUS " SLICE2CPP: ${ICE_SLICE2CPP}") - message(STATUS " SLICE2PY: ${ICE_SLICE2PY}") - - if(ICE_FOUND) - message(STATUS "Ice-3.5 found") - - set(ICE_LIBRARIES ${ICE_LIBRARY}) - set(ICE_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(ICE DEFAULT_MSG ICE_LIBRARY ICE_INCLUDE_DIR) - mark_as_advanced(ICE_INCLUDE_DIR ICE_LIBRARY) - endif(ICE_FOUND) - endif(ICE_ICE AND ICE_ICEUTIL) - -endif(NOT ICE_FOUND) diff --git a/cmake/Modules/FindICE.cmake b/cmake/Modules/FindICE.cmake deleted file mode 100644 index 2a65cf64da..0000000000 --- a/cmake/Modules/FindICE.cmake +++ /dev/null @@ -1,127 +0,0 @@ -# Override the search path for ICE; useful for manually installed libs. -# set(ICE_MANUAL_INSTALL_PATH /opt/Ice-3.4.2/) - -message(STATUS "Checking for Ice-3.4") - -FIND_PATH( - ICE_CONFIG_INCLUDE_DIR - NAMES IceUtil/Config.h - HINTS ${ICE_MANUAL_INSTALL_PATH}/include/ ${CMAKE_INSTALL_PREFIX}/include/ -) - -if(ICE_CONFIG_INCLUDE_DIR) - file(STRINGS "${ICE_CONFIG_INCLUDE_DIR}/IceUtil/Config.h" - ICE_STRING_VERSION REGEX "ICE_STRING_VERSION") - string(REGEX MATCH "3.4" ICE_FOUND ${ICE_STRING_VERSION}) - if(ICE_FOUND) - set(ICE_FOUND TRUE) - endif(ICE_FOUND) -endif(ICE_CONFIG_INCLUDE_DIR) - -if(NOT ICE_FOUND) - message(STATUS " package 'Ice-3.4' not found") - -else(NOT ICE_FOUND) - message(STATUS " ICE 3.4 Include directory found: ${ICE_CONFIG_INCLUDE_DIR}") - - # Prepare the path hint for the libraries based on the include - # directory found. - string(REGEX REPLACE "/include" "" ICE_PATH ${ICE_CONFIG_INCLUDE_DIR}) - - FIND_PATH( - ICE_INCLUDE_DIR - NAMES IceUtil/IceUtil.h Ice/Ice.h - NO_DEFAULT_PATH - HINTS ${CMAKE_INSTALL_PREFIX}/include - HINTS ${ICE_PATH}/include - ) - - set(ICE_LIBRARY ) - - if(APPLE) - set(ICE_LIB_PREFIX "Zeroc") - else() - set(ICE_LIB_PREFIX "") - endif(APPLE) - - FIND_LIBRARY( - ICE_ICE ${ICE_LIB_PREFIX}Ice - HINTS ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64 - HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 - ) - FIND_LIBRARY( - ICE_ICESTORM ${ICE_LIB_PREFIX}IceStorm - HINTS ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64 - HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 - ) - FIND_LIBRARY( - ICE_ICEGRID ${ICE_LIB_PREFIX}IceGrid - HINTS ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64 - HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 - ) - FIND_LIBRARY( - ICE_ICEUTIL ${ICE_LIB_PREFIX}IceUtil - HINTS ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64 - HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 - ) - FIND_LIBRARY( - ICE_GLACIER2 Glacier2 - HINTS ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64 - HINTS ${ICE_PATH}/lib ${ICE_PATH}/lib64 - ) - - FIND_LIBRARY( - ICE_PTHREAD NAMES pthread pthread-2.13 - HINTS ${CMAKE_INSTALL_PREFIX}/lib64/ ${CMAKE_INSTALL_PREFIX}/lib/ - HINTS ${PC_ICE_LIBDIR} ${PC_ICE_LIBRARY_DIRS} /lib/i386-linux-gnu /lib/x86_64-linux-gnu /usr/lib /lib /lib64 - ENV LD_LIBRARY_PATH - ) - - set(ICE_FOUND FALSE) - - if(ICE_ICE AND ICE_ICEUTIL) - list(APPEND ICE_LIBRARY - ${ICE_ICE} - ${ICE_ICEUTIL} - ) - - message(STATUS " libIce: ${ICE_ICE}") - message(STATUS " libIceUtil: ${ICE_ICEUTIL}") - - FIND_PROGRAM(ICE_SLICE2CPP slice2cpp - HINTS ${CMAKE_INSTALL_PREFIX}/bin ${ICE_MANUAL_INSTALL_PATH}/bin/) - FIND_PROGRAM(ICE_SLICE2PY slice2py - HINTS ${CMAKE_INSTALL_PREFIX}/bin ${ICE_MANUAL_INSTALL_PATH}/bin/) - - # Check that the ICE Python package is installed - include(GrPython) - GR_PYTHON_CHECK_MODULE("Ice >= 3.4" Ice "Ice.stringVersion() >= '3.4.0'" PYTHON_ICE_FOUND) - if(PYTHON_ICE_FOUND) - set(ICE_FOUND TRUE) - endif(PYTHON_ICE_FOUND) - - if(ICE_FOUND) - message(STATUS "Ice-3.4 found") - - if(CMAKE_COMPILER_IS_GNUCXX) - execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version - OUTPUT_VARIABLE gcc_version) - string(REGEX MATCH "[0-9].[0-9].[0-9]" gcc_version_num ${gcc_version}) - if(NOT ${gcc_version_num} VERSION_LESS "4.7") - message(STATUS "-- Found GCC version: ${gcc_version_num}") - message(STATUS "-- GCC incompatible with Ice 3.4, disabling ControlPort") - set(ICE_FOUND FALSE) - return() # exit now - endif(NOT ${gcc_version_num} VERSION_LESS "4.7") - endif(CMAKE_COMPILER_IS_GNUCXX) - - set(ICE_LIBRARIES ${ICE_LIBRARY}) - set(ICE_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(ICE DEFAULT_MSG ICE_LIBRARY ICE_INCLUDE_DIR) - mark_as_advanced(ICE_INCLUDE_DIR ICE_LIBRARY) - endif(ICE_FOUND) - endif(ICE_ICE AND ICE_ICEUTIL) - -endif(NOT ICE_FOUND) diff --git a/cmake/Modules/FindPortaudio.cmake b/cmake/Modules/FindPortaudio.cmake index 20145ea8df..8aa17d4448 100644 --- a/cmake/Modules/FindPortaudio.cmake +++ b/cmake/Modules/FindPortaudio.cmake @@ -34,13 +34,13 @@ mark_as_advanced(PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES) # Found PORTAUDIO, but it may be version 18 which is not acceptable. if(EXISTS ${PORTAUDIO_INCLUDE_DIRS}/portaudio.h) include(CheckCXXSourceCompiles) - include(CMakePushCheckState) - cmake_push_check_state() + set(CMAKE_REQUIRED_INCLUDES_SAVED ${CMAKE_REQUIRED_INCLUDES}) set(CMAKE_REQUIRED_INCLUDES ${PORTAUDIO_INCLUDE_DIRS}) CHECK_CXX_SOURCE_COMPILES( "#include <portaudio.h>\nPaDeviceIndex pa_find_device_by_name(const char *name); int main () {return 0;}" PORTAUDIO2_FOUND) - cmake_pop_check_state() + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVED}) + unset(CMAKE_REQUIRED_INCLUDES_SAVED) if(PORTAUDIO2_FOUND) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PORTAUDIO DEFAULT_MSG PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES) diff --git a/cmake/Modules/GrComponent.cmake b/cmake/Modules/GrComponent.cmake index f802cdcb41..5be3e8125d 100644 --- a/cmake/Modules/GrComponent.cmake +++ b/cmake/Modules/GrComponent.cmake @@ -46,9 +46,8 @@ function(GR_REGISTER_COMPONENT name var) message(STATUS " Dependency ${dep} = ${${dep}}") endforeach(dep) - #if the user set the var to force, we note this - if("${${var}}" STREQUAL "FORCE") - set(${var} ON) + #if the user set the var to force on, we note this + if("${${var}}" STREQUAL "ON") set(var_force TRUE) else() set(var_force FALSE) diff --git a/docs/doxygen/other/ctrlport.dox b/docs/doxygen/other/ctrlport.dox index a1ffcadef4..8db156dfbd 100644 --- a/docs/doxygen/other/ctrlport.dox +++ b/docs/doxygen/other/ctrlport.dox @@ -16,334 +16,8 @@ gnuradio.ctrlport module, imported as: from gnuradio import ctrlport \endcode - -\section Dependencies - -ControlPort is an abstracted remote procedure call tool that. It is -built on top of other middleware libraries. Currently, the only -implemented middleware library is the Internet Communication Engine -(ICE). It is possible to replace this library with other similar -tools in such a way that the GNU Radio interface to ControlPort is -unchanged. However, most clients were purpose-built around ICE and -will need to be redone. - -ControlPort requires ZeroC's ICE and associated -libraries/headers/programs. ICE is generally installed into the -standard paths if using a software repo (like apt-get, yum, etc.). If -installed by hand, GNU Radio assumes ICE is installed into -/opt/Ice-3.4.2. If this is not the case, you can tell GNU Radio where -to find ICE by passing to cmake the following: - - -DICE_MANUAL_INSTALL_PATH=\<your path here\> - - -\section conf Configuration - -ControlPort is configured using two files. The first is the GNU Radio -preferences file while the second file is specific to the type of -middleware used. Since we are focusing on using ICE, the configuration -file uses the ICE configuration file and format. - -The GNU Radio preferences file has three options. The 'on' option is -used to enable or disable the use of ControlPort, and is disabled by -default. The 'config' option allows a user to specify the -middleware-specific configuration file. The 'edges_list' is a special -option that exports the list of nodes and edges of the flowgraph -across ControlPort. This latter option is mainly used for redrawing -the flowgraph for the Performance Counter applications. - -\code - [ControlPort] - on = True - config = ctrlport.conf - edges_list = True -\endcode - -The ControlPort preferences are installed by default into -'gnuradio-runtime.conf'. These can always be overridden in the local -~/.gnuradio/config.conf file. - -En example ICE configuration file is installed as -$prefix/etc/gnuradio/ctrlport.conf.example. More information on how to -configure ICE can be found here: -http://doc.zeroc.com/display/Ice/Properties+and+Configuration - - -\section using_ctrlport Using ControlPort to Export Variables - -The ability to export variables from a block is inherited from -gr::block. Then, when the flowgraph is started, the function -<b>setup_rpc()</b> is called in turn for each block. By default, this -is an empty function. A block overloads this function and defines and -exports variables in it. - -Say we have a class <b>gr::blocks::foo</b> that has variables <b>a</b> -and <b>b</b> that we want to export. Specifically, we want to be able -to read the values of both <b>a</b> and <b>b</b> and also set the -value of <b>b</b>. The class <b>gr::blocks::foo</b> has setters and -getters all set up. So our class implementation header file looks -something like: - -\code -namespace gr { - namespace blocks { - - class foo_impl : public foo - { - private: - float d_a, d_b; - - public: - foo_impl(float a, float b); - ~foo_impl(); - - float a() const { return d_a; } - float b() const { return d_a; } - void set_a(float a) { d_a = a; } - void set_b(float b) { d_b = b; } - void setup_rpc(); - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - }; - - } /* namespace blocks */ -} /* namespace gr */ -\endcode - -The source code then sets up the class and fills in -<b>setup_rpc()</b>. - -\code -namespace gr { - namespace blocks { - - foo_impl::foo_impl(float a, float b): - sync_bloc(....), - d_a(a), d_b(b) - { } - - foo_impl::~foo_impl() - { } - - void - foo_impl::setup_rpc() - { -#ifdef GR_CTRLPORT - add_rpc_variable( - rpcbasic_sptr(new rpcbasic_register_get<foo, float>( - alias(), "a", - &foo::a, - pmt::mp(-2.0f), pmt::mp(2.0f), pmt::mp(0.0f), - "", "Get value of a", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); - - add_rpc_variable( - rpcbasic_sptr(new rpcbasic_register_get<foo, float>( - alias(), "b", - &foo::b, - pmt::mp(0.0f), pmt::mp(20.0f), pmt::mp(10.0f), - "", "Get value of b", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); - - add_rpc_variable( - rpcbasic_sptr(new rpcbasic_register_set<foo, float>( - alias(), "b", - &foo::set_b, - pmt::mp(0.0f), pmt::mp(20.0f), pmt::mp(10.0f), - "", "Set value of b", RPC_PRIVLVL_MIN, - DISPNULL))); -#endif /* GR_CTRLPORT */ - } - - int - foo_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { .... } - - } /* namespace blocks */ -} /* namespace gr */ -\endcode - -In the above example, we're ignoring some of the basic semantics of -the class as a GNU Radio block and focus just on the call to set up -the get and set functions over ControlPort. Each block has a function -that allows us to add a new ControlPort interface object to a list, -the <b>add_rpc_variable</b>. We don't care about that list anymore; -that's for ControlPort to worry about. We just add new variables, -either setters or getters. - -Without dissecting every piece of the above calls, notice that we use -the public class, <b>gr::blocks::foo</b> as the class, not the -implementation class. We also use the block's alias, which GNU Radio -uses as a database entry to connect a block by name to the pointer in -memory. This allows ControlPort to know where the object in memory is -at any given time to access the setters and getters. - -The three PMTs specified are simply an expected minimum, maximum, and -default value. None of these are strictly enforced and only serve as -guides. The RPC_PRIVLVL_MIN is currently a placeholder for a -privilege level setting. In many cases, reading <b>b</b> might be -fine for everyone, but we want strong restrictions on who has the -ability to set <b>b</b>. - -And finally, we can specify display options to hint at the right way -to display this variable when remotely plotting it. More on that in -the following section. - -Finally, note that we put \#ifdefs around the code. We always want -<b>setup_rpc</b> to be there and callable, but if ControlPort was not -built for GNU Radio, we cannot register any variables with it. This is -just a nicety to allow us to set up our code for use with ControlPort -without requiring it. - - -\subsection alt_reg Alternative Registers - -If using the concept above, <b>setup_rpc</b> automatically gets called -when the flowgraph is started. In most instances, this is all we ever -need since there's nothing interesting going on until then. However, -if not using a gr::block or needing access before we run the flowgraph, -the above method won't work (it comes down to when the block's alias -has meaning). - -There are alternate variable registration functions for the sets and -gets. These take the form: - -\code - rpcbasic_register_get(const std::string& name, - const char* functionbase, - T* obj, - Tfrom (T::*function)(), - const pmt::pmt_t &min, const pmt::pmt_t &max, const pmt::pmt_t &def, - const char* units_ = "", - const char* desc_ = "", - priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN, - DisplayType display_ = DISPNULL) - - rpcbasic_register_set(const std::string& name, - const char* functionbase, - T* obj, - void (T::*function)(Tto), - const pmt::pmt_t &min, const pmt::pmt_t &max, const pmt::pmt_t &def, - const char* units_ = "", - const char* desc_ = "", - priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN, - DisplayType display_ = DISPNULL) -\endcode - -The only thing different about the above code is that instead of -taking a single 'alias()' name, which provides us access to the -objects pointer, we instead provide a unique name -(<b>fucntionbase</b>) and a pointer to the object itself -(<b>obj</b>). These are templated functions, so the class T is known -from that. - -If using this method, the recommended way is to create a new function -(not <b>setup_rpc</b>), register the variable using -<b>add_rpc_variable</b> but with the different <b>register_get/set</b> -shown here, and then call this function either in the object's -constructor or make it a public member function to be called when you -need it. - - -\section disp Display Options - -When exporting a new RPC variable over ControlPort, one argument is a -display options mask. These options are useful to a remote client to -tell identify activities like default plotters and initial -conditions. The <b>gr-ctrlport-monitor</b> application uses this -heavily in determining how to plot ControlPort variables. - -The options mask is just a 32-bit value with options OR'd -together. Certain options are only appropriate for certain types of -plots. Options on plots where that option is not available will -simply be ignored. - -The main caveat to be aware of is that the DISPXY plot type is -specific to complex values. Therefore, DISPOPTCPLX is assumed. - -These options are specified in rpccallbackregister_base.h and are -exposed through SWIG to live in the \b gr namespace. - -<b>Plot Types</b> -\li <b>DISPNULL:</b> Nothing specified. -\li <b>DISPTIME:</b> Time-domain plot. -\li <b>DISPXY:</b> XY or constellation plot (complex only). -\li <b>DISPPSD:</b> PSD plot. -\li <b>DISPSPEC:</b> Spectrogram plot. -\li <b>DISPRAST:</b> Time raster plot (non-complex only) - -<b>Plot Options</b> -\li <b>DISPOPTCPLX:</b> Signal is complex. -\li <b>DISPOPTLOG:</b> Start plot in semilog-y mode (time domain only). -\li <b>DISPOPTSTEM:</b> Start plot in stem mode (time domain only). -\li <b>DISPOPTSTRIP:</b> Run plot as a stripchart (time domain only). -\li <b>DISPOPTSCATTER:</b> Do scatter plot instead of lines (XY plot only). - - -\section probes ControlPort Probes - -ControlPort provides a set of probes that can be used as sinks that -pass vectors of data across ControlPort. These probes are used to -sample or visualize data remotely. We can place a ControlPort probe -anywhere in the flowgraph to grab the latest sample of data from the -block it's connected to. - -The main ControlPort probe to use is -<b>blocks.ctrlport_probe2_x</b>. From GRC, this is simply "CtrlPort -Probe", which can handle complex, floats, ints, shorts, and bytes. The -blocks are named and given a description to identify them over -ControlPort. The blocks also take a vector length for how many samples -to pass back at a time. Finally, these blocks take a display hint, -as described in the above section. This allows us to specify the -default behavior for how to display the samples. - -Another block that can be used is the <b>fft.ctrlport_probe_psd</b> to -calculate the PSD and pass that over the ControlPort interface. - -\section monitors ControlPort Monitors - -There are two main ControlPort monitor applications provided with GNU -Radio. Both act similarly. The first is a standard ControlPort monitor -application. This connects to a running flowgraph and displays all -exported interfaces in a table format. The name, unit, latest sample, -and description of all interfaces are display in a -row. Double-clicking will open up the default display. Right clicking -any item will allow the user to select the type of plot to use to -display the data. - -When a display is active, using the buttons at the top, the subwindows -can all be tiled or windowed as needed to manage the full -interface. We can then drag-and-drop any other item on top of a -currently running display plot. - -To launch the ControlPort monitor application, know the IP address and -port of the ControlPort endpoint established by the flowgraph and run: - -<pre> -gr-ctrlport-monitor \<ip-addr\> -p \<port\> -</pre> - - -\subsection perfmonitor Performance Monitor - -A second application is used to locally redraw the flowgraph and -display some of the Performance Counters. In this application, the -nodes are blue boxes where the size of the box is proportional to the -work time and the color depth and line width are proportional to the -output buffer fullness. - -The controls at the top of the Performance Monitor application allow -us to select the instantaneous, average, and variance values of the -Performance Counters. And the work time and buffer fullness can be -displayed as a table or bar graph. - -To launch the Performance Monitor, run: - -<pre> -gr-perf-monitorx \<ip-addr\> -p \<port\> -</pre> +ControlPort is currently a temporary stub implementation of a set of +RPC calls we would like to enable that would allow remote viewing, +command, and control of GNU Radio flowgraphs and blocks. */ diff --git a/docs/doxygen/other/perf_counters.dox b/docs/doxygen/other/perf_counters.dox index c09f17c029..200d4dcf96 100644 --- a/docs/doxygen/other/perf_counters.dox +++ b/docs/doxygen/other/perf_counters.dox @@ -85,14 +85,4 @@ The options for the [PerfCounters] section are: \li clock: sets the type of clock used when calculating work_time ('thread' or 'monotonic'). - -\section pc_perfmonitor Performance Monitor - -See \ref perfmonitor for some details of using a ControlPort-based -monitor application, gr-perf-monitorx, for visualizing the -counters. This application is particularly useful in learning which -blocks are the computationally complex blocks that could use extra -optimization or work to improve their performance. It can also be used -to understand the current 'health' of the application. - */ diff --git a/gnuradio-runtime/CMakeLists.txt b/gnuradio-runtime/CMakeLists.txt index 75410abbb0..1f942429a0 100644 --- a/gnuradio-runtime/CMakeLists.txt +++ b/gnuradio-runtime/CMakeLists.txt @@ -60,18 +60,6 @@ GR_SET_GLOBAL(GNURADIO_RUNTIME_PYTHONPATH ${GNURADIO_RUNTIME_PYTHONPATH}) # Register controlport component ######################################################################## -if(ENABLE_STATIC_LIBS) - set(NOT_STATIC_LIBS False) - message(STATUS "ControlPort is incompatible with static library builds. Disabling.") -else(ENABLE_STATIC_LIBS) - set(NOT_STATIC_LIBS True) -endif(ENABLE_STATIC_LIBS) - -FIND_PACKAGE(ICE-3.5) # check for ICE 3.5 -if(NOT ICE_FOUND) - message(STATUS "ICE 3.5 not found. Looking for 3.4") - FIND_PACKAGE(ICE) # checks for version 3.4 -endif(NOT ICE_FOUND) FIND_PACKAGE(SWIG) if(SWIG_FOUND) @@ -88,9 +76,7 @@ GR_REGISTER_COMPONENT("gr-ctrlport" ENABLE_GR_CTRLPORT Boost_FOUND SWIG_FOUND SWIG_VERSION_CHECK - ICE_FOUND ENABLE_GNURADIO_RUNTIME - NOT_STATIC_LIBS ) ######################################################################## @@ -183,22 +169,4 @@ install( COMPONENT "runtime_devel" ) -######################################################################## -# Setup ControlPort preferences file and installation information -######################################################################## -if(ENABLE_GR_CTRLPORT) - -SET(GR_PKG_CTRL_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/ctrlport) - -SET(GR_PKG_CTRL_SLICE_DIR ${GR_PKG_DATA_DIR}/ctrlport) -file(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${GR_PKG_CTRL_SLICE_DIR} slicedir) - -install( - FILES ctrlport.conf.example - DESTINATION ${SYSCONFDIR}/${CMAKE_PROJECT_NAME} - COMPONENT "gnuradio_runtime" -) - -endif(ENABLE_GR_CTRLPORT) - endif(ENABLE_GNURADIO_RUNTIME) diff --git a/gnuradio-runtime/ctrlport.conf.example b/gnuradio-runtime/ctrlport.conf.example deleted file mode 100644 index dc61673ea5..0000000000 --- a/gnuradio-runtime/ctrlport.conf.example +++ /dev/null @@ -1,30 +0,0 @@ -## Use this to create an endpoint used to export ControlPort. -## -## A typical configuation would be to specify using a particular -## interface (determined from the IP address) and port number: -## -## ControlPort.Endpoints=tcp -h 192.168.1.1 -p 9000 -## -## A similar endpoint without the port number stated will pick a -## random, free port: -## -## ControlPort.Endpoints=tcp -h 192.168.1.1 -## -## ICE has some wildcard capabilities, as well. The following tells -## ICE to use all available interfaces: -## -## ControlPort.Endpoints=tcp -h * -## -## Using 'default' for the host will use what 'hostname' resolves to. -## -## For more details: -## http://doc.zeroc.com/display/Ice/Proxy+and+Endpoint+Syntax -## http://www.zeroc.com/doc/Ice-3.2.1/manual/ProxyEndpointRef.51.2.html - -# ControlPort.Endpoints = tcp -t 300 -h 127.0.0.1 -p 23456 - - -## Set a default hostname (or IP) if no '-h' is used in the Endpoint -## configuration - -#Ice.Default.Host = myhost diff --git a/gnuradio-runtime/ctrlport.conf.in b/gnuradio-runtime/ctrlport.conf.in deleted file mode 100644 index 5c31a04516..0000000000 --- a/gnuradio-runtime/ctrlport.conf.in +++ /dev/null @@ -1,6 +0,0 @@ -# This file contains system wide configuration data for GNU Radio. -# You may override any setting on a per-user basis by editing -# ~/.gnuradio/config.conf - -[ctrlport] -ice_directory=@slicedir@ diff --git a/gnuradio-runtime/gnuradio-runtime.conf.in b/gnuradio-runtime/gnuradio-runtime.conf.in index 0996fb21aa..6ac9d27783 100644 --- a/gnuradio-runtime/gnuradio-runtime.conf.in +++ b/gnuradio-runtime/gnuradio-runtime.conf.in @@ -30,11 +30,10 @@ debug_file = stderr [PerfCounters] on = False -export = True +export = False clock = thread #clock = monotonic [ControlPort] on = False edges_list = False -config = # @CMAKE_INSTALL_PREFIX@/etc/gnuradio/ctrlport.conf diff --git a/gnuradio-runtime/include/gnuradio/CMakeLists.txt b/gnuradio-runtime/include/gnuradio/CMakeLists.txt index a72ea1ed88..3fc2fe7bd8 100644 --- a/gnuradio-runtime/include/gnuradio/CMakeLists.txt +++ b/gnuradio-runtime/include/gnuradio/CMakeLists.txt @@ -72,20 +72,14 @@ install(FILES types.h sys_pri.h unittests.h - ice_application_base.h - IcePy_Communicator.h - ice_server_template.h rpccallbackregister_base.h rpcmanager_base.h rpcmanager.h - rpcpmtconverters_ice.h rpcregisterhelpers.h rpcserver_aggregator.h rpcserver_base.h rpcserver_booter_aggregator.h rpcserver_booter_base.h - rpcserver_booter_ice.h - rpcserver_ice.h rpcserver_selector.h ${CMAKE_CURRENT_BINARY_DIR}/logger.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio diff --git a/gnuradio-runtime/include/gnuradio/IcePy_Communicator.h b/gnuradio-runtime/include/gnuradio/IcePy_Communicator.h deleted file mode 100644 index 2dd0cc7bba..0000000000 --- a/gnuradio-runtime/include/gnuradio/IcePy_Communicator.h +++ /dev/null @@ -1,35 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef ICEPY_COMMUNICATOR_H -#define ICEPY_COMMUNICATOR_H - -#include <Ice/CommunicatorF.h> -#include <gnuradio/api.h> - -namespace IcePy -{ - -extern PyTypeObject CommunicatorType; - -GR_RUNTIME_API bool initCommunicator(PyObject*); - -GR_RUNTIME_API Ice::CommunicatorPtr getCommunicator(PyObject*); - -GR_RUNTIME_API PyObject* createCommunicator(const Ice::CommunicatorPtr&); -GR_RUNTIME_API PyObject* getCommunicatorWrapper(const Ice::CommunicatorPtr&); - -} - -extern "C" PyObject* IcePy_initialize(PyObject*, PyObject*); -extern "C" PyObject* IcePy_initializeWithProperties(PyObject*, PyObject*); -extern "C" PyObject* IcePy_initializeWithLogger(PyObject*, PyObject*); -extern "C" PyObject* IcePy_initializeWithPropertiesAndLogger(PyObject*, PyObject*); - -#endif diff --git a/gnuradio-runtime/include/gnuradio/ice_application_base.h b/gnuradio-runtime/include/gnuradio/ice_application_base.h deleted file mode 100644 index 126327151a..0000000000 --- a/gnuradio-runtime/include/gnuradio/ice_application_base.h +++ /dev/null @@ -1,231 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 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 ICE_APPLICATION_BASE_H -#define ICE_APPLICATION_BASE_H - -#ifdef HAVE_WINDOWS_H -#include <winsock2.h> -#include <sys/time.h> -#endif - -#include <gnuradio/api.h> -#include <gnuradio/prefs.h> -#include <Ice/Ice.h> -#include <boost/thread.hpp> -#include <boost/thread/mutex.hpp> -#include <stdio.h> -#include <iostream> -#include <set> -#include <string> -#include <stdio.h> - -namespace { - static const unsigned int ICEAPPLICATION_ACTIVATION_TIMEOUT_MS(600); -}; - -class GR_RUNTIME_API ice_application_common : public Ice::Application -{ - public: - template<typename TserverBase, typename TserverClass> friend class ice_application_base; - static boost::shared_ptr<ice_application_common> Instance(); - ~ice_application_common() {;} - static int d_reacquire_attributes; - - protected: - static bool d_main_called; - static bool d_have_ice_config; - static std::string d_endpointStr; - static boost::shared_ptr<boost::thread> d_thread; - ice_application_common() {;} - int run(int, char*[]); -}; - -template<typename TserverBase, typename TserverClass> -class ice_application_base -{ -public: - boost::shared_ptr<ice_application_common> d_application; - ice_application_base(TserverClass* _this); - ~ice_application_base() {;} - - static TserverBase* i(); - static const std::vector<std::string> endpoints(); - -protected: - bool have_ice_config() { return d_application->d_have_ice_config; } - void set_endpoint(const std::string& endpoint) { d_application->d_endpointStr = endpoint;} - - //this one is the key... overwrite in templated/inherited variants - virtual TserverBase* i_impl() = 0; - - //tools for the i_impl... - //tell it when it has to resync with the communicator - virtual bool reacquire_sync(); - virtual void sync_reacquire(); - - static TserverClass* d_this; - - int d_reacquire; - //static int d_reacquire_attributes; - -private: - void starticeexample(); - - bool application_started(); - - int run(int, char*[]); - - static void kickoff(); -}; - -template<typename TserverBase, typename TserverClass> -TserverClass* ice_application_base<TserverBase, TserverClass>::d_this(0); - -//template<typename TserverBase, typename TserverClass> -//int ice_application_base<TserverBase, TserverClass>::d_reacquire_attributes(0); - -template<typename TserverBase, typename TserverClass> -ice_application_base<TserverBase, TserverClass>::ice_application_base(TserverClass* _this) - : d_reacquire(0) -{ - //d_reacquire_attributes = 0; - d_this = _this; - d_application = ice_application_common::Instance(); -} - -template<typename TserverBase, typename TserverClass> -void ice_application_base<TserverBase, TserverClass>::starticeexample() -{ - char* argv[2]; - argv[0] = (char*)""; - - std::string conffile = gr::prefs::singleton()->get_string("ControlPort", "config", ""); - - if(conffile.size() > 0) { - std::stringstream iceconf; - ice_application_common::d_have_ice_config = true; - ice_application_common::d_main_called = true; - iceconf << conffile; - d_application->main(0, argv, iceconf.str().c_str()); - } - else { - ice_application_common::d_have_ice_config = false; - ice_application_common::d_main_called = true; - d_application->main(0, argv); - } -} - -template<typename TserverBase, typename TserverClass> -void ice_application_base<TserverBase, TserverClass>::kickoff() -{ - static bool run_once = false; - - //if(!d_this->application_started()) { - if(!run_once) { - ++d_this->d_application->d_reacquire_attributes; - - ice_application_common::d_thread = boost::shared_ptr<boost::thread> - (new boost::thread(boost::bind(&ice_application_base::starticeexample, d_this))); - - ::timespec timer_ts, rem_ts; - timer_ts.tv_sec = 0; timer_ts.tv_nsec = ICEAPPLICATION_ACTIVATION_TIMEOUT_MS*1000; - - int iter = 0; - while(!d_this->application_started()) { - #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) - ::Sleep(timer_ts.tv_nsec / 1000000); - #else - ::nanosleep(&timer_ts, &rem_ts); - #endif - if(!d_this->application_started()) - std::cout << "@"; - if(iter++ > 100) { - std::cout << "ice_application_base::kickoff(), timeout waiting to get communicator() d_application->main() might have failed?!" << std::endl;; - break; - } - } - - run_once = true; - } - - return; -} - - -template<typename TserverBase, typename TserverClass> -bool ice_application_base<TserverBase, TserverClass>::reacquire_sync() -{ - return (d_this->d_reacquire != d_application->d_reacquire_attributes); -} - -template<typename TserverBase, typename TserverClass> -void ice_application_base<TserverBase, TserverClass>::sync_reacquire() -{ - d_this->d_reacquire = d_application->d_reacquire_attributes; -} - - -template<typename TserverBase, typename TserverClass> -const std::vector<std::string> ice_application_base<TserverBase, TserverClass>::endpoints() -{ - std::vector<std::string> ep; ep.push_back(d_this->d_application->d_endpointStr); return ep; -} - -template<typename TserverBase, typename TserverClass> -TserverBase* ice_application_base<TserverBase, TserverClass>::i() -{ - //printf("indacall\n"); - - assert(d_this != 0); - if(!d_this->application_started()) { - //printf("anotherkickoff\n"); - kickoff(); - } - //printf("donekickedoff\n"); - - /*else if(!d_proxy) { - d_proxy = d_this->i_impl(); - assert(d_proxy != 0); - }*/ - - return d_this->i_impl(); -} - -/*template<typename TserverBase, typename TserverClass> - int ice_application_base<TserverBase, TserverClass>::run(int argc, char* argv[]) { - int implreturn(run_impl(argc, argv)); - ice_application_base<TserverBase, TserverClass>::communicator()->waitForShutdown(); - return implreturn; - }*/ - -template<typename TserverBase, typename TImplClass> -bool ice_application_base<TserverBase, TImplClass>::application_started() -{ - return ice_application_base<TserverBase, TImplClass>::d_this->d_application->communicator(); -} - -/*template<typename TserverBase, typename TImplClass> -int ice_application_base<TserverBase, TImplClass>::run_impl(int argc, char* argv[]) { return EXIT_SUCCESS; } -*/ - -#endif diff --git a/gnuradio-runtime/include/gnuradio/ice_server_template.h b/gnuradio-runtime/include/gnuradio/ice_server_template.h deleted file mode 100644 index 5e77d29265..0000000000 --- a/gnuradio-runtime/include/gnuradio/ice_server_template.h +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 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 ICE_SERVER_TEMPLATE_H -#define ICE_SERVER_TEMPLATE_H - -#include <gnuradio/rpcserver_ice.h> -#include <gnuradio/ice_application_base.h> -#include <iostream> - -template<typename TserverBase, typename TserverClass, typename TImplClass, typename TIceClass> -class ice_server_template : public ice_application_base<TserverBase, TImplClass> -{ -public: - ice_server_template(TImplClass* _this, - const std::string& contolPortName, - const std::string& endpointName); - ~ice_server_template(); - -protected: - //virtual bool application_started(); - TserverBase* i_impl(); - friend class ice_application_base<TserverBase, TImplClass>; - -private: - //virtual int run_impl(int, char*[]); - Ice::ObjectAdapterPtr d_adapter; - TserverBase* d_iceserver; - const std::string d_contolPortName, d_endpointName; -}; - -template<typename TserverBase, typename TserverClass, typename TImplClass, typename TIceClass> -ice_server_template<TserverBase, TserverClass, TImplClass, TIceClass>::ice_server_template - (TImplClass* _this, const std::string& controlPortName, const std::string& endpointName) - : ice_application_base<TserverBase, TImplClass>(_this), - d_iceserver(0), - d_contolPortName(controlPortName), - d_endpointName(endpointName) -{;} - -template<typename TserverBase, typename TserverClass, typename TImplClass, typename TIceClass> -ice_server_template<TserverBase, TserverClass,TImplClass, TIceClass>::~ice_server_template() -{ - if(d_adapter) { - d_adapter->deactivate(); - delete(d_iceserver); - d_adapter = 0; - } -} - -template<typename TserverBase, typename TserverClass, typename TImplClass, typename TIceClass> -TserverBase* ice_server_template<TserverBase, TserverClass, TImplClass, TIceClass>::i_impl() -{ - if(ice_application_base<TserverBase, TImplClass>::d_this->reacquire_sync()) { - d_adapter = (ice_application_base<TserverBase, TImplClass>::d_this->have_ice_config()) ? - ice_application_base<TserverBase, TImplClass>::d_this->d_this->d_application->communicator()->createObjectAdapter(d_contolPortName) : - ice_application_base<TserverBase, TImplClass>::d_this->d_this->d_application->communicator()->createObjectAdapterWithEndpoints(d_contolPortName,"tcp -h *"); - - TserverClass* server_ice(new TserverClass()); - TIceClass obj(server_ice); - - Ice::Identity id(ice_application_base<TserverBase, TImplClass>::d_this->d_this->d_application->communicator()->stringToIdentity(d_endpointName)); - d_adapter->add(obj, id); - d_adapter->activate(); - ice_application_base<TserverBase, TImplClass>::d_this->set_endpoint(ice_application_common::communicator()->proxyToString(d_adapter->createDirectProxy(id))); - - std::cout << std::endl << "Ice Radio Endpoint: " - << ice_server_template<TserverBase, TserverClass, TImplClass, TIceClass>::endpoints()[0] - << std::endl; - - d_iceserver = (TserverBase*) server_ice; - ice_application_base<TserverBase, TImplClass>::d_this->sync_reacquire(); - } - - return d_iceserver; -} - -#endif /* ICE_SERVER_TEMPLATE_H */ diff --git a/gnuradio-runtime/include/gnuradio/pycallback_object.h b/gnuradio-runtime/include/gnuradio/pycallback_object.h index 989aed1d00..85a883c3d3 100644 --- a/gnuradio-runtime/include/gnuradio/pycallback_object.h +++ b/gnuradio-runtime/include/gnuradio/pycallback_object.h @@ -22,8 +22,6 @@ #include <iostream> #include <gnuradio/rpcregisterhelpers.h> -#include <gnuradio/ice_application_base.h> -#include <gnuradio/IcePy_Communicator.h> #include <pythread.h> #include <boost/format.hpp> @@ -32,19 +30,6 @@ enum pyport_t { PYPORT_FLOAT }; -class Instance -{ -public: - static boost::shared_ptr<ice_application_common> get_application() - { - return ice_application_common::Instance(); - } - static Ice::CommunicatorPtr get_swig_communicator() - { - return get_application()->communicator(); - } -}; - int pycallback_object_count = 500; // a simple to-PMT converter template class-function diff --git a/gnuradio-runtime/include/gnuradio/rpcpmtconverters_ice.h b/gnuradio-runtime/include/gnuradio/rpcpmtconverters_ice.h deleted file mode 100644 index 8b2c52890b..0000000000 --- a/gnuradio-runtime/include/gnuradio/rpcpmtconverters_ice.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 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 RPCPMTCONVERTERS_ICE_H -#define RPCPMTCONVERTERS_ICE_H - -#include <pmt/pmt.h> -#include <gnuradio.h> - -namespace rpcpmtconverter -{ - pmt::pmt_t to_pmt(const GNURadio::KnobPtr& knob, const Ice::Current& c); - GNURadio::KnobPtr from_pmt(const pmt::pmt_t& knob, const Ice::Current& c); -} - -#endif /* RPCPMTCONVERTERS_ICE_H */ diff --git a/gnuradio-runtime/include/gnuradio/rpcserver_booter_ice.h b/gnuradio-runtime/include/gnuradio/rpcserver_booter_ice.h deleted file mode 100644 index 9c64095bb0..0000000000 --- a/gnuradio-runtime/include/gnuradio/rpcserver_booter_ice.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 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 RPCSERVER_BOOTER_ICE_H -#define RPCSERVER_BOOTER_ICE_H - -#include <gnuradio/rpcserver_booter_base.h> -#include <gnuradio/ice_server_template.h> -#include <gnuradio.h> - -class rpcserver_base; -class rpcserver_ice; - -class rpcserver_booter_ice : public virtual rpcserver_booter_base, - public virtual ice_server_template<rpcserver_base, rpcserver_ice, - rpcserver_booter_ice, GNURadio::ControlPortPtr> -{ -public: - rpcserver_booter_ice(); - ~rpcserver_booter_ice(); - - rpcserver_base* i(); - const std::string & type() {return d_type;} - const std::vector<std::string> endpoints(); - -private: - std::string d_type; -}; - -#endif /* RPCSERVER_BOOTER_ICE_H */ diff --git a/gnuradio-runtime/include/gnuradio/rpcserver_ice.h b/gnuradio-runtime/include/gnuradio/rpcserver_ice.h deleted file mode 100644 index 260c7f06b5..0000000000 --- a/gnuradio-runtime/include/gnuradio/rpcserver_ice.h +++ /dev/null @@ -1,228 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 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 RPCSERVER_ICE_H -#define RPCSERVER_ICE_H - -#include <gnuradio/rpcserver_base.h> -#include <gnuradio/rpcpmtconverters_ice.h> -#include <string> -#include <sstream> -#include <map> -#include <gnuradio.h> -#include <Ice/Exception.h> -#include <boost/format.hpp> - -class rpcserver_ice : public virtual rpcserver_base, public GNURadio::ControlPort -{ -public: - rpcserver_ice(); - virtual ~rpcserver_ice(); - - void registerConfigureCallback(const std::string &id, const configureCallback_t callback); - void unregisterConfigureCallback(const std::string &id); - - void registerQueryCallback(const std::string &id, const queryCallback_t callback); - void unregisterQueryCallback(const std::string &id); - - virtual void set(const GNURadio::KnobMap&, const Ice::Current&); - - GNURadio::KnobMap get(const GNURadio::KnobIDList&, const Ice::Current&); - - GNURadio::KnobMap getRe(const GNURadio::KnobIDList&, const Ice::Current&); - - GNURadio::KnobPropMap properties(const GNURadio::KnobIDList&, const Ice::Current&); - - virtual void shutdown(const Ice::Current&); - -private: - typedef std::map<std::string, configureCallback_t> ConfigureCallbackMap_t; - ConfigureCallbackMap_t d_setcallbackmap; - - typedef std::map<std::string, queryCallback_t> QueryCallbackMap_t; - QueryCallbackMap_t d_getcallbackmap; - - template<typename T, typename TMap> struct set_f - : public std::unary_function<T,void> - { - set_f(const Ice::Current& _c, TMap& _setcallbackmap, const priv_lvl_t& _cur_priv) : - c(_c), d_setcallbackmap(_setcallbackmap), cur_priv(_cur_priv) - {;} - - void operator()(const T& p) - { - ConfigureCallbackMap_t::const_iterator iter(d_setcallbackmap.find(p.first)); - if(iter != d_setcallbackmap.end()) { - if(cur_priv <= iter->second.priv) { - (*iter->second.callback).post(pmt::PMT_NIL, rpcpmtconverter::to_pmt(p.second,c)); - } - else { - std::cout << "Key " << p.first << " requires PRIVLVL <= " - << iter->second.priv << " to set, currently at: " - << cur_priv << std::endl; - } - } - else { - throw IceUtil::NullHandleException(__FILE__, __LINE__); - } - } - - const Ice::Current& c; - TMap& d_setcallbackmap; - const priv_lvl_t& cur_priv; - }; - - template<typename T, typename TMap> - struct get_f : public std::unary_function<T,void> - { - get_f(const Ice::Current& _c, TMap& _getcallbackmap, - const priv_lvl_t& _cur_priv, GNURadio::KnobMap& _outknobs) : - c(_c), d_getcallbackmap(_getcallbackmap), cur_priv(_cur_priv), outknobs(_outknobs) - {} - - void operator()(const T& p) - { - QueryCallbackMap_t::const_iterator iter(d_getcallbackmap.find(p)); - if(iter != d_getcallbackmap.end()) { - if(cur_priv <= iter->second.priv) { - outknobs[p] = rpcpmtconverter::from_pmt((*iter->second.callback).retrieve(), c); - } - else { - std::cout << "Key " << iter->first << " requires PRIVLVL: <= " - << iter->second.priv << " to get, currently at: " - << cur_priv << std::endl; - } - } - else { - std::stringstream ss; - ss << "Ctrlport Key called with unregistered key (" << p << ")\n"; - std::cout << ss.str(); - throw IceUtil::IllegalArgumentException(__FILE__,__LINE__,ss.str().c_str()); - } - } - - const Ice::Current& c; - TMap& d_getcallbackmap; - const priv_lvl_t& cur_priv; - GNURadio::KnobMap& outknobs; - }; - - template<typename T, typename TMap, typename TKnobMap> - struct get_all_f : public std::unary_function<T,void> - { - get_all_f(const Ice::Current& _c, TMap& _getcallbackmap, - const priv_lvl_t& _cur_priv, TKnobMap& _outknobs) : - c(_c), d_getcallbackmap(_getcallbackmap), cur_priv(_cur_priv), outknobs(_outknobs) - {;} - - void operator()(const T& p) - { - if(cur_priv <= p.second.priv) { - outknobs[p.first] = rpcpmtconverter::from_pmt(p.second.callback->retrieve(), c); - } - else { - std::cout << "Key " << p.first << " requires PRIVLVL <= " - << p.second.priv << " to get, currently at: " - << cur_priv << std::endl; - } - } - - const Ice::Current& c; - TMap& d_getcallbackmap; - const priv_lvl_t& cur_priv; - TKnobMap& outknobs; - }; - - template<typename T, typename TMap, typename TKnobMap> - struct properties_all_f : public std::unary_function<T,void> - { - properties_all_f(const Ice::Current& _c, QueryCallbackMap_t& _getcallbackmap, - const priv_lvl_t& _cur_priv, GNURadio::KnobPropMap& _outknobs) : - c(_c), d_getcallbackmap(_getcallbackmap), cur_priv(_cur_priv), outknobs(_outknobs) - {;} - - void operator()(const T& p) - { - if(cur_priv <= p.second.priv) { - GNURadio::KnobProp prop;//(new GNURadio::KnobProp()); - prop.type = GNURadio::KNOBDOUBLE; - prop.units = p.second.units; - prop.description = p.second.description; - prop.min = rpcpmtconverter::from_pmt(p.second.min, c); - prop.max = rpcpmtconverter::from_pmt(p.second.max, c); - prop.display = static_cast<uint32_t>(p.second.display); - outknobs[p.first] = prop; - } - else { - std::cout << "Key " << p.first << " requires PRIVLVL <= " - << p.second.priv << " to get, currently at: " - << cur_priv << std::endl; - } - } - - const Ice::Current& c; - TMap& d_getcallbackmap; - const priv_lvl_t& cur_priv; - TKnobMap& outknobs; - }; - - template<class T, typename TMap, typename TKnobMap> - struct properties_f : public std::unary_function<T,void> - { - properties_f(const Ice::Current& _c, TMap& _getcallbackmap, - const priv_lvl_t& _cur_priv, TKnobMap& _outknobs) : - c(_c), d_getcallbackmap(_getcallbackmap), cur_priv(_cur_priv), outknobs(_outknobs) - {;} - - void operator()(const T& p) - { - typename TMap::const_iterator iter(d_getcallbackmap.find(p)); - if(iter != d_getcallbackmap.end()) { - if(cur_priv <= iter->second.priv) { - GNURadio::KnobProp prop; - prop.type = GNURadio::KNOBDOUBLE; - prop.units = iter->second.units; - prop.description = iter->second.description; - prop.min = rpcpmtconverter::from_pmt(iter->second.min, c); - prop.max = rpcpmtconverter::from_pmt(iter->second.max, c); - prop.display = static_cast<uint32_t>(iter->second.display); - //outknobs[iter->first] = prop; - outknobs[p] = prop; - } - else { - std::cout << "Key " << iter->first << " requires PRIVLVL: <= " << - iter->second.priv << " to get, currently at: " << cur_priv << std::endl; - } - } - else { - throw IceUtil::NullHandleException(__FILE__, __LINE__); - } - } - - const Ice::Current& c; - TMap& d_getcallbackmap; - const priv_lvl_t& cur_priv; - TKnobMap& outknobs; - }; -}; - -#endif /* RPCSERVER_ICE_H */ diff --git a/gnuradio-runtime/include/gnuradio/rpcserver_selector.h b/gnuradio-runtime/include/gnuradio/rpcserver_selector.h index f45e919b0b..8a14f78d99 100644 --- a/gnuradio-runtime/include/gnuradio/rpcserver_selector.h +++ b/gnuradio-runtime/include/gnuradio/rpcserver_selector.h @@ -23,9 +23,9 @@ #ifndef RPCSERVER_SELECTOR #define RPCSERVER_SELECTOR -#define RPCSERVER_ENABLED +//#define RPCSERVER_ENABLED -#define RPCSERVER_ICE +//#define RPCSERVER_ICE //#define RPCSERVER_ERLANG //#define RPCSERVER_XMLRPC diff --git a/gnuradio-runtime/lib/controlport/CMakeLists.txt b/gnuradio-runtime/lib/controlport/CMakeLists.txt index bd46659eb2..c41d87b1f7 100644 --- a/gnuradio-runtime/lib/controlport/CMakeLists.txt +++ b/gnuradio-runtime/lib/controlport/CMakeLists.txt @@ -19,44 +19,24 @@ if(ENABLE_GR_CTRLPORT) -include_directories(${ICE_INCLUDE_DIR}) - # Add definition so we can compile in ControlPort to the blocks. ADD_DEFINITIONS(-DGR_CTRLPORT) -######################################################################## -# Run ICE To compile Slice files -######################################################################## -EXECUTE_PROCESS( - COMMAND "${ICE_SLICE2CPP}" "-I${CMAKE_CURRENT_SOURCE_DIR}" - "--output-dir=${CMAKE_CURRENT_BINARY_DIR}/" - "${CMAKE_CURRENT_SOURCE_DIR}/gnuradio.ice" - ) - list(APPEND gnuradio_runtime_sources - ${CMAKE_CURRENT_SOURCE_DIR}/ice_application_base.cc ${CMAKE_CURRENT_SOURCE_DIR}/rpcmanager.cc - ${CMAKE_CURRENT_SOURCE_DIR}/rpcpmtconverters_ice.cc ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_aggregator.cc ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_booter_aggregator.cc - ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_booter_ice.cc - ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_ice.cc ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_selector.cc ) -# Append generated file in build directory -list(APPEND gnuradio_runtime_sources - ${CMAKE_CURRENT_BINARY_DIR}/gnuradio.cpp -) - ######################################################################## # Add controlport stuff to gnuradio-runtime ######################################################################## include_directories(${CMAKE_CURRENT_BINARY_DIR}) -list(APPEND gnuradio_runtime_libs - ${ICE_LIBRARIES} -) +# Add any required libraries here +#list(APPEND gnuradio_runtime_libs +#) endif(ENABLE_GR_CTRLPORT) diff --git a/gnuradio-runtime/lib/controlport/ICE_LICENSE b/gnuradio-runtime/lib/controlport/ICE_LICENSE deleted file mode 100644 index 51ab60d453..0000000000 --- a/gnuradio-runtime/lib/controlport/ICE_LICENSE +++ /dev/null @@ -1,54 +0,0 @@ -Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved. - -This copy of Ice is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 as -published by the Free Software Foundation. - -Ice 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 version -2 along with this program; if not, see http://www.gnu.org/licenses. - -Linking Ice statically or dynamically with other software (such as a -library, module or application) is making a combined work based on Ice. -Thus, the terms and conditions of the GNU General Public License version -2 cover this combined work. - -If such software can only be used together with Ice, then not only the -combined work but the software itself is a work derived from Ice and as -such shall be licensed under the terms of the GNU General Public License -version 2. This includes the situation where Ice is only being used -through an abstraction layer. - -As a special exception to the above, ZeroC grants to the contributors for -the following projects the permission to license their Ice-based software -under the terms of the GNU Lesser General Public License (LGPL) version -2.1 or of the BSD license: - - - Orca Robotics (http://orca-robotics.sourceforge.net) - - - Mumble (http://mumble.sourceforge.net) - -This exception does not extend to the parts of Ice used by these -projects, or to any other derived work: as a whole, any work based on Ice -shall be licensed under the terms and conditions of the GNU General -Public License version 2. - -You may also combine Ice with any software not derived from Ice, provided -the license of such software is compatible with the GNU General Public -License version 2. In addition, as a special exception, ZeroC grants you -permission to combine Ice with: - - - the OpenSSL library, or with a modified version of the OpenSSL library - that uses the same license as OpenSSL - - - any library not derived from Ice and licensed under the terms of - the Apache License, version 2.0 - (http://www.apache.org/licenses/LICENSE-2.0.html) - -If you modify this copy of Ice, you may extend any of the exceptions -provided above to your version of Ice, but you are not obligated to -do so. diff --git a/gnuradio-runtime/lib/controlport/frontend.ice b/gnuradio-runtime/lib/controlport/frontend.ice deleted file mode 100644 index e4d346dba0..0000000000 --- a/gnuradio-runtime/lib/controlport/frontend.ice +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright 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. - */ - -#include <gnuradio.ice> - -[["python:package:gnuradio.ctrlport"]] -module GNURadio { - module Frontend { - - // primitive types - dictionary<string, string> StrStrDict; - dictionary<string, string> TunerArgs; - struct F32Range - { - float min; - float max; - }; - - // exception types - exception NotSupported {}; - exception InvalidSetting { string msg; }; - exception ReceiverFailure { string msg; }; - exception NotExist {}; - - - // Status Types - struct TunerStatus { - float freq; - float rate; - int a2dbits; - float gain; - F32Range gainrange; - bool isInverted; - StrStrDict info; - }; - - struct StreamInfo { - string uri; - StrStrDict info; - }; - - struct ReceiverInfo { - string uid; - string name; - StrStrDict info; - }; - - struct ChannelStatus { - string uid; - string name; - bool active; - float freq; - float bandwidth; - bool isComplex; - StrStrDict info; - }; - - struct ChannelizerStatus { - string uid; - string name; - StrStrDict info; - }; - - // Interfaces - interface Component { - void setName(string newName); - }; - - interface AbstractReceiver extends Component { - idempotent ReceiverInfo getReceiverInfo(); - }; - - interface Tuner extends Component { - TunerStatus configureTuner(TunerArgs args) throws ReceiverFailure, InvalidSetting; - idempotent TunerStatus status(); - idempotent float setGain(float gain) throws ReceiverFailure, NotSupported, InvalidSetting; - idempotent bool setInversion(bool inverted) throws ReceiverFailure, NotSupported, InvalidSetting; - idempotent float setCenterFreq(float freq) throws ReceiverFailure, NotSupported, InvalidSetting; - idempotent float setBandwidth(float bw) throws ReceiverFailure, NotSupported, InvalidSetting; - idempotent void setInfo(string k, string v) throws ReceiverFailure, NotSupported, InvalidSetting; - }; - - interface Channel extends Tuner { - void start(); - void stop(); - void destroyChannel() throws NotSupported; - idempotent bool active(); - idempotent ChannelStatus channelStat(); - idempotent StreamInfo stream(); - idempotent bool setComplex(bool complex) throws ReceiverFailure, NotSupported, InvalidSetting; - idempotent void setStreamInfo(string k, string v) throws ReceiverFailure, NotSupported, InvalidSetting; - }; - - sequence<Tuner*> TunerSeq; - sequence<Channel*> ChannelSeq; - - interface Channelizer extends AbstractReceiver { - idempotent ChannelizerStatus status(); - idempotent Tuner* getTuner(); - idempotent ChannelSeq getChannels(); - idempotent ChannelSeq getActiveChannels(); - idempotent ChannelSeq getInactiveChannels(); - Channel* createChannel(float freq, float bw, StrStrDict args) throws NotSupported; - }; - - sequence<Channelizer*> ChannelizerSeq; - - interface Receiver extends AbstractReceiver { - idempotent ChannelizerSeq getInputs(); - idempotent Channel* getChannelByID(string id) throws NotExist; - idempotent Channelizer* getChannelizerByID(string id) throws NotExist; - idempotent void setInfo(string k, string v) throws ReceiverFailure, NotSupported, InvalidSetting; - }; - - }; - - module Booter { - dictionary<string, string> WaveformArgs; - exception WaveformRunningError { - string waveformClass; - float centerFrequencyHz; - }; - exception SignalSourceError {string msg; }; - interface WaveformBooter extends Frontend::Receiver, ControlPort { - string launchWaveform(string waveformClass, WaveformArgs args) - throws WaveformRunningError, SignalSourceError; - WaveformArgMap getDriverEnum(); - WaveformArgMap getSourceInfo(); - idempotent bool waveformRunning(); - idempotent string getWaveformClass(); - }; - }; -}; diff --git a/gnuradio-runtime/lib/controlport/gnuradio.ice b/gnuradio-runtime/lib/controlport/gnuradio.ice deleted file mode 100644 index 01db91b7be..0000000000 --- a/gnuradio-runtime/lib/controlport/gnuradio.ice +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2012 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. - */ - -[["python:package:gnuradio.ctrlport"]] - -#ifndef GNURADIO_DEBUG -#define GNURADIO_DEBUG - -module GNURadio { - -struct complex { - float re; - float im; -}; - -class Knob {}; -class KnobB extends Knob { bool value; }; -class KnobC extends Knob { byte value; }; -class KnobI extends Knob { int value; }; -class KnobT extends Knob { short value; }; -class KnobF extends Knob { float value; }; -class KnobD extends Knob { double value; }; -class KnobL extends Knob { long value; }; -class KnobS extends Knob { string value; }; -class KnobZ extends Knob { complex value; }; - -sequence<bool> VectorB; sequence<byte> VectorC; -sequence<int> VectorI; sequence<float> VectorF; -sequence<double> VectorD; sequence<string> VectorS; -sequence<long> VectorL; sequence<short> VectorT; - -class KnobVecB extends Knob { VectorB value; }; -class KnobVecC extends Knob { VectorC value; }; -class KnobVecI extends Knob { VectorI value; }; -class KnobVecT extends Knob { VectorT value; }; -class KnobVecF extends Knob { VectorF value; }; -class KnobVecD extends Knob { VectorD value; }; -class KnobVecL extends Knob { VectorL value; }; -class KnobVecS extends Knob { VectorS value; }; - -enum KnobType { KNOBBOOL, KNOBCHAR, KNOBINT, KNOBFLOAT, - KNOBDOUBLE, KNOBSTRING, KNOBLONG, KNOBVECBOOL, - KNOBVECCHAR, KNOBVECINT, KNOBVECFLOAT, KNOBVECDOUBLE, - KNOBVECSTRING, KNOBVECLONG, KNOBSHORT}; - -const int DISPNULL = 0x0000; -const int DISPTIME = 0x0001; -const int DISPXY = 0x0002; -const int DISPPSD = 0x0004; -const int DISPSPEC = 0x0008; -const int DISPRAST = 0x0010; -const int DISPOPTCPLX = 0x0100; -const int DISPOPTLOG = 0x0200; -const int DISPOPTSTEM = 0x0400; -const int DISPOPTSTRIP = 0x0800; -const int DISPOPTSCATTER = 0x1000; - -struct KnobProp { - KnobType type; - string units; - string description; - int display; - Knob min; - Knob max; - Knob defaultvalue; -}; - -sequence<string> KnobIDList; -dictionary<string, Knob> KnobMap; -dictionary<string, KnobProp> KnobPropMap; -dictionary<string, string> WaveformArgMap; - -interface StreamReceiver { - void push(VectorC data); -}; - -interface ControlPort { - void set(KnobMap knobs); - idempotent KnobMap get(KnobIDList knobs); - idempotent KnobMap getRe(KnobIDList knobs); - idempotent KnobPropMap properties(KnobIDList knobs); - void shutdown(); -}; - -}; - -#endif diff --git a/gnuradio-runtime/lib/controlport/ice_application_base.cc b/gnuradio-runtime/lib/controlport/ice_application_base.cc deleted file mode 100644 index b390c77c84..0000000000 --- a/gnuradio-runtime/lib/controlport/ice_application_base.cc +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 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 <gnuradio/ice_application_base.h> - -int ice_application_common::d_reacquire_attributes(0); -bool ice_application_common::d_main_called(false); -bool ice_application_common::d_have_ice_config(false); -boost::shared_ptr<boost::thread> ice_application_common::d_thread; -std::string ice_application_common::d_endpointStr(""); - -boost::shared_ptr<ice_application_common> -ice_application_common::Instance() -{ - static boost::shared_ptr<ice_application_common> - instance(new ice_application_common()); - return instance; -} - -int ice_application_common::run(int, char**) -{ - communicator()->waitForShutdown(); - return EXIT_SUCCESS; -} diff --git a/gnuradio-runtime/lib/controlport/rpcpmtconverters_ice.cc b/gnuradio-runtime/lib/controlport/rpcpmtconverters_ice.cc deleted file mode 100644 index 1477ae2c8d..0000000000 --- a/gnuradio-runtime/lib/controlport/rpcpmtconverters_ice.cc +++ /dev/null @@ -1,151 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 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 <gnuradio/rpcpmtconverters_ice.h> -#include <Ice/Ice.h> -#include <gnuradio.h> - -GNURadio::KnobPtr -rpcpmtconverter::from_pmt(const pmt::pmt_t& knob, const Ice::Current& c) -{ - if(pmt::is_real(knob)) { - return new GNURadio::KnobD(Ice::Double(pmt::to_double(knob))); - } - else if(pmt::is_symbol(knob)) { - std::string stuff = pmt::symbol_to_string(knob); - return new GNURadio::KnobS(stuff); - } - else if(pmt::is_integer(knob)) { - return new GNURadio::KnobI(pmt::to_long(knob)); - } - else if(pmt::is_bool(knob)) { - return new GNURadio::KnobB(pmt::to_bool(knob)); - } - else if(pmt::is_uint64(knob)) { - return new GNURadio::KnobL(pmt::to_uint64(knob)); - } - else if(pmt::is_complex(knob)) { - std::complex<double> tmp = pmt::to_complex(knob); - GNURadio::complex cpx; - cpx.re = tmp.real(); - cpx.im = tmp.imag(); - return new GNURadio::KnobZ(cpx); - } - else if(pmt::is_c32vector(knob)) { // c32 sent as interleaved floats - size_t size(pmt::length(knob)); - const float* start((const float*) pmt::c32vector_elements(knob,size)); - return new GNURadio::KnobVecF(std::vector<float>(start,start+size*2)); - } - else if (pmt::is_s32vector(knob)) { - size_t size(pmt::length(knob)); - const int* start((const int*) pmt::s32vector_elements(knob,size)); - return new GNURadio::KnobVecI(std::vector<int>(start,start+size)); - } - else if (pmt::is_s16vector(knob)) { - size_t size(pmt::length(knob)); - const short* start((const short*) pmt::s16vector_elements(knob,size)); - return new GNURadio::KnobVecT(std::vector<short>(start,start+size)); - } - else if(pmt::is_f32vector(knob)) { - size_t size(pmt::length(knob)); - const float* start((const float*) pmt::f32vector_elements(knob,size)); - return new GNURadio::KnobVecF(std::vector<float>(start,start+size)); - } - else if (pmt::is_u8vector(knob)) { - size_t size(pmt::length(knob)); - const uint8_t* start((const uint8_t*) pmt::u8vector_elements(knob,size)); - return new GNURadio::KnobVecC(std::vector<Ice::Byte>(start,start+size)); - } - else if (pmt::is_s8vector(knob)) { - size_t size(pmt::length(knob)); - const int8_t* start((const int8_t*) pmt::s8vector_elements(knob,size)); - return new GNURadio::KnobVecC(std::vector<Ice::Byte>(start,start+size)); - } - else { - std::cerr << "Error: Don't know how to handle Knob Type (from): " << std::endl; assert(0);} - //TODO: VECTORS!!! - return new GNURadio::Knob(); -} - -pmt::pmt_t -rpcpmtconverter::to_pmt(const GNURadio::KnobPtr& knob, const Ice::Current& c) -{ - std::string id(knob->ice_id(c).substr(12)); - if(id == "KnobD") { - GNURadio::KnobDPtr k(GNURadio::KnobDPtr::dynamicCast(knob)); - return pmt::mp(k->value); - } - else if(id == "KnobF") { - GNURadio::KnobFPtr k(GNURadio::KnobFPtr::dynamicCast(knob)); - return pmt::mp(k->value); - } - else if(id == "KnobI") { - GNURadio::KnobIPtr k(GNURadio::KnobIPtr::dynamicCast(knob)); - return pmt::mp(k->value); - } - else if(id == "KnobT") { - GNURadio::KnobTPtr k(GNURadio::KnobTPtr::dynamicCast(knob)); - return pmt::mp(k->value); - } - else if(id == "KnobS") { - GNURadio::KnobSPtr k(GNURadio::KnobSPtr::dynamicCast(knob)); - return pmt::string_to_symbol(k->value); - } - else if(id == "KnobB") { - GNURadio::KnobBPtr k(GNURadio::KnobBPtr::dynamicCast(knob)); - if((k->value == true) || (k->value > 0)) - return pmt::PMT_T; - else - return pmt::PMT_F; - } - else if(id == "KnobC") { - GNURadio::KnobCPtr k(GNURadio::KnobCPtr::dynamicCast(knob)); - return pmt::mp(k->value); - } - else if(id == "KnobL") { - GNURadio::KnobLPtr k(GNURadio::KnobLPtr::dynamicCast(knob)); - return pmt::mp((long)k->value); - } - else if(id == "KnobZ") { - GNURadio::KnobZPtr k(GNURadio::KnobZPtr::dynamicCast(knob)); - std::complex<double> cpx(k->value.re, k->value.im); - return pmt::from_complex(cpx); - } - else if(id == "KnobVecC") { - GNURadio::KnobVecCPtr k(GNURadio::KnobVecCPtr::dynamicCast(knob)); - return pmt::init_u8vector(k->value.size(), &k->value[0]); - } - else if(id == "KnobVecI") { - GNURadio::KnobVecIPtr k(GNURadio::KnobVecIPtr::dynamicCast(knob)); - return pmt::init_s32vector(k->value.size(), &k->value[0]); - } - //else if(id == "KnobVecF") { - // GNURadio::KnobVecFPtr k(GNURadio::KnobVecFPtr::dynamicCast(knob)); - // return pmt::mp(k->value); - //TODO: FLOAT!!! - //TODO: VECTORS!!! - else { - std::cerr << "Error: Don't know how to handle Knob Type: " << id << std::endl; assert(0); - } - - return pmt::pmt_t(); -} diff --git a/gnuradio-runtime/lib/controlport/rpcserver_booter_ice.cc b/gnuradio-runtime/lib/controlport/rpcserver_booter_ice.cc deleted file mode 100644 index f60a218747..0000000000 --- a/gnuradio-runtime/lib/controlport/rpcserver_booter_ice.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 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 <gnuradio/rpcserver_ice.h> -#include <gnuradio/rpcserver_booter_ice.h> - -namespace { - static const char* const CONTROL_PORT_CLASS("ice"); - static const char* const CONTROL_PORT_NAME("ControlPort"); - static const char* const ENDPOINT_NAME("gnuradio"); -}; - -rpcserver_booter_ice::rpcserver_booter_ice() : - ice_server_template<rpcserver_base, rpcserver_ice, - rpcserver_booter_ice, GNURadio::ControlPortPtr> - (this, std::string(CONTROL_PORT_NAME), std::string(ENDPOINT_NAME)), - d_type(std::string(CONTROL_PORT_CLASS)) -{;} - -rpcserver_booter_ice::~rpcserver_booter_ice() -{;} - -rpcserver_base* -rpcserver_booter_ice::i() -{ - return ice_server_template<rpcserver_base, rpcserver_ice, - rpcserver_booter_ice, GNURadio::ControlPortPtr>::i(); -} - -const std::vector<std::string> -rpcserver_booter_ice::endpoints() -{ - return ice_server_template<rpcserver_base, rpcserver_ice, - rpcserver_booter_ice, GNURadio::ControlPortPtr>::endpoints(); -} diff --git a/gnuradio-runtime/lib/controlport/rpcserver_ice.cc b/gnuradio-runtime/lib/controlport/rpcserver_ice.cc deleted file mode 100644 index cba6be578e..0000000000 --- a/gnuradio-runtime/lib/controlport/rpcserver_ice.cc +++ /dev/null @@ -1,192 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 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 <gnuradio/rpcserver_ice.h> -#include <IceUtil/IceUtil.h> -#include <Ice/Ice.h> -#include <iostream> -#include <sstream> -#include <stdexcept> -#include <pmt/pmt.h> -#include <boost/xpressive/xpressive.hpp> - -#define DEBUG 0 - -using namespace rpcpmtconverter; - -rpcserver_ice::rpcserver_ice() -{} - -rpcserver_ice::~rpcserver_ice() -{} - -void -rpcserver_ice::registerConfigureCallback(const std::string &id, - const configureCallback_t callback) -{ - { - ConfigureCallbackMap_t::const_iterator iter(d_setcallbackmap.find(id)); - if(iter != d_setcallbackmap.end()) { - std::stringstream s; - s << "rpcserver_ice:: rpcserver_ice ERROR registering set, already registered: " - << id << std::endl; - throw std::runtime_error(s.str().c_str()); - } - } - - if(DEBUG) - std::cout << "rpcserver_ice registering set: " << id << std::endl; - - d_setcallbackmap.insert(ConfigureCallbackMap_t::value_type(id, callback)); -} - -void -rpcserver_ice::unregisterConfigureCallback(const std::string &id) -{ - ConfigureCallbackMap_t::iterator iter(d_setcallbackmap.find(id)); - if(iter == d_setcallbackmap.end()) { - std::stringstream s; - s << "rpcserver_ice:: rpcserver_ice ERROR unregistering set, not registered: " - << id << std::endl; - throw std::runtime_error(s.str().c_str()); - } - - if(DEBUG) - std::cout << "rpcserver_ice unregistering set: " << id << std::endl; - - d_setcallbackmap.erase(iter); -} - -void -rpcserver_ice::registerQueryCallback(const std::string &id, - const queryCallback_t callback) -{ - { - QueryCallbackMap_t::const_iterator iter(d_getcallbackmap.find(id)); - if(iter != d_getcallbackmap.end()) { - std::stringstream s; - s << "rpcserver_ice:: rpcserver_ice ERROR registering get, already registered: " - << id << std::endl; - throw std::runtime_error(s.str().c_str()); - } - } - - if(DEBUG) - std::cout << "rpcserver_ice registering get: " << id << std::endl; - - d_getcallbackmap.insert(QueryCallbackMap_t::value_type(id, callback)); -} - -void -rpcserver_ice::unregisterQueryCallback(const std::string &id) -{ - QueryCallbackMap_t::iterator iter(d_getcallbackmap.find(id)); - if(iter == d_getcallbackmap.end()) { - std::stringstream s; - s << "rpcserver_ice:: rpcserver_ice ERROR unregistering get, registered: " - << id << std::endl; - throw std::runtime_error(s.str().c_str()); - } - - if(DEBUG) - std::cout << "rpcserver_ice unregistering get: " << id << std::endl; - - d_getcallbackmap.erase(iter); -} - -void -rpcserver_ice::set(const GNURadio::KnobMap& knobs, const Ice::Current& c) -{ - std::for_each(knobs.begin(), knobs.end(), - set_f<GNURadio::KnobMap::value_type,ConfigureCallbackMap_t> - (c, d_setcallbackmap, cur_priv)); -} - -GNURadio::KnobMap -rpcserver_ice::getRe(const GNURadio::KnobIDList& knobs, const Ice::Current& c) -{ - GNURadio::KnobMap outknobs; - - if(knobs.size() == 0) { - std::for_each(d_getcallbackmap.begin(), d_getcallbackmap.end(), - get_all_f<QueryCallbackMap_t::value_type, QueryCallbackMap_t, GNURadio::KnobMap> - (c, d_getcallbackmap, cur_priv, outknobs)); - } - else { - QueryCallbackMap_t::iterator it; - for(it = d_getcallbackmap.begin(); it != d_getcallbackmap.end(); it++){ - for(size_t j=0; j<knobs.size(); j++){ - const boost::xpressive::sregex re(boost::xpressive::sregex::compile(knobs[j])); - if(boost::xpressive::regex_match(it->first, re)){ - get_f<GNURadio::KnobIDList::value_type, QueryCallbackMap_t> - (c, d_getcallbackmap, cur_priv, outknobs)(it->first); - break; - } - } - } - } - return outknobs; -} - -GNURadio::KnobMap -rpcserver_ice::get(const GNURadio::KnobIDList& knobs, const Ice::Current& c) -{ - GNURadio::KnobMap outknobs; - - if(knobs.size() == 0) { - std::for_each(d_getcallbackmap.begin(), d_getcallbackmap.end(), - get_all_f<QueryCallbackMap_t::value_type, QueryCallbackMap_t, GNURadio::KnobMap> - (c, d_getcallbackmap, cur_priv, outknobs)); - } - else { - std::for_each(knobs.begin(), knobs.end(), - get_f<GNURadio::KnobIDList::value_type, QueryCallbackMap_t> - (c, d_getcallbackmap, cur_priv, outknobs)); - } - return outknobs; -} - -GNURadio::KnobPropMap -rpcserver_ice::properties(const GNURadio::KnobIDList& knobs, const Ice::Current& c) -{ - GNURadio::KnobPropMap outknobs; - - if(knobs.size() == 0) { - std::for_each(d_getcallbackmap.begin(), d_getcallbackmap.end(), - properties_all_f<QueryCallbackMap_t::value_type, - QueryCallbackMap_t,GNURadio::KnobPropMap>(c, d_getcallbackmap, cur_priv, outknobs)); - } - else { - std::for_each(knobs.begin(), knobs.end(), - properties_f<GNURadio::KnobIDList::value_type, - QueryCallbackMap_t, GNURadio::KnobPropMap>(c, d_getcallbackmap, cur_priv, outknobs)); - } - return outknobs; -} - -void -rpcserver_ice::shutdown(const Ice::Current& c) -{ - if(DEBUG) - std::cout << "Shutting down..." << std::endl; - c.adapter->getCommunicator()->shutdown(); -} diff --git a/gnuradio-runtime/lib/controlport/rpcserver_selector.cc b/gnuradio-runtime/lib/controlport/rpcserver_selector.cc index d515e78963..692f151958 100644 --- a/gnuradio-runtime/lib/controlport/rpcserver_selector.cc +++ b/gnuradio-runtime/lib/controlport/rpcserver_selector.cc @@ -27,8 +27,7 @@ bool rpcmanager::make_aggregator(false); #ifdef RPCSERVER_ICE - #include <gnuradio/rpcserver_booter_ice.h> - rpcmanager::rpcserver_booter_register_helper<rpcserver_booter_ice> boot_ice; + #error TODO ICE #endif #ifdef RPCSERVER_ERLANG diff --git a/gnuradio-runtime/lib/pmt/test_pmt.cc b/gnuradio-runtime/lib/pmt/test_pmt.cc index 49700b5928..403bf64cd0 100644 --- a/gnuradio-runtime/lib/pmt/test_pmt.cc +++ b/gnuradio-runtime/lib/pmt/test_pmt.cc @@ -29,6 +29,7 @@ #include <gnuradio/unittests.h> #include <qa_pmt.h> +#include <fstream> int main (int argc, char **argv) diff --git a/gnuradio-runtime/lib/test_runtime.cc b/gnuradio-runtime/lib/test_runtime.cc index 1285302eb4..6f75bcc1b1 100644 --- a/gnuradio-runtime/lib/test_runtime.cc +++ b/gnuradio-runtime/lib/test_runtime.cc @@ -29,6 +29,7 @@ #include <gnuradio/unittests.h> #include <qa_runtime.h> +#include <fstream> int main (int argc, char **argv) diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt b/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt index 80806341ea..1d5a292429 100644 --- a/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt +++ b/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt @@ -20,62 +20,6 @@ ######################################################################## include(GrPython) -EXECUTE_PROCESS( - COMMAND ${ICE_SLICE2PY} -I${CMAKE_SOURCE_DIR}/gnuradio-runtime/lib/controlport - --output-dir=${CMAKE_BINARY_DIR}/gnuradio-runtime/python - ${CMAKE_SOURCE_DIR}/gnuradio-runtime/lib/controlport/gnuradio.ice -) - -EXECUTE_PROCESS( - COMMAND ${ICE_SLICE2PY} -I${CMAKE_SOURCE_DIR}/gnuradio-runtime/lib/controlport - --output-dir=${CMAKE_BINARY_DIR}/gnuradio-runtime/python - ${CMAKE_SOURCE_DIR}/gnuradio-runtime/lib/controlport/frontend.ice -) - -EXECUTE_PROCESS( - COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/gnuradio-runtime/python/gnuradio/__init__.py -) - -GR_PYTHON_INSTALL( - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py - ${CMAKE_CURRENT_SOURCE_DIR}/IceRadioClient.py - DESTINATION ${GR_PYTHON_DIR}/gnuradio/ctrlport/ - COMPONENT "runtime_python" -) - -# We don't want to install these in the root Python directory, but we -# aren't given a choice based on the way slice2py generates the -# information. -GR_PYTHON_INSTALL( - FILES - ${CMAKE_BINARY_DIR}/gnuradio-runtime/python/gnuradio_ice.py - ${CMAKE_BINARY_DIR}/gnuradio-runtime/python/frontend_ice.py - DESTINATION ${GR_PYTHON_DIR} - COMPONENT "runtime_python" -) - -GR_PYTHON_INSTALL( - FILES - ${CMAKE_CURRENT_BINARY_DIR}/GNURadio/__init__.py - DESTINATION ${GR_PYTHON_DIR}/gnuradio/ctrlport/GNURadio - COMPONENT "runtime_python" -) - -GR_PYTHON_INSTALL( - FILES - ${CMAKE_CURRENT_BINARY_DIR}/GNURadio/Booter/__init__.py - DESTINATION ${GR_PYTHON_DIR}/gnuradio/ctrlport/GNURadio/Booter - COMPONENT "runtime_python" -) - -GR_PYTHON_INSTALL( - FILES - ${CMAKE_CURRENT_BINARY_DIR}/GNURadio/Frontend/__init__.py - DESTINATION ${GR_PYTHON_DIR}/gnuradio/ctrlport/GNURadio/Frontend - COMPONENT "runtime_python" -) - install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/icon.png @@ -90,13 +34,3 @@ GR_PYTHON_INSTALL( DESTINATION ${GR_PYTHON_DIR}/gnuradio/ctrlport/ COMPONENT "runtime_python" ) - -GR_PYTHON_INSTALL( - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/gr-ctrlport-monitor - ${CMAKE_CURRENT_SOURCE_DIR}/gr-perf-monitorx - ${CMAKE_CURRENT_SOURCE_DIR}/gr-ctrlport-curses - DESTINATION ${GR_RUNTIME_DIR} - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - COMPONENT "runtime_python" -) diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/IceRadioClient.py b/gnuradio-runtime/python/gnuradio/ctrlport/IceRadioClient.py deleted file mode 100644 index 87998f7911..0000000000 --- a/gnuradio-runtime/python/gnuradio/ctrlport/IceRadioClient.py +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012 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. -# - -import Ice, Glacier2 -from PyQt4 import QtGui, QtCore -import sys, time, Ice -from gnuradio import gr -from gnuradio.ctrlport import GNURadio - -class IceRadioClient(Ice.Application): - def __init__(self, parentClass): - self.parentClass = parentClass - - def getRadio(self, host, port): - radiostr = "gnuradio -t:tcp -h " + host + " -p " + port + " -t 3000" - base = self.communicator().stringToProxy(radiostr).ice_twoway() - radio = GNURadio.ControlPortPrx.checkedCast(base) - - if not radio: - sys.stderr.write("{0} : invalid proxy.\n".format(args[0])) - return None - - return radio - - def run(self,args): - if len(args) < 2: - print "useage: [glacierinstance glacierhost glacierport] host port" - return - if len(args) == 8: - self.useglacier = True - guser = args[1] - gpass = args[2] - ginst = args[3] - ghost = args[4] - gport = args[5] - host = args[6] - port = args[7] - else: - self.useglacier = False - host = args[1] - port = args[2] - if(port == "-p"): - port = args[3] - - if self.useglacier: - gstring = ginst + "/router -t:tcp -h " + ghost + " -p " + gport - print "GLACIER: {0}".format(gstring) - - setrouter = Glacier2.RouterPrx.checkedCast(self.communicator().stringToProxy(gstring)) - self.communicator().setDefaultRouter(setrouter) - defaultRouter = self.communicator().getDefaultRouter() - #defaultRouter = self.communicator().stringToProxy(gstring) - if not defaultRouter: - print self.appName() + ": no default router set" - return 1 - else: - print str(defaultRouter) - router = Glacier2.RouterPrx.checkedCast(defaultRouter) - if not router: - print self.appName() + ": configured router is not a Glacier2 router" - return 1 - - while True: - print "This demo accepts any user-id / password combination." - if not guser == '' and not gpass == '': - id = guser - pw = gpass - else: - id = raw_input("user id: ") - pw = raw_input("password: ") - - try: - router.createSession(id, pw) - break - except Glacier2.PermissionDeniedException, ex: - print "permission denied:\n" + ex.reason - - radio = self.getRadio(host, port) - if(radio is None): - return 1 - - app = QtGui.QApplication(sys.argv) - ex = self.parentClass(radio, port, self) - ex.show(); - app.exec_() diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/__init__.py b/gnuradio-runtime/python/gnuradio/ctrlport/__init__.py index cfb30ce850..8f33d65bbc 100644 --- a/gnuradio-runtime/python/gnuradio/ctrlport/__init__.py +++ b/gnuradio-runtime/python/gnuradio/ctrlport/__init__.py @@ -20,8 +20,6 @@ # The presence of this file turns this directory into a Python package -import Ice, IcePy - # import swig generated symbols into the ctrlport namespace #from ctrlport_swig import * from monitor import * diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/gr-ctrlport-curses b/gnuradio-runtime/python/gnuradio/ctrlport/gr-ctrlport-curses deleted file mode 100755 index f40c87a6d8..0000000000 --- a/gnuradio-runtime/python/gnuradio/ctrlport/gr-ctrlport-curses +++ /dev/null @@ -1,268 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012 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. -# - -import threading -import curses -import os, sys, time -from optparse import OptionParser - -import Ice -from gnuradio.ctrlport import GNURadio - -ENTER = chr(10) -UP_ARROW = chr(65) -DOWN_ARROW = chr(66) - -class modem_monitor(threading.Thread): - def __init__(self, cb_live, cb_exit, interface): - threading.Thread.__init__(self) - self.cb_live = cb_live - self.cb_exit = cb_exit - - self.running = True - - def __del__(self): - rx.close() - - def run(self): - while self.running: - time.sleep(0.5) - - def shutdown(self): - self.running = False - self.rx.close() - - def cb(self,contents): - (op, sep, payload) = contents.partition(":") - if(op == "live"): - print "live" - self.cb_live(payload) - elif(op == "exit"): - self.cb_exit(payload) - else: - print "unknown op arrived! garbage on multicast adx?" - -class modem_window(threading.Thread): - def __init__(self, locator): - threading.Thread.__init__(self) - self.locator = locator - - # curses init - self.win = curses.newwin(30,100,4,4) - - # Ice/GRCP init - self.comm = Ice.initialize() - proxy = self.comm.stringToProxy(locator) - self.radio = GNURadio.ControlPortPrx.checkedCast(proxy) - self.updateKnobs() - - # GUI init - self.running = True - self.ssel = 0 - self.start() - #self.updateGUI() - - # input loop - while(self.running): - self.getInput() - - # wait for update thread exit - self.join() - - def updateKnobs(self): - self.knobs = self.radio.get([]) - - def getInput(self): - a = self.win.getch() - if(a <= 256): - a = chr(a) - if(a == 'q'): - self.running = False - elif(a == UP_ARROW): - self.ssel = max(self.ssel-1, 0) - self.updateGUI() - elif(a == DOWN_ARROW): - self.ssel = max(min(self.ssel+1, len(self.knobs.keys())-1),0) - self.updateGUI() - self.updateGUI() - - def updateGUI(self): - self.win.clear() - self.win.border(0) - self.win.addstr(1, 2, "Modem Statistics :: %s"%(self.locator)) - self.win.addstr(2, 2, "---------------------------------------------------") - - maxnb = 0 - maxk = 0 - for k in self.knobs.keys(): - (nb,k) = k.split("::", 2) - maxnb = max(maxnb,len(nb)) - maxk = max(maxk,len(k)) - - offset = 3 - keys = self.knobs.keys() - keys.sort() - for k in keys: - (nb,sk) = k.split("::", 2) - v = self.knobs[k].value - sv = str(v) - if(len(sv) > 20): - sv = sv[0:20] - props = 0 - if(self.ssel == offset-3): - props = props | curses.A_REVERSE - self.win.addstr(offset, 2, "%s %s %s" % \ - (nb.rjust(maxnb," "), sk.ljust(maxk," "), sv),props) - offset = offset + 1 - self.win.refresh() - - def run(self): - while(self.running): - self.updateKnobs() - self.updateGUI() - time.sleep(1) - -class monitor_gui: - def __init__(self, interfaces, options): - - locator = None - - # Extract options into a locator - if(options.host and options.port): - locator = "{0} -t:{1} -h {2} -p {3}".format( - options.app, options.protocol, - options.host, options.port) - - # Set up GUI - self.locators = {} - - self.mode = 0 # modem index screen (modal keyboard input) - self.lsel = 0 # selected locator - self.scr = curses.initscr() - self.updateGUI() - - # Kick off initial monitors - self.monitors = [] - for i in interfaces: - self.monitors.append( modem_monitor(self.addModem, self.delModem, i) ) - self.monitors[-1].start() - - if not ((locator == None) or (locator == "")): - self.addModem(locator) - - # wait for user input - while(True): - self.getInput() - - def addModem(self, locator): - if(not self.locators.has_key(locator)): - self.locators[locator] = {} - self.locators[locator]["update_time"] = time.time() - self.locators[locator]["status"] = "live" - - self.updateGUI(); - - def delModem(self, locator): - #if(self.locators.has_key(locator)): - if(not self.locators.has_key(locator)): - self.locators[locator] = {} - self.locators[locator]["update_time"] = time.time() - self.locators[locator]["status"] = "exit" - - self.updateGUI() - - def updateGUI(self): - if(self.mode == 0): #redraw locators - self.scr.clear() - self.scr.border(0) - self.scr.addstr(1, 2, " GRCP-Curses Modem Monitor :: (A)dd (R)efresh, (Q)uit, ...") - for i in range(len(self.locators.keys())): - locator = self.locators.keys()[i] - lhash = self.locators[locator] - #self.scr.addstr(3+i, 5, locator + str(lhash)) - props = 0 - if(self.lsel == i): - props = props | curses.A_REVERSE - self.scr.addstr(3+i, 5, locator + str(lhash), props) - self.scr.refresh() - - def connectGUI(self): - self.scr.clear() - self.scr.addstr(1, 1, "Connect to radio:") - locator = self.scr.getstr(200) - self.addModem(locator) - self.updateGUI() - - def getInput(self): - a = self.scr.getch() - self.scr.addstr(20, 2, "got key (%d) " % (int(a))) - if(a <= 256): - a = chr(a) - if(a =='r'): - self.updateGUI() - elif(a == 'q'): - self.shutdown() - elif(a == 'a'): - self.connectGUI() - elif(a == UP_ARROW): - self.lsel = max(self.lsel-1, 0) - self.updateGUI() - elif(a == DOWN_ARROW): - self.lsel = max(min(self.lsel+1, len(self.locators.keys())-1),0) - self.updateGUI() - elif(a == ENTER): - try: - locator = self.locators.keys()[self.lsel] - self.mode = 1 - mwin = modem_window(locator) - self.mode = 0 - # pop up a new modem display ... - self.updateGUI() - except: - pass - - def shutdown(self): - curses.endwin() - os._exit(0) - -if __name__ == "__main__": - parser = OptionParser() - parser.add_option("-H", "--host", type="string", - help="Hostname of ControlPort server.") - parser.add_option("-p", "--port", type="int", - help="Port number of host's ControlPort endpoint.") - parser.add_option("-i", "--interfaces", type="string", - action="append", default=["lo"], - help="Interfaces to use. [default=%default]") - parser.add_option("-P", "--protocol", type="string", default="tcp", - help="Type of protocol to use (usually tcp). [default=%default]") - parser.add_option("-a", "--app", type="string", default="gnuradio", - help="Name of application [default=%default]") - (options, args) = parser.parse_args() - - if((options.host == None) ^ (options.port == None)): - print "Please set both a hostname and a port number.\n" - parser.print_help() - sys.exit(1) - - mg = monitor_gui(options.interfaces, options) - diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/gr-ctrlport-monitor b/gnuradio-runtime/python/gnuradio/ctrlport/gr-ctrlport-monitor deleted file mode 100755 index 76dd2e5bc1..0000000000 --- a/gnuradio-runtime/python/gnuradio/ctrlport/gr-ctrlport-monitor +++ /dev/null @@ -1,752 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, ctrlport - -from PyQt4 import QtCore,Qt -import PyQt4.QtGui as QtGui -import os, sys, time, struct - -import Ice -from gnuradio.ctrlport.IceRadioClient import * -from gnuradio.ctrlport.GrDataPlotter import * -from gnuradio.ctrlport import GNURadio - -class RateDialog(QtGui.QDialog): - def __init__(self, delay, parent=None): - super(RateDialog, self).__init__(parent) - self.gridLayout = QtGui.QGridLayout(self) - self.setWindowTitle("Update Delay (ms)"); - self.delay = QtGui.QLineEdit(self); - self.delay.setText(str(delay)); - self.buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel) - self.gridLayout.addWidget(self.delay); - self.gridLayout.addWidget(self.buttonBox); - self.buttonBox.accepted.connect(self.accept) - self.buttonBox.rejected.connect(self.reject) - def accept(self): - self.done(1); - def reject(self): - self.done(0); - -class MAINWindow(QtGui.QMainWindow): - def minimumSizeHint(self): - return Qtgui.QSize(800,600) - - def __init__(self, radio, port, interface): - - super(MAINWindow, self).__init__() - self.updateRate = 1000; - self.conns = [] - self.plots = [] - self.knobprops = [] - self.interface = interface - - self.mdiArea = QtGui.QMdiArea() - self.mdiArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) - self.mdiArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) - self.setCentralWidget(self.mdiArea) - - self.mdiArea.subWindowActivated.connect(self.updateMenus) - self.windowMapper = QtCore.QSignalMapper(self) - self.windowMapper.mapped[QtGui.QWidget].connect(self.setActiveSubWindow) - - self.createActions() - self.createMenus() - self.createToolBars() - self.createStatusBar() - self.updateMenus() - - self.setWindowTitle("GNU Radio Control Port Monitor") - self.setUnifiedTitleAndToolBarOnMac(True) - - self.newCon(radio, port) - icon = QtGui.QIcon(ctrlport.__path__[0] + "/icon.png" ) - self.setWindowIcon(icon) - - # Locally turn off ControlPort export from GR. This prevents - # our GR-based plotters from launching their own ControlPort - # instance (and possibly causing a port collision if one has - # been specified). - os.environ['GR_CONF_CONTROLPORT_ON'] = 'False' - - def setUpdateRate(self,nur): - self.updateRate = int(nur); - for c in self.conns: - c.updateRate = self.updateRate; - c.timer.setInterval(self.updateRate); - - def newCon(self, radio=None, port=None): - child = MForm(radio, port, len(self.conns), self.updateRate, self) - if(child.radio is not None): - child.setWindowTitle(str(child.radio)) - self.mdiArea.addSubWindow(child) - child.showMaximized() - self.conns.append(child) - self.plots.append([]) - - def propertiesMenu(self, key, radio, uid): - r = str(radio).split(" ") - title = "{0}:{1}".format(r[3], r[5]) - - props = radio.properties([key]) - - pmin,pmax = get_minmax(props[key]) - - # Use display option mask of item to set up available plot - # types and default options. - disp = self.knobprops[uid][key].display - cplx = disp & gr.DISPOPTCPLX | disp & gr.DISPXY - strip = disp & gr.DISPOPTSTRIP - stem = disp & gr.DISPOPTSTEM - log = disp & gr.DISPOPTLOG - scatter = disp & gr.DISPOPTSCATTER - - def newUpdaterProxy(): - self.newUpdater(key, radio) - - def newPlotterFProxy(): - self.newPlotF(key, uid, title, pmin, pmax, - log, strip, stem) - - def newPlotterCProxy(): - self.newPlotC(key, uid, title, pmin, pmax, - log, strip, stem) - - def newPlotterConstProxy(): - self.newPlotConst(key, uid, title, pmin, pmax, - scatter, strip) - - def newPlotterPsdFProxy(): - self.newPlotPsdF(key, uid, title) - - def newPlotterPsdCProxy(): - self.newPlotPsdC(key, uid, title) - - def newPlotterRasterFProxy(): - self.newPlotRasterF(key, uid, title, pmin, pmax) - - def newPlotterRasterBProxy(): - self.newPlotRasterB(key, uid, title, pmin, pmax) - - menu = QtGui.QMenu(self) - menu.setTitle("Item Actions") - menu.setTearOffEnabled(False) - - # object properties - menu.addAction("Properties", newUpdaterProxy) - - # displays available - if(cplx == 0): - menu.addAction("Plot Time", newPlotterFProxy) - menu.addAction("Plot PSD", newPlotterPsdFProxy) - menu.addAction("Plot Raster (real)", newPlotterRasterFProxy) - #menu.addAction("Plot Raster (bits)", newPlotterRasterBProxy) - else: - menu.addAction("Plot Time", newPlotterCProxy) - menu.addAction("Plot PSD", newPlotterPsdCProxy) - menu.addAction("Plot Constellation", newPlotterConstProxy) - - menu.popup(QtGui.QCursor.pos()) - - def newUpdater(self, key, radio): - updater = UpdaterWindow(key, radio, None) - updater.setWindowTitle("Updater: " + key) - updater.setModal(False) - updater.exec_() - - def newSub(self, e): - tag = str(e.text(0)) - tree = e.treeWidget().parent() - uid = tree.uid - knobprop = self.knobprops[uid][tag] - - r = str(tree.radio).split(" ") - title = "{0}:{1}".format(r[3], r[5]) - pmin,pmax = get_minmax(knobprop) - - disp = knobprop.display - if(disp & gr.DISPTIME): - strip = disp & gr.DISPOPTSTRIP - stem = disp & gr.DISPOPTSTEM - log = disp & gr.DISPOPTLOG - if(disp & gr.DISPOPTCPLX == 0): - self.newPlotF(tag, uid, title, pmin, pmax, - log, strip, stem) - else: - self.newPlotC(tag, uid, title, pmin, pmax, - log, strip, stem) - - elif(disp & gr.DISPXY): - scatter = disp & gr.DISPOPTSCATTER - self.newPlotConst(tag, uid, title, pmin, pmax, scatter) - - elif(disp & gr.DISPPSD): - if(disp & gr.DISPOPTCPLX == 0): - self.newPlotPsdF(tag, uid, title) - else: - self.newPlotPsdC(tag, uid, title) - - def startDrag(self, e): - drag = QtGui.QDrag(self) - mime_data = QtCore.QMimeData() - - tag = str(e.text(0)) - tree = e.treeWidget().parent() - knobprop = self.knobprops[tree.uid][tag] - disp = knobprop.display - iscomplex = (disp & gr.DISPOPTCPLX) or (disp & gr.DISPXY) - - if(disp != gr.DISPNULL): - data = "PlotData:::{0}:::{1}".format(tag, iscomplex) - else: - data = "OtherData:::{0}:::{1}".format(tag, iscomplex) - - mime_data.setText(data) - drag.setMimeData(mime_data) - - drop = drag.start() - - def createPlot(self, plot, uid, title): - plot.start() - self.plots[uid].append(plot) - - self.mdiArea.addSubWindow(plot) - plot.setWindowTitle("{0}: {1}".format(title, plot.name())) - self.connect(plot.qwidget(), - QtCore.SIGNAL('destroyed(QObject*)'), - self.destroyPlot) - - # when the plot is updated via drag-and-drop, we need to be - # notified of the new qwidget that's created so we can - # properly destroy it. - plot.plotupdated.connect(self.plotUpdated) - - plot.show() - - def plotUpdated(self, q): - # the plot has been updated with a new qwidget; make sure this - # gets dies to the destroyPlot function. - for i, plots in enumerate(self.plots): - for p in plots: - if(p == q): - #plots.remove(p) - #plots.append(q) - self.connect(q.qwidget(), - QtCore.SIGNAL('destroyed(QObject*)'), - self.destroyPlot) - break - - def destroyPlot(self, obj): - for plots in self.plots: - for p in plots: - if p.qwidget() == obj: - plots.remove(p) - break - - def newPlotConst(self, tag, uid, title="", pmin=None, pmax=None, - scatter=False, stripchart=False): - plot = GrDataPlotterConst(tag, 32e6, pmin, pmax, stripchart) - plot.scatter(scatter) - self.createPlot(plot, uid, title) - - def newPlotF(self, tag, uid, title="", pmin=None, pmax=None, - logy=False, stripchart=False, stem=False): - plot = GrDataPlotterF(tag, 32e6, pmin, pmax, stripchart) - plot.semilogy(logy) - plot.stem(stem) - self.createPlot(plot, uid, title) - - def newPlotC(self, tag, uid, title="", pmin=None, pmax=None, - logy=False, stripchart=False, stem=False): - plot = GrDataPlotterC(tag, 32e6, pmin, pmax, stripchart) - plot.semilogy(logy) - plot.stem(stem) - self.createPlot(plot, uid, title) - - def newPlotPsdF(self, tag, uid, title="", pmin=None, pmax=None): - plot = GrDataPlotterPsdF(tag, 32e6, pmin, pmax) - self.createPlot(plot, uid, title) - - def newPlotPsdC(self, tag, uid, title="", pmin=None, pmax=None): - plot = GrDataPlotterPsdC(tag, 32e6, pmin, pmax) - self.createPlot(plot, uid, title) - - def newPlotRasterF(self, tag, uid, title="", pmin=None, pmax=None): - plot = GrTimeRasterF(tag, 32e6, pmin, pmax) - self.createPlot(plot, uid, title) - - def newPlotRasterB(self, tag, uid, title="", pmin=None, pmax=None): - plot = GrTimeRasterB(tag, 32e6, pmin, pmax) - self.createPlot(plot, uid, title) - - def update(self, knobs, uid): - #sys.stderr.write("KNOB KEYS: {0}\n".format(knobs.keys())) - for plot in self.plots[uid]: - data = [] - for n in plot.knobnames: - d = knobs[n].value - if(type(d) == GNURadio.complex): - d = [d.re, d.im] - - # If it's a byte stream, Python thinks it's a string. - # Unpack and convert to floats for plotting. - if(type(d) == str and n.find('probe2_b') == 0): - d = struct.unpack(len(d)*'b', d) - d = [float(di) for di in d] - - data.append(d) - plot.update(data) - plot.stop() - plot.wait() - plot.start() - - def setActiveSubWindow(self, window): - if window: - self.mdiArea.setActiveSubWindow(window) - - - def createActions(self): - self.newConAct = QtGui.QAction("&New Connection", - self, shortcut=QtGui.QKeySequence.New, - statusTip="Create a new file", triggered=self.newCon) - - self.exitAct = QtGui.QAction("E&xit", self, shortcut="Ctrl+Q", - statusTip="Exit the application", - triggered=QtGui.qApp.closeAllWindows) - - self.closeAct = QtGui.QAction("Cl&ose", self, shortcut="Ctrl+F4", - statusTip="Close the active window", - triggered=self.mdiArea.closeActiveSubWindow) - - self.closeAllAct = QtGui.QAction("Close &All", self, - statusTip="Close all the windows", - triggered=self.mdiArea.closeAllSubWindows) - - self.urAct = QtGui.QAction("Update Rate", self, shortcut="F5", - statusTip="Change Update Rate", - triggered=self.updateRateShow) - - qks = QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_T); - self.tileAct = QtGui.QAction("&Tile", self, - statusTip="Tile the windows", - triggered=self.mdiArea.tileSubWindows, - shortcut=qks) - - qks = QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_C); - self.cascadeAct = QtGui.QAction("&Cascade", self, - statusTip="Cascade the windows", shortcut=qks, - triggered=self.mdiArea.cascadeSubWindows) - - self.nextAct = QtGui.QAction("Ne&xt", self, - shortcut=QtGui.QKeySequence.NextChild, - statusTip="Move the focus to the next window", - triggered=self.mdiArea.activateNextSubWindow) - - self.previousAct = QtGui.QAction("Pre&vious", self, - shortcut=QtGui.QKeySequence.PreviousChild, - statusTip="Move the focus to the previous window", - triggered=self.mdiArea.activatePreviousSubWindow) - - self.separatorAct = QtGui.QAction(self) - self.separatorAct.setSeparator(True) - - self.aboutAct = QtGui.QAction("&About", self, - statusTip="Show the application's About box", - triggered=self.about) - - self.aboutQtAct = QtGui.QAction("About &Qt", self, - statusTip="Show the Qt library's About box", - triggered=QtGui.qApp.aboutQt) - - def createMenus(self): - self.fileMenu = self.menuBar().addMenu("&File") - self.fileMenu.addAction(self.newConAct) - self.fileMenu.addAction(self.urAct) - self.fileMenu.addSeparator() - self.fileMenu.addAction(self.exitAct) - - self.windowMenu = self.menuBar().addMenu("&Window") - self.updateWindowMenu() - self.windowMenu.aboutToShow.connect(self.updateWindowMenu) - - self.menuBar().addSeparator() - - self.helpMenu = self.menuBar().addMenu("&Help") - self.helpMenu.addAction(self.aboutAct) - self.helpMenu.addAction(self.aboutQtAct) - - def updateRateShow(self): - askrate = RateDialog(self.updateRate, self); - if askrate.exec_(): - ur = float(str(askrate.delay.text())); - self.setUpdateRate(ur); - return; - else: - return; - - def createToolBars(self): - self.fileToolBar = self.addToolBar("File") - self.fileToolBar.addAction(self.newConAct) - self.fileToolBar.addAction(self.urAct) - - self.fileToolBar = self.addToolBar("Window") - self.fileToolBar.addAction(self.tileAct) - self.fileToolBar.addAction(self.cascadeAct) - - def createStatusBar(self): - self.statusBar().showMessage("Ready") - - - def activeMdiChild(self): - activeSubWindow = self.mdiArea.activeSubWindow() - if activeSubWindow: - return activeSubWindow.widget() - return None - - def updateMenus(self): - hasMdiChild = (self.activeMdiChild() is not None) - self.closeAct.setEnabled(hasMdiChild) - self.closeAllAct.setEnabled(hasMdiChild) - self.tileAct.setEnabled(hasMdiChild) - self.cascadeAct.setEnabled(hasMdiChild) - self.nextAct.setEnabled(hasMdiChild) - self.previousAct.setEnabled(hasMdiChild) - self.separatorAct.setVisible(hasMdiChild) - - def updateWindowMenu(self): - self.windowMenu.clear() - self.windowMenu.addAction(self.closeAct) - self.windowMenu.addAction(self.closeAllAct) - self.windowMenu.addSeparator() - self.windowMenu.addAction(self.tileAct) - self.windowMenu.addAction(self.cascadeAct) - self.windowMenu.addSeparator() - self.windowMenu.addAction(self.nextAct) - self.windowMenu.addAction(self.previousAct) - self.windowMenu.addAction(self.separatorAct) - - def about(self): - about_info = \ -'''Copyright 2012 Free Software Foundation, Inc.\n -This program is part of GNU Radio.\n -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.\n -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.\n -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.''' - - QtGui.QMessageBox.about(None, "gr-ctrlport-monitor", about_info) - - -class ConInfoDialog(QtGui.QDialog): - def __init__(self, parent=None): - super(ConInfoDialog, self).__init__(parent) - - self.gridLayout = QtGui.QGridLayout(self) - - - self.host = QtGui.QLineEdit(self); - self.port = QtGui.QLineEdit(self); - self.host.setText("localhost"); - self.port.setText("43243"); - - self.buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel) - - self.gridLayout.addWidget(self.host); - self.gridLayout.addWidget(self.port); - self.gridLayout.addWidget(self.buttonBox); - - self.buttonBox.accepted.connect(self.accept) - self.buttonBox.rejected.connect(self.reject) - - - def accept(self): - self.done(1); - - def reject(self): - self.done(0); - - -class UpdaterWindow(QtGui.QDialog): - def __init__(self, key, radio, parent): - QtGui.QDialog.__init__(self, parent) - - self.key = key; - self.radio = radio - - self.resize(300,200) - self.layout = QtGui.QVBoxLayout() - - self.props = radio.properties([key])[key] - info = str(self.props) - - self.infoLabel = QtGui.QLabel(info) - self.layout.addWidget(self.infoLabel) - - # Test here to make sure that a 'set' function exists - try: - a = radio.set(radio.get([key])) - has_set = True - except Ice.UnknownException: - has_set = False - - if(has_set is False): - self.cancelButton = QtGui.QPushButton("Ok") - self.cancelButton.connect(self.cancelButton, QtCore.SIGNAL('clicked()'), self.reject) - - self.buttonlayout = QtGui.QHBoxLayout() - self.buttonlayout.addWidget(self.cancelButton) - self.layout.addLayout(self.buttonlayout) - - else: # we have a set function - self.textInput = QtGui.QLineEdit() - self.layout.addWidget(self.textInput) - - self.applyButton = QtGui.QPushButton("Apply") - self.setButton = QtGui.QPushButton("OK") - self.cancelButton = QtGui.QPushButton("Cancel") - - rv = radio.get([key]) - val = rv[key].value - if(type(val) == GNURadio.complex): - val = val.re + val.im*1j - - self.textInput.setText(str(val)) - self.sv = rv[key] - - self.applyButton.connect(self.applyButton, QtCore.SIGNAL('clicked()'), self._apply) - self.setButton.connect(self.setButton, QtCore.SIGNAL('clicked()'), self._set) - self.cancelButton.connect(self.cancelButton, QtCore.SIGNAL('clicked()'), self.reject) - - self.is_num = ((type(self.sv.value)==float) or (type(self.sv.value)==int)) - if(self.is_num): - self.sliderlayout = QtGui.QHBoxLayout() - - self.slider = QtGui.QSlider(QtCore.Qt.Horizontal) - - self.sliderlayout.addWidget(QtGui.QLabel(str(self.props.min.value))) - self.sliderlayout.addWidget(self.slider) - self.sliderlayout.addWidget(QtGui.QLabel(str(self.props.max.value))) - - self.steps = 10000 - self.valspan = self.props.max.value - self.props.min.value - - self.slider.setRange(0, 10000) - self._set_slider_value(self.sv.value) - - self.connect(self.slider, QtCore.SIGNAL("sliderReleased()"), self._slide) - - self.layout.addLayout(self.sliderlayout) - else: - self._set_slider_value = None - - self.buttonlayout = QtGui.QHBoxLayout() - self.buttonlayout.addWidget(self.applyButton) - self.buttonlayout.addWidget(self.setButton) - self.buttonlayout.addWidget(self.cancelButton) - self.layout.addLayout(self.buttonlayout) - - # set layout and go... - self.setLayout(self.layout) - - def _set_slider_value(self, val): - self.slider.setValue(self.steps*(val-self.props.min.value)/self.valspan) - - def _slide(self): - val = (self.slider.value()*self.valspan + self.props.min.value)/float(self.steps) - self.textInput.setText(str(val)) - - def _apply(self): - if(type(self.sv.value) == str): - val = str(self.textInput.text()) - elif(type(self.sv.value) == int): - val = int(round(float(self.textInput.text()))) - elif(type(self.sv.value) == float): - val = float(self.textInput.text()) - elif(type(self.sv.value) == GNURadio.complex): - t = str(self.textInput.text()) - t = complex(t.strip("(").strip(")").replace(" ", "")) - val = GNURadio.complex() - val.re = t.real - val.im = t.imag - else: - sys.stderr.write("set type not supported! ({0})\n".format(type(self.sv.value))) - return - - self.sv.value = val - km = {} - km[self.key] = self.sv - self.radio.set(km) - if self._set_slider_value: - self._set_slider_value(self.sv.value) - - def _set(self): - self._apply() - self.done(0) - - -class MForm(QtGui.QWidget): - def update(self): - try: - st = time.time(); - knobs = self.radio.get([]); - ft = time.time(); - latency = ft-st; - self.parent.statusBar().showMessage("Current GNU Radio Control Port Query Latency: %f ms"%(latency*1000)) - - except Exception, e: - sys.stderr.write("ctrlport-monitor: radio.get threw exception ({0}).\n".format(e)) - if(type(self.parent) is MAINWindow): - # Find window of connection - remove = [] - for p in self.parent.mdiArea.subWindowList(): - if self.parent.conns[self.uid] == p.widget(): - remove.append(p) - - # Find any subplot windows of connection - for p in self.parent.mdiArea.subWindowList(): - for plot in self.parent.plots[self.uid]: - if plot.qwidget() == p.widget(): - remove.append(p) - - # Clean up local references to these - self.parent.conns.remove(self.parent.conns[self.uid]) - self.parent.plots.remove(self.parent.plots[self.uid]) - - # Remove subwindows for connection and plots - for r in remove: - self.parent.mdiArea.removeSubWindow(r) - - # Clean up self - self.close() - else: - sys.exit(1) - return - - tableitems = knobs.keys() - - #UPDATE TABLE: - try: - self.table.updateItems(knobs, self.knobprops) - except: - self.knobprops = self.radio.properties([]) - - #UPDATE PLOTS - self.parent.update(knobs, self.uid) - - - def __init__(self, radio=None, port=None, uid=0, updateRate=2000, parent=None): - - super(MForm, self).__init__() - - if(radio == None or port == None): - askinfo = ConInfoDialog(self); - if askinfo.exec_(): - host = str(askinfo.host.text()); - port = str(askinfo.port.text()); - radio = parent.interface.getRadio(host, port) - else: - self.radio = None - return - - self.uid = uid - self.parent = parent - self.horizontalLayout = QtGui.QVBoxLayout(self) - self.gridLayout = QtGui.QGridLayout() - - self.radio = radio - self.knobprops = self.radio.properties([]) - self.parent.knobprops.append(self.knobprops) - self.resize(775,500) - self.timer = QtCore.QTimer() - self.constupdatediv = 0 - self.tableupdatediv = 0 - plotsize=250 - - # make table - self.table = GrDataPlotterValueTable(uid, self, 0, 0, 400, 200) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) - self.table.treeWidget.setSizePolicy(sizePolicy) - self.table.treeWidget.setEditTriggers(QtGui.QAbstractItemView.EditKeyPressed) - self.table.treeWidget.setSortingEnabled(True) - self.table.treeWidget.setDragEnabled(True) - - # add things to layouts - self.horizontalLayout.addWidget(self.table.treeWidget) - - # set up timer - self.connect(self.timer, QtCore.SIGNAL('timeout()'), self.update) - self.updateRate = updateRate; - self.timer.start(self.updateRate) - - # set up context menu .. - self.table.treeWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) - self.table.treeWidget.customContextMenuRequested.connect(self.openMenu) - - # Set up double-click to launch default plotter - self.connect(self.table.treeWidget, - QtCore.SIGNAL('itemDoubleClicked(QTreeWidgetItem*, int)'), - self.parent.newSub); - - # Allow drag/drop event from table item to plotter - self.connect(self.table.treeWidget, - QtCore.SIGNAL('itemPressed(QTreeWidgetItem*, int)'), - self.parent.startDrag) - - def openMenu(self, pos): - index = self.table.treeWidget.selectedIndexes() - item = self.table.treeWidget.itemFromIndex(index[0]) - itemname = str(item.text(0)) - self.parent.propertiesMenu(itemname, self.radio, self.uid) - - -def get_minmax(p): - pmin = p.min.value - pmax = p.max.value - - # Find min/max or real or imag for GNURadio::complex - if(type(pmin) == GNURadio.complex): - pmin = min(pmin.re, pmin.im) - if(type(pmax) == GNURadio.complex): - pmax = max(pmax.re, pmax.im) - - # If it's a byte stream, Python thinks it's a string. - if(type(pmin) == str): - pmin = struct.unpack('b', pmin)[0] - if(type(pmax) == str): - pmax = struct.unpack('b', pmax)[0] - - if pmin == []: - pmin = None - else: - pmin = 1.1*float(pmin) - if pmax == []: - pmax = None - else: - pmax = 1.1*float(pmax) - - return pmin, pmax - -class MyClient(IceRadioClient): - def __init__(self): - IceRadioClient.__init__(self, MAINWindow) - -sys.exit(MyClient().main(sys.argv)) diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitor b/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitor deleted file mode 100755 index 612eb66063..0000000000 --- a/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitor +++ /dev/null @@ -1,591 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -from gnuradio import gr, ctrlport - -from PyQt4 import QtCore,Qt,Qwt5 -import PyQt4.QtGui as QtGui -import sys, time, re, pprint -import itertools -import scipy - -import Ice -from gnuradio.ctrlport.IceRadioClient import * -from gnuradio.ctrlport.GrDataPlotter import * -from gnuradio.ctrlport import GNURadio - -class MAINWindow(QtGui.QMainWindow): - def minimumSizeHint(self): - return QtGui.QSize(800,600) - - def __init__(self, radio, port, interface): - - super(MAINWindow, self).__init__() - self.conns = [] - self.plots = [] - self.knobprops = [] - self.interface = interface - - self.mdiArea = QtGui.QMdiArea() - self.mdiArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) - self.mdiArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) - self.setCentralWidget(self.mdiArea) - - self.mdiArea.subWindowActivated.connect(self.updateMenus) - self.windowMapper = QtCore.QSignalMapper(self) - self.windowMapper.mapped[QtGui.QWidget].connect(self.setActiveSubWindow) - - self.createActions() - self.createMenus() - self.createToolBars() - self.createStatusBar() - self.updateMenus() - - self.setWindowTitle("GNU Radio Performance Monitor") - self.setUnifiedTitleAndToolBarOnMac(True) - - self.newCon(radio, port) - icon = QtGui.QIcon(ctrlport.__path__[0] + "/icon.png" ) - self.setWindowIcon(icon) - - def newCon(self, radio=None, port=None): - child = MForm(radio, port, len(self.conns), self) - if(child.radio is not None): - child.setWindowTitle(str(child.radio)) - horizbar = QtGui.QScrollArea() - horizbar.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) - horizbar.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) - horizbar.setWidget(child) - self.mdiArea.addSubWindow(horizbar) - self.mdiArea.currentSubWindow().showMaximized() - - self.conns.append(child) - self.plots.append([]) - - def newUpdater(self, key, radio): - updater = UpdaterWindow(key, radio, None) - updater.setWindowTitle("Updater: " + key) - updater.setModal(False) - updater.exec_() - - def update(self, knobs, uid): - #sys.stderr.write("KNOB KEYS: {0}\n".format(knobs.keys())) - for plot in self.plots[uid]: - data = knobs[plot.name()].value - plot.update(data) - plot.stop() - plot.wait() - plot.start() - - def setActiveSubWindow(self, window): - if window: - self.mdiArea.setActiveSubWindow(window) - - - def createActions(self): - self.newConAct = QtGui.QAction("&New Connection", - self, shortcut=QtGui.QKeySequence.New, - statusTip="Create a new file", triggered=self.newCon) - - self.exitAct = QtGui.QAction("E&xit", self, shortcut="Ctrl+Q", - statusTip="Exit the application", - triggered=QtGui.qApp.closeAllWindows) - - self.closeAct = QtGui.QAction("Cl&ose", self, shortcut="Ctrl+F4", - statusTip="Close the active window", - triggered=self.mdiArea.closeActiveSubWindow) - - self.closeAllAct = QtGui.QAction("Close &All", self, - statusTip="Close all the windows", - triggered=self.mdiArea.closeAllSubWindows) - - - qks = QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_T); - self.tileAct = QtGui.QAction("&Tile", self, - statusTip="Tile the windows", - triggered=self.mdiArea.tileSubWindows, - shortcut=qks) - - qks = QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_C); - self.cascadeAct = QtGui.QAction("&Cascade", self, - statusTip="Cascade the windows", shortcut=qks, - triggered=self.mdiArea.cascadeSubWindows) - - self.nextAct = QtGui.QAction("Ne&xt", self, - shortcut=QtGui.QKeySequence.NextChild, - statusTip="Move the focus to the next window", - triggered=self.mdiArea.activateNextSubWindow) - - self.previousAct = QtGui.QAction("Pre&vious", self, - shortcut=QtGui.QKeySequence.PreviousChild, - statusTip="Move the focus to the previous window", - triggered=self.mdiArea.activatePreviousSubWindow) - - self.separatorAct = QtGui.QAction(self) - self.separatorAct.setSeparator(True) - - self.aboutAct = QtGui.QAction("&About", self, - statusTip="Show the application's About box", - triggered=self.about) - - self.aboutQtAct = QtGui.QAction("About &Qt", self, - statusTip="Show the Qt library's About box", - triggered=QtGui.qApp.aboutQt) - - def createMenus(self): - self.fileMenu = self.menuBar().addMenu("&File") - self.fileMenu.addAction(self.newConAct) - self.fileMenu.addSeparator() - self.fileMenu.addAction(self.exitAct) - - self.windowMenu = self.menuBar().addMenu("&Window") - self.updateWindowMenu() - self.windowMenu.aboutToShow.connect(self.updateWindowMenu) - - self.menuBar().addSeparator() - - self.helpMenu = self.menuBar().addMenu("&Help") - self.helpMenu.addAction(self.aboutAct) - self.helpMenu.addAction(self.aboutQtAct) - - def createToolBars(self): - self.fileToolBar = self.addToolBar("File") - self.fileToolBar.addAction(self.newConAct) - - self.fileToolBar = self.addToolBar("Window") - self.fileToolBar.addAction(self.tileAct) - self.fileToolBar.addAction(self.cascadeAct) - - def createStatusBar(self): - self.statusBar().showMessage("Ready") - - - def activeMdiChild(self): - activeSubWindow = self.mdiArea.activeSubWindow() - if activeSubWindow: - return activeSubWindow.widget() - return None - - def updateMenus(self): - hasMdiChild = (self.activeMdiChild() is not None) - self.closeAct.setEnabled(hasMdiChild) - self.closeAllAct.setEnabled(hasMdiChild) - self.tileAct.setEnabled(hasMdiChild) - self.cascadeAct.setEnabled(hasMdiChild) - self.nextAct.setEnabled(hasMdiChild) - self.previousAct.setEnabled(hasMdiChild) - self.separatorAct.setVisible(hasMdiChild) - - def updateWindowMenu(self): - self.windowMenu.clear() - self.windowMenu.addAction(self.closeAct) - self.windowMenu.addAction(self.closeAllAct) - self.windowMenu.addSeparator() - self.windowMenu.addAction(self.tileAct) - self.windowMenu.addAction(self.cascadeAct) - self.windowMenu.addSeparator() - self.windowMenu.addAction(self.nextAct) - self.windowMenu.addAction(self.previousAct) - self.windowMenu.addAction(self.separatorAct) - - def about(self): - about_info = \ -'''Copyright 2012 Free Software Foundation, Inc.\n -This program is part of GNU Radio.\n -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.\n -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.\n -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.''' - - QtGui.QMessageBox.about(None, "gr-ctrlport-monitor", about_info) - - -class ConInfoDialog(QtGui.QDialog): - def __init__(self, parent=None): - super(ConInfoDialog, self).__init__(parent) - - self.gridLayout = QtGui.QGridLayout(self) - - - self.host = QtGui.QLineEdit(self); - self.port = QtGui.QLineEdit(self); - self.host.setText("localhost"); - self.port.setText("43243"); - - self.buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | - QtGui.QDialogButtonBox.Cancel) - - self.gridLayout.addWidget(self.host); - self.gridLayout.addWidget(self.port); - self.gridLayout.addWidget(self.buttonBox); - - self.buttonBox.accepted.connect(self.accept) - self.buttonBox.rejected.connect(self.reject) - - - def accept(self): - self.done(1); - - def reject(self): - self.done(0); - - -class UpdaterWindow(QtGui.QDialog): - def __init__(self, key, radio, parent): - QtGui.QDialog.__init__(self, parent) - - self.key = key; - self.radio = radio - - self.resize(300,200) - self.layout = QtGui.QVBoxLayout() - - self.props = radio.properties([key])[key] - info = str(self.props) - - self.infoLabel = QtGui.QLabel(info) - self.layout.addWidget(self.infoLabel) - - self.cancelButton = QtGui.QPushButton("Ok") - self.cancelButton.connect(self.cancelButton, QtCore.SIGNAL('clicked()'), self.reject) - - self.buttonlayout = QtGui.QHBoxLayout() - self.buttonlayout.addWidget(self.cancelButton) - self.layout.addLayout(self.buttonlayout) - - # set layout and go... - self.setLayout(self.layout) - - def _set_slider_value(self, val): - self.slider.setValue(self.steps*(val-self.props.min.value)/self.valspan) - - def _slide(self): - val = (self.slider.value()*self.valspan + self.props.min.value)/float(self.steps) - self.textInput.setText(str(val)) - - def _apply(self): - if(type(self.sv.value) == str): - val = str(self.textInput.text()) - elif(type(self.sv.value) == int): - val = int(round(float(self.textInput.text()))) - elif(type(self.sv.value) == float): - val = float(self.textInput.text()) - else: - sys.stderr.write("set type not supported! ({0})\n".format(type(self.sv.value))) - sys.exit(-1) - - self.sv.value = val - km = {} - km[self.key] = self.sv - self.radio.set(km) - self._set_slider_value(self.sv.value) - - def _set(self): - self._apply() - self.done(0) - - -def build_edge_graph(sources, sinks, edges): - ''' - Starting from the sources, walks through all of the edges to find - the next connected block. The output is stored in 'allblocks' - where each row starts with a source and follows one path down - until it terminates in either a sink or as an input to a block - that is part of another chain. - ''' - def find_edge(src, sinks, edges, row, col): - #print "\n\nAll blocks: " - #printer.pprint(allblocks) - #print "\nLooking for: ", src - - src0 = src.split(":")[0] - if(src0 in sinks): - if(len(allblocks) <= row): - allblocks.append(col*[""]) - allblocks[row].append(src) - return row+1 - - for edge in edges: - if(re.match(src0, edge)): - s = edge.split("->")[0] - b = edge.split("->")[1] - if(len(allblocks) <= row): - allblocks.append(col*[""]) - allblocks[row].append(s) - #print "Source: {0} Sink: {1}".format(s, b) - row = find_edge(b, sinks, edges, row, col+1) - return row - - # Recursively get all edges as a matrix of source->sink - n = 0 - allblocks = [] - for src in sources: - n = find_edge(src, sinks, edges, n, 0) - - # Sort by longest list - allblocks = sorted(allblocks, key=len) - allblocks.reverse() - - # Make all rows same length by padding '' in front of sort rows - maxrowlen = len(allblocks[0]) - for i,a in enumerate(allblocks): - rowlen = len(a) - allblocks[i] = (maxrowlen-rowlen)*[''] + a - - # Dedup rows - allblocks = sorted(allblocks) - allblocks = list(k for k,_ in itertools.groupby(allblocks)) - allblocks.reverse() - - return allblocks - - -class MForm(QtGui.QWidget): - def update(self): - try: - st = time.time() - knobs = self.radio.get([b[0] for b in self.block_dict]) - - ft = time.time() - latency = ft-st - self.parent.statusBar().showMessage("Current GNU Radio Control Port Query Latency: %f ms"%\ - (latency*1000)) - - except Exception, e: - sys.stderr.write("ctrlport-monitor: radio.get threw exception ({0}).\n".format(e)) - if(type(self.parent) is MAINWindow): - # Find window of connection - remove = [] - for p in self.parent.mdiArea.subWindowList(): - if self.parent.conns[self.uid] == p.widget(): - remove.append(p) - - # Find any subplot windows of connection - for p in self.parent.mdiArea.subWindowList(): - for plot in self.parent.plots[self.uid]: - if plot.qwidget() == p.widget(): - remove.append(p) - - # Clean up local references to these - self.parent.conns.remove(self.parent.conns[self.uid]) - self.parent.plots.remove(self.parent.plots[self.uid]) - - # Remove subwindows for connection and plots - for r in remove: - self.parent.mdiArea.removeSubWindow(r) - - # Clean up self - self.close() - else: - sys.exit(1) - return - - #UPDATE TABLE: - self.updateItems(knobs) - - #UPDATE PLOTS - self.parent.update(knobs, self.uid) - - def updateItems(self, knobs): - for b in self.block_dict: - if(knobs[b[0]].ice_id.im_class == GNURadio.KnobVecF): - b[1].setText("{0:.4f}".format(knobs[b[0]].value[b[2]])) - else: - b[1].setText("{0:.4f}".format(knobs[b[0]].value)) - - def __init__(self, radio=None, port=None, uid=0, parent=None): - - super(MForm, self).__init__() - - if(radio == None or port == None): - askinfo = ConInfoDialog(self); - if askinfo.exec_(): - host = str(askinfo.host.text()); - port = str(askinfo.port.text()); - radio = parent.interface.getRadio(host, port) - else: - self.radio = None - return - - self.uid = uid - self.parent = parent - self.layout = QtGui.QGridLayout(self) - self.layout.setSizeConstraint(QtGui.QLayout.SetFixedSize) - - self.radio = radio - self.knobprops = self.radio.properties([]) - self.parent.knobprops.append(self.knobprops) - self.resize(775,500) - self.timer = QtCore.QTimer() - self.constupdatediv = 0 - self.tableupdatediv = 0 - plotsize=250 - - - # Set up the graph of blocks - input_name = lambda x: x+"::avg input % full" - output_name = lambda x: x+"::avg output % full" - wtime_name = lambda x: x+"::avg work time" - nout_name = lambda x: x+"::avg noutput_items" - nprod_name = lambda x: x+"::avg nproduced" - - tmplist = [] - knobs = self.radio.get([]) - edgelist = None - for k in knobs: - propname = k.split("::") - blockname = propname[0] - keyname = propname[1] - if(keyname == "edge list"): - edgelist = knobs[k].value - elif(blockname not in tmplist): - # only take gr_blocks (no hier_block2) - if(knobs.has_key(input_name(blockname))): - tmplist.append(blockname) - - if not edgelist: - sys.stderr.write("Could not find list of edges from flowgraph. " + \ - "Make sure the option 'edges_list' is enabled " + \ - "in the ControlPort configuration.\n\n") - sys.exit(1) - - edges = edgelist.split("\n")[0:-1] - producers = [] - consumers = [] - for e in edges: - _e = e.split("->") - producers.append(_e[0]) - consumers.append(_e[1]) - - # Get producers and consumers as sets while ignoring the - # ports. - prods = set(map(lambda x: x.split(":")[0], producers)) - cons = set(map(lambda x: x.split(":")[0], consumers)) - - # Split out all blocks, sources, and sinks based on how they - # appear as consumers and/or producers. - blocks = prods.intersection(cons) - sources = prods.difference(blocks) - sinks = cons.difference(blocks) - - nblocks = len(prods) + len(cons) - - allblocks = build_edge_graph(sources, sinks, edges) - nrows = len(allblocks) - ncols = len(allblocks[0]) - - col_width = 120 - - self.block_dict = [] - - for row, blockrow in enumerate(allblocks): - for col, block in enumerate(blockrow): - if(block == ''): - continue - - bgroup = QtGui.QGroupBox(block) - playout = QtGui.QFormLayout() - bgroup.setLayout(playout) - self.layout.addWidget(bgroup, row, 2*col) - - blockname = block.split(":")[0] - - name = wtime_name(blockname) - wtime = knobs[name].value - newtime = QtGui.QLineEdit() - newtime.setMinimumWidth(col_width) - newtime.setText("{0:.4f}".format(wtime)) - self.block_dict.append((name, newtime)) - - name = nout_name(blockname) - nout = knobs[name].value - newnout = QtGui.QLineEdit() - newnout.setText("{0:.4f}".format(nout)) - newnout.setMinimumWidth(col_width) - self.block_dict.append((name, newnout)) - - name = nprod_name(blockname) - nprod = knobs[name].value - newnprod = QtGui.QLineEdit() - newnprod.setMinimumWidth(col_width) - newnprod.setText("{0:.4f}".format(nprod)) - self.block_dict.append((name, newnprod)) - - playout.addRow("Work time", newtime) - playout.addRow("noutput_items", newnout) - playout.addRow("nproduced", newnprod) - - if blockname in blocks or blockname in sources: - # Add a buffer between blocks - buffgroup = QtGui.QGroupBox("Buffer") - bufflayout = QtGui.QFormLayout() - buffgroup.setLayout(bufflayout) - self.layout.addWidget(buffgroup, row, 2*col+1) - - i = int(block.split(":")[1]) - name = output_name(blockname) - obuff = knobs[name].value - for i,o in enumerate(obuff): - newobuff = QtGui.QLineEdit() - newobuff.setMinimumWidth(col_width) - newobuff.setText("{0:.4f}".format(o)) - self.block_dict.append((name, newobuff, i)) - bufflayout.addRow("Out Buffer {0}".format(i), - newobuff) - - if blockname in blocks or blockname in sinks: - item = self.layout.itemAtPosition(row, 2*col-1) - if(item): - buffgroup = item.widget() - bufflayout = buffgroup.layout() - else: - buffgroup = QtGui.QGroupBox("Buffer") - bufflayout = QtGui.QFormLayout() - buffgroup.setLayout(bufflayout) - self.layout.addWidget(buffgroup, row, 2*col-1) - - i = int(block.split(":")[1]) - name = input_name(blockname) - ibuff = knobs[name].value[i] - newibuff = QtGui.QLineEdit() - newibuff.setMinimumWidth(col_width) - newibuff.setText("{0:.4f}".format(ibuff)) - self.block_dict.append((name, newibuff, i)) - bufflayout.addRow("In Buffer {0}".format(i), - newibuff) - - # set up timer - self.timer = QtCore.QTimer() - self.connect(self.timer, QtCore.SIGNAL('timeout()'), self.update) - self.timer.start(1000) - - def openMenu(self, pos): - index = self.table.treeWidget.selectedIndexes() - item = self.table.treeWidget.itemFromIndex(index[0]) - itemname = str(item.text(0)) - self.parent.propertiesMenu(itemname, self.radio, self.uid) - - -class MyClient(IceRadioClient): - def __init__(self): - IceRadioClient.__init__(self, MAINWindow) - -sys.exit(MyClient().main(sys.argv)) diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx b/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx deleted file mode 100755 index 369922cbbf..0000000000 --- a/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx +++ /dev/null @@ -1,849 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -import random,math,operator -import networkx as nx; -import matplotlib -matplotlib.use("Qt4Agg"); -import matplotlib.pyplot as plt -from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas -from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar -from matplotlib.figure import Figure - -from gnuradio import gr, ctrlport - -from PyQt4 import QtCore,Qt,Qwt5 -import PyQt4.QtGui as QtGui -import sys, time, re, pprint -import itertools - -import Ice -from gnuradio.ctrlport.IceRadioClient import * -from gnuradio.ctrlport.GrDataPlotter import * -from gnuradio.ctrlport import GNURadio - -class MAINWindow(QtGui.QMainWindow): - def minimumSizeHint(self): - return QtGui.QSize(800,600) - - def __init__(self, radio, port, interface): - - super(MAINWindow, self).__init__() - self.conns = [] - self.plots = [] - self.knobprops = [] - self.interface = interface - - self.mdiArea = QtGui.QMdiArea() - self.mdiArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) - self.mdiArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) - self.setCentralWidget(self.mdiArea) - - self.mdiArea.subWindowActivated.connect(self.updateMenus) - self.windowMapper = QtCore.QSignalMapper(self) - self.windowMapper.mapped[QtGui.QWidget].connect(self.setActiveSubWindow) - - self.createActions() - self.createMenus() - self.createToolBars() - self.createStatusBar() - self.updateMenus() - - self.setWindowTitle("GNU Radio Performance Monitor") - self.setUnifiedTitleAndToolBarOnMac(True) - - self.newCon(radio, port) - icon = QtGui.QIcon(ctrlport.__path__[0] + "/icon.png" ) - self.setWindowIcon(icon) - - def newSubWindow(self, window, title): - child = window; - child.setWindowTitle(title) - self.mdiArea.addSubWindow(child) - self.conns.append(child) - child.show(); - self.mdiArea.currentSubWindow().showMaximized() - - - def newCon(self, radio=None, port=None): - child = MForm(radio, port, len(self.conns), self) - if(child.radio is not None): - child.setWindowTitle(str(child.radio)) -# horizbar = QtGui.QScrollArea() -# horizbar.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) -# horizbar.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded) -# horizbar.setWidget(child) -# self.mdiArea.addSubWindow(horizbar) - self.mdiArea.addSubWindow(child) - self.mdiArea.currentSubWindow().showMaximized() - - self.conns.append(child) - self.plots.append([]) - - def update(self, knobs, uid): - #sys.stderr.write("KNOB KEYS: {0}\n".format(knobs.keys())) - for plot in self.plots[uid]: - data = knobs[plot.name()].value - plot.update(data) - plot.stop() - plot.wait() - plot.start() - - def setActiveSubWindow(self, window): - if window: - self.mdiArea.setActiveSubWindow(window) - - - def createActions(self): - self.newConAct = QtGui.QAction("&New Connection", - self, shortcut=QtGui.QKeySequence.New, - statusTip="Create a new file", triggered=self.newCon) - - self.exitAct = QtGui.QAction("E&xit", self, shortcut="Ctrl+Q", - statusTip="Exit the application", - triggered=QtGui.qApp.closeAllWindows) - - self.closeAct = QtGui.QAction("Cl&ose", self, shortcut="Ctrl+F4", - statusTip="Close the active window", - triggered=self.mdiArea.closeActiveSubWindow) - - self.closeAllAct = QtGui.QAction("Close &All", self, - statusTip="Close all the windows", - triggered=self.mdiArea.closeAllSubWindows) - - qks = QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_T); - self.tileAct = QtGui.QAction("&Tile", self, - statusTip="Tile the windows", - triggered=self.mdiArea.tileSubWindows, - shortcut=qks) - - qks = QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_C); - self.cascadeAct = QtGui.QAction("&Cascade", self, - statusTip="Cascade the windows", shortcut=qks, - triggered=self.mdiArea.cascadeSubWindows) - - self.nextAct = QtGui.QAction("Ne&xt", self, - shortcut=QtGui.QKeySequence.NextChild, - statusTip="Move the focus to the next window", - triggered=self.mdiArea.activateNextSubWindow) - - self.previousAct = QtGui.QAction("Pre&vious", self, - shortcut=QtGui.QKeySequence.PreviousChild, - statusTip="Move the focus to the previous window", - triggered=self.mdiArea.activatePreviousSubWindow) - - self.separatorAct = QtGui.QAction(self) - self.separatorAct.setSeparator(True) - - self.aboutAct = QtGui.QAction("&About", self, - statusTip="Show the application's About box", - triggered=self.about) - - self.aboutQtAct = QtGui.QAction("About &Qt", self, - statusTip="Show the Qt library's About box", - triggered=QtGui.qApp.aboutQt) - - def createMenus(self): - self.fileMenu = self.menuBar().addMenu("&File") - self.fileMenu.addAction(self.newConAct) - self.fileMenu.addSeparator() - self.fileMenu.addAction(self.exitAct) - - self.windowMenu = self.menuBar().addMenu("&Window") - self.updateWindowMenu() - self.windowMenu.aboutToShow.connect(self.updateWindowMenu) - - self.menuBar().addSeparator() - - self.helpMenu = self.menuBar().addMenu("&Help") - self.helpMenu.addAction(self.aboutAct) - self.helpMenu.addAction(self.aboutQtAct) - - def createToolBars(self): - self.fileToolBar = self.addToolBar("File") - self.fileToolBar.addAction(self.newConAct) - - self.fileToolBar = self.addToolBar("Window") - self.fileToolBar.addAction(self.tileAct) - self.fileToolBar.addAction(self.cascadeAct) - - def createStatusBar(self): - self.statusBar().showMessage("Ready") - - - def activeMdiChild(self): - activeSubWindow = self.mdiArea.activeSubWindow() - if activeSubWindow: - return activeSubWindow.widget() - return None - - def updateMenus(self): - hasMdiChild = (self.activeMdiChild() is not None) - self.closeAct.setEnabled(hasMdiChild) - self.closeAllAct.setEnabled(hasMdiChild) - self.tileAct.setEnabled(hasMdiChild) - self.cascadeAct.setEnabled(hasMdiChild) - self.nextAct.setEnabled(hasMdiChild) - self.previousAct.setEnabled(hasMdiChild) - self.separatorAct.setVisible(hasMdiChild) - - def updateWindowMenu(self): - self.windowMenu.clear() - self.windowMenu.addAction(self.closeAct) - self.windowMenu.addAction(self.closeAllAct) - self.windowMenu.addSeparator() - self.windowMenu.addAction(self.tileAct) - self.windowMenu.addAction(self.cascadeAct) - self.windowMenu.addSeparator() - self.windowMenu.addAction(self.nextAct) - self.windowMenu.addAction(self.previousAct) - self.windowMenu.addAction(self.separatorAct) - - def about(self): - about_info = \ -'''Copyright 2012 Free Software Foundation, Inc.\n -This program is part of GNU Radio.\n -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.\n -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.\n -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.''' - - QtGui.QMessageBox.about(None, "gr-ctrlport-monitor", about_info) - - -class ConInfoDialog(QtGui.QDialog): - def __init__(self, parent=None): - super(ConInfoDialog, self).__init__(parent) - - self.gridLayout = QtGui.QGridLayout(self) - - - self.host = QtGui.QLineEdit(self); - self.port = QtGui.QLineEdit(self); - self.host.setText("localhost"); - self.port.setText("43243"); - - self.buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | - QtGui.QDialogButtonBox.Cancel) - - self.gridLayout.addWidget(self.host); - self.gridLayout.addWidget(self.port); - self.gridLayout.addWidget(self.buttonBox); - - self.buttonBox.accepted.connect(self.accept) - self.buttonBox.rejected.connect(self.reject) - - - def accept(self): - self.done(1); - - def reject(self): - self.done(0); - - -class DataTable(QtGui.QWidget): - def update(self): - print "update" - - def __init__(self, radio, G): - QtGui.QWidget.__init__( self) - - self.layout = QtGui.QVBoxLayout(self); - self.hlayout = QtGui.QHBoxLayout(); - self.layout.addLayout(self.hlayout); - - self.G = G; - self.radio = radio; - - self._keymap = None - - # Create a combobox to set the type of statistic we want. - self._statistic = "Instantaneous" - self._statistics_table = {"Instantaneous": "", - "Average": "avg ", - "Variance": "var "} - self.stattype = QtGui.QComboBox() - self.stattype.addItem("Instantaneous") - self.stattype.addItem("Average") - self.stattype.addItem("Variance") - self.stattype.setMaximumWidth(200) - self.hlayout.addWidget(self.stattype); - self.stattype.currentIndexChanged.connect(self.stat_changed) - - # Create a checkbox to toggle sorting of graphs - self._sort = False - self.checksort = QtGui.QCheckBox("Sort") - self.checksort.setCheckState(self._sort) - self.hlayout.addWidget(self.checksort); - self.checksort.stateChanged.connect(self.checksort_changed) - - # set up table - self.perfTable = Qt.QTableWidget(); - self.perfTable.setColumnCount(2) - self.perfTable.verticalHeader().hide(); - self.perfTable.setHorizontalHeaderLabels( ["Block Name", "Percent Runtime"] ); - self.perfTable.horizontalHeader().setStretchLastSection(True); - self.perfTable.setSortingEnabled(True) - nodes = self.G.nodes(data=True) - - # set up plot - self.f = plt.figure(figsize=(10,8), dpi=90) - self.sp = self.f.add_subplot(111); - self.sp.autoscale_view(True,True,True); - self.sp.set_autoscale_on(True) - self.canvas = FigureCanvas(self.f) - - # set up tabs - self.tabber = QtGui.QTabWidget(); - self.layout.addWidget(self.tabber); - self.tabber.addTab(self.perfTable,"Table View"); - self.tabber.addTab(self.canvas, "Graph View"); - - # set up timer - self.timer = QtCore.QTimer() - self.connect(self.timer, QtCore.SIGNAL('timeout()'), self.update) - self.timer.start(500) - - for i in range(0,len(nodes)): - self.perfTable.setItem( - i,0, - Qt.QTableWidgetItem(nodes[i][0])) - - def table_update(self,data): - for k in data.keys(): - weight = data[k] - existing = self.perfTable.findItems(str(k),QtCore.Qt.MatchFixedString) - if(len(existing) == 0): - i = self.perfTable.rowCount(); - self.perfTable.setRowCount( i+1) - self.perfTable.setItem( i,0, Qt.QTableWidgetItem(str(k))) - self.perfTable.setItem( i,1, Qt.QTableWidgetItem(str(weight))) - else: - self.perfTable.setItem( self.perfTable.row(existing[0]),1, Qt.QTableWidgetItem(str(weight))) - - def stat_changed(self, index): - self._statistic = str(self.stattype.currentText()) - - def checksort_changed(self, state): - self._sort = state > 0 - -class DataTableBuffers(DataTable): - def __init__(self, radio, G): - DataTable.__init__(self,radio,G) - self.perfTable.setHorizontalHeaderLabels( ["Block Name", "Percent Buffer Full"] ); - - def update(self): - nodes = self.G.nodes(); - - # get buffer fullness for all blocks - kl = map(lambda x: "%s::%soutput %% full" % \ - (x, self._statistics_table[self._statistic]), - nodes); - buf_knobs = self.radio.get(kl) - - # strip values out of ctrlport response - buffer_fullness = dict(zip( - map(lambda x: x.split("::")[0], buf_knobs.keys()), - map(lambda x: x.value, buf_knobs.values()))) - - blockport_fullness = {} - for blk in buffer_fullness: - for port in range(0,len(buffer_fullness[blk])): - blockport_fullness["%s:%d"%(blk,port)] = buffer_fullness[blk][port]; - - self.table_update(blockport_fullness); - - if(self._sort): - sorted_fullness = sorted(blockport_fullness.iteritems(), key=operator.itemgetter(1)) - self._keymap = map(operator.itemgetter(0), sorted_fullness) - else: - if self._keymap: - sorted_fullness = len(self._keymap)*['',] - for b in blockport_fullness: - sorted_fullness[self._keymap.index(b)] = (b, blockport_fullness[b]) - else: - sorted_fullness = blockport_fullness.items() - - self.sp.clear(); - plt.figure(self.f.number) - plt.subplot(111); - self.sp.bar(range(0,len(sorted_fullness)), map(lambda x: x[1], sorted_fullness), - alpha=0.5) - self.sp.set_ylabel("% Buffers Full"); - self.sp.set_xticks( map(lambda x: x+0.5, range(0,len(sorted_fullness)))) - self.sp.set_xticklabels( map(lambda x: " " + x, map(lambda x: x[0], sorted_fullness)), - rotation="vertical", verticalalignment="bottom" ) - self.canvas.draw(); - self.canvas.show(); - -class DataTableRuntimes(DataTable): - def __init__(self, radio, G): - DataTable.__init__(self,radio,G) - #self.perfTable.setRowCount(len( self.G.nodes() )) - - def update(self): - nodes = self.G.nodes(); - - # get work time for all blocks - kl = map(lambda x: "%s::%swork time" % \ - (x, self._statistics_table[self._statistic]), - nodes); - wrk_knobs = self.radio.get(kl) - - # strip values out of ctrlport response - total_work = sum(map(lambda x: x.value, wrk_knobs.values())) - if(total_work == 0): - total_work = 1 - work_times = dict(zip( - map(lambda x: x.split("::")[0], wrk_knobs.keys()), - map(lambda x: x.value/total_work, wrk_knobs.values()))) - - # update table view - self.table_update(work_times) - - if(self._sort): - sorted_work = sorted(work_times.iteritems(), key=operator.itemgetter(1)) - self._keymap = map(operator.itemgetter(0), sorted_work) - else: - if self._keymap: - sorted_work = len(self._keymap)*['',] - for b in work_times: - sorted_work[self._keymap.index(b)] = (b, work_times[b]) - else: - sorted_work = work_times.items() - - self.sp.clear(); - plt.figure(self.f.number) - plt.subplot(111); - self.sp.bar(range(0,len(sorted_work)), map(lambda x: x[1], sorted_work), - alpha=0.5) - self.sp.set_ylabel("% Runtime"); - self.sp.set_xticks( map(lambda x: x+0.5, range(0,len(sorted_work)))) - self.sp.set_xticklabels( map(lambda x: " " + x[0], sorted_work), - rotation="vertical", verticalalignment="bottom" ) - - self.canvas.draw(); - self.canvas.show(); - -class MForm(QtGui.QWidget): - def update(self): - try: - try: - # update current clock type - self.prevent_clock_change = True; - kl1 = None; - if(self.clockKey == None): - kl1 = self.radio.getRe([".*perfcounter_clock"]) - else: - kl1 = self.radio.get([self.clockKey]); - self.clockKey = kl1.keys()[0]; - self.currClock = kl1[self.clockKey].value; - self.clockSelIdx = self.clocks.values().index(self.currClock); - self.clockSel.setCurrentIndex(self.clockSelIdx); - self.prevent_clock_change = False; - except: - print "WARNING: Failed to get current clock setting!" - - nodes_stream = self.G_stream.nodes(); - nodes_msg = self.G_msg.nodes(); - - # get current buffer depths of all output buffers - kl = map(lambda x: "%s::%soutput %% full" % \ - (x, self._statistics_table[self._statistic]), - nodes_stream); - - st = time.time() - buf_knobs = self.radio.get(kl) - td1 = time.time() - st; - - # strip values out of ctrlport response - buf_vals = dict(zip( - map(lambda x: x.split("::")[0], buf_knobs.keys()), - map(lambda x: x.value, buf_knobs.values()))) - - # get work time for all blocks - kl = map(lambda x: "%s::%swork time" % \ - (x, self._statistics_table[self._statistic]), - nodes_stream); - st = time.time() - wrk_knobs = self.radio.get(kl) - td2 = time.time() - st; - - # strip values out of ctrlport response - total_work = sum(map(lambda x: x.value, wrk_knobs.values())) - if(total_work == 0): - total_work = 1 - work_times = dict(zip( - map(lambda x: x.split("::")[0], wrk_knobs.keys()), - map(lambda x: x.value/total_work, wrk_knobs.values()))) - work_times_padded = dict(zip( - self.G.nodes(), - [0.1]*len(self.G.nodes()))) - work_times_padded.update(work_times) - - for n in nodes_stream: - # ne is the list of edges away from this node! - ne = self.G.edges([n],True); - #for e in ne: # iterate over edges from this block - for e in ne: # iterate over edges from this block - # get the right output buffer/port weight for each edge - sourceport = e[2]["sourceport"]; - if(e[2]["type"] == "stream"): - newweight = buf_vals[n][sourceport] - e[2]["weight"] = newweight; - - for n in nodes_msg: - ne = self.G.edges([n],True); - for e in ne: # iterate over edges from this block - sourceport = e[2]["sourceport"]; - if(e[2]["type"] == "msg"): - #newweight = buf_vals[n][sourceport] - newweight = 0.01; - e[2]["weight"] = newweight; - - # set updated weights - #self.node_weights = map(lambda x: 20+2000*work_times[x], nodes_stream); - self.node_weights = map(lambda x: 20+2000*work_times_padded[x], self.G.nodes()); - self.edge_weights = map(lambda x: 100.0*x[2]["weight"], self.G.edges(data=True)); - - # draw graph updates - self.updateGraph(); - - latency = td1 + td2; - self.parent.statusBar().showMessage("Current GNU Radio Control Port Query Latency: %f ms"%\ - (latency*1000)) - - except Exception, e: - sys.stderr.write("ctrlport-monitor: radio.get threw exception ({0}).\n".format(e)) - if(type(self.parent) is MAINWindow): - # Find window of connection - remove = [] - for p in self.parent.mdiArea.subWindowList(): - if self.parent.conns[self.uid] == p.widget(): - remove.append(p) - - # Remove subwindows for connection and plots - for r in remove: - self.parent.mdiArea.removeSubWindow(r) - - # Clean up self - self.close() - else: - sys.exit(1) - return - - def rtt(self): - self.parent.newSubWindow( DataTableRuntimes(self.radio, self.G_stream), "Runtime Table" ); - - def bpt(self): - self.parent.newSubWindow( DataTableBuffers(self.radio, self.G_stream), "Buffers Table" ); - - def resetPCs(self): - knob = GNURadio.KnobB() - knob.value = False - km = {} - for b in self.blocks_list: - km[b + "::reset_perf_counters"] = knob - k = self.radio.set(km) - - def toggleFlowgraph(self): - if self.pauseFGAct.isChecked(): - self.pauseFlowgraph() - else: - self.unpauseFlowgraph() - - def pauseFlowgraph(self): - knob = GNURadio.KnobB() - knob.value = False - km = {} - km[self.top_block + "::lock"] = knob - km[self.top_block + "::stop"] = knob - k = self.radio.set(km) - - def unpauseFlowgraph(self): - knob = GNURadio.KnobB() - knob.value = False - km = {} - km[self.top_block + "::unlock"] = knob - k = self.radio.set(km) - - def stat_changed(self, index): - self._statistic = str(self.stattype.currentText()) - - def update_clock(self, clkidx): - if(self.prevent_clock_change): - return; - idx = self.clockSel.currentIndex(); - clk = self.clocks.values()[idx] -# print "UPDATE CLOCK!!! %d -> %d"%(idx,clk); - k = self.radio.get([self.clockKey]); - k[self.clockKey].value = clk; - km = {}; - km[self.clockKey] = k[self.clockKey]; - self.radio.set(km); - - def __init__(self, radio=None, port=None, uid=0, parent=None): - - super(MForm, self).__init__() - - if(radio == None or port == None): - askinfo = ConInfoDialog(self); - if askinfo.exec_(): - host = str(askinfo.host.text()); - port = str(askinfo.port.text()); - radio = parent.interface.getRadio(host, port) - else: - self.radio = None - return - - - self.uid = uid - self.parent = parent - - self.layoutTop = QtGui.QVBoxLayout(self) - self.ctlBox = QtGui.QHBoxLayout(); - self.layout = QtGui.QHBoxLayout() - - self.layoutTop.addLayout(self.ctlBox); - self.layoutTop.addLayout(self.layout); - - self.rttAct = QtGui.QAction("Runtime Table", - self, statusTip="Runtime Table", triggered=self.rtt) - self.rttBut = Qt.QToolButton() - self.rttBut.setDefaultAction(self.rttAct); - self.ctlBox.addWidget(self.rttBut); - - self.bptAct = QtGui.QAction("Buffer Table", - self, statusTip="Buffer Table", triggered=self.bpt) - self.bptBut = Qt.QToolButton() - self.bptBut.setDefaultAction(self.bptAct); - self.ctlBox.addWidget(self.bptBut); - - self.resetPCsAct = QtGui.QAction("Reset", self, - statusTip="Reset all Performance Counters", - triggered=self.resetPCs) - self.resetPCsBut = Qt.QToolButton() - self.resetPCsBut.setDefaultAction(self.resetPCsAct); - self.ctlBox.addWidget(self.resetPCsBut); - - self.pauseFGAct = QtGui.QAction("Pause", self, - statusTip="Pause the Flowgraph", - triggered=self.toggleFlowgraph) - self.pauseFGAct.setCheckable(True) - self.pauseFGBut = Qt.QToolButton() - self.pauseFGBut.setDefaultAction(self.pauseFGAct); - self.ctlBox.addWidget(self.pauseFGBut); - - self.prevent_clock_change = True; - self.clockKey = None; - self.clocks = {"MONOTONIC":1, "THREAD":3}; - self.clockSel = QtGui.QComboBox(self); - map(lambda x: self.clockSel.addItem(x), self.clocks.keys()); - self.ctlBox.addWidget(self.clockSel); - self.clockSel.currentIndexChanged.connect(self.update_clock); - self.prevent_clock_change = False; - - self._statistic = "Instantaneous" - self._statistics_table = {"Instantaneous": "", - "Average": "avg ", - "Variance": "var "} - self.stattype = QtGui.QComboBox() - self.stattype.addItem("Instantaneous") - self.stattype.addItem("Average") - self.stattype.addItem("Variance") - self.stattype.setMaximumWidth(200) - self.ctlBox.addWidget(self.stattype); - self.stattype.currentIndexChanged.connect(self.stat_changed) - -# self.setLayout(self.layout); - - self.radio = radio - self.knobprops = self.radio.properties([]) - self.parent.knobprops.append(self.knobprops) - - self.timer = QtCore.QTimer() - self.constupdatediv = 0 - self.tableupdatediv = 0 - plotsize=250 - - - # Set up the graph of blocks - input_name = lambda x: x+"::avg input % full" - output_name = lambda x: x+"::avg output % full" - wtime_name = lambda x: x+"::avg work time" - nout_name = lambda x: x+"::avg noutput_items" - nprod_name = lambda x: x+"::avg nproduced" - - tmplist = [] - knobs = self.radio.get([]) - edgelist = None - msgedgelist = None - for k in knobs: - propname = k.split("::") - blockname = propname[0] - keyname = propname[1] - if(keyname == "edge list"): - edgelist = knobs[k].value - self.top_block = blockname - elif(keyname == "msg edges list"): - msgedgelist = knobs[k].value - elif(blockname not in tmplist): - # only take gr_blocks (no hier_block2) - if(knobs.has_key(input_name(blockname))): - tmplist.append(blockname) - - - if not edgelist: - sys.stderr.write("Could not find list of edges from flowgraph. " + \ - "Make sure the option 'edges_list' is enabled " + \ - "in the ControlPort configuration.\n\n") - sys.exit(1) - - self.blocks_list = tmplist - edges = edgelist.split("\n")[0:-1] - msgedges = msgedgelist.split("\n")[0:-1] - - edgepairs_stream = []; - edgepairs_msg = []; - - # add stream connections - for e in edges: - _e = e.split("->") - edgepairs_stream.append( (_e[0].split(":")[0], _e[1].split(":")[0], - {"type":"stream", "sourceport":int(_e[0].split(":")[1])}) ); - - # add msg connections - for e in msgedges: - _e = e.split("->") - edgepairs_msg.append( (_e[0].split(":")[0], _e[1].split(":")[0], - {"type":"msg", "sourceport":_e[0].split(":")[1]}) ); - - self.G = nx.MultiDiGraph(); - self.G_stream = nx.MultiDiGraph(); - self.G_msg = nx.MultiDiGraph(); - - self.G.add_edges_from(edgepairs_stream); - self.G.add_edges_from(edgepairs_msg); - - self.G_stream.add_edges_from(edgepairs_stream); - self.G_msg.add_edges_from(edgepairs_msg); - - n_edges = self.G.edges(data=True); - for e in n_edges: - e[2]["weight"] = 5+random.random()*10; - - self.G.clear(); - self.G.add_edges_from(n_edges); - - - self.f = plt.figure(figsize=(10,8), dpi=90) - self.sp = self.f.add_subplot(111); - self.sp.autoscale_view(True,True,True); - self.sp.set_autoscale_on(True) - - self.canvas = FigureCanvas(self.f) - self.layout.addWidget(self.canvas); - - self.pos = nx.graphviz_layout(self.G); - #self.pos = nx.pygraphviz_layout(self.G); - #self.pos = nx.spectral_layout(self.G); - #self.pos = nx.circular_layout(self.G); - #self.pos = nx.shell_layout(self.G); - #self.pos = nx.spring_layout(self.G); - - # generate weights and plot - self.update(); - - # set up timer - self.timer = QtCore.QTimer() - self.connect(self.timer, QtCore.SIGNAL('timeout()'), self.update) - self.timer.start(1000) - - # Set up mouse callback functions to move blocks around. - self._grabbed = False - self._current_block = '' - self.f.canvas.mpl_connect('button_press_event', - self.button_press) - self.f.canvas.mpl_connect('motion_notify_event', - self.mouse_move) - self.f.canvas.mpl_connect('button_release_event', - self.button_release) - - def button_press(self, event): - x, y = event.xdata, event.ydata - thrsh = 100 - - if(x is not None and y is not None): - nearby = map(lambda z: math.sqrt( math.pow(x-z[0],2) + math.pow(y-z[1],2)), self.pos.values()) - i = nearby.index(min(nearby)) - if(abs(self.pos.values()[i][0] - x) < thrsh and - abs(self.pos.values()[i][1]-y) < thrsh): - self._current_block = self.pos.keys()[i] - #print "MOVING BLOCK: ", self._current_block - #print "CUR POS: ", self.pos.values()[i] - self._grabbed = True - - def mouse_move(self, event): - if self._grabbed: - x, y = event.xdata, event.ydata - if(x is not None and y is not None): - #print "NEW POS: ", (x,y) - self.pos[self._current_block] = (x,y) - self.updateGraph(); - - def button_release(self, event): - self._grabbed = False - - - def openMenu(self, pos): - index = self.table.treeWidget.selectedIndexes() - item = self.table.treeWidget.itemFromIndex(index[0]) - itemname = str(item.text(0)) - self.parent.propertiesMenu(itemname, self.radio, self.uid) - - def updateGraph(self): - - self.canvas.updateGeometry() - self.sp.clear(); - plt.figure(self.f.number) - plt.subplot(111); - nx.draw(self.G, self.pos, - edge_color=self.edge_weights, - node_color='#A0CBE2', - width=map(lambda x: 3+math.log(x), self.edge_weights), - node_shape="s", - node_size=self.node_weights, - #edge_cmap=plt.cm.Blues, - edge_cmap=plt.cm.Reds, - ax=self.sp, - arrows=False - ) - nx.draw_networkx_labels(self.G, self.pos, - font_size=12) - - self.canvas.draw(); - self.canvas.show(); - -class MyClient(IceRadioClient): - def __init__(self): - IceRadioClient.__init__(self, MAINWindow) - -sys.exit(MyClient().main(sys.argv)) diff --git a/gnuradio-runtime/swig/CMakeLists.txt b/gnuradio-runtime/swig/CMakeLists.txt index 06ccc751be..ca9ddd4039 100644 --- a/gnuradio-runtime/swig/CMakeLists.txt +++ b/gnuradio-runtime/swig/CMakeLists.txt @@ -70,8 +70,6 @@ endif(ENABLE_GR_LOG) if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) list(APPEND GR_SWIG_FLAGS -DGR_CTRLPORT) - list(APPEND GR_SWIG_LIBRARIES ${ICE_LIBRARIES}) - list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/runtime_swig_doc.i) diff --git a/gr-analog/lib/CMakeLists.txt b/gr-analog/lib/CMakeLists.txt index 34a852fdb3..8376cbff55 100644 --- a/gr-analog/lib/CMakeLists.txt +++ b/gr-analog/lib/CMakeLists.txt @@ -37,7 +37,6 @@ link_directories(${Boost_LIBRARY_DIRS}) if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) - include_directories(${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) ######################################################################## diff --git a/gr-analog/lib/test_gr_analog.cc b/gr-analog/lib/test_gr_analog.cc index e621f9d395..228a99e347 100644 --- a/gr-analog/lib/test_gr_analog.cc +++ b/gr-analog/lib/test_gr_analog.cc @@ -30,6 +30,7 @@ #include <gnuradio/unittests.h> #include "qa_analog.h" #include <iostream> +#include <fstream> int main (int argc, char **argv) diff --git a/gr-analog/swig/CMakeLists.txt b/gr-analog/swig/CMakeLists.txt index 06f1cdf985..38fef3a236 100644 --- a/gr-analog/swig/CMakeLists.txt +++ b/gr-analog/swig/CMakeLists.txt @@ -34,7 +34,6 @@ set(GR_SWIG_INCLUDE_DIRS if(ENABLE_GR_CTRLPORT) list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT") - list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/analog_swig_doc.i) diff --git a/gr-atsc/lib/test_atsci.cc b/gr-atsc/lib/test_atsci.cc index acea17a7ab..edbe24f0b6 100644 --- a/gr-atsc/lib/test_atsci.cc +++ b/gr-atsc/lib/test_atsci.cc @@ -28,6 +28,7 @@ #include <cppunit/TextTestRunner.h> #include <cppunit/XmlOutputter.h> #include "qa_atsci.h" +#include <fstream> int main (int argc, char **argv) diff --git a/gr-atsc/swig/CMakeLists.txt b/gr-atsc/swig/CMakeLists.txt index 2eb7047a11..8d02a00c23 100644 --- a/gr-atsc/swig/CMakeLists.txt +++ b/gr-atsc/swig/CMakeLists.txt @@ -35,7 +35,6 @@ set(GR_SWIG_INCLUDE_DIRS if(ENABLE_GR_CTRLPORT) list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT") - list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/atsc_swig_doc.i) diff --git a/gr-audio/lib/CMakeLists.txt b/gr-audio/lib/CMakeLists.txt index 2ae7c41e56..e9e2de858e 100644 --- a/gr-audio/lib/CMakeLists.txt +++ b/gr-audio/lib/CMakeLists.txt @@ -37,7 +37,6 @@ list(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/gr-audio.conf) if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) - include_directories(${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) ######################################################################## diff --git a/gr-audio/swig/CMakeLists.txt b/gr-audio/swig/CMakeLists.txt index bc49f4ac8c..f9dabfd8c4 100644 --- a/gr-audio/swig/CMakeLists.txt +++ b/gr-audio/swig/CMakeLists.txt @@ -31,7 +31,6 @@ set(GR_SWIG_INCLUDE_DIRS if(ENABLE_GR_CTRLPORT) list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT") - list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/audio_swig_doc.i) @@ -54,4 +53,3 @@ install( DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "audio_swig" ) - diff --git a/gr-blocks/grc/CMakeLists.txt b/gr-blocks/grc/CMakeLists.txt index 9d38e3dcd8..96a715a7e4 100644 --- a/gr-blocks/grc/CMakeLists.txt +++ b/gr-blocks/grc/CMakeLists.txt @@ -23,8 +23,6 @@ file(GLOB xml_files "*.xml") # Force out the controlport GRC blocks if we've disabled it. if(NOT ENABLE_GR_CTRLPORT) list(REMOVE_ITEM xml_files - ${CMAKE_CURRENT_SOURCE_DIR}/ctrlport_viewer.xml - ${CMAKE_CURRENT_SOURCE_DIR}/blocks_ctrlport_performance.xml ${CMAKE_CURRENT_SOURCE_DIR}/ctrlport_probe_c.xml ${CMAKE_CURRENT_SOURCE_DIR}/ctrlport_probe2_c.xml ) diff --git a/gr-blocks/grc/blocks_block_tree.xml b/gr-blocks/grc/blocks_block_tree.xml index b0d7ff0687..78f615b63b 100644 --- a/gr-blocks/grc/blocks_block_tree.xml +++ b/gr-blocks/grc/blocks_block_tree.xml @@ -51,8 +51,6 @@ </cat> <cat> <name>Control Port</name> - <block>blocks_ctrlport_monitor</block> - <block>blocks_ctrlport_monitor_performance</block> <block>blocks_ctrlport_probe2_x</block> <block>blocks_ctrlport_probe2_c</block> <block>blocks_ctrlport_probe_c</block> diff --git a/gr-blocks/grc/blocks_ctrlport_performance.xml b/gr-blocks/grc/blocks_ctrlport_performance.xml deleted file mode 100644 index ae0fb91c50..0000000000 --- a/gr-blocks/grc/blocks_ctrlport_performance.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0"?> - -<!-- - Copyright 2012 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. ---> - -<block> - <name>CtrlPort Performance Monitor</name> - <key>blocks_ctrlport_monitor_performance</key> - <import>from gnuradio.ctrlport.monitor import *</import> - <make>not $en or monitor("gr-perf-monitorx")</make> - <param> - <name>Enabled</name> - <key>en</key> - <value></value> - <type>enum</type> - <option> - <name>True</name> - <key>True</key> - </option> - <option> - <name>False</name> - <key>False</key> - </option> - </param> - - <doc> - Place this in a graph to launch a QtPy GR CtrlPort Performance Monitor app. - </doc> - -</block> - diff --git a/gr-blocks/grc/blocks_ctrlport_viewer.xml b/gr-blocks/grc/blocks_ctrlport_viewer.xml deleted file mode 100644 index 2b69ae05ad..0000000000 --- a/gr-blocks/grc/blocks_ctrlport_viewer.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0"?> - -<!-- - Copyright 2012 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. ---> - -<block> - <name>CtrlPort Monitor</name> - <key>blocks_ctrlport_monitor</key> - <import>from gnuradio.ctrlport.monitor import *</import> - <make>not $en or monitor()</make> - <param> - <name>Enabled</name> - <key>en</key> - <value></value> - <type>enum</type> - <option> - <name>True</name> - <key>True</key> - </option> - <option> - <name>False</name> - <key>False</key> - </option> - </param> - - <doc> - Place this in a graph to launch a QtPy GR CtrlPort Monitor app. - </doc> - -</block> - diff --git a/gr-blocks/include/gnuradio/blocks/delay.h b/gr-blocks/include/gnuradio/blocks/delay.h index fc90e22493..381669b7ed 100644 --- a/gr-blocks/include/gnuradio/blocks/delay.h +++ b/gr-blocks/include/gnuradio/blocks/delay.h @@ -35,6 +35,11 @@ namespace gr { * * Positive delays insert zero items at the beginning of the stream. * Negative delays discard items from the stream. + * + * You cannot initialize this block with a negative delay, + * however. That leads to a causality issue with the buffers when + * they are initialized. If you need to negetively delay one path, + * then put the positive delay on the other path instead. */ class BLOCKS_API delay : virtual public block { @@ -45,11 +50,17 @@ namespace gr { /*! * \brief Make a delay block. * \param itemsize size of the data items. - * \param delay number of samples to delay stream. + * \param delay number of samples to delay stream (>= 0). */ static sptr make(size_t itemsize, int delay); virtual int dly() const = 0; + + /*! + * \brief Reset the delay. + * \param d change the delay value. This can be a positive or + * negative value. + */ virtual void set_dly(int d) = 0; }; @@ -57,4 +68,3 @@ namespace gr { } /* namespace gr */ #endif /* INCLUDED_BLOCKS_DELAY_H */ - diff --git a/gr-blocks/lib/CMakeLists.txt b/gr-blocks/lib/CMakeLists.txt index 7702e4bf1d..d1fad2eefb 100644 --- a/gr-blocks/lib/CMakeLists.txt +++ b/gr-blocks/lib/CMakeLists.txt @@ -137,7 +137,6 @@ link_directories(${Boost_LIBRARY_DIRS}) if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) - include_directories(${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) ######################################################################## diff --git a/gr-blocks/lib/delay_impl.cc b/gr-blocks/lib/delay_impl.cc index 7ae4037780..0ebe124b09 100644 --- a/gr-blocks/lib/delay_impl.cc +++ b/gr-blocks/lib/delay_impl.cc @@ -44,6 +44,9 @@ namespace gr { io_signature::make(1, -1, itemsize)), d_itemsize(itemsize) { + if(delay < 0) { + throw std::runtime_error("delay: Cannot initialize block with a delay < 0."); + } set_dly(delay); d_delta = 0; } diff --git a/gr-blocks/lib/file_meta_sink_impl.cc b/gr-blocks/lib/file_meta_sink_impl.cc index 06ac051d8c..027d12faf2 100644 --- a/gr-blocks/lib/file_meta_sink_impl.cc +++ b/gr-blocks/lib/file_meta_sink_impl.cc @@ -171,7 +171,7 @@ namespace gr { bool file_meta_sink_impl::_open(FILE **fp, const char *filename) { - gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of this function + gr::thread::scoped_lock guard(d_setlock); // hold mutex for duration of this function bool ret = true; int fd; @@ -201,7 +201,7 @@ namespace gr { void file_meta_sink_impl::close() { - gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of this function + gr::thread::scoped_lock guard(d_setlock); // hold mutex for duration of this function update_last_header(); if(d_state == STATE_DETACHED) { @@ -222,7 +222,7 @@ namespace gr { file_meta_sink_impl::do_update() { if(d_updated) { - gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of this block + gr::thread::scoped_lock guard(d_setlock); // hold mutex for duration of this block if(d_state == STATE_DETACHED) { if(d_hdr_fp) fclose(d_hdr_fp); diff --git a/gr-blocks/lib/file_meta_sink_impl.h b/gr-blocks/lib/file_meta_sink_impl.h index e454341f62..5e678729b2 100644 --- a/gr-blocks/lib/file_meta_sink_impl.h +++ b/gr-blocks/lib/file_meta_sink_impl.h @@ -25,7 +25,6 @@ #include <gnuradio/blocks/file_meta_sink.h> #include <pmt/pmt.h> -#include <gnuradio/thread/thread.h> using namespace pmt; @@ -51,7 +50,6 @@ namespace gr { bool d_updated; bool d_unbuffered; - boost::mutex d_mutex; FILE *d_new_fp, *d_new_hdr_fp; FILE *d_fp, *d_hdr_fp; meta_state_t d_state; diff --git a/gr-blocks/lib/file_meta_source_impl.cc b/gr-blocks/lib/file_meta_source_impl.cc index 58be9ece7e..5686945700 100644 --- a/gr-blocks/lib/file_meta_source_impl.cc +++ b/gr-blocks/lib/file_meta_source_impl.cc @@ -297,7 +297,7 @@ namespace gr { bool file_meta_source_impl::_open(FILE **fp, const char *filename) { - gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of this function + gr::thread::scoped_lock guard(d_setlock); // hold mutex for duration of this function bool ret = true; int fd; @@ -326,7 +326,7 @@ namespace gr { void file_meta_source_impl::close() { - gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of this function + gr::thread::scoped_lock guard(d_setlock); // hold mutex for duration of this function if(d_state == STATE_DETACHED) { if(d_new_hdr_fp) { fclose(d_new_hdr_fp); @@ -345,7 +345,7 @@ namespace gr { file_meta_source_impl::do_update() { if(d_updated) { - gr::thread::scoped_lock guard(d_mutex); // hold mutex for duration of this block + gr::thread::scoped_lock guard(d_setlock); // hold mutex for duration of this block if(d_state == STATE_DETACHED) { if(d_hdr_fp) fclose(d_hdr_fp); @@ -403,7 +403,7 @@ namespace gr { d_tags.pop_back(); } - gr::thread::scoped_lock lock(d_mutex); // hold for the rest of this function + gr::thread::scoped_lock lock(d_setlock); // hold for the rest of this function while(size) { i = fread(out, d_itemsize, size, d_fp); diff --git a/gr-blocks/lib/file_meta_source_impl.h b/gr-blocks/lib/file_meta_source_impl.h index 00d8d7e86f..bd7d3c1209 100644 --- a/gr-blocks/lib/file_meta_source_impl.h +++ b/gr-blocks/lib/file_meta_source_impl.h @@ -50,7 +50,6 @@ namespace gr { bool d_updated; bool d_repeat; - gr::thread::mutex d_mutex; FILE *d_new_fp, *d_new_hdr_fp; FILE *d_fp, *d_hdr_fp; meta_state_t d_state; diff --git a/gr-blocks/lib/test_gr_blocks.cc b/gr-blocks/lib/test_gr_blocks.cc index 2d8f0d6d2a..bc3901dac3 100644 --- a/gr-blocks/lib/test_gr_blocks.cc +++ b/gr-blocks/lib/test_gr_blocks.cc @@ -30,6 +30,7 @@ #include <gnuradio/unittests.h> #include <qa_blocks.h> #include <iostream> +#include <fstream> int main(int argc, char **argv) diff --git a/gr-blocks/python/blocks/qa_cpp_py_binding.py b/gr-blocks/python/blocks/qa_cpp_py_binding.py deleted file mode 100755 index 35e073d584..0000000000 --- a/gr-blocks/python/blocks/qa_cpp_py_binding.py +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -# -# This program tests mixed python and c++ ctrlport exports in a single app -# - -import Ice -import sys, time, random, numpy -from gnuradio import gr, gr_unittest, blocks - -from gnuradio.ctrlport import GNURadio -from gnuradio import ctrlport -import os - -def get1(): - return "success" - -def get2(): - return "failure" - -class inc_class: - def __init__(self): - self.val = 1 - def pp(self): - self.val = self.val+1 - return self.val - -get3 = inc_class() - -def get4(): - random.seed(0) - rv = random.random() - return rv - -def get5(): - numpy.random.seed(0) - samp_t = numpy.random.randn(24)+1j*numpy.random.randn(24); - samp_f = numpy.fft.fft(samp_t); - log_pow_f = 20*numpy.log10(numpy.abs(samp_f)) - rv = list(log_pow_f) - return rv; - -def get6(): - numpy.random.seed(0) - samp_t = numpy.random.randn(1024)+1j*numpy.random.randn(1024); - rv = list(samp_t) - return rv; - -class test_cpp_py_binding(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block() - os.environ['GR_CONF_CONTROLPORT_ON'] = 'True' - - def tearDown(self): - self.tb = None - - def test_001(self): - v1 = gr.RPC_get_string("pyland", "v1", "unit_1_string", - "Python Exported String", "", "", "", - gr.DISPNULL) - v1.activate(get1) - - v2 = gr.RPC_get_string("pyland", "v2", "unit_2_string", - "Python Exported String", "", "", "", - gr.DISPNULL) - v2.activate(get2) - - v3 = gr.RPC_get_int("pyland", "v3", "unit_3_int", - "Python Exported Int", 0, 100, 1, - gr.DISPNULL) - v3.activate(get3.pp) - - v4 = gr.RPC_get_double("pyland", "time", "unit_4_time_double", - "Python Exported Double", 0, 1000, 1, - gr.DISPNULL) - v4.activate(get4) - - v5 = gr.RPC_get_vector_float("pyland", "fvec", "unit_5_float_vector", - "Python Exported Float Vector", [], [], [], - gr.DISPTIME | gr.DISPOPTCPLX) - v5.activate(get5) - - v6 = gr.RPC_get_vector_gr_complex("pyland", "cvec", "unit_6_gr_complex_vector", - "Python Exported Complex Vector", [], [], [], - gr.DISPXY | gr.DISPOPTSCATTER) - v6.activate(get6) - - # print some variables locally - val = get1() - rval = v1.get() - self.assertEqual(val, rval) - - val = get2() - rval = v2.get() - self.assertEqual(val, rval) - - val = get3.pp() - rval = v3.get() - self.assertEqual(val+1, rval) - - val = get4() - rval = v4.get() - self.assertEqual(val, rval) - - val = get5() - rval = v5.get() - self.assertComplexTuplesAlmostEqual(val, rval, 5) - - val = get6() - rval = v6.get() - self.assertComplexTuplesAlmostEqual(val, rval, 5) - - def test_002(self): - data = range(1,9) - - self.src = blocks.vector_source_c(data) - self.p1 = blocks.ctrlport_probe_c("aaa","C++ exported variable") - self.p2 = blocks.ctrlport_probe_c("bbb","C++ exported variable") - probe_name = self.p2.alias() - - self.tb.connect(self.src, self.p1) - self.tb.connect(self.src, self.p2) - self.tb.start() - - # Probes return complex values as list of floats with re, im - # Imaginary parts of this data set are 0. - expected_result = [1, 0, 2, 0, 3, 0, 4, 0, - 5, 0, 6, 0, 7, 0, 8, 0] - - # Make sure we have time for flowgraph to run - time.sleep(0.1) - - # Get available endpoint - ep = gr.rpcmanager_get().endpoints()[0] - - # Initialize a simple Ice client from endpoint - ic = Ice.initialize(sys.argv) - base = ic.stringToProxy(ep) - radio = GNURadio.ControlPortPrx.checkedCast(base) - - # Get all exported knobs - ret = radio.get([probe_name + "::bbb"]) - for name in ret.keys(): - result = ret[name].value - self.assertEqual(result, expected_result) - - self.tb.stop() - -if __name__ == '__main__': - gr_unittest.run(test_cpp_py_binding, "test_cpp_py_binding.xml") - diff --git a/gr-blocks/python/blocks/qa_cpp_py_binding_set.py b/gr-blocks/python/blocks/qa_cpp_py_binding_set.py deleted file mode 100755 index 69ed6d1d2b..0000000000 --- a/gr-blocks/python/blocks/qa_cpp_py_binding_set.py +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/env python -# -# 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. -# - -# -# This program tests mixed python and c++ GRCP sets in a single app -# - -import Ice -import sys, time, random, numpy -from gnuradio import gr, gr_unittest, blocks - -from gnuradio.ctrlport import GNURadio -from gnuradio import ctrlport -import os - -class inc_class: - def __init__(self,val): - self.val = val; - - def _get(self): - #print "returning get (val = %s)"%(str(self.val)); - return self.val; - - def _set(self,val): - #print "updating val to %s"%(str(val)); - self.val = val; - return; - -getset1 = inc_class(10); -getset2 = inc_class(100.0); -getset3 = inc_class("test"); - -class test_cpp_py_binding_set(gr_unittest.TestCase): - def setUp(self): - self.tb = gr.top_block() - os.environ['GR_CONF_CONTROLPORT_ON'] = 'True' - - def tearDown(self): - self.tb = None - - def test_001(self): - - g1 = gr.RPC_get_int("pyland", "v1", "unit_1_int", - "Python Exported Int", 0, 100, 10, - gr.DISPNULL) - g1.activate(getset1._get) - s1 = gr.RPC_get_int("pyland", "v1", "unit_1_int", - "Python Exported Int", 0, 100, 10, - gr.DISPNULL) - s1.activate(getset1._set) - time.sleep(0.01) - - # test int variables - getset1._set(21) - val = getset1._get() - rval = g1.get() - self.assertEqual(val, rval) - - g2 = gr.RPC_get_float("pyland", "v2", "unit_2_float", - "Python Exported Float", -100, 1000.0, 100.0, - gr.DISPNULL) - g2.activate(getset2._get) - s2 = gr.RPC_get_float("pyland", "v2", "unit_2_float", - "Python Exported Float", -100, 1000.0, 100.0, - gr.DISPNULL) - s2.activate(getset2._set) - time.sleep(0.01) - - # test float variables - getset2._set(123.456) - val = getset2._get() - rval = g2.get() - self.assertAlmostEqual(val, rval, 4) - - g3 = gr.RPC_get_string("pyland", "v3", "unit_3_string", - "Python Exported String", "", "", "", - gr.DISPNULL) - g3.activate(getset3._get) - s3 = gr.RPC_get_string("pyland", "v3", "unit_3_string", - "Python Exported String", "", "", "", - gr.DISPNULL) - s3.activate(getset3._set) - time.sleep(0.01) - - # test string variables - getset3._set("third test") - val = getset3._get() - rval = g3.get() - self.assertEqual(val, rval) - - - def test_002(self): - data = range(1, 10) - - self.src = blocks.vector_source_c(data, True) - self.p = blocks.nop(gr.sizeof_gr_complex) - self.p.set_ctrlport_test(0); - probe_info = self.p.alias() - - self.tb.connect(self.src, self.p) - - # Get available endpoint - ep = gr.rpcmanager_get().endpoints()[0] - - # Initialize a simple Ice client from endpoint - ic = Ice.initialize(sys.argv) - base = ic.stringToProxy(ep) - radio = GNURadio.ControlPortPrx.checkedCast(base) - - self.tb.start() - - # Make sure we have time for flowgraph to run - time.sleep(0.1) - - # Get all exported knobs - key_name_test = probe_info+"::test" - ret = radio.get([key_name_test,]) - - ret[key_name_test].value = 10 - radio.set({key_name_test: ret[key_name_test]}) - - ret = radio.get([]) - result_test = ret[key_name_test].value - self.assertEqual(result_test, 10) - - self.tb.stop() - self.tb.wait() - -if __name__ == '__main__': - gr_unittest.run(test_cpp_py_binding_set, "test_cpp_py_binding_set.xml") - diff --git a/gr-blocks/python/blocks/qa_ctrlport_probes.py b/gr-blocks/python/blocks/qa_ctrlport_probes.py index b31934f705..91d96010fd 100644 --- a/gr-blocks/python/blocks/qa_ctrlport_probes.py +++ b/gr-blocks/python/blocks/qa_ctrlport_probes.py @@ -20,12 +20,9 @@ # Boston, MA 02110-1301, USA. # -import Ice import sys, time, random, numpy from gnuradio import gr, gr_unittest, blocks -from gnuradio.ctrlport import GNURadio -from gnuradio import ctrlport import os, struct class test_ctrlport_probes(gr_unittest.TestCase): @@ -37,193 +34,21 @@ class test_ctrlport_probes(gr_unittest.TestCase): def tearDown(self): self.tb = None - def test_001(self): - data = range(1,9) - - self.src = blocks.vector_source_c(data, True) - self.probe = blocks.ctrlport_probe2_c("samples","Complex", - len(data), gr.DISPNULL) - probe_name = self.probe.alias() - - self.tb.connect(self.src, self.probe) - self.tb.start() - - # Probes return complex values as list of floats with re, im - # Imaginary parts of this data set are 0. - expected_result = [1, 0, 2, 0, 3, 0, 4, 0, - 5, 0, 6, 0, 7, 0, 8, 0] - - # Make sure we have time for flowgraph to run - time.sleep(0.1) - - # Get available endpoint - ep = gr.rpcmanager_get().endpoints()[0] - - # Initialize a simple Ice client from endpoint - ic = Ice.initialize(sys.argv) - base = ic.stringToProxy(ep) - radio = GNURadio.ControlPortPrx.checkedCast(base) - - # Get all exported knobs - ret = radio.get([probe_name + "::samples"]) - for name in ret.keys(): - # Get data in probe, which might be offset; find the - # beginning and unwrap. - result = ret[name].value - i = result.index(1.0) - result = result[i:] + result[0:i] - self.assertEqual(expected_result, result) - - self.tb.stop() - + def xtest_001(self): + pass def test_002(self): - data = range(1,9) - - self.src = blocks.vector_source_f(data, True) - self.probe = blocks.ctrlport_probe2_f("samples","Floats", - len(data), gr.DISPNULL) - probe_name = self.probe.alias() - - self.tb.connect(self.src, self.probe) - self.tb.start() - - expected_result = [1, 2, 3, 4, 5, 6, 7, 8,] - - # Make sure we have time for flowgraph to run - time.sleep(0.1) - - # Get available endpoint - ep = gr.rpcmanager_get().endpoints()[0] - - # Initialize a simple Ice client from endpoint - ic = Ice.initialize(sys.argv) - base = ic.stringToProxy(ep) - radio = GNURadio.ControlPortPrx.checkedCast(base) - - # Get all exported knobs - ret = radio.get([probe_name + "::samples"]) - for name in ret.keys(): - # Get data in probe, which might be offset; find the - # beginning and unwrap. - result = ret[name].value - i = result.index(1.0) - result = result[i:] + result[0:i] - self.assertEqual(expected_result, result) - - self.tb.stop() + pass def test_003(self): - data = range(1,9) - - self.src = blocks.vector_source_i(data, True) - self.probe = blocks.ctrlport_probe2_i("samples","Integers", - len(data), gr.DISPNULL) - probe_name = self.probe.alias() - - self.tb.connect(self.src, self.probe) - self.tb.start() - - expected_result = [1, 2, 3, 4, 5, 6, 7, 8,] - - # Make sure we have time for flowgraph to run - time.sleep(0.1) - - # Get available endpoint - ep = gr.rpcmanager_get().endpoints()[0] - - # Initialize a simple Ice client from endpoint - ic = Ice.initialize(sys.argv) - base = ic.stringToProxy(ep) - radio = GNURadio.ControlPortPrx.checkedCast(base) - - # Get all exported knobs - ret = radio.get([probe_name + "::samples"]) - for name in ret.keys(): - # Get data in probe, which might be offset; find the - # beginning and unwrap. - result = ret[name].value - i = result.index(1.0) - result = result[i:] + result[0:i] - self.assertEqual(expected_result, result) - - self.tb.stop() - + pass def test_004(self): - data = range(1,9) - - self.src = blocks.vector_source_s(data, True) - self.probe = blocks.ctrlport_probe2_s("samples","Shorts", - len(data), gr.DISPNULL) - probe_name = self.probe.alias() - - self.tb.connect(self.src, self.probe) - self.tb.start() - - expected_result = [1, 2, 3, 4, 5, 6, 7, 8,] - - # Make sure we have time for flowgraph to run - time.sleep(0.1) - - # Get available endpoint - ep = gr.rpcmanager_get().endpoints()[0] - - # Initialize a simple Ice client from endpoint - ic = Ice.initialize(sys.argv) - base = ic.stringToProxy(ep) - radio = GNURadio.ControlPortPrx.checkedCast(base) - - # Get all exported knobs - ret = radio.get([probe_name + "::samples"]) - for name in ret.keys(): - # Get data in probe, which might be offset; find the - # beginning and unwrap. - result = ret[name].value - i = result.index(1.0) - result = result[i:] + result[0:i] - self.assertEqual(expected_result, result) - - self.tb.stop() + pass def test_005(self): - data = range(1,9) - - self.src = blocks.vector_source_b(data, True) - self.probe = blocks.ctrlport_probe2_b("samples","Bytes", - len(data), gr.DISPNULL) - probe_name = self.probe.alias() - - self.tb.connect(self.src, self.probe) - self.tb.start() - - expected_result = [1, 2, 3, 4, 5, 6, 7, 8,] - - # Make sure we have time for flowgraph to run - time.sleep(0.1) - - # Get available endpoint - ep = gr.rpcmanager_get().endpoints()[0] - - # Initialize a simple Ice client from endpoint - ic = Ice.initialize(sys.argv) - base = ic.stringToProxy(ep) - radio = GNURadio.ControlPortPrx.checkedCast(base) - - # Get all exported knobs - ret = radio.get([probe_name + "::samples"]) - for name in ret.keys(): - # Get data in probe, which might be offset; find the - # beginning and unwrap. - result = ret[name].value - result = list(struct.unpack(len(result)*'b', result)) - i = result.index(1) - result = result[i:] + result[0:i] - self.assertEqual(expected_result, result) - - self.tb.stop() + pass if __name__ == '__main__': gr_unittest.run(test_ctrlport_probes, "test_ctrlport_probes.xml") - diff --git a/gr-blocks/swig/CMakeLists.txt b/gr-blocks/swig/CMakeLists.txt index f4c428c878..c128a9b26c 100644 --- a/gr-blocks/swig/CMakeLists.txt +++ b/gr-blocks/swig/CMakeLists.txt @@ -32,7 +32,6 @@ set(GR_SWIG_INCLUDE_DIRS if(ENABLE_GR_CTRLPORT) list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT") - list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) configure_file( diff --git a/gr-channels/lib/CMakeLists.txt b/gr-channels/lib/CMakeLists.txt index c74e3386df..390eb63ee1 100644 --- a/gr-channels/lib/CMakeLists.txt +++ b/gr-channels/lib/CMakeLists.txt @@ -35,7 +35,6 @@ link_directories(${Boost_LIBRARY_DIRS}) if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) - include_directories(${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) ######################################################################## diff --git a/gr-channels/swig/CMakeLists.txt b/gr-channels/swig/CMakeLists.txt index 5f5091f342..3a85626e98 100644 --- a/gr-channels/swig/CMakeLists.txt +++ b/gr-channels/swig/CMakeLists.txt @@ -32,7 +32,6 @@ set(GR_SWIG_INCLUDE_DIRS if(ENABLE_GR_CTRLPORT) list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT") - list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/channels_swig_doc.i) diff --git a/gr-comedi/lib/CMakeLists.txt b/gr-comedi/lib/CMakeLists.txt index 206ddb3e55..efd1bf76c3 100644 --- a/gr-comedi/lib/CMakeLists.txt +++ b/gr-comedi/lib/CMakeLists.txt @@ -36,7 +36,6 @@ link_directories( if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) - include_directories(${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) ######################################################################## diff --git a/gr-comedi/swig/CMakeLists.txt b/gr-comedi/swig/CMakeLists.txt index 0c275cc48e..b31e4e87eb 100644 --- a/gr-comedi/swig/CMakeLists.txt +++ b/gr-comedi/swig/CMakeLists.txt @@ -31,7 +31,6 @@ set(GR_SWIG_INCLUDE_DIRS if(ENABLE_GR_CTRLPORT) list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT") - list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) # Setup swig docs to depend on includes and pull in from build directory diff --git a/gr-digital/grc/digital_block_tree.xml b/gr-digital/grc/digital_block_tree.xml index c77876f16e..f6dcceb6d0 100644 --- a/gr-digital/grc/digital_block_tree.xml +++ b/gr-digital/grc/digital_block_tree.xml @@ -85,7 +85,6 @@ <cat> <name>OFDM</name> <block>digital_ofdm_mod</block> - <block>digital_ofdm_mod2</block> <block>digital_ofdm_demod</block> <block>digital_ofdm_carrier_allocator_cvc</block> <block>digital_ofdm_chanest_vcvc</block> diff --git a/gr-digital/grc/digital_ofdm_mod2.xml b/gr-digital/grc/digital_ofdm_mod2.xml deleted file mode 100644 index f2f69cd5d6..0000000000 --- a/gr-digital/grc/digital_ofdm_mod2.xml +++ /dev/null @@ -1,64 +0,0 @@ -<block> - <name>OFDM Mod 2</name> - <key>digital_ofdm_mod2</key> - <import>from gnuradio import digital</import> - <make>digital.ofdm_mod2(fft_len=$fft_len, - cp_len=$cp_len, - length_tag_name=$length_tag_name, - occupied_carriers=$occupied_carriers, - pilot_carriers=$pilot_carriers, - pilot_symbols=$pilot_symbols, - sync_sequence=$sync_sequence, - ) - </make> - <param> - <name>Cyclic Prefix Length</name> - <key>cp_len</key> - <value>16</value> - <type>int</type> - </param> - <param> - <name>FFT Length</name> - <key>fft_len</key> - <value>64</value> - <type>int</type> - </param> - <param> - <name>Length Tag Name</name> - <key>length_tag_name</key> - <value>length</value> - <type>string</type> - </param> - <param> - <name>Occupied Carriers</name> - <key>occupied_carriers</key> - <value>(range(1, 27) + range(38, 64),)</value> - <type>raw</type> - </param> - <param> - <name>Pilot Carriers</name> - <key>pilot_carriers</key> - <value>((0,),)</value> - <type>raw</type> - </param> - <param> - <name>Pilot Symbols</name> - <key>pilot_symbols</key> - <value>((100,),)</value> - <type>raw</type> - </param> - <param> - <name>Synchronization Sequence</name> - <key>sync_sequence</key> - <value>None</value> - <type>raw</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/gr-digital/lib/CMakeLists.txt b/gr-digital/lib/CMakeLists.txt index 4ba821a307..2c03f6d686 100644 --- a/gr-digital/lib/CMakeLists.txt +++ b/gr-digital/lib/CMakeLists.txt @@ -38,7 +38,6 @@ link_directories(${LOG4CPP_LIBRARY_DIRS}) if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) - include_directories(${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) ######################################################################## @@ -176,7 +175,6 @@ list(APPEND digital_sources scrambler_bb_impl.cc simple_correlator_impl.cc simple_framer_impl.cc - header_payload_demux_impl.cc ) #Add Windows DLL resource file if using MSVC diff --git a/gr-digital/lib/hdlc_deframer_bp_impl.cc b/gr-digital/lib/hdlc_deframer_bp_impl.cc index 0723ad473e..976d14784d 100644 --- a/gr-digital/lib/hdlc_deframer_bp_impl.cc +++ b/gr-digital/lib/hdlc_deframer_bp_impl.cc @@ -56,7 +56,6 @@ namespace gr { d_bitctr=0; d_ones=0; d_pktbuf = new unsigned char[length_max+2]; - d_in_frame=false; } /* @@ -106,28 +105,23 @@ namespace gr { } else { } - d_in_frame=false; } else { - d_in_frame=true; } d_bitctr=0; d_bytectr=0; } else { //unstuff } } else { //not 5+ continuous ones - if(d_in_frame) { - if(d_bytectr > d_length_max) { - d_bytectr=0; + if(d_bytectr > d_length_max) { + d_bytectr=0; + d_bitctr=0; + } else { + d_pktbuf[d_bytectr]>>=1; + if (bit) d_pktbuf[d_bytectr] |= 0x80; + d_bitctr++; + if (d_bitctr==8) { d_bitctr=0; - d_in_frame=false; - } else { - d_pktbuf[d_bytectr]>>=1; - if (bit) d_pktbuf[d_bytectr] |= 0x80; - d_bitctr++; - if (d_bitctr==8) { - d_bitctr=0; - d_bytectr++; - } + d_bytectr++; } } } diff --git a/gr-digital/lib/hdlc_deframer_bp_impl.h b/gr-digital/lib/hdlc_deframer_bp_impl.h index f7c4253b3d..d29d9fcc3e 100644 --- a/gr-digital/lib/hdlc_deframer_bp_impl.h +++ b/gr-digital/lib/hdlc_deframer_bp_impl.h @@ -36,7 +36,6 @@ namespace gr { size_t d_ones; size_t d_bytectr; size_t d_bitctr; - bool d_in_frame; unsigned char *d_pktbuf; unsigned int crc_ccitt(unsigned char *data, size_t len); diff --git a/gr-digital/swig/CMakeLists.txt b/gr-digital/swig/CMakeLists.txt index 3797c655f2..d87b7e9f7b 100644 --- a/gr-digital/swig/CMakeLists.txt +++ b/gr-digital/swig/CMakeLists.txt @@ -35,7 +35,6 @@ set(GR_SWIG_INCLUDE_DIRS if(ENABLE_GR_CTRLPORT) list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT") - list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) # Setup swig docs to depend on includes and pull in from build directory diff --git a/gr-fcd/lib/CMakeLists.txt b/gr-fcd/lib/CMakeLists.txt index 9364c3d718..cc896792a1 100644 --- a/gr-fcd/lib/CMakeLists.txt +++ b/gr-fcd/lib/CMakeLists.txt @@ -41,7 +41,6 @@ link_directories( if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) - include_directories(${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) include_directories(${LOG4CPP_INCLUDE_DIRS}) diff --git a/gr-fcd/swig/CMakeLists.txt b/gr-fcd/swig/CMakeLists.txt index 48fce658fd..b91cf92272 100644 --- a/gr-fcd/swig/CMakeLists.txt +++ b/gr-fcd/swig/CMakeLists.txt @@ -35,7 +35,6 @@ set(GR_SWIG_INCLUDE_DIRS if(ENABLE_GR_CTRLPORT) list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT") - list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/fcd_swig_doc.i) diff --git a/gr-fec/lib/CMakeLists.txt b/gr-fec/lib/CMakeLists.txt index 8af27db334..40b829987f 100644 --- a/gr-fec/lib/CMakeLists.txt +++ b/gr-fec/lib/CMakeLists.txt @@ -38,7 +38,6 @@ include_directories( if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) - include_directories(${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) link_directories( diff --git a/gr-fec/swig/CMakeLists.txt b/gr-fec/swig/CMakeLists.txt index d1dc556c8a..fdc5f2f723 100644 --- a/gr-fec/swig/CMakeLists.txt +++ b/gr-fec/swig/CMakeLists.txt @@ -32,7 +32,6 @@ set(GR_SWIG_INCLUDE_DIRS if(ENABLE_GR_CTRLPORT) list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT") - list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/fec_swig_doc.i) diff --git a/gr-fft/lib/CMakeLists.txt b/gr-fft/lib/CMakeLists.txt index 51fecbe677..c1c58f36fd 100644 --- a/gr-fft/lib/CMakeLists.txt +++ b/gr-fft/lib/CMakeLists.txt @@ -34,7 +34,6 @@ link_directories(${FFTW3F_LIBRARY_DIRS}) if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) - include_directories(${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) ######################################################################## diff --git a/gr-fft/swig/CMakeLists.txt b/gr-fft/swig/CMakeLists.txt index 476e343da7..74a4a25b10 100644 --- a/gr-fft/swig/CMakeLists.txt +++ b/gr-fft/swig/CMakeLists.txt @@ -32,7 +32,6 @@ set(GR_SWIG_INCLUDE_DIRS if(ENABLE_GR_CTRLPORT) list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT") - list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/fft_swig_doc.i) diff --git a/gr-filter/lib/CMakeLists.txt b/gr-filter/lib/CMakeLists.txt index 17867f8879..5f1dd56a5c 100644 --- a/gr-filter/lib/CMakeLists.txt +++ b/gr-filter/lib/CMakeLists.txt @@ -108,7 +108,6 @@ link_directories( if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) - include_directories(${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) ######################################################################## diff --git a/gr-filter/lib/test_gr_filter.cc b/gr-filter/lib/test_gr_filter.cc index b713aafaf7..f43b781490 100644 --- a/gr-filter/lib/test_gr_filter.cc +++ b/gr-filter/lib/test_gr_filter.cc @@ -30,6 +30,7 @@ #include <gnuradio/unittests.h> #include <qa_filter.h> #include <iostream> +#include <fstream> int main (int argc, char **argv) diff --git a/gr-filter/swig/CMakeLists.txt b/gr-filter/swig/CMakeLists.txt index a35d816d03..b7bf203d16 100644 --- a/gr-filter/swig/CMakeLists.txt +++ b/gr-filter/swig/CMakeLists.txt @@ -33,7 +33,6 @@ set(GR_SWIG_INCLUDE_DIRS if(ENABLE_GR_CTRLPORT) list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT") - list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) # FIXME: rename to filter_swig_doc.i when gnuradio-runtime is updated diff --git a/gr-noaa/lib/CMakeLists.txt b/gr-noaa/lib/CMakeLists.txt index 49310ecb50..ef75789d79 100644 --- a/gr-noaa/lib/CMakeLists.txt +++ b/gr-noaa/lib/CMakeLists.txt @@ -32,7 +32,6 @@ link_directories(${LOG4CPP_LIBRARY_DIRS}) if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) - include_directories(${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) ######################################################################## diff --git a/gr-noaa/swig/CMakeLists.txt b/gr-noaa/swig/CMakeLists.txt index 3a6db36103..8d39b678f8 100644 --- a/gr-noaa/swig/CMakeLists.txt +++ b/gr-noaa/swig/CMakeLists.txt @@ -31,7 +31,6 @@ set(GR_SWIG_INCLUDE_DIRS if(ENABLE_GR_CTRLPORT) list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT") - list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/noaa_swig_doc.i) diff --git a/gr-pager/lib/CMakeLists.txt b/gr-pager/lib/CMakeLists.txt index 7fae2c9892..f59d770be7 100644 --- a/gr-pager/lib/CMakeLists.txt +++ b/gr-pager/lib/CMakeLists.txt @@ -29,7 +29,6 @@ include_directories( if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) - include_directories(${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) link_directories(${Boost_LIBRARY_DIRS}) diff --git a/gr-pager/swig/CMakeLists.txt b/gr-pager/swig/CMakeLists.txt index b63c45c15d..fc71394823 100644 --- a/gr-pager/swig/CMakeLists.txt +++ b/gr-pager/swig/CMakeLists.txt @@ -31,7 +31,6 @@ set(GR_SWIG_INCLUDE_DIRS if(ENABLE_GR_CTRLPORT) list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT") - list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/pager_swig_doc.i) diff --git a/gr-qtgui/lib/CMakeLists.txt b/gr-qtgui/lib/CMakeLists.txt index 2dc73a9abb..22f7bda973 100644 --- a/gr-qtgui/lib/CMakeLists.txt +++ b/gr-qtgui/lib/CMakeLists.txt @@ -134,7 +134,6 @@ include_directories(${PYTHON_INCLUDE_PATH}) #deprecated for dirs (cmake 2.6) if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) - include_directories(${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) ######################################################################## diff --git a/gr-qtgui/lib/ber_sink_b_impl.h b/gr-qtgui/lib/ber_sink_b_impl.h index 9ab61e6652..5ae637699e 100644 --- a/gr-qtgui/lib/ber_sink_b_impl.h +++ b/gr-qtgui/lib/ber_sink_b_impl.h @@ -25,7 +25,6 @@ #include <gnuradio/qtgui/ber_sink_b.h> #include <gnuradio/high_res_timer.h> -#include <gnuradio/thread/thread.h> #include <gnuradio/qtgui/constellationdisplayform.h> namespace gr { @@ -36,8 +35,6 @@ namespace gr { private: void initialize(); - gr::thread::mutex d_mutex; - std::vector<double*> d_esno_buffers; std::vector<double*> d_ber_buffers; diff --git a/gr-qtgui/lib/const_sink_c_impl.cc b/gr-qtgui/lib/const_sink_c_impl.cc index 93986d84c7..a1e1d096d6 100644 --- a/gr-qtgui/lib/const_sink_c_impl.cc +++ b/gr-qtgui/lib/const_sink_c_impl.cc @@ -115,8 +115,10 @@ namespace gr { d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } @@ -236,7 +238,7 @@ namespace gr { int channel, const std::string &tag_key) { - gr::thread::scoped_lock lock(d_mutex); + gr::thread::scoped_lock lock(d_setlock); d_trigger_mode = mode; d_trigger_slope = slope; @@ -306,7 +308,7 @@ namespace gr { void const_sink_c_impl::set_nsamps(const int newsize) { - gr::thread::scoped_lock lock(d_mutex); + gr::thread::scoped_lock lock(d_setlock); if(newsize != d_size) { // Set new size and reset buffer index @@ -329,6 +331,7 @@ namespace gr { } d_main_gui->setNPoints(d_size); + _reset(); } } @@ -353,7 +356,7 @@ namespace gr { void const_sink_c_impl::reset() { - gr::thread::scoped_lock lock(d_mutex); + gr::thread::scoped_lock lock(d_setlock); _reset(); } diff --git a/gr-qtgui/lib/const_sink_c_impl.h b/gr-qtgui/lib/const_sink_c_impl.h index 0f1540de7e..e28ac3fded 100644 --- a/gr-qtgui/lib/const_sink_c_impl.h +++ b/gr-qtgui/lib/const_sink_c_impl.h @@ -25,7 +25,6 @@ #include <gnuradio/qtgui/const_sink_c.h> #include <gnuradio/high_res_timer.h> -#include <gnuradio/thread/thread.h> #include <gnuradio/qtgui/constellationdisplayform.h> namespace gr { @@ -36,8 +35,6 @@ namespace gr { private: void initialize(); - gr::thread::mutex d_mutex; - int d_size, d_buffer_size; std::string d_name; int d_nconnections; diff --git a/gr-qtgui/lib/freq_sink_c_impl.cc b/gr-qtgui/lib/freq_sink_c_impl.cc index 4b43967f32..11e8fc378f 100644 --- a/gr-qtgui/lib/freq_sink_c_impl.cc +++ b/gr-qtgui/lib/freq_sink_c_impl.cc @@ -140,8 +140,10 @@ namespace gr { d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } @@ -407,6 +409,8 @@ namespace gr { void freq_sink_c_impl::windowreset() { + gr::thread::scoped_lock lock(d_setlock); + filter::firdes::win_type newwintype; newwintype = d_main_gui->getFFTWindowType(); if(d_wintype != newwintype) { @@ -427,7 +431,7 @@ namespace gr { void freq_sink_c_impl::fftresize() { - gr::thread::scoped_lock lock(d_mutex); + gr::thread::scoped_lock lock(d_setlock); int newfftsize = d_main_gui->getFFTSize(); d_fftavg = d_main_gui->getFFTAverage(); diff --git a/gr-qtgui/lib/freq_sink_c_impl.h b/gr-qtgui/lib/freq_sink_c_impl.h index e435cc6614..dc985c1a99 100644 --- a/gr-qtgui/lib/freq_sink_c_impl.h +++ b/gr-qtgui/lib/freq_sink_c_impl.h @@ -27,7 +27,6 @@ #include <gnuradio/filter/firdes.h> #include <gnuradio/fft/fft.h> #include <gnuradio/high_res_timer.h> -#include <gnuradio/thread/thread.h> #include <gnuradio/qtgui/freqdisplayform.h> namespace gr { @@ -40,8 +39,6 @@ namespace gr { void initialize(); - gr::thread::mutex d_mutex; - int d_fftsize; float d_fftavg; filter::firdes::win_type d_wintype; diff --git a/gr-qtgui/lib/freq_sink_f_impl.cc b/gr-qtgui/lib/freq_sink_f_impl.cc index ab6167d10a..c0a29becd8 100644 --- a/gr-qtgui/lib/freq_sink_f_impl.cc +++ b/gr-qtgui/lib/freq_sink_f_impl.cc @@ -140,8 +140,10 @@ namespace gr { d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } @@ -408,7 +410,7 @@ namespace gr { void freq_sink_f_impl::windowreset() { - gr::thread::scoped_lock lock(d_mutex); + gr::thread::scoped_lock lock(d_setlock); filter::firdes::win_type newwintype; newwintype = d_main_gui->getFFTWindowType(); @@ -430,7 +432,7 @@ namespace gr { void freq_sink_f_impl::fftresize() { - gr::thread::scoped_lock lock(d_mutex); + gr::thread::scoped_lock lock(d_setlock); int newfftsize = d_main_gui->getFFTSize(); d_fftavg = d_main_gui->getFFTAverage(); diff --git a/gr-qtgui/lib/freq_sink_f_impl.h b/gr-qtgui/lib/freq_sink_f_impl.h index 8a821f86c3..9c4e1e3bcb 100644 --- a/gr-qtgui/lib/freq_sink_f_impl.h +++ b/gr-qtgui/lib/freq_sink_f_impl.h @@ -27,7 +27,6 @@ #include <gnuradio/filter/firdes.h> #include <gnuradio/fft/fft.h> #include <gnuradio/high_res_timer.h> -#include <gnuradio/thread/thread.h> #include <gnuradio/qtgui/freqdisplayform.h> namespace gr { @@ -40,8 +39,6 @@ namespace gr { void initialize(); - gr::thread::mutex d_mutex; - int d_fftsize; float d_fftavg; filter::firdes::win_type d_wintype; diff --git a/gr-qtgui/lib/histogram_sink_f_impl.cc b/gr-qtgui/lib/histogram_sink_f_impl.cc index bd43f8645c..56a4177a5c 100644 --- a/gr-qtgui/lib/histogram_sink_f_impl.cc +++ b/gr-qtgui/lib/histogram_sink_f_impl.cc @@ -109,8 +109,10 @@ namespace gr { d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } @@ -276,7 +278,7 @@ namespace gr { void histogram_sink_f_impl::set_nsamps(const int newsize) { - gr::thread::scoped_lock lock(d_mutex); + gr::thread::scoped_lock lock(d_setlock); if(newsize != d_size) { // Resize residbuf and replace data @@ -300,7 +302,7 @@ namespace gr { void histogram_sink_f_impl::set_bins(const int bins) { - gr::thread::scoped_lock lock(d_mutex); + gr::thread::scoped_lock lock(d_setlock); d_bins = bins; d_main_gui->setNumBins(d_bins); } diff --git a/gr-qtgui/lib/histogram_sink_f_impl.h b/gr-qtgui/lib/histogram_sink_f_impl.h index a3cb03eab1..a5409a2ef6 100644 --- a/gr-qtgui/lib/histogram_sink_f_impl.h +++ b/gr-qtgui/lib/histogram_sink_f_impl.h @@ -25,7 +25,6 @@ #include <gnuradio/qtgui/histogram_sink_f.h> #include <gnuradio/qtgui/histogramdisplayform.h> -#include <gnuradio/thread/thread.h> #include <gnuradio/high_res_timer.h> namespace gr { @@ -36,8 +35,6 @@ namespace gr { private: void initialize(); - gr::thread::mutex d_mutex; - int d_size; int d_bins; double d_xmin, d_xmax; diff --git a/gr-qtgui/lib/number_sink_impl.cc b/gr-qtgui/lib/number_sink_impl.cc index abfb8725f4..4e513d5b8a 100644 --- a/gr-qtgui/lib/number_sink_impl.cc +++ b/gr-qtgui/lib/number_sink_impl.cc @@ -30,6 +30,7 @@ #include <volk/volk.h> #include <gnuradio/fft/fft.h> #include <qwt_symbol.h> +#include <cmath> namespace gr { namespace qtgui { @@ -256,7 +257,7 @@ namespace gr { void number_sink_impl::reset() { - gr::thread::scoped_lock lock(d_mutex); + gr::thread::scoped_lock lock(d_setlock); _reset(); } @@ -265,30 +266,44 @@ namespace gr { { } + void + number_sink_impl::_gui_update_trigger() + { + // Only update the time if different than the current interval + // add some slop in cpu ticks for double comparison + gr::high_res_timer_type tps = gr::high_res_timer_tps(); + double t = d_main_gui->updateTime(); + if((d_update_time < (tps*t-10)) || ((tps*t+10) < d_update_time)) { + set_update_time(t); + } + + float a = d_main_gui->average(); + if(a != d_average) { + set_average(a); + } + } + int number_sink_impl::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - gr::thread::scoped_lock lock(d_mutex); + gr::thread::scoped_lock lock(d_setlock); - float new_avg = d_main_gui->average(); - set_update_time(d_main_gui->updateTime()); - if(new_avg != d_average) { - set_average(new_avg); - } + _gui_update_trigger(); if(d_average > 0) { for(int n = 0; n < d_nconnections; n++) { float *in = (float*)input_items[n]; for(int i = 0; i < noutput_items; i++) { - d_avg_value[n] = d_iir[n].filter(in[i]); + if(std::isfinite(in[i])) + d_avg_value[n] = d_iir[n].filter(in[i]); } } } // Plot if we are able to update - if(gr::high_res_timer_now() - d_last_time > d_update_time) { + if((gr::high_res_timer_now() - d_last_time) > d_update_time) { d_last_time = gr::high_res_timer_now(); std::vector<float> d(d_nconnections); if(d_average > 0) { @@ -296,8 +311,11 @@ namespace gr { d[n] = d_avg_value[n]; } else { - for(int n = 0; n < d_nconnections; n++) - d[n] = ((float*)input_items[n])[0]; + for(int n = 0; n < d_nconnections; n++) { + float x = ((float*)input_items[n])[0]; + if(std::isfinite(x)) + d[n] = x; + } } d_qApplication->postEvent(d_main_gui, new NumberUpdateEvent(d)); diff --git a/gr-qtgui/lib/number_sink_impl.h b/gr-qtgui/lib/number_sink_impl.h index 0f4fd48262..13fc5ef866 100644 --- a/gr-qtgui/lib/number_sink_impl.h +++ b/gr-qtgui/lib/number_sink_impl.h @@ -26,7 +26,6 @@ #include <gnuradio/qtgui/number_sink.h> #include <gnuradio/qtgui/numberdisplayform.h> #include <gnuradio/filter/single_pole_iir.h> -#include <gnuradio/thread/thread.h> #include <gnuradio/high_res_timer.h> namespace gr { @@ -37,8 +36,6 @@ namespace gr { private: void initialize(); - gr::thread::mutex d_mutex; - size_t d_itemsize; float d_average; graph_t d_type; diff --git a/gr-qtgui/lib/sink_c_impl.cc b/gr-qtgui/lib/sink_c_impl.cc index bcd2c4468c..ed2512b00c 100644 --- a/gr-qtgui/lib/sink_c_impl.cc +++ b/gr-qtgui/lib/sink_c_impl.cc @@ -130,8 +130,10 @@ namespace gr { d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } diff --git a/gr-qtgui/lib/sink_f_impl.cc b/gr-qtgui/lib/sink_f_impl.cc index 67896b71df..e2263f7150 100644 --- a/gr-qtgui/lib/sink_f_impl.cc +++ b/gr-qtgui/lib/sink_f_impl.cc @@ -130,8 +130,10 @@ namespace gr { d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } diff --git a/gr-qtgui/lib/time_raster_sink_b_impl.cc b/gr-qtgui/lib/time_raster_sink_b_impl.cc index ecd8ac319a..afc5e90e2d 100644 --- a/gr-qtgui/lib/time_raster_sink_b_impl.cc +++ b/gr-qtgui/lib/time_raster_sink_b_impl.cc @@ -124,8 +124,10 @@ namespace gr { d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } diff --git a/gr-qtgui/lib/time_raster_sink_b_impl.h b/gr-qtgui/lib/time_raster_sink_b_impl.h index bd568e91c0..ba4b282194 100644 --- a/gr-qtgui/lib/time_raster_sink_b_impl.h +++ b/gr-qtgui/lib/time_raster_sink_b_impl.h @@ -27,7 +27,6 @@ #include <gnuradio/filter/firdes.h> #include <gnuradio/fft/fft.h> #include <gnuradio/high_res_timer.h> -#include <gnuradio/thread/thread.h> #include <gnuradio/qtgui/timerasterdisplayform.h> namespace gr { diff --git a/gr-qtgui/lib/time_raster_sink_f_impl.cc b/gr-qtgui/lib/time_raster_sink_f_impl.cc index 3a18985b2d..7d271abb20 100644 --- a/gr-qtgui/lib/time_raster_sink_f_impl.cc +++ b/gr-qtgui/lib/time_raster_sink_f_impl.cc @@ -122,8 +122,10 @@ namespace gr { d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } diff --git a/gr-qtgui/lib/time_raster_sink_f_impl.h b/gr-qtgui/lib/time_raster_sink_f_impl.h index 1e0dcf8370..66f4465f0e 100644 --- a/gr-qtgui/lib/time_raster_sink_f_impl.h +++ b/gr-qtgui/lib/time_raster_sink_f_impl.h @@ -27,7 +27,6 @@ #include <gnuradio/filter/firdes.h> #include <gnuradio/fft/fft.h> #include <gnuradio/high_res_timer.h> -#include <gnuradio/thread/thread.h> #include <gnuradio/qtgui/timerasterdisplayform.h> namespace gr { diff --git a/gr-qtgui/lib/time_sink_c_impl.cc b/gr-qtgui/lib/time_sink_c_impl.cc index e053806fd2..664c164316 100644 --- a/gr-qtgui/lib/time_sink_c_impl.cc +++ b/gr-qtgui/lib/time_sink_c_impl.cc @@ -113,8 +113,10 @@ namespace gr { d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } @@ -229,7 +231,7 @@ namespace gr { float delay, int channel, const std::string &tag_key) { - gr::thread::scoped_lock lock(d_mutex); + gr::thread::scoped_lock lock(d_setlock); d_trigger_mode = mode; d_trigger_slope = slope; @@ -309,7 +311,7 @@ namespace gr { time_sink_c_impl::set_nsamps(const int newsize) { if(newsize != d_size) { - gr::thread::scoped_lock lock(d_mutex); + gr::thread::scoped_lock lock(d_setlock); // Set new size and reset buffer index // (throws away any currently held data, but who cares?) @@ -340,7 +342,7 @@ namespace gr { void time_sink_c_impl::set_samp_rate(const double samp_rate) { - gr::thread::scoped_lock lock(d_mutex); + gr::thread::scoped_lock lock(d_setlock); d_samp_rate = samp_rate; d_main_gui->setSampleRate(d_samp_rate); } @@ -402,7 +404,7 @@ namespace gr { void time_sink_c_impl::reset() { - gr::thread::scoped_lock lock(d_mutex); + gr::thread::scoped_lock lock(d_setlock); _reset(); } @@ -581,7 +583,7 @@ namespace gr { _npoints_resize(); _gui_update_trigger(); - gr::thread::scoped_lock lock(d_mutex); + gr::thread::scoped_lock lock(d_setlock); int nfill = d_end - d_index; // how much room left in buffers int nitems = std::min(noutput_items, nfill); // num items we can put in buffers diff --git a/gr-qtgui/lib/time_sink_c_impl.h b/gr-qtgui/lib/time_sink_c_impl.h index c3c5bde5e9..4e6ffb3db4 100644 --- a/gr-qtgui/lib/time_sink_c_impl.h +++ b/gr-qtgui/lib/time_sink_c_impl.h @@ -25,7 +25,6 @@ #include <gnuradio/qtgui/time_sink_c.h> #include <gnuradio/qtgui/timedisplayform.h> -#include <gnuradio/thread/thread.h> #include <gnuradio/high_res_timer.h> namespace gr { @@ -36,8 +35,6 @@ namespace gr { private: void initialize(); - gr::thread::mutex d_mutex; - int d_size, d_buffer_size; double d_samp_rate; std::string d_name; diff --git a/gr-qtgui/lib/time_sink_f_impl.cc b/gr-qtgui/lib/time_sink_f_impl.cc index 8424702bc1..b444d78302 100644 --- a/gr-qtgui/lib/time_sink_f_impl.cc +++ b/gr-qtgui/lib/time_sink_f_impl.cc @@ -115,8 +115,10 @@ namespace gr { d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } @@ -231,7 +233,7 @@ namespace gr { float delay, int channel, const std::string &tag_key) { - gr::thread::scoped_lock lock(d_mutex); + gr::thread::scoped_lock lock(d_setlock); d_trigger_mode = mode; d_trigger_slope = slope; @@ -311,7 +313,7 @@ namespace gr { time_sink_f_impl::set_nsamps(const int newsize) { if(newsize != d_size) { - gr::thread::scoped_lock lock(d_mutex); + gr::thread::scoped_lock lock(d_setlock); // Set new size and reset buffer index // (throws away any currently held data, but who cares?) @@ -342,7 +344,7 @@ namespace gr { void time_sink_f_impl::set_samp_rate(const double samp_rate) { - gr::thread::scoped_lock lock(d_mutex); + gr::thread::scoped_lock lock(d_setlock); d_samp_rate = samp_rate; d_main_gui->setSampleRate(d_samp_rate); } @@ -404,7 +406,7 @@ namespace gr { void time_sink_f_impl::reset() { - gr::thread::scoped_lock lock(d_mutex); + gr::thread::scoped_lock lock(d_setlock); _reset(); } @@ -577,7 +579,7 @@ namespace gr { _npoints_resize(); _gui_update_trigger(); - gr::thread::scoped_lock lock(d_mutex); + gr::thread::scoped_lock lock(d_setlock); int nfill = d_end - d_index; // how much room left in buffers int nitems = std::min(noutput_items, nfill); // num items we can put in buffers diff --git a/gr-qtgui/lib/time_sink_f_impl.h b/gr-qtgui/lib/time_sink_f_impl.h index 32e860a89c..6b3252cc2e 100644 --- a/gr-qtgui/lib/time_sink_f_impl.h +++ b/gr-qtgui/lib/time_sink_f_impl.h @@ -25,7 +25,6 @@ #include <gnuradio/qtgui/time_sink_f.h> #include <gnuradio/qtgui/timedisplayform.h> -#include <gnuradio/thread/thread.h> #include <gnuradio/high_res_timer.h> namespace gr { @@ -36,8 +35,6 @@ namespace gr { private: void initialize(); - gr::thread::mutex d_mutex; - int d_size, d_buffer_size; double d_samp_rate; std::string d_name; diff --git a/gr-qtgui/lib/waterfall_sink_c_impl.cc b/gr-qtgui/lib/waterfall_sink_c_impl.cc index 8cb3f1a7bf..5e393528d4 100644 --- a/gr-qtgui/lib/waterfall_sink_c_impl.cc +++ b/gr-qtgui/lib/waterfall_sink_c_impl.cc @@ -54,8 +54,8 @@ namespace gr { int nconnections, QWidget *parent) : sync_block("waterfall_sink_c", - io_signature::make(1, nconnections, sizeof(gr_complex)), - io_signature::make(0, 0, 0)), + io_signature::make(1, nconnections, sizeof(gr_complex)), + io_signature::make(0, 0, 0)), d_fftsize(fftsize), d_fftavg(1.0), d_wintype((filter::firdes::win_type)(wintype)), d_center_freq(fc), d_bandwidth(bw), d_name(name), @@ -139,8 +139,10 @@ namespace gr { d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } @@ -370,6 +372,8 @@ namespace gr { void waterfall_sink_c_impl::windowreset() { + gr::thread::scoped_lock lock(d_setlock); + filter::firdes::win_type newwintype; newwintype = d_main_gui->getFFTWindowType(); if(d_wintype != newwintype) { @@ -390,6 +394,8 @@ namespace gr { void waterfall_sink_c_impl::fftresize() { + gr::thread::scoped_lock lock(d_setlock); + int newfftsize = d_main_gui->getFFTSize(); d_fftavg = d_main_gui->getFFTAverage(); diff --git a/gr-qtgui/lib/waterfall_sink_c_impl.h b/gr-qtgui/lib/waterfall_sink_c_impl.h index ecff5a9676..d0e7eb13ba 100644 --- a/gr-qtgui/lib/waterfall_sink_c_impl.h +++ b/gr-qtgui/lib/waterfall_sink_c_impl.h @@ -27,7 +27,6 @@ #include <gnuradio/filter/firdes.h> #include <gnuradio/fft/fft.h> #include <gnuradio/high_res_timer.h> -#include <gnuradio/thread/thread.h> #include <gnuradio/qtgui/waterfalldisplayform.h> namespace gr { diff --git a/gr-qtgui/lib/waterfall_sink_f_impl.cc b/gr-qtgui/lib/waterfall_sink_f_impl.cc index 1c1453c1d1..5667acf2e7 100644 --- a/gr-qtgui/lib/waterfall_sink_f_impl.cc +++ b/gr-qtgui/lib/waterfall_sink_f_impl.cc @@ -138,8 +138,10 @@ namespace gr { d_qApplication = qApp; } else { +#if QT_VERSION >= 0x040500 std::string style = prefs::singleton()->get_string("qtgui", "style", "raster"); QApplication::setGraphicsSystem(QString(style.c_str())); +#endif d_qApplication = new QApplication(d_argc, &d_argv); } @@ -372,6 +374,8 @@ namespace gr { void waterfall_sink_f_impl::windowreset() { + gr::thread::scoped_lock lock(d_setlock); + filter::firdes::win_type newwintype; newwintype = d_main_gui->getFFTWindowType(); if(d_wintype != newwintype) { @@ -392,6 +396,8 @@ namespace gr { void waterfall_sink_f_impl::fftresize() { + gr::thread::scoped_lock lock(d_setlock); + int newfftsize = d_fftsize; if(newfftsize != d_fftsize) { diff --git a/gr-qtgui/lib/waterfall_sink_f_impl.h b/gr-qtgui/lib/waterfall_sink_f_impl.h index 86cf0dc5d2..d783f31d14 100644 --- a/gr-qtgui/lib/waterfall_sink_f_impl.h +++ b/gr-qtgui/lib/waterfall_sink_f_impl.h @@ -27,7 +27,6 @@ #include <gnuradio/filter/firdes.h> #include <gnuradio/fft/fft.h> #include <gnuradio/high_res_timer.h> -#include <gnuradio/thread/thread.h> #include <gnuradio/qtgui/waterfalldisplayform.h> namespace gr { diff --git a/gr-qtgui/swig/CMakeLists.txt b/gr-qtgui/swig/CMakeLists.txt index 5207318ba5..44b5c2fbd4 100644 --- a/gr-qtgui/swig/CMakeLists.txt +++ b/gr-qtgui/swig/CMakeLists.txt @@ -38,7 +38,6 @@ set(GR_SWIG_INCLUDE_DIRS if(ENABLE_GR_CTRLPORT) list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT") - list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/qtgui_swig_doc.i) diff --git a/gr-trellis/lib/CMakeLists.txt b/gr-trellis/lib/CMakeLists.txt index 67a339d029..2cc53c6107 100644 --- a/gr-trellis/lib/CMakeLists.txt +++ b/gr-trellis/lib/CMakeLists.txt @@ -34,7 +34,6 @@ link_directories(${LOG4CXX_LIBRARY_DIRS}) if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) - include_directories(${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) ####################################################################### diff --git a/gr-trellis/swig/CMakeLists.txt b/gr-trellis/swig/CMakeLists.txt index 81c3e876f1..d03d0998ef 100644 --- a/gr-trellis/swig/CMakeLists.txt +++ b/gr-trellis/swig/CMakeLists.txt @@ -34,7 +34,6 @@ set(GR_SWIG_LIBRARIES gnuradio-trellis gnuradio-digital) if(ENABLE_GR_CTRLPORT) list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT") - list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) # Setup swig docs to depend on includes and pull in from build directory diff --git a/gr-uhd/lib/CMakeLists.txt b/gr-uhd/lib/CMakeLists.txt index 9121dd41b8..e0a9db8cc2 100644 --- a/gr-uhd/lib/CMakeLists.txt +++ b/gr-uhd/lib/CMakeLists.txt @@ -37,7 +37,6 @@ link_directories( if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) - include_directories(${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) include_directories(${LOG4CPP_INCLUDE_DIRS}) diff --git a/gr-uhd/lib/usrp_sink_impl.cc b/gr-uhd/lib/usrp_sink_impl.cc index b6a98391be..f05d90e26a 100644 --- a/gr-uhd/lib/usrp_sink_impl.cc +++ b/gr-uhd/lib/usrp_sink_impl.cc @@ -605,9 +605,6 @@ namespace gr { if (my_tag_count >= max_count) { break; } - else if (not pmt::is_null(_length_tag_key) and my_tag_count > samp0_count + _nitems_to_send) { - break; - } /* I. Bursts that can only be on the first sample of burst * diff --git a/gr-uhd/swig/CMakeLists.txt b/gr-uhd/swig/CMakeLists.txt index 4084bc07e9..ef54761d0f 100644 --- a/gr-uhd/swig/CMakeLists.txt +++ b/gr-uhd/swig/CMakeLists.txt @@ -34,7 +34,6 @@ set(GR_SWIG_INCLUDE_DIRS if(ENABLE_GR_CTRLPORT) list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT") - list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/uhd_swig_doc.i) diff --git a/gr-utils/python/modtool/gr-newmod/lib/test_howto.cc b/gr-utils/python/modtool/gr-newmod/lib/test_howto.cc index f01bd5a064..cc89dc90f3 100644 --- a/gr-utils/python/modtool/gr-newmod/lib/test_howto.cc +++ b/gr-utils/python/modtool/gr-newmod/lib/test_howto.cc @@ -30,6 +30,7 @@ #include <gnuradio/unittests.h> #include "qa_howto.h" #include <iostream> +#include <fstream> int main (int argc, char **argv) diff --git a/gr-utils/python/modtool/gr-newmod/python/__init__.py b/gr-utils/python/modtool/gr-newmod/python/__init__.py index d852fda545..ed385a0abe 100644 --- a/gr-utils/python/modtool/gr-newmod/python/__init__.py +++ b/gr-utils/python/modtool/gr-newmod/python/__init__.py @@ -23,24 +23,6 @@ This is the GNU Radio HOWTO module. Place your Python package description here (python/__init__.py). ''' -# ---------------------------------------------------------------- -# Temporary workaround for ticket:181 (swig+python problem) -import sys -_RTLD_GLOBAL = 0 -try: - from dl import RTLD_GLOBAL as _RTLD_GLOBAL -except ImportError: - try: - from DLFCN import RTLD_GLOBAL as _RTLD_GLOBAL - except ImportError: - pass - -if _RTLD_GLOBAL != 0: - _dlopenflags = sys.getdlopenflags() - sys.setdlopenflags(_dlopenflags|_RTLD_GLOBAL) -# ---------------------------------------------------------------- - - # import swig generated symbols into the howto namespace try: # this might fail if the module is python-only @@ -50,9 +32,3 @@ except ImportError: # import any pure python here # - -# ---------------------------------------------------------------- -# Tail of workaround -if _RTLD_GLOBAL != 0: - sys.setdlopenflags(_dlopenflags) # Restore original flags -# ---------------------------------------------------------------- diff --git a/gr-utils/python/modtool/modtool_makexml.py b/gr-utils/python/modtool/modtool_makexml.py index 28eabe1b81..82dc9d94d4 100644 --- a/gr-utils/python/modtool/modtool_makexml.py +++ b/gr-utils/python/modtool/modtool_makexml.py @@ -137,7 +137,7 @@ class ModToolMakeXML(ModTool): 'std::vector<float>': 'real_vector', 'std::vector<gr_complex>': 'complex_vector', } - if p_type in ('int',) and default_v[:2].lower() == '0x': + if p_type in ('int',) and default_v is not None and len(default_v) > 1 and default_v[:2].lower() == '0x': return 'hex' try: return translate_dict[p_type] diff --git a/gr-video-sdl/lib/CMakeLists.txt b/gr-video-sdl/lib/CMakeLists.txt index 8c992f98ef..c431382366 100644 --- a/gr-video-sdl/lib/CMakeLists.txt +++ b/gr-video-sdl/lib/CMakeLists.txt @@ -33,7 +33,6 @@ link_directories(${Boost_LIBRARY_DIRS}) if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) - include_directories(${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) ######################################################################## diff --git a/gr-video-sdl/swig/CMakeLists.txt b/gr-video-sdl/swig/CMakeLists.txt index df64cb38d3..46343741a1 100644 --- a/gr-video-sdl/swig/CMakeLists.txt +++ b/gr-video-sdl/swig/CMakeLists.txt @@ -33,7 +33,6 @@ set(GR_SWIG_LIBRARIES gnuradio-video-sdl) if(ENABLE_GR_CTRLPORT) list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT") - list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) # Setup swig docs to depend on includes and pull in from build directory diff --git a/gr-vocoder/lib/CMakeLists.txt b/gr-vocoder/lib/CMakeLists.txt index 61c973b699..4c373fdbfd 100644 --- a/gr-vocoder/lib/CMakeLists.txt +++ b/gr-vocoder/lib/CMakeLists.txt @@ -88,7 +88,6 @@ link_directories(${Boost_LIBRARY_DIRS}) if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) - include_directories(${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) include_directories(${LOG4CPP_INCLUDE_DIRS}) diff --git a/gr-vocoder/lib/codec2/quantise.c b/gr-vocoder/lib/codec2/quantise.c index 6423dc83df..f7326c4fcd 100644 --- a/gr-vocoder/lib/codec2/quantise.c +++ b/gr-vocoder/lib/codec2/quantise.c @@ -153,7 +153,7 @@ void encode_lspds_scalar( float dlsp_[LPC_MAX]; float wt[LPC_MAX]; const float *cb; - float se; + float se = 0.0f; assert(order == LPC_ORD); @@ -245,7 +245,7 @@ void lspvq_quantise( int i,k,m,ncb, nlsp; float wt[LPC_ORD], lsp_hz[LPC_ORD]; const float *cb; - float se; + float se = 0.0f; int index; for(i=0; i<LPC_ORD; i++) { @@ -301,7 +301,7 @@ void lspjnd_quantise(float lsps[], float lsps_[], int order) int i,k,m; float wt[LPC_ORD], lsps_hz[LPC_ORD]; const float *cb; - float se = 0.0; + float se = 0.0f; int index; for(i=0; i<LPC_ORD; i++) { @@ -369,7 +369,7 @@ void lspdt_quantise(float lsps[], float lsps_[], float lsps__prev[], int mode) int k,m; int index; const float *cb; - float se = 0.0; + float se = 0.0f; #endif // TRY_LSPDT_VQ //compute_weights(lsps, wt, LPC_ORD); @@ -1225,7 +1225,7 @@ void encode_lsps_scalar(int indexes[], float lsp[], int order) float wt[1]; float lsp_hz[LPC_MAX]; const float * cb; - float se; + float se = 0.0f; /* convert from radians to Hz so we can use human readable frequencies */ @@ -1298,7 +1298,7 @@ void encode_lsps_diff_freq_vq(int indexes[], float lsp[], int order) float dlsp_[LPC_MAX]; float wt[LPC_MAX]; const float * cb; - float se; + float se = 0.0f; for(i=0; i<LPC_ORD; i++) { wt[i] = 1.0; @@ -1404,7 +1404,7 @@ void encode_lsps_diff_time(int indexes[], float lsps_dt[LPC_ORD]; float wt[LPC_MAX]; const float * cb; - float se; + float se = 0.0f; /* Determine difference in time and convert from radians to Hz so we can use human readable frequencies */ diff --git a/gr-vocoder/swig/CMakeLists.txt b/gr-vocoder/swig/CMakeLists.txt index 2c2a7a6791..26623969a7 100644 --- a/gr-vocoder/swig/CMakeLists.txt +++ b/gr-vocoder/swig/CMakeLists.txt @@ -31,7 +31,6 @@ set(GR_SWIG_INCLUDE_DIRS if(ENABLE_GR_CTRLPORT) list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT") - list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/vocoder_swig_doc.i) diff --git a/gr-wavelet/lib/CMakeLists.txt b/gr-wavelet/lib/CMakeLists.txt index 99c32aac19..4bb85dc431 100644 --- a/gr-wavelet/lib/CMakeLists.txt +++ b/gr-wavelet/lib/CMakeLists.txt @@ -40,7 +40,6 @@ add_definitions(${GSL_DEFINITIONS}) if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) - include_directories(${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) include_directories(${LOG4CPP_INCLUDE_DIRS}) diff --git a/gr-wavelet/swig/CMakeLists.txt b/gr-wavelet/swig/CMakeLists.txt index c539898575..1f31497844 100644 --- a/gr-wavelet/swig/CMakeLists.txt +++ b/gr-wavelet/swig/CMakeLists.txt @@ -33,7 +33,6 @@ set(GR_SWIG_INCLUDE_DIRS if(ENABLE_GR_CTRLPORT) list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT") - list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/wavelet_swig_doc.i) diff --git a/gr-wxgui/lib/CMakeLists.txt b/gr-wxgui/lib/CMakeLists.txt index 02b2e94dce..2a263d3a74 100644 --- a/gr-wxgui/lib/CMakeLists.txt +++ b/gr-wxgui/lib/CMakeLists.txt @@ -34,7 +34,6 @@ link_directories(${Boost_LIBRARY_DIRS}) if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) - include_directories(${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) ######################################################################## diff --git a/gr-wxgui/python/wxgui/forms/forms.py b/gr-wxgui/python/wxgui/forms/forms.py index db55472210..f819f13397 100644 --- a/gr-wxgui/python/wxgui/forms/forms.py +++ b/gr-wxgui/python/wxgui/forms/forms.py @@ -515,13 +515,13 @@ class notebook(_chooser_base): _chooser_base.__init__(self, **kwargs) assert len(pages) == len(self._choices) self._notebook = notebook - self._notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self._handle) + self._notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self._handle) #add pages, setting the label on each tab for i, page in enumerate(pages): self._notebook.AddPage(page, self._labels[i]) self._add_widget(self._notebook) - def _handle(self, event): self[INT_KEY] = self._notebook.GetSelection() + def _handle(self, event): self[INT_KEY] = event.GetSelection() # SetSelection triggers a page change event (deprecated, breaks on Windows) and ChangeSelection does not def _update(self, i): self._notebook.ChangeSelection(i) diff --git a/gr-wxgui/swig/CMakeLists.txt b/gr-wxgui/swig/CMakeLists.txt index f02f1f1455..034036e267 100644 --- a/gr-wxgui/swig/CMakeLists.txt +++ b/gr-wxgui/swig/CMakeLists.txt @@ -32,7 +32,6 @@ set(GR_SWIG_INCLUDE_DIRS if(ENABLE_GR_CTRLPORT) list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT") - list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/wxgui_swig_doc.i) diff --git a/gr-zeromq/lib/CMakeLists.txt b/gr-zeromq/lib/CMakeLists.txt index 07ac36bc9c..952561b761 100644 --- a/gr-zeromq/lib/CMakeLists.txt +++ b/gr-zeromq/lib/CMakeLists.txt @@ -31,7 +31,6 @@ link_directories(${Boost_LIBRARY_DIRS}) if(ENABLE_GR_CTRLPORT) ADD_DEFINITIONS(-DGR_CTRLPORT) - include_directories(${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) ######################################################################## diff --git a/gr-zeromq/swig/CMakeLists.txt b/gr-zeromq/swig/CMakeLists.txt index 529cb0deaf..5c2aff2ed0 100644 --- a/gr-zeromq/swig/CMakeLists.txt +++ b/gr-zeromq/swig/CMakeLists.txt @@ -32,7 +32,6 @@ set(GR_SWIG_INCLUDE_DIRS if(ENABLE_GR_CTRLPORT) list(APPEND GR_SWIG_FLAGS "-DGR_CTRLPORT") - list(APPEND GR_SWIG_INCLUDE_DIRS ${ICE_INCLUDE_DIR}) endif(ENABLE_GR_CTRLPORT) set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/zeromq_swig_doc.i) diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl index 52582384aa..ace217c967 100644 --- a/grc/python/flow_graph.tmpl +++ b/grc/python/flow_graph.tmpl @@ -58,6 +58,7 @@ class $(class_name)(grc_wxgui.top_block_gui): self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) #end if #elif $generate_options == 'qt_gui' +from distutils.version import StrictVersion class $(class_name)(gr.top_block, Qt.QWidget): def __init__($param_str): @@ -316,7 +317,8 @@ if __name__ == '__main__': tb.Wait() #end if #elif $generate_options == 'qt_gui' - Qt.QApplication.setGraphicsSystem(gr.prefs().get_string('qtgui','style','raster')) + if(StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0")): + Qt.QApplication.setGraphicsSystem(gr.prefs().get_string('qtgui','style','raster')) qapp = Qt.QApplication(sys.argv) tb = $(class_name)($(', '.join($params_eq_list))) #if $flow_graph.get_option('run') diff --git a/volk/kernels/volk/volk_8u_conv_k7_r2puppet_8u.h b/volk/kernels/volk/volk_8u_conv_k7_r2puppet_8u.h index fef9db5de8..8d31e469f2 100644 --- a/volk/kernels/volk/volk_8u_conv_k7_r2puppet_8u.h +++ b/volk/kernels/volk/volk_8u_conv_k7_r2puppet_8u.h @@ -3,6 +3,7 @@ #include <volk/volk.h> #include <volk/volk_8u_x4_conv_k7_r2_8u.h> +#include <string.h> typedef union { //decision_t is a BIT vector diff --git a/volk/lib/CMakeLists.txt b/volk/lib/CMakeLists.txt index d72eb726e4..3b12b4aee5 100644 --- a/volk/lib/CMakeLists.txt +++ b/volk/lib/CMakeLists.txt @@ -66,6 +66,18 @@ if(COMPILER_NAME MATCHES "GNU") endif() ######################################################################## +# check for posix_memalign, since some OSs do not internally define +# _XOPEN_SOURCE or _POSIX_C_SOURCE; they leave this to the user. +######################################################################## + +include(CheckFunctionExists) +CHECK_FUNCTION_EXISTS(posix_memalign HAVE_POSIX_MEMALIGN) + +if(HAVE_POSIX_MEMALIGN) + add_definitions(-DHAVE_POSIX_MEMALIGN) +endif(HAVE_POSIX_MEMALIGN) + +######################################################################## # detect x86 flavor of CPU ######################################################################## if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^(i.86|x86|x86_64|amd64)$") diff --git a/volk/lib/volk_malloc.c b/volk/lib/volk_malloc.c index b2b77ddcd7..b0ffcb5ef2 100644 --- a/volk/lib/volk_malloc.c +++ b/volk/lib/volk_malloc.c @@ -20,6 +20,7 @@ * Boston, MA 02110-1301, USA. */ +#include <pthread.h> #include <volk/volk_malloc.h> #include <stdio.h> #include <stdlib.h> @@ -54,7 +55,7 @@ // Otherwise, test if we are a POSIX or X/Open system // This only has a restriction that alignment be a power of 2. -#if _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 +#if _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || HAVE_POSIX_MEMALIGN void *volk_malloc(size_t size, size_t alignment) { @@ -75,102 +76,49 @@ void volk_free(void *ptr) } // No standard handlers; we'll do it ourselves. -#else // _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 +#else // _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || HAVE_POSIX_MEMALIGN -typedef struct mbuf_t { - void *orig; - void *align; - struct mbuf_t *next; -} mbuf; - -/* - Keep track of the pointers we've allocated. We hold a linked list - from volk_first_ptr to volk_last_ptr and the number of allocated - pointers. When allocating a new pointer, we create the pointer with - malloc, find how it is misaligned, and create a new pointer at the - alignment boundary. Both of these are stored in the linked list data - structure. When free, we are passed the aligned pointer and use that - to look up the original pointer, which we use to actually free the - entire allocated memory. -*/ -unsigned int volk_nptrs = 0; -mbuf* volk_first_ptr = NULL; -mbuf* volk_last_ptr = NULL; +struct block_info +{ + void *real; +}; -void* +void * volk_malloc(size_t size, size_t alignment) { - // Allocate memory plus enough extra to adjust alignment - void *ptr = malloc(size + (alignment - 1)); - if(ptr == NULL) { - free(ptr); - fprintf(stderr, "VOLK: Error allocating memory (malloc)\n"); - return NULL; - } + void *real, *user; + struct block_info *info; - // Find and return the first aligned boundary of the pointer - void *aptr = ptr; - if((unsigned long)ptr % alignment != 0) - aptr = (void*)((unsigned long)ptr + (alignment - ((unsigned long)ptr % alignment))); - - // Store original pointer and aligned pointers - mbuf *n = (mbuf*)malloc(sizeof(mbuf)); - n->orig = ptr; - n->align = aptr; - n->next = NULL; - if(volk_first_ptr == NULL) { - volk_first_ptr = n; - } - else { - volk_last_ptr->next = n; - } - volk_last_ptr = n; - volk_nptrs++; + /* At least align to sizeof our struct */ + if (alignment < sizeof(struct block_info)) + alignment = sizeof(struct block_info); + + /* Alloc */ + real = malloc(size + (2 * alignment - 1)); + + /* Get pointer to the various zones */ + user = (void *)((((uintptr_t) real) + sizeof(struct block_info) + alignment - 1) & ~(alignment - 1)); + info = (struct block_info *)(((uintptr_t)user) - sizeof(struct block_info)); + + /* Store the info for the free */ + info->real = real; - return aptr; + /* Return pointer to user */ + return user; } -void volk_free(void *ptr) +void +volk_free(void *ptr) { - unsigned long aptr = (unsigned long)ptr; - mbuf *prev = volk_first_ptr; - mbuf *p = volk_first_ptr; - - // Look for the aligned pointer until we either find it or have - // walked the entire list of allocated pointers - while(p != NULL) { - if((unsigned long)(p->align) == aptr) { - // If the memory is found at the first pointer, move this - // pointer to the next in the list - if(p == volk_first_ptr) { - if(volk_first_ptr == volk_last_ptr) - volk_last_ptr = NULL; - volk_first_ptr = p->next; - } - // Otherwise, link the previous to the following to skip the - // struct we're deleting. - else { - if(p == volk_last_ptr) - volk_last_ptr = prev; - prev->next = p->next; - } - - // Free the original pointer to remove all memory allocated - free((void*)p->orig); - volk_nptrs--; - - // Free the struct to clean up all memory and exit - free(p); - - return; - } - // Not found, update our pointers to look at the next in the list - prev = p; - p = p->next; - } - fprintf(stderr, "VOLK: tried to free a non-VOLK pointer\n"); + struct block_info *info; + + /* Get the real pointer */ + info = (struct block_info *)(((uintptr_t)ptr) - sizeof(struct block_info)); + + /* Release real pointer */ + free(info->real); } -#endif // _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 +#endif // _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || HAVE_POSIX_MEMALIGN //#endif // _ISOC11_SOURCE |