diff options
51 files changed, 4166 insertions, 137 deletions
diff --git a/gnuradio-runtime/include/gnuradio/rpccallbackregister_base.h b/gnuradio-runtime/include/gnuradio/rpccallbackregister_base.h index 814749fe66..14e8772449 100644 --- a/gnuradio-runtime/include/gnuradio/rpccallbackregister_base.h +++ b/gnuradio-runtime/include/gnuradio/rpccallbackregister_base.h @@ -99,6 +99,7 @@ struct callbackregister_base typedef callback_t<gr::messages::msg_accepter, gr::messages::msg_accepter_sptr> configureCallback_t; typedef callback_t<gr::messages::msg_producer, gr::messages::msg_producer_sptr> queryCallback_t; + typedef callback_t<gr::messages::msg_accepter, gr::messages::msg_accepter_sptr> handlerCallback_t; callbackregister_base() {;} virtual ~callbackregister_base() {;} @@ -107,6 +108,8 @@ struct callbackregister_base virtual void unregisterConfigureCallback(const std::string &id) = 0; virtual void registerQueryCallback(const std::string &id, const queryCallback_t callback) = 0; virtual void unregisterQueryCallback(const std::string &id) = 0; + virtual void registerHandlerCallback(const std::string &id, const handlerCallback_t callback) = 0; + virtual void unregisterHandlerCallback(const std::string &id) = 0; }; #endif /* RPCCALLBACKREGISTER_BASE_H */ diff --git a/gnuradio-runtime/include/gnuradio/rpcregisterhelpers.h b/gnuradio-runtime/include/gnuradio/rpcregisterhelpers.h index f82f5ed0aa..4405c90939 100644 --- a/gnuradio-runtime/include/gnuradio/rpcregisterhelpers.h +++ b/gnuradio-runtime/include/gnuradio/rpcregisterhelpers.h @@ -143,6 +143,49 @@ public: }; + +/********************************************************************* + * RPC Handler Base Classes + ********************************************************************/ + +/*! + *\brief Base class for registering a ControlPort Handler. Acts as + * a message acceptor. + */ +template<typename T> +class rpchandler_base + : public virtual gr::messages::msg_accepter +{ +public: + rpchandler_base(T* source, const char* handler) : + _source(source), _handler(handler) {;} + ~rpchandler_base() {;} + + void post(pmt::pmt_t which_port, pmt::pmt_t msg) { + _source->post(which_port, msg); + } + +protected: + T* _source; + const char* _handler; +}; + + +/*! + * \brief Templated parent class for registering a ControlPort Extractor. + */ +template<typename T> +class rpcbasic_handler : public virtual rpchandler_base<T> +{ +public: + rpcbasic_handler(T* source, const char* handler) : + rpchandler_base<T>(source, handler) + {;} +}; + + + + /********************************************************************* * RPC Specialized Extractors ********************************************************************/ @@ -196,7 +239,7 @@ public: void post(pmt::pmt_t which_port, pmt::pmt_t msg) { - (rpcextractor_base<T,short>::_source->*rpcextractor_base<T,char>::_func) + (rpcextractor_base<T,short>::_source->*rpcextractor_base<T,short>::_func) (static_cast<short>(pmt::to_long(msg))); } }; @@ -1355,6 +1398,81 @@ public: }; +/*! + * \brief Registers a message handler function to post a message to a + * block's handler. + */ +template<typename T> +class rpcbasic_register_handler : public rpcbasic_base +{ +public: + + /*! + * \brief Adds the ability to pass a message over ControlPort. + * + * \details + * This makes any message handler function avialable over + * ControlPort. Since message handlers always take in a single PMT + * message input, this interface provides a very generic way of + * setting values in a block in a flowgraph. + * + * \param block_alias Alias of the block + * \param handler The name of the message port in the block + * \param units_ A string to describe what units to represent the variable with + * \param desc_ A string to describing the variable. + * \param minpriv_ The required minimum privilege level + * \param display_ The display mask + */ + rpcbasic_register_handler(const std::string& block_alias, + const char* handler, + const char* units_ = "", + const char* desc_ = "", + priv_lvl_t minpriv_ = RPC_PRIVLVL_MIN, + DisplayType display_ = DISPNULL) + { + d_units = units_; + d_desc = desc_; + d_minpriv = minpriv_; + d_display = display_; + d_object = dynamic_cast<T*>(global_block_registry.block_lookup(pmt::intern(block_alias)).get()); +#ifdef GR_RPCSERVER_ENABLED + callbackregister_base::handlerCallback_t + inserter(new rpcbasic_handler<T>(d_object, handler), + minpriv_, std::string(units_), display_, std::string(desc_), + 0, 0, 0); + std::ostringstream oss(std::ostringstream::out); + oss << block_alias << "::" << handler; + d_id = oss.str(); + //std::cerr << "REGISTERING GET: " << d_id << " " << desc_ << std::endl; + rpcmanager::get()->i()->registerHandlerCallback(d_id, inserter); +#endif + } + + ~rpcbasic_register_handler() + { +#ifdef GR_RPCSERVER_ENABLED + rpcmanager::get()->i()->unregisterHandlerCallback(d_id); +#endif + } + + std::string units() const { return d_units; } + std::string description() const { return d_desc; } + priv_lvl_t privilege_level() const { return d_minpriv; } + DisplayType default_display() const { return d_display; } + + void units(std::string u) { d_units = u; } + void description(std::string d) { d_desc = d; } + void privilege_level(priv_lvl_t p) { d_minpriv = p; } + void default_display(DisplayType d) { d_display = d; } + +private: + std::string d_id; + std::string d_units, d_desc; + priv_lvl_t d_minpriv; + DisplayType d_display; + T *d_object; +}; + #endif diff --git a/gnuradio-runtime/include/gnuradio/rpcserver_aggregator.h b/gnuradio-runtime/include/gnuradio/rpcserver_aggregator.h index 98aae92b90..08426bb00c 100644 --- a/gnuradio-runtime/include/gnuradio/rpcserver_aggregator.h +++ b/gnuradio-runtime/include/gnuradio/rpcserver_aggregator.h @@ -40,6 +40,9 @@ public: void registerQueryCallback(const std::string &id, const queryCallback_t callback); void unregisterQueryCallback(const std::string &id); + void registerHandlerCallback(const std::string &id, const handlerCallback_t callback); + void unregisterHandlerCallback(const std::string &id); + void registerServer(rpcmanager_base::rpcserver_booter_base_sptr server); const std::string& type(); @@ -91,6 +94,32 @@ private: const std::string& id; }; + + + template<class T, typename Tcallback> + struct registerHandlerCallback_f: public std::unary_function<T,void> + { + registerHandlerCallback_f(const std::string &_id, const Tcallback _callback) + : id(_id), callback(_callback) + {;} + + void operator()(T& x) { x->i()->registerHandlerCallback(id, callback); } + const std::string& id; const Tcallback& callback; + }; + + template<class T, typename Tcallback> + struct unregisterHandlerCallback_f: public std::unary_function<T,void> + { + unregisterHandlerCallback_f(const std::string &_id) + : id(_id) + {;} + + void operator()(T& x) { x->i()->unregisterHandlerCallback(id); } + const std::string& id; + }; + + + const std::string d_type; typedef std::vector<rpcmanager_base::rpcserver_booter_base_sptr> rpcServerMap_t; std::vector<std::string> d_registeredServers; diff --git a/gnuradio-runtime/include/gnuradio/rpcserver_base.h b/gnuradio-runtime/include/gnuradio/rpcserver_base.h index af0b9e762d..276dec5d1e 100644 --- a/gnuradio-runtime/include/gnuradio/rpcserver_base.h +++ b/gnuradio-runtime/include/gnuradio/rpcserver_base.h @@ -33,8 +33,13 @@ public: virtual void registerConfigureCallback(const std::string &id, const configureCallback_t callback) = 0; virtual void unregisterConfigureCallback(const std::string &id) = 0; + virtual void registerQueryCallback(const std::string &id, const queryCallback_t callback) = 0; virtual void unregisterQueryCallback(const std::string &id) = 0; + + virtual void registerHandlerCallback(const std::string &id, const handlerCallback_t callback) = 0; + virtual void unregisterHandlerCallback(const std::string &id) = 0; + virtual void setCurPrivLevel(const priv_lvl_t priv) { cur_priv = priv; } typedef boost::shared_ptr<rpcserver_base> rpcserver_base_sptr; diff --git a/gnuradio-runtime/include/gnuradio/rpcserver_thrift.h b/gnuradio-runtime/include/gnuradio/rpcserver_thrift.h index 203be66e9a..dc7ad40161 100644 --- a/gnuradio-runtime/include/gnuradio/rpcserver_thrift.h +++ b/gnuradio-runtime/include/gnuradio/rpcserver_thrift.h @@ -38,7 +38,9 @@ #define S_(x) S(x) #define S__LINE__ S_(__LINE__) -class rpcserver_thrift : public virtual rpcserver_base, public GNURadio::ControlPortIf +class rpcserver_thrift + : public virtual rpcserver_base, + public GNURadio::ControlPortIf { public: rpcserver_thrift(); @@ -52,6 +54,10 @@ public: const queryCallback_t callback); void unregisterQueryCallback(const std::string &id); + void registerHandlerCallback(const std::string &id, + const handlerCallback_t callback); + void unregisterHandlerCallback(const std::string &id); + void setKnobs(const GNURadio::KnobMap&); void getKnobs(GNURadio::KnobMap&, const GNURadio::KnobIDList&); @@ -59,6 +65,35 @@ public: const GNURadio::KnobIDList&); void properties(GNURadio::KnobPropMap&, const GNURadio::KnobIDList& knobs); + + /*! + * \brief Call this to post a message to the \p port for the block + * identified by \p alias. + * + * The message, \p msg, is passed as a serialized PMT that is then + * passed to the message handler function identified by \p port to + * the block identified by \p alias. The \p alias and \p port + * values are passed as serialized PMT symbols (see + * pmt::intern). The message is whatever PMT format is appropriate + * for the message handler function. + * + * To use this function, the message handler function must have + * been registered (most likely in setup_rpc) in the block during + * construction using rpcbasic_register_handler. + * + * \param alias The alias of the block, which is used to map to the + * real block through the global_block_registry. Passed in + * as a serialized PMT symbol. + * \param port The name of the message port. Passed in as a + * serialized PMT symbol. + * \param msg The actual message to pass to \p port. This is a + * serialized PMT where the PMT is whatever form appropriate + * for the message handler function. + */ + void postMessage(const std::string& alias, + const std::string& port, + const std::string& msg); + virtual void shutdown(); private: @@ -70,6 +105,28 @@ public: typedef std::map<std::string, queryCallback_t> QueryCallbackMap_t; QueryCallbackMap_t d_getcallbackmap; + typedef std::map<std::string, handlerCallback_t> HandlerCallbackMap_t; + HandlerCallbackMap_t d_handlercallbackmap; + + /*! + * \brief Manages calling the callback function for a message handler posting. + */ + void + set_h(const handlerCallback_t &_handlerCallback, + const priv_lvl_t &_cur_priv, + pmt::pmt_t port, pmt::pmt_t msg) + { + if(cur_priv <= _handlerCallback.priv) { + _handlerCallback.callback->post(port, msg); + } + else { + std::cerr << "Message " << _handlerCallback.description << " requires PRIVLVL <= " + << _handlerCallback.priv << " to set, currently at: " + << cur_priv << std::endl; + } + } + + template<typename T, typename TMap> struct set_f : public std::unary_function<T,void> { @@ -87,7 +144,7 @@ public: (*iter->second.callback).post(pmt::PMT_NIL, rpcpmtconverter::To_PMT::instance(p.second)); } else { - std::cout << "Key " << p.first << " requires PRIVLVL <= " + std::cerr << "Key " << p.first << " requires PRIVLVL <= " << iter->second.priv << " to set, currently at: " << cur_priv << std::endl; } @@ -116,7 +173,7 @@ public: outknobs[p] = rpcpmtconverter::from_pmt((*iter->second.callback).retrieve()); } else { - std::cout << "Key " << iter->first << " requires PRIVLVL: <= " + std::cerr << "Key " << iter->first << " requires PRIVLVL: <= " << iter->second.priv << " to get, currently at: " << cur_priv << std::endl; } @@ -124,7 +181,7 @@ public: else { std::stringstream ss; ss << "Ctrlport Key called with unregistered key (" << p << ")\n"; - std::cout << ss.str(); + std::cerr << ss.str(); throw apache::thrift::TApplicationException(__FILE__ " " S__LINE__); } } @@ -147,7 +204,7 @@ public: outknobs[p.first] = rpcpmtconverter::from_pmt(p.second.callback->retrieve()); } else { - std::cout << "Key " << p.first << " requires PRIVLVL <= " + std::cerr << "Key " << p.first << " requires PRIVLVL <= " << p.second.priv << " to get, currently at: " << cur_priv << std::endl; } @@ -182,7 +239,7 @@ public: outknobs[p.first] = prop; } else { - std::cout << "Key " << p.first << " requires PRIVLVL <= " + std::cerr << "Key " << p.first << " requires PRIVLVL <= " << p.second.priv << " to get, currently at: " << cur_priv << std::endl; } @@ -215,7 +272,7 @@ public: outknobs[p] = prop; } else { - std::cout << "Key " << iter->first << " requires PRIVLVL: <= " + std::cerr << "Key " << iter->first << " requires PRIVLVL: <= " << iter->second.priv << " to get, currently at: " << cur_priv << std::endl; } } diff --git a/gnuradio-runtime/include/gnuradio/thrift_server_template.h b/gnuradio-runtime/include/gnuradio/thrift_server_template.h index e2d6f63a69..632a902360 100644 --- a/gnuradio-runtime/include/gnuradio/thrift_server_template.h +++ b/gnuradio-runtime/include/gnuradio/thrift_server_template.h @@ -25,7 +25,6 @@ #include <gnuradio/prefs.h> #include <gnuradio/logger.h> -#include <gnuradio/rpcserver_thrift.h> #include <gnuradio/thrift_application_base.h> #include <iostream> diff --git a/gnuradio-runtime/lib/controlport/rpcserver_aggregator.cc b/gnuradio-runtime/lib/controlport/rpcserver_aggregator.cc index 3ff553af69..e81a899626 100644 --- a/gnuradio-runtime/lib/controlport/rpcserver_aggregator.cc +++ b/gnuradio-runtime/lib/controlport/rpcserver_aggregator.cc @@ -74,6 +74,25 @@ rpcserver_aggregator::unregisterQueryCallback(const std::string &id) unregisterQueryCallback_f<rpcmanager_base::rpcserver_booter_base_sptr, queryCallback_t>(id)); } + + +void +rpcserver_aggregator::registerHandlerCallback(const std::string &id, + const handlerCallback_t callback) +{ + std::for_each(d_serverlist.begin(), d_serverlist.end(), + registerHandlerCallback_f<rpcmanager_base::rpcserver_booter_base_sptr, handlerCallback_t>(id, callback)); +} + +void +rpcserver_aggregator::unregisterHandlerCallback(const std::string &id) +{ + std::for_each(d_serverlist.begin(), d_serverlist.end(), + unregisterHandlerCallback_f<rpcmanager_base::rpcserver_booter_base_sptr, handlerCallback_t>(id)); +} + + + void rpcserver_aggregator::registerServer(rpcmanager_base::rpcserver_booter_base_sptr server) { diff --git a/gnuradio-runtime/lib/controlport/thrift/gnuradio.thrift b/gnuradio-runtime/lib/controlport/thrift/gnuradio.thrift index 023e9fd788..432fb5d76c 100644 --- a/gnuradio-runtime/lib/controlport/thrift/gnuradio.thrift +++ b/gnuradio-runtime/lib/controlport/thrift/gnuradio.thrift @@ -105,5 +105,6 @@ service ControlPort { KnobMap getKnobs(1:KnobIDList knobs); KnobMap getRe(1:KnobIDList knobs); KnobPropMap properties(1:KnobIDList knobs); + void postMessage(1:string blk_alias, 2:string port, 3:string msg); void shutdown(); } diff --git a/gnuradio-runtime/lib/controlport/thrift/rpcserver_thrift.cc b/gnuradio-runtime/lib/controlport/thrift/rpcserver_thrift.cc index e33fea457a..6b912bbfae 100644 --- a/gnuradio-runtime/lib/controlport/thrift/rpcserver_thrift.cc +++ b/gnuradio-runtime/lib/controlport/thrift/rpcserver_thrift.cc @@ -124,6 +124,51 @@ rpcserver_thrift::unregisterQueryCallback(const std::string &id) d_getcallbackmap.erase(iter); } + + +void +rpcserver_thrift::registerHandlerCallback(const std::string &id, + const handlerCallback_t callback) +{ + boost::mutex::scoped_lock lock(d_callback_map_lock); + { + HandlerCallbackMap_t::const_iterator iter(d_handlercallbackmap.find(id)); + if(iter != d_handlercallbackmap.end()) { + std::stringstream s; + s << "rpcserver_thrift:: rpcserver_thrift ERROR registering handler, already registered: " + << id << std::endl; + throw std::runtime_error(s.str().c_str()); + } + } + + if(DEBUG) { + std::cerr << "rpcserver_thrift registering handler: " << id << std::endl; + } + d_handlercallbackmap.insert(HandlerCallbackMap_t::value_type(id, callback)); +} + +void +rpcserver_thrift::unregisterHandlerCallback(const std::string &id) +{ + boost::mutex::scoped_lock lock(d_callback_map_lock); + HandlerCallbackMap_t::iterator iter(d_handlercallbackmap.find(id)); + if(iter == d_handlercallbackmap.end()) { + std::stringstream s; + s << "rpcserver_thrift:: rpcserver_thrift ERROR unregistering handler, registered: " + << id << std::endl; + throw std::runtime_error(s.str().c_str()); + } + + if(DEBUG) { + std::cerr << "rpcserver_thrift unregistering handler: " << id << std::endl; + } + + d_handlercallbackmap.erase(iter); +} + + + + void rpcserver_thrift::setKnobs(const GNURadio::KnobMap& knobs) { @@ -193,6 +238,35 @@ rpcserver_thrift::properties(GNURadio::KnobPropMap& _return, } } + +void +rpcserver_thrift::postMessage(const std::string& alias, + const std::string& port, + const std::string& msg) +{ + // alias and port are received as serialized PMT strings and need to + // be deserialized into PMTs and then the actual info from there. + // The actual message (msg) is also received as a serialized PMT. We + // just need to get the PMT itself out of this to pass to the set_h + // function for handling the message post. + + boost::mutex::scoped_lock lock(d_callback_map_lock); + + pmt::pmt_t alias_pmt = pmt::deserialize_str(alias); + pmt::pmt_t port_pmt = pmt::deserialize_str(port); + pmt::pmt_t msg_pmt = pmt::deserialize_str(msg); + std::string alias_str = pmt::symbol_to_string(alias_pmt); + std::string port_str = pmt::symbol_to_string(port_pmt); + std::string iface = alias_str + "::" + port_str; + + HandlerCallbackMap_t::iterator itr = d_handlercallbackmap.begin(); + for(; itr != d_handlercallbackmap.end(); itr++) { + if(iface == (*itr).first) { + set_h((*itr).second, cur_priv, port_pmt, msg_pmt); + } + } +} + void rpcserver_thrift::shutdown() { if (DEBUG) { diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/RPCConnection.py b/gnuradio-runtime/python/gnuradio/ctrlport/RPCConnection.py index e14cc0cea7..1b129534c9 100644 --- a/gnuradio-runtime/python/gnuradio/ctrlport/RPCConnection.py +++ b/gnuradio-runtime/python/gnuradio/ctrlport/RPCConnection.py @@ -105,6 +105,9 @@ class RPCConnection(object): def getRe(self,*args): raise exceptions.NotImplementedError() + def postMessage(self,*args): + raise exceptions.NotImplementedError() + def setKnobs(self,*args): raise exceptions.NotImplementedError() diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/RPCConnectionThrift.py b/gnuradio-runtime/python/gnuradio/ctrlport/RPCConnectionThrift.py index 9a2a302af5..522c74117b 100644 --- a/gnuradio-runtime/python/gnuradio/ctrlport/RPCConnectionThrift.py +++ b/gnuradio-runtime/python/gnuradio/ctrlport/RPCConnectionThrift.py @@ -27,6 +27,7 @@ from thrift.protocol import TBinaryProtocol from gnuradio.ctrlport.GNURadio import ControlPort from gnuradio.ctrlport import RPCConnection from gnuradio import gr +import pmt import sys class ThriftRadioClient: @@ -196,6 +197,22 @@ class RPCConnectionThrift(RPCConnection.RPCConnection): def shutdown(self): self.thriftclient.radio.shutdown() + def postMessage(self, blk_alias, port, msg): + ''' + blk_alias: the alias of the block we are posting the message + to; must have an open message port named 'port'. + Provide as a string. + port: The name of the message port we are sending the message to. + Provide as a string. + msg: The actual message. Provide this as a PMT of the form + right for the message port. + The alias and port names are converted to PMT symbols and + serialized. The msg is already a PMT and so just serialized. + ''' + self.thriftclient.radio.postMessage(pmt.serialize_str(pmt.intern(blk_alias)), + pmt.serialize_str(pmt.intern(port)), + pmt.serialize_str(msg)); + def printProperties(self, props): info = "" info += "Item:\t\t{0}\n".format(props.description) diff --git a/gr-blocks/examples/ctrlport/CMakeLists.txt b/gr-blocks/examples/ctrlport/CMakeLists.txt index ffa0766c78..23d2db129f 100644 --- a/gr-blocks/examples/ctrlport/CMakeLists.txt +++ b/gr-blocks/examples/ctrlport/CMakeLists.txt @@ -19,7 +19,19 @@ include(GrPython) +install( + FILES + comparing_resamplers.grc + pfb_sync_test.grc + simple_copy.grc + usrp_source_control.grc + DESTINATION ${GR_PKG_DATA_DIR}/examples/ctrlport + COMPONENT "runtime_python" +) + GR_PYTHON_INSTALL(PROGRAMS - DESTINATION ${GR_PKG_CTRLPORT_EXAMPLES_DIR} - COMPONENT "runtime_python" + simple_copy_controller.py + usrp_source_controller.py + DESTINATION ${GR_PKG_DATA_DIR}/examples/ctrlport + COMPONENT "runtime_python" ) diff --git a/gr-blocks/examples/ctrlport/simple_copy.grc b/gr-blocks/examples/ctrlport/simple_copy.grc new file mode 100644 index 0000000000..6e795d751b --- /dev/null +++ b/gr-blocks/examples/ctrlport/simple_copy.grc @@ -0,0 +1,772 @@ +<?xml version='1.0' encoding='utf-8'?> +<?grc format='1' created='3.7.9'?> +<flow_graph> + <timestamp>Sat Mar 16 22:03:14 2013</timestamp> + <block> + <key>options</key> + <param> + <key>author</key> + <value></value> + </param> + <param> + <key>window_size</key> + <value>1280, 1024</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>description</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>generate_options</key> + <value>qt_gui</value> + </param> + <param> + <key>id</key> + <value>simple_copy</value> + </param> + <param> + <key>max_nouts</key> + <value>0</value> + </param> + <param> + <key>realtime_scheduling</key> + <value></value> + </param> + <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>thread_safe_setters</key> + <value></value> + </param> + <param> + <key>title</key> + <value></value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(178, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>samp_rate</value> + </param> + <param> + <key>value</key> + <value>32000</value> + </param> + </block> + <block> + <key>analog_fastnoise_source_x</key> + <param> + <key>amp</key> + <value>0.05</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(32, 203)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>analog_fastnoise_source_x_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>noise_type</key> + <value>analog.GR_GAUSSIAN</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>seed</key> + <value>0</value> + </param> + <param> + <key>samples</key> + <value>8192</value> + </param> + </block> + <block> + <key>analog_sig_source_x</key> + <param> + <key>amp</key> + <value>0.5</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>freq</key> + <value>1000</value> + </param> + <param> + <key>_coordinate</key> + <value>(32, 83)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>analog_sig_source_x_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>offset</key> + <value>0</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>samp_rate</key> + <value>samp_rate</value> + </param> + <param> + <key>waveform</key> + <value>analog.GR_COS_WAVE</value> + </param> + </block> + <block> + <key>blocks_add_xx</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(384, 153)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_add_xx_0</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_copy</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value>Use simple_copy_controller.py +to enable/disablethis block</value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>enabled</key> + <value>False</value> + </param> + <param> + <key>_coordinate</key> + <value>(512, 129)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_copy_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>showports</key> + <value>False</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>blocks_throttle</key> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(200, 115)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>blocks_throttle_0</value> + </param> + <param> + <key>ignoretag</key> + <value>True</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>samples_per_second</key> + <value>samp_rate</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + </block> + <block> + <key>qtgui_time_sink_x</key> + <param> + <key>autoscale</key> + <value>False</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>ctrlpanel</key> + <value>False</value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>entags</key> + <value>True</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(704, 123)</value> + </param> + <param> + <key>gui_hint</key> + <value></value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>grid</key> + <value>False</value> + </param> + <param> + <key>id</key> + <value>qtgui_time_sink_x_0</value> + </param> + <param> + <key>legend</key> + <value>False</value> + </param> + <param> + <key>alpha1</key> + <value>1.0</value> + </param> + <param> + <key>color1</key> + <value>"blue"</value> + </param> + <param> + <key>label1</key> + <value></value> + </param> + <param> + <key>marker1</key> + <value>-1</value> + </param> + <param> + <key>style1</key> + <value>1</value> + </param> + <param> + <key>width1</key> + <value>1</value> + </param> + <param> + <key>alpha10</key> + <value>1.0</value> + </param> + <param> + <key>color10</key> + <value>"blue"</value> + </param> + <param> + <key>label10</key> + <value></value> + </param> + <param> + <key>marker10</key> + <value>-1</value> + </param> + <param> + <key>style10</key> + <value>1</value> + </param> + <param> + <key>width10</key> + <value>1</value> + </param> + <param> + <key>alpha2</key> + <value>1.0</value> + </param> + <param> + <key>color2</key> + <value>"red"</value> + </param> + <param> + <key>label2</key> + <value></value> + </param> + <param> + <key>marker2</key> + <value>-1</value> + </param> + <param> + <key>style2</key> + <value>1</value> + </param> + <param> + <key>width2</key> + <value>1</value> + </param> + <param> + <key>alpha3</key> + <value>1.0</value> + </param> + <param> + <key>color3</key> + <value>"green"</value> + </param> + <param> + <key>label3</key> + <value></value> + </param> + <param> + <key>marker3</key> + <value>-1</value> + </param> + <param> + <key>style3</key> + <value>1</value> + </param> + <param> + <key>width3</key> + <value>1</value> + </param> + <param> + <key>alpha4</key> + <value>1.0</value> + </param> + <param> + <key>color4</key> + <value>"black"</value> + </param> + <param> + <key>label4</key> + <value></value> + </param> + <param> + <key>marker4</key> + <value>-1</value> + </param> + <param> + <key>style4</key> + <value>1</value> + </param> + <param> + <key>width4</key> + <value>1</value> + </param> + <param> + <key>alpha5</key> + <value>1.0</value> + </param> + <param> + <key>color5</key> + <value>"cyan"</value> + </param> + <param> + <key>label5</key> + <value></value> + </param> + <param> + <key>marker5</key> + <value>-1</value> + </param> + <param> + <key>style5</key> + <value>1</value> + </param> + <param> + <key>width5</key> + <value>1</value> + </param> + <param> + <key>alpha6</key> + <value>1.0</value> + </param> + <param> + <key>color6</key> + <value>"magenta"</value> + </param> + <param> + <key>label6</key> + <value></value> + </param> + <param> + <key>marker6</key> + <value>-1</value> + </param> + <param> + <key>style6</key> + <value>1</value> + </param> + <param> + <key>width6</key> + <value>1</value> + </param> + <param> + <key>alpha7</key> + <value>1.0</value> + </param> + <param> + <key>color7</key> + <value>"yellow"</value> + </param> + <param> + <key>label7</key> + <value></value> + </param> + <param> + <key>marker7</key> + <value>-1</value> + </param> + <param> + <key>style7</key> + <value>1</value> + </param> + <param> + <key>width7</key> + <value>1</value> + </param> + <param> + <key>alpha8</key> + <value>1.0</value> + </param> + <param> + <key>color8</key> + <value>"dark red"</value> + </param> + <param> + <key>label8</key> + <value></value> + </param> + <param> + <key>marker8</key> + <value>-1</value> + </param> + <param> + <key>style8</key> + <value>1</value> + </param> + <param> + <key>width8</key> + <value>1</value> + </param> + <param> + <key>alpha9</key> + <value>1.0</value> + </param> + <param> + <key>color9</key> + <value>"dark green"</value> + </param> + <param> + <key>label9</key> + <value></value> + </param> + <param> + <key>marker9</key> + <value>-1</value> + </param> + <param> + <key>style9</key> + <value>1</value> + </param> + <param> + <key>width9</key> + <value>1</value> + </param> + <param> + <key>name</key> + <value>""</value> + </param> + <param> + <key>nconnections</key> + <value>1</value> + </param> + <param> + <key>size</key> + <value>1024</value> + </param> + <param> + <key>srate</key> + <value>samp_rate</value> + </param> + <param> + <key>tr_chan</key> + <value>0</value> + </param> + <param> + <key>tr_delay</key> + <value>0</value> + </param> + <param> + <key>tr_level</key> + <value>0.0</value> + </param> + <param> + <key>tr_mode</key> + <value>qtgui.TRIG_MODE_FREE</value> + </param> + <param> + <key>tr_slope</key> + <value>qtgui.TRIG_SLOPE_POS</value> + </param> + <param> + <key>tr_tag</key> + <value>""</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>update_time</key> + <value>0.10</value> + </param> + <param> + <key>ylabel</key> + <value>Amplitude</value> + </param> + <param> + <key>yunit</key> + <value>""</value> + </param> + <param> + <key>ymax</key> + <value>1</value> + </param> + <param> + <key>ymin</key> + <value>-1</value> + </param> + </block> + <connection> + <source_block_id>analog_fastnoise_source_x_0</source_block_id> + <sink_block_id>blocks_add_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>analog_sig_source_x_0</source_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_add_xx_0</source_block_id> + <sink_block_id>blocks_copy_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_copy_0</source_block_id> + <sink_block_id>qtgui_time_sink_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blocks_throttle_0</source_block_id> + <sink_block_id>blocks_add_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> +</flow_graph> diff --git a/gr-blocks/examples/ctrlport/simple_copy_controller.py b/gr-blocks/examples/ctrlport/simple_copy_controller.py new file mode 100755 index 0000000000..7bd05006f5 --- /dev/null +++ b/gr-blocks/examples/ctrlport/simple_copy_controller.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +import sys +import pmt +from gnuradio.ctrlport.GNURadioControlPortClient import GNURadioControlPortClient + +args = sys.argv +if(len(args) < 4): + sys.stderr.write('Not enough arguments: simple_copy_controller.py <host> <port> [true|false]\n\n') + sys.exit(1) + +hostname = args[1] +portnum = int(args[2]) +msg = args[3].lower() +argv = [None, hostname, portnum] +radiosys = GNURadioControlPortClient(argv=argv, rpcmethod='thrift') +radio = radiosys.client + +if(msg == 'true'): + radio.postMessage('copy0', 'en', pmt.PMT_T) +elif(msg == 'false'): + radio.postMessage('copy0', 'en', pmt.PMT_F) +else: + sys.stderr.write('Unrecognized message: must be true or false.\n\n') + sys.exit(1) diff --git a/gr-blocks/examples/ctrlport/usrp_source_control.grc b/gr-blocks/examples/ctrlport/usrp_source_control.grc new file mode 100644 index 0000000000..b6683888b8 --- /dev/null +++ b/gr-blocks/examples/ctrlport/usrp_source_control.grc @@ -0,0 +1,1837 @@ +<?xml version='1.0' encoding='utf-8'?> +<?grc format='1' created='3.7.9'?> +<flow_graph> + <timestamp>Sat Mar 16 22:03:14 2013</timestamp> + <block> + <key>options</key> + <param> + <key>author</key> + <value></value> + </param> + <param> + <key>window_size</key> + <value>1280, 1024</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>description</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>generate_options</key> + <value>qt_gui</value> + </param> + <param> + <key>id</key> + <value>usrp_source_control</value> + </param> + <param> + <key>max_nouts</key> + <value>0</value> + </param> + <param> + <key>realtime_scheduling</key> + <value></value> + </param> + <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>thread_safe_setters</key> + <value></value> + </param> + <param> + <key>title</key> + <value></value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(178, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>samp_rate</value> + </param> + <param> + <key>value</key> + <value>1000000</value> + </param> + </block> + <block> + <key>qtgui_freq_sink_x</key> + <param> + <key>autoscale</key> + <value>False</value> + </param> + <param> + <key>average</key> + <value>1.0</value> + </param> + <param> + <key>bw</key> + <value>samp_rate</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>fc</key> + <value>0</value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>ctrlpanel</key> + <value>False</value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>fftsize</key> + <value>1024</value> + </param> + <param> + <key>_coordinate</key> + <value>(256, 171)</value> + </param> + <param> + <key>gui_hint</key> + <value></value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>grid</key> + <value>False</value> + </param> + <param> + <key>id</key> + <value>qtgui_freq_sink_x_0</value> + </param> + <param> + <key>legend</key> + <value>False</value> + </param> + <param> + <key>alpha1</key> + <value>1.0</value> + </param> + <param> + <key>color1</key> + <value>"blue"</value> + </param> + <param> + <key>label1</key> + <value></value> + </param> + <param> + <key>width1</key> + <value>1</value> + </param> + <param> + <key>alpha10</key> + <value>1.0</value> + </param> + <param> + <key>color10</key> + <value>"dark blue"</value> + </param> + <param> + <key>label10</key> + <value></value> + </param> + <param> + <key>width10</key> + <value>1</value> + </param> + <param> + <key>alpha2</key> + <value>1.0</value> + </param> + <param> + <key>color2</key> + <value>"red"</value> + </param> + <param> + <key>label2</key> + <value></value> + </param> + <param> + <key>width2</key> + <value>1</value> + </param> + <param> + <key>alpha3</key> + <value>1.0</value> + </param> + <param> + <key>color3</key> + <value>"green"</value> + </param> + <param> + <key>label3</key> + <value></value> + </param> + <param> + <key>width3</key> + <value>1</value> + </param> + <param> + <key>alpha4</key> + <value>1.0</value> + </param> + <param> + <key>color4</key> + <value>"black"</value> + </param> + <param> + <key>label4</key> + <value></value> + </param> + <param> + <key>width4</key> + <value>1</value> + </param> + <param> + <key>alpha5</key> + <value>1.0</value> + </param> + <param> + <key>color5</key> + <value>"cyan"</value> + </param> + <param> + <key>label5</key> + <value></value> + </param> + <param> + <key>width5</key> + <value>1</value> + </param> + <param> + <key>alpha6</key> + <value>1.0</value> + </param> + <param> + <key>color6</key> + <value>"magenta"</value> + </param> + <param> + <key>label6</key> + <value></value> + </param> + <param> + <key>width6</key> + <value>1</value> + </param> + <param> + <key>alpha7</key> + <value>1.0</value> + </param> + <param> + <key>color7</key> + <value>"yellow"</value> + </param> + <param> + <key>label7</key> + <value></value> + </param> + <param> + <key>width7</key> + <value>1</value> + </param> + <param> + <key>alpha8</key> + <value>1.0</value> + </param> + <param> + <key>color8</key> + <value>"dark red"</value> + </param> + <param> + <key>label8</key> + <value></value> + </param> + <param> + <key>width8</key> + <value>1</value> + </param> + <param> + <key>alpha9</key> + <value>1.0</value> + </param> + <param> + <key>color9</key> + <value>"dark green"</value> + </param> + <param> + <key>label9</key> + <value></value> + </param> + <param> + <key>width9</key> + <value>1</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>name</key> + <value>""</value> + </param> + <param> + <key>nconnections</key> + <value>1</value> + </param> + <param> + <key>showports</key> + <value>True</value> + </param> + <param> + <key>freqhalf</key> + <value>True</value> + </param> + <param> + <key>tr_chan</key> + <value>0</value> + </param> + <param> + <key>tr_level</key> + <value>0.0</value> + </param> + <param> + <key>tr_mode</key> + <value>qtgui.TRIG_MODE_FREE</value> + </param> + <param> + <key>tr_tag</key> + <value>""</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>update_time</key> + <value>0.10</value> + </param> + <param> + <key>wintype</key> + <value>firdes.WIN_BLACKMAN_hARRIS</value> + </param> + <param> + <key>ymax</key> + <value>10</value> + </param> + <param> + <key>ymin</key> + <value>-140</value> + </param> + </block> + <block> + <key>qtgui_time_sink_x</key> + <param> + <key>autoscale</key> + <value>False</value> + </param> + <param> + <key>alias</key> + <value></value> + </param> + <param> + <key>comment</key> + <value></value> + </param> + <param> + <key>ctrlpanel</key> + <value>False</value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>entags</key> + <value>True</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(256, 83)</value> + </param> + <param> + <key>gui_hint</key> + <value></value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>grid</key> + <value>False</value> + </param> + <param> + <key>id</key> + <value>qtgui_time_sink_x_0</value> + </param> + <param> + <key>legend</key> + <value>False</value> + </param> + <param> + <key>alpha1</key> + <value>1.0</value> + </param> + <param> + <key>color1</key> + <value>"blue"</value> + </param> + <param> + <key>label1</key> + <value></value> + </param> + <param> + <key>marker1</key> + <value>-1</value> + </param> + <param> + <key>style1</key> + <value>1</value> + </param> + <param> + <key>width1</key> + <value>1</value> + </param> + <param> + <key>alpha10</key> + <value>1.0</value> + </param> + <param> + <key>color10</key> + <value>"blue"</value> + </param> + <param> + <key>label10</key> + <value></value> + </param> + <param> + <key>marker10</key> + <value>-1</value> + </param> + <param> + <key>style10</key> + <value>1</value> + </param> + <param> + <key>width10</key> + <value>1</value> + </param> + <param> + <key>alpha2</key> + <value>1.0</value> + </param> + <param> + <key>color2</key> + <value>"red"</value> + </param> + <param> + <key>label2</key> + <value></value> + </param> + <param> + <key>marker2</key> + <value>-1</value> + </param> + <param> + <key>style2</key> + <value>1</value> + </param> + <param> + <key>width2</key> + <value>1</value> + </param> + <param> + <key>alpha3</key> + <value>1.0</value> + </param> + <param> + <key>color3</key> + <value>"green"</value> + </param> + <param> + <key>label3</key> + <value></value> + </param> + <param> + <key>marker3</key> + <value>-1</value> + </param> + <param> + <key>style3</key> + <value>1</value> + </param> + <param> + <key>width3</key> + <value>1</value> + </param> + <param> + <key>alpha4</key> + <value>1.0</value> + </param> + <param> + <key>color4</key> + <value>"black"</value> + </param> + <param> + <key>label4</key> + <value></value> + </param> + <param> + <key>marker4</key> + <value>-1</value> + </param> + <param> + <key>style4</key> + <value>1</value> + </param> + <param> + <key>width4</key> + <value>1</value> + </param> + <param> + <key>alpha5</key> + <value>1.0</value> + </param> + <param> + <key>color5</key> + <value>"cyan"</value> + </param> + <param> + <key>label5</key> + <value></value> + </param> + <param> + <key>marker5</key> + <value>-1</value> + </param> + <param> + <key>style5</key> + <value>1</value> + </param> + <param> + <key>width5</key> + <value>1</value> + </param> + <param> + <key>alpha6</key> + <value>1.0</value> + </param> + <param> + <key>color6</key> + <value>"magenta"</value> + </param> + <param> + <key>label6</key> + <value></value> + </param> + <param> + <key>marker6</key> + <value>-1</value> + </param> + <param> + <key>style6</key> + <value>1</value> + </param> + <param> + <key>width6</key> + <value>1</value> + </param> + <param> + <key>alpha7</key> + <value>1.0</value> + </param> + <param> + <key>color7</key> + <value>"yellow"</value> + </param> + <param> + <key>label7</key> + <value></value> + </param> + <param> + <key>marker7</key> + <value>-1</value> + </param> + <param> + <key>style7</key> + <value>1</value> + </param> + <param> + <key>width7</key> + <value>1</value> + </param> + <param> + <key>alpha8</key> + <value>1.0</value> + </param> + <param> + <key>color8</key> + <value>"dark red"</value> + </param> + <param> + <key>label8</key> + <value></value> + </param> + <param> + <key>marker8</key> + <value>-1</value> + </param> + <param> + <key>style8</key> + <value>1</value> + </param> + <param> + <key>width8</key> + <value>1</value> + </param> + <param> + <key>alpha9</key> + <value>1.0</value> + </param> + <param> + <key>color9</key> + <value>"dark green"</value> + </param> + <param> + <key>label9</key> + <value></value> + </param> + <param> + <key>marker9</key> + <value>-1</value> + </param> + <param> + <key>style9</key> + <value>1</value> + </param> + <param> + <key>width9</key> + <value>1</value> + </param> + <param> + <key>name</key> + <value>""</value> + </param> + <param> + <key>nconnections</key> + <value>1</value> + </param> + <param> + <key>size</key> + <value>1024</value> + </param> + <param> + <key>srate</key> + <value>samp_rate</value> + </param> + <param> + <key>tr_chan</key> + <value>0</value> + </param> + <param> + <key>tr_delay</key> + <value>0</value> + </param> + <param> + <key>tr_level</key> + <value>0.0</value> + </param> + <param> + <key>tr_mode</key> + <value>qtgui.TRIG_MODE_FREE</value> + </param> + <param> + <key>tr_slope</key> + <value>qtgui.TRIG_SLOPE_POS</value> + </param> + <param> + <key>tr_tag</key> + <value>""</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>update_time</key> + <value>0.10</value> + </param> + <param> + <key>ylabel</key> + <value>Amplitude</value> + </param> + <param> + <key>yunit</key> + <value>""</value> + </param> + <param> + <key>ymax</key> + <value>1</value> + </param> + <param> + <key>ymin</key> + <value>-1</value> + </param> + </block> + <block> + <key>uhd_usrp_source</key> + <param> + <key>alias</key> + <value>usrp_source0</value> + </param> + <param> + <key>ant0</key> + <value></value> + </param> + <param> + <key>bw0</key> + <value>0</value> + </param> + <param> + <key>center_freq0</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb0</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb0</key> + <value>""</value> + </param> + <param> + <key>norm_gain0</key> + <value>False</value> + </param> + <param> + <key>gain0</key> + <value>0</value> + </param> + <param> + <key>ant10</key> + <value></value> + </param> + <param> + <key>bw10</key> + <value>0</value> + </param> + <param> + <key>center_freq10</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb10</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb10</key> + <value>""</value> + </param> + <param> + <key>norm_gain10</key> + <value>False</value> + </param> + <param> + <key>gain10</key> + <value>0</value> + </param> + <param> + <key>ant11</key> + <value></value> + </param> + <param> + <key>bw11</key> + <value>0</value> + </param> + <param> + <key>center_freq11</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb11</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb11</key> + <value>""</value> + </param> + <param> + <key>norm_gain11</key> + <value>False</value> + </param> + <param> + <key>gain11</key> + <value>0</value> + </param> + <param> + <key>ant12</key> + <value></value> + </param> + <param> + <key>bw12</key> + <value>0</value> + </param> + <param> + <key>center_freq12</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb12</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb12</key> + <value>""</value> + </param> + <param> + <key>norm_gain12</key> + <value>False</value> + </param> + <param> + <key>gain12</key> + <value>0</value> + </param> + <param> + <key>ant13</key> + <value></value> + </param> + <param> + <key>bw13</key> + <value>0</value> + </param> + <param> + <key>center_freq13</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb13</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb13</key> + <value>""</value> + </param> + <param> + <key>norm_gain13</key> + <value>False</value> + </param> + <param> + <key>gain13</key> + <value>0</value> + </param> + <param> + <key>ant14</key> + <value></value> + </param> + <param> + <key>bw14</key> + <value>0</value> + </param> + <param> + <key>center_freq14</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb14</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb14</key> + <value>""</value> + </param> + <param> + <key>norm_gain14</key> + <value>False</value> + </param> + <param> + <key>gain14</key> + <value>0</value> + </param> + <param> + <key>ant15</key> + <value></value> + </param> + <param> + <key>bw15</key> + <value>0</value> + </param> + <param> + <key>center_freq15</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb15</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb15</key> + <value>""</value> + </param> + <param> + <key>norm_gain15</key> + <value>False</value> + </param> + <param> + <key>gain15</key> + <value>0</value> + </param> + <param> + <key>ant16</key> + <value></value> + </param> + <param> + <key>bw16</key> + <value>0</value> + </param> + <param> + <key>center_freq16</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb16</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb16</key> + <value>""</value> + </param> + <param> + <key>norm_gain16</key> + <value>False</value> + </param> + <param> + <key>gain16</key> + <value>0</value> + </param> + <param> + <key>ant17</key> + <value></value> + </param> + <param> + <key>bw17</key> + <value>0</value> + </param> + <param> + <key>center_freq17</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb17</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb17</key> + <value>""</value> + </param> + <param> + <key>norm_gain17</key> + <value>False</value> + </param> + <param> + <key>gain17</key> + <value>0</value> + </param> + <param> + <key>ant18</key> + <value></value> + </param> + <param> + <key>bw18</key> + <value>0</value> + </param> + <param> + <key>center_freq18</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb18</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb18</key> + <value>""</value> + </param> + <param> + <key>norm_gain18</key> + <value>False</value> + </param> + <param> + <key>gain18</key> + <value>0</value> + </param> + <param> + <key>ant19</key> + <value></value> + </param> + <param> + <key>bw19</key> + <value>0</value> + </param> + <param> + <key>center_freq19</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb19</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb19</key> + <value>""</value> + </param> + <param> + <key>norm_gain19</key> + <value>False</value> + </param> + <param> + <key>gain19</key> + <value>0</value> + </param> + <param> + <key>ant1</key> + <value></value> + </param> + <param> + <key>bw1</key> + <value>0</value> + </param> + <param> + <key>center_freq1</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb1</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb1</key> + <value>""</value> + </param> + <param> + <key>norm_gain1</key> + <value>False</value> + </param> + <param> + <key>gain1</key> + <value>0</value> + </param> + <param> + <key>ant20</key> + <value></value> + </param> + <param> + <key>bw20</key> + <value>0</value> + </param> + <param> + <key>center_freq20</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb20</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb20</key> + <value>""</value> + </param> + <param> + <key>norm_gain20</key> + <value>False</value> + </param> + <param> + <key>gain20</key> + <value>0</value> + </param> + <param> + <key>ant21</key> + <value></value> + </param> + <param> + <key>bw21</key> + <value>0</value> + </param> + <param> + <key>center_freq21</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb21</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb21</key> + <value>""</value> + </param> + <param> + <key>norm_gain21</key> + <value>False</value> + </param> + <param> + <key>gain21</key> + <value>0</value> + </param> + <param> + <key>ant22</key> + <value></value> + </param> + <param> + <key>bw22</key> + <value>0</value> + </param> + <param> + <key>center_freq22</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb22</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb22</key> + <value>""</value> + </param> + <param> + <key>norm_gain22</key> + <value>False</value> + </param> + <param> + <key>gain22</key> + <value>0</value> + </param> + <param> + <key>ant23</key> + <value></value> + </param> + <param> + <key>bw23</key> + <value>0</value> + </param> + <param> + <key>center_freq23</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb23</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb23</key> + <value>""</value> + </param> + <param> + <key>norm_gain23</key> + <value>False</value> + </param> + <param> + <key>gain23</key> + <value>0</value> + </param> + <param> + <key>ant24</key> + <value></value> + </param> + <param> + <key>bw24</key> + <value>0</value> + </param> + <param> + <key>center_freq24</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb24</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb24</key> + <value>""</value> + </param> + <param> + <key>norm_gain24</key> + <value>False</value> + </param> + <param> + <key>gain24</key> + <value>0</value> + </param> + <param> + <key>ant25</key> + <value></value> + </param> + <param> + <key>bw25</key> + <value>0</value> + </param> + <param> + <key>center_freq25</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb25</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb25</key> + <value>""</value> + </param> + <param> + <key>norm_gain25</key> + <value>False</value> + </param> + <param> + <key>gain25</key> + <value>0</value> + </param> + <param> + <key>ant26</key> + <value></value> + </param> + <param> + <key>bw26</key> + <value>0</value> + </param> + <param> + <key>center_freq26</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb26</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb26</key> + <value>""</value> + </param> + <param> + <key>norm_gain26</key> + <value>False</value> + </param> + <param> + <key>gain26</key> + <value>0</value> + </param> + <param> + <key>ant27</key> + <value></value> + </param> + <param> + <key>bw27</key> + <value>0</value> + </param> + <param> + <key>center_freq27</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb27</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb27</key> + <value>""</value> + </param> + <param> + <key>norm_gain27</key> + <value>False</value> + </param> + <param> + <key>gain27</key> + <value>0</value> + </param> + <param> + <key>ant28</key> + <value></value> + </param> + <param> + <key>bw28</key> + <value>0</value> + </param> + <param> + <key>center_freq28</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb28</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb28</key> + <value>""</value> + </param> + <param> + <key>norm_gain28</key> + <value>False</value> + </param> + <param> + <key>gain28</key> + <value>0</value> + </param> + <param> + <key>ant29</key> + <value></value> + </param> + <param> + <key>bw29</key> + <value>0</value> + </param> + <param> + <key>center_freq29</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb29</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb29</key> + <value>""</value> + </param> + <param> + <key>norm_gain29</key> + <value>False</value> + </param> + <param> + <key>gain29</key> + <value>0</value> + </param> + <param> + <key>ant2</key> + <value></value> + </param> + <param> + <key>bw2</key> + <value>0</value> + </param> + <param> + <key>center_freq2</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb2</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb2</key> + <value>""</value> + </param> + <param> + <key>norm_gain2</key> + <value>False</value> + </param> + <param> + <key>gain2</key> + <value>0</value> + </param> + <param> + <key>ant30</key> + <value></value> + </param> + <param> + <key>bw30</key> + <value>0</value> + </param> + <param> + <key>center_freq30</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb30</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb30</key> + <value>""</value> + </param> + <param> + <key>norm_gain30</key> + <value>False</value> + </param> + <param> + <key>gain30</key> + <value>0</value> + </param> + <param> + <key>ant31</key> + <value></value> + </param> + <param> + <key>bw31</key> + <value>0</value> + </param> + <param> + <key>center_freq31</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb31</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb31</key> + <value>""</value> + </param> + <param> + <key>norm_gain31</key> + <value>False</value> + </param> + <param> + <key>gain31</key> + <value>0</value> + </param> + <param> + <key>ant3</key> + <value></value> + </param> + <param> + <key>bw3</key> + <value>0</value> + </param> + <param> + <key>center_freq3</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb3</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb3</key> + <value>""</value> + </param> + <param> + <key>norm_gain3</key> + <value>False</value> + </param> + <param> + <key>gain3</key> + <value>0</value> + </param> + <param> + <key>ant4</key> + <value></value> + </param> + <param> + <key>bw4</key> + <value>0</value> + </param> + <param> + <key>center_freq4</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb4</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb4</key> + <value>""</value> + </param> + <param> + <key>norm_gain4</key> + <value>False</value> + </param> + <param> + <key>gain4</key> + <value>0</value> + </param> + <param> + <key>ant5</key> + <value></value> + </param> + <param> + <key>bw5</key> + <value>0</value> + </param> + <param> + <key>center_freq5</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb5</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb5</key> + <value>""</value> + </param> + <param> + <key>norm_gain5</key> + <value>False</value> + </param> + <param> + <key>gain5</key> + <value>0</value> + </param> + <param> + <key>ant6</key> + <value></value> + </param> + <param> + <key>bw6</key> + <value>0</value> + </param> + <param> + <key>center_freq6</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb6</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb6</key> + <value>""</value> + </param> + <param> + <key>norm_gain6</key> + <value>False</value> + </param> + <param> + <key>gain6</key> + <value>0</value> + </param> + <param> + <key>ant7</key> + <value></value> + </param> + <param> + <key>bw7</key> + <value>0</value> + </param> + <param> + <key>center_freq7</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb7</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb7</key> + <value>""</value> + </param> + <param> + <key>norm_gain7</key> + <value>False</value> + </param> + <param> + <key>gain7</key> + <value>0</value> + </param> + <param> + <key>ant8</key> + <value></value> + </param> + <param> + <key>bw8</key> + <value>0</value> + </param> + <param> + <key>center_freq8</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb8</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb8</key> + <value>""</value> + </param> + <param> + <key>norm_gain8</key> + <value>False</value> + </param> + <param> + <key>gain8</key> + <value>0</value> + </param> + <param> + <key>ant9</key> + <value></value> + </param> + <param> + <key>bw9</key> + <value>0</value> + </param> + <param> + <key>center_freq9</key> + <value>0</value> + </param> + <param> + <key>dc_offs_enb9</key> + <value>""</value> + </param> + <param> + <key>iq_imbal_enb9</key> + <value>""</value> + </param> + <param> + <key>norm_gain9</key> + <value>False</value> + </param> + <param> + <key>gain9</key> + <value>0</value> + </param> + <param> + <key>clock_rate</key> + <value>0.0</value> + </param> + <param> + <key>comment</key> + <value>Use usrp_source_controller.py +to change frequency and gain.</value> + </param> + <param> + <key>affinity</key> + <value></value> + </param> + <param> + <key>dev_addr</key> + <value>addr=192.168.10.2</value> + </param> + <param> + <key>dev_args</key> + <value>""</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(24, 123)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + <param> + <key>id</key> + <value>uhd_usrp_source_0</value> + </param> + <param> + <key>maxoutbuf</key> + <value>0</value> + </param> + <param> + <key>clock_source0</key> + <value></value> + </param> + <param> + <key>sd_spec0</key> + <value></value> + </param> + <param> + <key>time_source0</key> + <value></value> + </param> + <param> + <key>clock_source1</key> + <value></value> + </param> + <param> + <key>sd_spec1</key> + <value></value> + </param> + <param> + <key>time_source1</key> + <value></value> + </param> + <param> + <key>clock_source2</key> + <value></value> + </param> + <param> + <key>sd_spec2</key> + <value></value> + </param> + <param> + <key>time_source2</key> + <value></value> + </param> + <param> + <key>clock_source3</key> + <value></value> + </param> + <param> + <key>sd_spec3</key> + <value></value> + </param> + <param> + <key>time_source3</key> + <value></value> + </param> + <param> + <key>clock_source4</key> + <value></value> + </param> + <param> + <key>sd_spec4</key> + <value></value> + </param> + <param> + <key>time_source4</key> + <value></value> + </param> + <param> + <key>clock_source5</key> + <value></value> + </param> + <param> + <key>sd_spec5</key> + <value></value> + </param> + <param> + <key>time_source5</key> + <value></value> + </param> + <param> + <key>clock_source6</key> + <value></value> + </param> + <param> + <key>sd_spec6</key> + <value></value> + </param> + <param> + <key>time_source6</key> + <value></value> + </param> + <param> + <key>clock_source7</key> + <value></value> + </param> + <param> + <key>sd_spec7</key> + <value></value> + </param> + <param> + <key>time_source7</key> + <value></value> + </param> + <param> + <key>minoutbuf</key> + <value>0</value> + </param> + <param> + <key>nchan</key> + <value>1</value> + </param> + <param> + <key>num_mboards</key> + <value>1</value> + </param> + <param> + <key>type</key> + <value>fc32</value> + </param> + <param> + <key>samp_rate</key> + <value>samp_rate</value> + </param> + <param> + <key>hide_cmd_port</key> + <value>False</value> + </param> + <param> + <key>stream_args</key> + <value></value> + </param> + <param> + <key>stream_chans</key> + <value>[]</value> + </param> + <param> + <key>sync</key> + <value></value> + </param> + <param> + <key>otw</key> + <value></value> + </param> + </block> + <connection> + <source_block_id>uhd_usrp_source_0</source_block_id> + <sink_block_id>qtgui_freq_sink_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>uhd_usrp_source_0</source_block_id> + <sink_block_id>qtgui_time_sink_x_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> +</flow_graph> diff --git a/gr-blocks/examples/ctrlport/usrp_source_controller.py b/gr-blocks/examples/ctrlport/usrp_source_controller.py new file mode 100755 index 0000000000..77a6cb482b --- /dev/null +++ b/gr-blocks/examples/ctrlport/usrp_source_controller.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +import sys +import pmt +from gnuradio.ctrlport.GNURadioControlPortClient import GNURadioControlPortClient + +args = sys.argv +if(len(args) < 4): + sys.stderr.write('Not enough arguments: usrp_source_controller.py <host> <port> <command> <value>\n') + sys.stderr.write('See the "UHD Interface" section of the manual for available commands.\n\n') + sys.exit(1) + +alias = 'usrp_source0' +port = 'command' + +hostname = args[1] +portnum = int(args[2]) +cmd = args[3].lower() + +if(cmd == "antenna"): + val = pmt.intern(args[4]) +else: + val = pmt.from_double(float(args[4])) + +argv = [None, hostname, portnum] +radiosys = GNURadioControlPortClient(argv=argv, rpcmethod='thrift') +radio = radiosys.client + +radio.postMessage(alias, port, pmt.cons(pmt.intern(cmd), val)) diff --git a/gr-blocks/include/gnuradio/blocks/CMakeLists.txt b/gr-blocks/include/gnuradio/blocks/CMakeLists.txt index 3364423863..429ca51fba 100644 --- a/gr-blocks/include/gnuradio/blocks/CMakeLists.txt +++ b/gr-blocks/include/gnuradio/blocks/CMakeLists.txt @@ -23,7 +23,6 @@ include(GrMiscUtils) GR_EXPAND_X_H(blocks abs_XX ss ii ff) GR_EXPAND_X_H(blocks add_XX ss ii cc) -GR_EXPAND_X_H(blocks add_const_XX bb ss ii ff cc) GR_EXPAND_X_H(blocks add_const_vXX bb ss ii ff cc) GR_EXPAND_X_H(blocks and_XX bb ss ii) GR_EXPAND_X_H(blocks and_const_XX bb ss ii) @@ -74,6 +73,11 @@ install(FILES unpack_k_bits.h wavfile.h add_ff.h + add_const_bb.h + add_const_ss.h + add_const_ii.h + add_const_ff.h + add_const_cc.h annotator_1to1.h annotator_alltoall.h annotator_raw.h diff --git a/gr-blocks/include/gnuradio/blocks/add_const_bb.h b/gr-blocks/include/gnuradio/blocks/add_const_bb.h new file mode 100644 index 0000000000..4e456f9532 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/add_const_bb.h @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012,2015 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 ADD_CONST_BB +#define ADD_CONST_BB + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = input + constant + * \ingroup math_operators_blk + */ + class BLOCKS_API add_const_bb : virtual public sync_block + { + public: + + // gr::blocks::add_const_bb::sptr + typedef boost::shared_ptr<add_const_bb> sptr; + + /*! + * \brief Create an instance of add_const_bb + * \param k additive constant + */ + static sptr make(char k); + + /*! + * \brief Return additive constant + */ + virtual char k() const = 0; + + /*! + * \brief Set additive constant + */ + virtual void set_k(char k) = 0; + }; + + } +} + +#endif /* ADD_CONST_BB */ diff --git a/gr-blocks/include/gnuradio/blocks/add_const_cc.h b/gr-blocks/include/gnuradio/blocks/add_const_cc.h new file mode 100644 index 0000000000..35a15f72a8 --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/add_const_cc.h @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012,2015 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 ADD_CONST_CC +#define ADD_CONST_CC + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = input + constant + * \ingroup math_operators_blk + */ + class BLOCKS_API add_const_cc : virtual public sync_block + { + public: + + // gr::blocks::add_const_cc::sptr + typedef boost::shared_ptr<add_const_cc> sptr; + + /*! + * \brief Create an instance of add_const_cc + * \param k additive constant + */ + static sptr make(gr_complex k); + + /*! + * \brief Return additive constant + */ + virtual gr_complex k() const = 0; + + /*! + * \brief Set additive constant + */ + virtual void set_k(gr_complex k) = 0; + }; + + } +} + +#endif /* ADD_CONST_CC */ diff --git a/gr-blocks/include/gnuradio/blocks/add_const_ff.h b/gr-blocks/include/gnuradio/blocks/add_const_ff.h new file mode 100644 index 0000000000..66be094dab --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/add_const_ff.h @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012,2015 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 ADD_CONST_FF +#define ADD_CONST_FF + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = input + constant + * \ingroup math_operators_blk + */ + class BLOCKS_API add_const_ff : virtual public sync_block + { + public: + + // gr::blocks::add_const_ff::sptr + typedef boost::shared_ptr<add_const_ff> sptr; + + /*! + * \brief Create an instance of add_const_ff + * \param k additive constant + */ + static sptr make(float k); + + /*! + * \brief Return additive constant + */ + virtual float k() const = 0; + + /*! + * \brief Set additive constant + */ + virtual void set_k(float k) = 0; + }; + + } +} + +#endif /* ADD_CONST_FF */ diff --git a/gr-blocks/include/gnuradio/blocks/add_const_XX.h.t b/gr-blocks/include/gnuradio/blocks/add_const_ii.h index 723fc78218..246902caf4 100644 --- a/gr-blocks/include/gnuradio/blocks/add_const_XX.h.t +++ b/gr-blocks/include/gnuradio/blocks/add_const_ii.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2012 Free Software Foundation, Inc. + * Copyright 2004,2012,2015 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,10 +20,8 @@ * Boston, MA 02110-1301, USA. */ -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ +#ifndef ADD_CONST_II +#define ADD_CONST_II #include <gnuradio/blocks/api.h> #include <gnuradio/sync_block.h> @@ -35,31 +33,31 @@ namespace gr { * \brief output = input + constant * \ingroup math_operators_blk */ - class BLOCKS_API @NAME@ : virtual public sync_block + class BLOCKS_API add_const_ii : virtual public sync_block { public: - // gr::blocks::@NAME@::sptr - typedef boost::shared_ptr<@NAME@> sptr; + // gr::blocks::add_const_ii::sptr + typedef boost::shared_ptr<add_const_ii> sptr; /*! - * \brief Create an instance of @NAME@ + * \brief Create an instance of add_const_ii * \param k additive constant */ - static sptr make(@O_TYPE@ k); + static sptr make(int k); /*! * \brief Return additive constant */ - virtual @O_TYPE@ k() const = 0; + virtual int k() const = 0; /*! * \brief Set additive constant */ - virtual void set_k(@O_TYPE@ k) = 0; + virtual void set_k(int k) = 0; }; } } -#endif /* @GUARD_NAME@ */ +#endif /* ADD_CONST_II */ diff --git a/gr-blocks/include/gnuradio/blocks/add_const_ss.h b/gr-blocks/include/gnuradio/blocks/add_const_ss.h new file mode 100644 index 0000000000..f9beee1b7b --- /dev/null +++ b/gr-blocks/include/gnuradio/blocks/add_const_ss.h @@ -0,0 +1,63 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2012,2015 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 ADD_CONST_SS +#define ADD_CONST_SS + +#include <gnuradio/blocks/api.h> +#include <gnuradio/sync_block.h> + +namespace gr { + namespace blocks { + + /*! + * \brief output = input + constant + * \ingroup math_operators_blk + */ + class BLOCKS_API add_const_ss : virtual public sync_block + { + public: + + // gr::blocks::add_const_ss::sptr + typedef boost::shared_ptr<add_const_ss> sptr; + + /*! + * \brief Create an instance of add_const_ss + * \param k additive constant + */ + static sptr make(short k); + + /*! + * \brief Return additive constant + */ + virtual short k() const = 0; + + /*! + * \brief Set additive constant + */ + virtual void set_k(short k) = 0; + }; + + } +} + +#endif /* ADD_CONST_SS */ diff --git a/gr-blocks/lib/CMakeLists.txt b/gr-blocks/lib/CMakeLists.txt index 6e1a3f2ed3..facff2212b 100644 --- a/gr-blocks/lib/CMakeLists.txt +++ b/gr-blocks/lib/CMakeLists.txt @@ -28,7 +28,6 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/ConfigChecks.cmake) include(GrMiscUtils) GR_EXPAND_X_CC_H_IMPL(blocks abs_XX ss ii ff) GR_EXPAND_X_CC_H_IMPL(blocks add_XX ss ii cc) -GR_EXPAND_X_CC_H_IMPL(blocks add_const_XX bb ss ii ff cc) GR_EXPAND_X_CC_H_IMPL(blocks add_const_vXX bb ss ii ff cc) GR_EXPAND_X_CC_H_IMPL(blocks and_XX bb ss ii) GR_EXPAND_X_CC_H_IMPL(blocks and_const_XX bb ss ii) @@ -88,6 +87,11 @@ list(APPEND gr_blocks_sources unpack_k_bits.cc wavfile.cc add_ff_impl.cc + add_const_bb_impl.cc + add_const_ss_impl.cc + add_const_ii_impl.cc + add_const_ff_impl.cc + add_const_cc_impl.cc annotator_1to1_impl.cc annotator_alltoall_impl.cc annotator_raw_impl.cc diff --git a/gr-blocks/lib/add_const_XX_impl.cc.t b/gr-blocks/lib/add_const_XX_impl.cc.t deleted file mode 100644 index fe68216923..0000000000 --- a/gr-blocks/lib/add_const_XX_impl.cc.t +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2009,2010,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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME_IMPL@.h> -#include <gnuradio/io_signature.h> - -namespace gr { - namespace blocks { - - @NAME@::sptr @NAME@::make(@O_TYPE@ k) - { - return gnuradio::get_initial_sptr(new @NAME_IMPL@(k)); - } - - @NAME_IMPL@::@NAME_IMPL@(@O_TYPE@ k) - : sync_block ("@NAME@", - io_signature::make (1, 1, sizeof (@I_TYPE@)), - io_signature::make (1, 1, sizeof (@O_TYPE@))), - d_k(k) - { - } - - int - @NAME_IMPL@::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) - { - @I_TYPE@ *iptr = (@I_TYPE@ *) input_items[0]; - @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0]; - - int size = noutput_items; - - while (size >= 8){ - *optr++ = *iptr++ + d_k; - *optr++ = *iptr++ + d_k; - *optr++ = *iptr++ + d_k; - *optr++ = *iptr++ + d_k; - *optr++ = *iptr++ + d_k; - *optr++ = *iptr++ + d_k; - *optr++ = *iptr++ + d_k; - *optr++ = *iptr++ + d_k; - size -= 8; - } - - while (size-- > 0) - *optr++ = *iptr++ + d_k; - - return noutput_items; - } - - } /* namespace blocks */ -} /* namespace gr */ diff --git a/gr-blocks/lib/add_const_bb_impl.cc b/gr-blocks/lib/add_const_bb_impl.cc new file mode 100644 index 0000000000..e1c808245d --- /dev/null +++ b/gr-blocks/lib/add_const_bb_impl.cc @@ -0,0 +1,107 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2010,2012,2015 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <add_const_bb_impl.h> +#include <gnuradio/io_signature.h> + +namespace gr { + namespace blocks { + + add_const_bb::sptr add_const_bb::make(char k) + { + return gnuradio::get_initial_sptr + (new add_const_bb_impl(k)); + } + + add_const_bb_impl::add_const_bb_impl(char k) + : sync_block("add_const_bb", + io_signature::make (1, 1, sizeof(char)), + io_signature::make (1, 1, sizeof(char))), + d_k(k) + { + } + + add_const_bb_impl::~add_const_bb_impl() + { + } + + int + add_const_bb_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const char *iptr = (const char *) input_items[0]; + char *optr = (char *) output_items[0]; + + int size = noutput_items; + + while(size >= 8) { + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + size -= 8; + } + + while(size-- > 0) { + *optr++ = *iptr++ + d_k; + } + + return noutput_items; + } + + void + add_const_bb_impl::setup_rpc() + { +#ifdef GR_CTRLPORT + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<add_const_bb, char>( + alias(), "Constant", + &add_const_bb::k, + pmt::from_long(-128), + pmt::from_long(127), + pmt::from_long(0), + "", "Constant to add", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTCPLX | DISPOPTSTRIP))); + + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_set<add_const_bb, char>( + alias(), "Constant", + &add_const_bb::set_k, + pmt::from_long(-128), + pmt::from_long(127), + pmt::from_long(0), + "", "Constant to add", + RPC_PRIVLVL_MIN, DISPNULL))); +#endif /* GR_CTRLPORT */ + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/lib/add_const_bb_impl.h b/gr-blocks/lib/add_const_bb_impl.h new file mode 100644 index 0000000000..8bded0c19c --- /dev/null +++ b/gr-blocks/lib/add_const_bb_impl.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2012,2015 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 ADD_CONST_BB_IMPL +#define ADD_CONST_BB_IMPL + +#include <gnuradio/blocks/add_const_bb.h> + +namespace gr { + namespace blocks { + + class BLOCKS_API add_const_bb_impl : public add_const_bb + { + private: + char d_k; + + public: + add_const_bb_impl(char k); + ~add_const_bb_impl(); + + void setup_rpc(); + + char k() const { return d_k; } + void set_k(char k) { d_k = k; } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* ADD_CONST_BB_IMPL */ diff --git a/gr-blocks/lib/add_const_cc_impl.cc b/gr-blocks/lib/add_const_cc_impl.cc new file mode 100644 index 0000000000..61acb1c7a5 --- /dev/null +++ b/gr-blocks/lib/add_const_cc_impl.cc @@ -0,0 +1,103 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2010,2012,2015 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <add_const_cc_impl.h> +#include <gnuradio/io_signature.h> + +namespace gr { + namespace blocks { + + add_const_cc::sptr add_const_cc::make(gr_complex k) + { + return gnuradio::get_initial_sptr + (new add_const_cc_impl(k)); + } + + add_const_cc_impl::add_const_cc_impl(gr_complex k) + : sync_block("add_const_cc", + io_signature::make (1, 1, sizeof(gr_complex)), + io_signature::make (1, 1, sizeof(gr_complex))), + d_k(k) + { + } + + int + add_const_cc_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const gr_complex *iptr = (const gr_complex *) input_items[0]; + gr_complex *optr = (gr_complex *) output_items[0]; + + int size = noutput_items; + + while(size >= 8) { + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + size -= 8; + } + + while(size-- > 0) { + *optr++ = *iptr++ + d_k; + } + + return noutput_items; + } + + void + add_const_cc_impl::setup_rpc() + { +#ifdef GR_CTRLPORT + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<add_const_cc, gr_complex>( + alias(), "Constant", + &add_const_cc::k, + pmt::from_complex(-4.29e9, 0), + pmt::from_complex(4.29e9, 0), + pmt::from_complex(0, 0), + "", "Constant to add", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTCPLX | DISPOPTSTRIP))); + + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_set<add_const_cc, gr_complex>( + alias(), "Constant", + &add_const_cc::set_k, + pmt::from_complex(-4.29e9, 0), + pmt::from_complex(4.29e9, 0), + pmt::from_complex(0, 0), + "", "Constant to add", + RPC_PRIVLVL_MIN, DISPNULL))); +#endif /* GR_CTRLPORT */ + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/lib/add_const_cc_impl.h b/gr-blocks/lib/add_const_cc_impl.h new file mode 100644 index 0000000000..f1861da7b2 --- /dev/null +++ b/gr-blocks/lib/add_const_cc_impl.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2012,2015 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 ADD_CONST_CC_IMPL +#define ADD_CONST_CC_IMPL + +#include <gnuradio/blocks/add_const_cc.h> + +namespace gr { + namespace blocks { + + class BLOCKS_API add_const_cc_impl : public add_const_cc + { + private: + gr_complex d_k; + + public: + add_const_cc_impl(gr_complex k); + + void setup_rpc(); + + gr_complex k() const { return d_k; } + void set_k(gr_complex k) { d_k = k; } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* ADD_CONST_CC_IMPL */ diff --git a/gr-blocks/lib/add_const_ff_impl.cc b/gr-blocks/lib/add_const_ff_impl.cc new file mode 100644 index 0000000000..b786a343c6 --- /dev/null +++ b/gr-blocks/lib/add_const_ff_impl.cc @@ -0,0 +1,103 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2010,2012,2015 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <add_const_ff_impl.h> +#include <gnuradio/io_signature.h> + +namespace gr { + namespace blocks { + + add_const_ff::sptr add_const_ff::make(float k) + { + return gnuradio::get_initial_sptr + (new add_const_ff_impl(k)); + } + + add_const_ff_impl::add_const_ff_impl(float k) + : sync_block("add_const_ff", + io_signature::make (1, 1, sizeof(float)), + io_signature::make (1, 1, sizeof(float))), + d_k(k) + { + } + + int + add_const_ff_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const float *iptr = (const float *) input_items[0]; + float *optr = (float *) output_items[0]; + + int size = noutput_items; + + while(size >= 8) { + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + size -= 8; + } + + while(size-- > 0) { + *optr++ = *iptr++ + d_k; + } + + return noutput_items; + } + + void + add_const_ff_impl::setup_rpc() + { +#ifdef GR_CTRLPORT + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<add_const_ff, float>( + alias(), "Constant", + &add_const_ff::k, + pmt::from_double(-4.29e9), + pmt::from_double(4.29e9), + pmt::from_double(0), + "", "Constant to add", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTCPLX | DISPOPTSTRIP))); + + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_set<add_const_ff, float>( + alias(), "Constant", + &add_const_ff::set_k, + pmt::from_double(-4.29e9), + pmt::from_double(4.29e9), + pmt::from_double(0), + "", "Constant to add", + RPC_PRIVLVL_MIN, DISPNULL))); +#endif /* GR_CTRLPORT */ + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/lib/add_const_ff_impl.h b/gr-blocks/lib/add_const_ff_impl.h new file mode 100644 index 0000000000..a3074b4b98 --- /dev/null +++ b/gr-blocks/lib/add_const_ff_impl.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2012,2015 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 ADD_CONST_FF_IMPL +#define ADD_CONST_FF_IMPL + +#include <gnuradio/blocks/add_const_ff.h> + +namespace gr { + namespace blocks { + + class BLOCKS_API add_const_ff_impl : public add_const_ff + { + private: + float d_k; + + public: + add_const_ff_impl(float k); + + void setup_rpc(); + + float k() const { return d_k; } + void set_k(float k) { d_k = k; } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* ADD_CONST_FF_IMPL */ diff --git a/gr-blocks/lib/add_const_ii_impl.cc b/gr-blocks/lib/add_const_ii_impl.cc new file mode 100644 index 0000000000..1cd207780e --- /dev/null +++ b/gr-blocks/lib/add_const_ii_impl.cc @@ -0,0 +1,103 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2010,2012,2015 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <add_const_ii_impl.h> +#include <gnuradio/io_signature.h> + +namespace gr { + namespace blocks { + + add_const_ii::sptr add_const_ii::make(int k) + { + return gnuradio::get_initial_sptr + (new add_const_ii_impl(k)); + } + + add_const_ii_impl::add_const_ii_impl(int k) + : sync_block("add_const_ii", + io_signature::make (1, 1, sizeof(int)), + io_signature::make (1, 1, sizeof(int))), + d_k(k) + { + } + + int + add_const_ii_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const int *iptr = (const int *) input_items[0]; + int *optr = (int *) output_items[0]; + + int size = noutput_items; + + while(size >= 8) { + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + size -= 8; + } + + while(size-- > 0) { + *optr++ = *iptr++ + d_k; + } + + return noutput_items; + } + + void + add_const_ii_impl::setup_rpc() + { +#ifdef GR_CTRLPORT + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<add_const_ii, int>( + alias(), "Constant", + &add_const_ii::k, + pmt::from_long(-4.29e9), + pmt::from_long(4.29e9), + pmt::from_long(0), + "", "Constant to add", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTCPLX | DISPOPTSTRIP))); + + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_set<add_const_ii, int>( + alias(), "Constant", + &add_const_ii::set_k, + pmt::from_long(-4.29e9), + pmt::from_long(4.29e9), + pmt::from_long(0), + "", "Constant to add", + RPC_PRIVLVL_MIN, DISPNULL))); +#endif /* GR_CTRLPORT */ + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/lib/add_const_XX_impl.h.t b/gr-blocks/lib/add_const_ii_impl.h index e0c2ae54bc..8ddc3adb51 100644 --- a/gr-blocks/lib/add_const_XX_impl.h.t +++ b/gr-blocks/lib/add_const_ii_impl.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2009,2012 Free Software Foundation, Inc. + * Copyright 2004,2009,2012,2015 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,25 +20,26 @@ * Boston, MA 02110-1301, USA. */ -// @WARNING@ +#ifndef ADD_CONST_II_IMPL +#define ADD_CONST_II_IMPL -#ifndef @GUARD_NAME_IMPL@ -#define @GUARD_NAME_IMPL@ - -#include <gnuradio/blocks/@NAME@.h> +#include <gnuradio/blocks/add_const_ii.h> namespace gr { namespace blocks { - class BLOCKS_API @NAME_IMPL@ : public @NAME@ + class BLOCKS_API add_const_ii_impl : public add_const_ii { - @O_TYPE@ d_k; + private: + int d_k; public: - @NAME_IMPL@(@O_TYPE@ k); + add_const_ii_impl(int k); + + void setup_rpc(); - @O_TYPE@ k() const { return d_k; } - void set_k(@O_TYPE@ k) { d_k = k; } + int k() const { return d_k; } + void set_k(int k) { d_k = k; } int work(int noutput_items, gr_vector_const_void_star &input_items, @@ -48,4 +49,4 @@ namespace gr { } /* namespace blocks */ } /* namespace gr */ -#endif /* @GUARD_NAME_IMPL@ */ +#endif /* ADD_CONST_II_IMPL */ diff --git a/gr-blocks/lib/add_const_ss_impl.cc b/gr-blocks/lib/add_const_ss_impl.cc new file mode 100644 index 0000000000..e23a2ef9a8 --- /dev/null +++ b/gr-blocks/lib/add_const_ss_impl.cc @@ -0,0 +1,107 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2010,2012,2015 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <add_const_ss_impl.h> +#include <gnuradio/io_signature.h> + +namespace gr { + namespace blocks { + + add_const_ss::sptr add_const_ss::make(short k) + { + return gnuradio::get_initial_sptr + (new add_const_ss_impl(k)); + } + + add_const_ss_impl::add_const_ss_impl(short k) + : sync_block("add_const_ss", + io_signature::make (1, 1, sizeof(short)), + io_signature::make (1, 1, sizeof(short))), + d_k(k) + { + } + + add_const_ss_impl::~add_const_ss_impl() + { + } + + int + add_const_ss_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const short *iptr = (const short *) input_items[0]; + short *optr = (short *) output_items[0]; + + int size = noutput_items; + + while(size >= 8) { + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + *optr++ = *iptr++ + d_k; + size -= 8; + } + + while(size-- > 0) { + *optr++ = *iptr++ + d_k; + } + + return noutput_items; + } + + void + add_const_ss_impl::setup_rpc() + { +#ifdef GR_CTRLPORT + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<add_const_ss, short>( + alias(), "Constant", + &add_const_ss::k, + pmt::from_long(-65536), + pmt::from_long(65535), + pmt::from_long(0), + "", "Constant to add", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTCPLX | DISPOPTSTRIP))); + + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_set<add_const_ss, short>( + alias(), "Constant", + &add_const_ss::set_k, + pmt::from_long(-65536), + pmt::from_long(65535), + pmt::from_long(0), + "", "Constant to add", + RPC_PRIVLVL_MIN, DISPNULL))); +#endif /* GR_CTRLPORT */ + } + + } /* namespace blocks */ +} /* namespace gr */ diff --git a/gr-blocks/lib/add_const_ss_impl.h b/gr-blocks/lib/add_const_ss_impl.h new file mode 100644 index 0000000000..40bcfb9b45 --- /dev/null +++ b/gr-blocks/lib/add_const_ss_impl.h @@ -0,0 +1,53 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,2009,2012,2015 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 ADD_CONST_SS_IMPL +#define ADD_CONST_SS_IMPL + +#include <gnuradio/blocks/add_const_ss.h> + +namespace gr { + namespace blocks { + + class BLOCKS_API add_const_ss_impl : public add_const_ss + { + private: + short d_k; + + public: + add_const_ss_impl(short k); + ~add_const_ss_impl(); + + void setup_rpc(); + + short k() const { return d_k; } + void set_k(short k) { d_k = k; } + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace blocks */ +} /* namespace gr */ + +#endif /* ADD_CONST_SS_IMPL */ diff --git a/gr-blocks/lib/copy_impl.cc b/gr-blocks/lib/copy_impl.cc index 02848369d1..acac576075 100644 --- a/gr-blocks/lib/copy_impl.cc +++ b/gr-blocks/lib/copy_impl.cc @@ -99,5 +99,18 @@ namespace gr { return n; } + + void + copy_impl::setup_rpc() + { +#ifdef GR_CTRLPORT + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_handler<copy>( + alias(), "en", + "", "Enable", + RPC_PRIVLVL_MIN, DISPNULL))); +#endif /* GR_CTRLPORT */ + } + } /* namespace blocks */ } /* namespace gr */ diff --git a/gr-blocks/lib/copy_impl.h b/gr-blocks/lib/copy_impl.h index 925efb2153..ac7126749b 100644 --- a/gr-blocks/lib/copy_impl.h +++ b/gr-blocks/lib/copy_impl.h @@ -43,6 +43,8 @@ namespace gr { void handle_enable(pmt::pmt_t msg); + void setup_rpc(); + void set_enabled(bool enable) { d_enabled = enable; } bool enabled() const { return d_enabled;} diff --git a/gr-blocks/lib/multiply_const_cc_impl.cc b/gr-blocks/lib/multiply_const_cc_impl.cc index c082a1ddd8..e7c5e3b08e 100644 --- a/gr-blocks/lib/multiply_const_cc_impl.cc +++ b/gr-blocks/lib/multiply_const_cc_impl.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2009,2010,2012 Free Software Foundation, Inc. + * Copyright 2004,2009,2010,2012,2015 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -69,8 +69,8 @@ namespace gr { rpcbasic_sptr(new rpcbasic_register_get<multiply_const_cc, gr_complex>( alias(), "Constant", &multiply_const_cc::k, - pmt::from_complex(-1000.0f, 0.0f), - pmt::from_complex(1000.0f, 0.0f), + pmt::from_complex(-1024.0f, 0.0f), + pmt::from_complex(1024.0f, 0.0f), pmt::from_complex(0.0f, 0.0f), "", "Constant to multiply", RPC_PRIVLVL_MIN, DISPTIME | DISPOPTCPLX | DISPOPTSTRIP))); @@ -79,8 +79,8 @@ namespace gr { rpcbasic_sptr(new rpcbasic_register_set<multiply_const_cc, gr_complex>( alias(), "Constant", &multiply_const_cc::set_k, - pmt::from_complex(-1000.0f, 0.0f), - pmt::from_complex(1000.0f, 0.0f), + pmt::from_complex(-1024.0f, 0.0f), + pmt::from_complex(1024.0f, 0.0f), pmt::from_complex(0.0f, 0.0f), "", "Constant to multiply", RPC_PRIVLVL_MIN, DISPNULL))); diff --git a/gr-blocks/lib/multiply_const_ff_impl.cc b/gr-blocks/lib/multiply_const_ff_impl.cc index 366c06181f..c5d0ce1e9a 100644 --- a/gr-blocks/lib/multiply_const_ff_impl.cc +++ b/gr-blocks/lib/multiply_const_ff_impl.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2004,2009,2010,2012 Free Software Foundation, Inc. + * Copyright 2004,2009,2010,2012,2015 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -63,5 +63,27 @@ namespace gr { return noutput_items; } + void + multiply_const_ff_impl::setup_rpc() + { +#ifdef GR_CTRLPORT + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<multiply_const_ff, float>( + alias(), "coefficient", + &multiply_const_ff::k, + pmt::mp(-1024.0f), pmt::mp(1024.0f), pmt::mp(0.0f), + "", "Coefficient", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP))); + + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_set<multiply_const_ff, float>( + alias(), "coefficient", + &multiply_const_ff::set_k, + pmt::mp(-1024.0f), pmt::mp(1024.0f), pmt::mp(0.0f), + "", "Coefficient", + RPC_PRIVLVL_MIN, DISPNULL))); +#endif /* GR_CTRLPORT */ + } + } /* namespace blocks */ } /* namespace gr */ diff --git a/gr-blocks/lib/multiply_const_ff_impl.h b/gr-blocks/lib/multiply_const_ff_impl.h index 976d0a7507..4eb1c19f76 100644 --- a/gr-blocks/lib/multiply_const_ff_impl.h +++ b/gr-blocks/lib/multiply_const_ff_impl.h @@ -38,6 +38,8 @@ namespace gr { public: multiply_const_ff_impl(float k, size_t vlen); + void setup_rpc(); + float k() const { return d_k; } void set_k(float k) { d_k = k; } diff --git a/gr-blocks/lib/multiply_const_vcc_impl.cc b/gr-blocks/lib/multiply_const_vcc_impl.cc index 637f79eb12..b793ec7ddb 100644 --- a/gr-blocks/lib/multiply_const_vcc_impl.cc +++ b/gr-blocks/lib/multiply_const_vcc_impl.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2014 Free Software Foundation, Inc. + * Copyright 2014-2015 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -68,5 +68,33 @@ namespace gr { return noutput_items; } + void + multiply_const_vcc_impl::setup_rpc() + { +#ifdef GR_CTRLPORT + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<multiply_const_vcc, + std::vector<gr_complex> >( + alias(), "coefficient", + &multiply_const_vcc::k, + pmt::from_complex(-1024.0f), + pmt::from_complex(1024.0f), + pmt::from_complex(0.0f), + "", "Coefficient", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP))); + + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_set<multiply_const_vcc, + std::vector<gr_complex> >( + alias(), "coefficient", + &multiply_const_vcc::set_k, + pmt::from_complex(-1024.0f), + pmt::from_complex(1024.0f), + pmt::from_complex(0.0f), + "", "Coefficient", + RPC_PRIVLVL_MIN, DISPNULL))); +#endif /* GR_CTRLPORT */ + } + } /* namespace blocks */ } /* namespace gr */ diff --git a/gr-blocks/lib/multiply_const_vcc_impl.h b/gr-blocks/lib/multiply_const_vcc_impl.h index 18886ed00e..c3fc5885b0 100644 --- a/gr-blocks/lib/multiply_const_vcc_impl.h +++ b/gr-blocks/lib/multiply_const_vcc_impl.h @@ -36,6 +36,8 @@ namespace gr { public: multiply_const_vcc_impl(std::vector<gr_complex> k); + void setup_rpc(); + std::vector<gr_complex> k() const { return d_k; } void set_k(std::vector<gr_complex> k) { d_k = k; } diff --git a/gr-blocks/lib/multiply_const_vff_impl.cc b/gr-blocks/lib/multiply_const_vff_impl.cc index ab53ce3ce3..6a4719e5d3 100644 --- a/gr-blocks/lib/multiply_const_vff_impl.cc +++ b/gr-blocks/lib/multiply_const_vff_impl.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2014 Free Software Foundation, Inc. + * Copyright 2014-2015 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -68,5 +68,29 @@ namespace gr { return noutput_items; } + void + multiply_const_vff_impl::setup_rpc() + { +#ifdef GR_CTRLPORT + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_get<multiply_const_vff, + std::vector<float> >( + alias(), "coefficient", + &multiply_const_vff::k, + pmt::mp(-1024.0f), pmt::mp(1024.0f), pmt::mp(0.0f), + "", "Coefficient", RPC_PRIVLVL_MIN, + DISPTIME | DISPOPTSTRIP))); + + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_set<multiply_const_vff, + std::vector<float> >( + alias(), "coefficient", + &multiply_const_vff::set_k, + pmt::mp(-1024.0f), pmt::mp(1024.0f), pmt::mp(0.0f), + "", "Coefficient", + RPC_PRIVLVL_MIN, DISPNULL))); +#endif /* GR_CTRLPORT */ + } + } /* namespace blocks */ } /* namespace gr */ diff --git a/gr-blocks/lib/multiply_const_vff_impl.h b/gr-blocks/lib/multiply_const_vff_impl.h index 4fda2a831e..ca555669ed 100644 --- a/gr-blocks/lib/multiply_const_vff_impl.h +++ b/gr-blocks/lib/multiply_const_vff_impl.h @@ -36,6 +36,8 @@ namespace gr { public: multiply_const_vff_impl(std::vector<float> k); + void setup_rpc(); + std::vector<float> k() const { return d_k; } void set_k(std::vector<float> k) { d_k = k; } diff --git a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t b/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t index a9e70e7b45..f45426dafe 100644 --- a/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t +++ b/gr-filter/lib/freq_xlating_fir_filter_XXX_impl.cc.t @@ -128,7 +128,13 @@ namespace gr { void @IMPL_NAME@::handle_set_center_freq(pmt::pmt_t msg) { - if(pmt::is_pair(msg)) { + if(pmt::is_dict(msg) && pmt::dict_has_key(msg, pmt::intern("freq")) ) { + pmt::pmt_t x = pmt::dict_ref(msg, pmt::intern("freq"), pmt::PMT_NIL ); + if(pmt::is_real(x)) { + double freq = pmt::to_double(x); + set_center_freq(freq); + } + } else if(pmt::is_pair(msg)) { pmt::pmt_t x = pmt::cdr(msg); if(pmt::is_real(x)) { double freq = pmt::to_double(x); diff --git a/gr-uhd/apps/uhd_rx_nogui b/gr-uhd/apps/uhd_rx_nogui index ea43a43be6..3f43f577d4 100755 --- a/gr-uhd/apps/uhd_rx_nogui +++ b/gr-uhd/apps/uhd_rx_nogui @@ -163,8 +163,7 @@ class app_top_block(gr.top_block): AGC = analog.agc_cc(1.0/channel_rate, # Time constant 1.0, # Reference power - 1.0, # Initial gain - 1.0) # Maximum gain + 1.0) # Gain DEMOD = demod(channel_rate, audio_decim) diff --git a/gr-uhd/lib/CMakeLists.txt b/gr-uhd/lib/CMakeLists.txt index 531bd40b09..b57b80b557 100644 --- a/gr-uhd/lib/CMakeLists.txt +++ b/gr-uhd/lib/CMakeLists.txt @@ -82,16 +82,6 @@ GR_LIBRARY_FOO(gnuradio-uhd RUNTIME_COMPONENT "uhd_runtime" DEVEL_COMPONENT "uhd ######################################################################## if(ENABLE_STATIC_LIBS) if(UHD_VERSION VERSION_GREATER "3.8.1") - if(ENABLE_GR_CTRLPORT) - # Remove GR_CTRLPORT set this target's definitions. - # Makes sure we don't try to use ControlPort stuff in source files - GET_DIRECTORY_PROPERTY(STATIC_DEFS COMPILE_DEFINITIONS) - list(REMOVE_ITEM STATIC_DEFS "GR_CTRLPORT") - SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS "${STATIC_DEFS}") - - # readd it to the target since we removed it from the directory-wide list. - SET_PROPERTY(TARGET gnuradio-uhd APPEND PROPERTY COMPILE_DEFINITIONS "GR_CTRLPORT") - endif(ENABLE_GR_CTRLPORT) add_library(gnuradio-uhd_static STATIC ${gr_uhd_sources}) diff --git a/gr-uhd/lib/usrp_source_impl.cc b/gr-uhd/lib/usrp_source_impl.cc index efa49aae8e..fbeb992192 100644 --- a/gr-uhd/lib/usrp_source_impl.cc +++ b/gr-uhd/lib/usrp_source_impl.cc @@ -553,5 +553,17 @@ namespace gr { return num_samps; } + void + usrp_source_impl::setup_rpc() + { +#ifdef GR_CTRLPORT + add_rpc_variable( + rpcbasic_sptr(new rpcbasic_register_handler<usrp_block>( + alias(), "command", + "", "UHD Commands", + RPC_PRIVLVL_MIN, DISPNULL))); +#endif /* GR_CTRLPORT */ + } + } /* namespace uhd */ } /* namespace gr */ diff --git a/gr-uhd/lib/usrp_source_impl.h b/gr-uhd/lib/usrp_source_impl.h index 9f6fc1a759..98af816c02 100644 --- a/gr-uhd/lib/usrp_source_impl.h +++ b/gr-uhd/lib/usrp_source_impl.h @@ -106,6 +106,8 @@ namespace gr { gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); + void setup_rpc(); + private: //! Like set_center_freq(), but uses _curr_freq and _curr_lo_offset ::uhd::tune_result_t _set_center_freq_from_internals(size_t chan); diff --git a/grc/gui/DrawingArea.py b/grc/gui/DrawingArea.py index d22a2c6d5f..4412129809 100644 --- a/grc/gui/DrawingArea.py +++ b/grc/gui/DrawingArea.py @@ -47,6 +47,7 @@ class DrawingArea(gtk.DrawingArea): self.connect('motion-notify-event', self._handle_mouse_motion) self.connect('button-press-event', self._handle_mouse_button_press) self.connect('button-release-event', self._handle_mouse_button_release) + self.connect('scroll-event', self._handle_mouse_scroll) self.add_events( gtk.gdk.BUTTON_PRESS_MASK | \ gtk.gdk.POINTER_MOTION_MASK | \ @@ -83,6 +84,13 @@ class DrawingArea(gtk.DrawingArea): """ self._flow_graph.add_new_block(selection_data.data, (x, y)) + def _handle_mouse_scroll(self, widget, event): + if event.state & gtk.gdk.SHIFT_MASK: + if event.direction == gtk.gdk.SCROLL_UP: + event.direction = gtk.gdk.SCROLL_LEFT + else: + event.direction = gtk.gdk.SCROLL_RIGHT + def _handle_mouse_button_press(self, widget, event): """ Forward button click information to the flow graph. diff --git a/grc/python/Generator.py b/grc/python/Generator.py index d48be2f00e..d60befe3fa 100644 --- a/grc/python/Generator.py +++ b/grc/python/Generator.py @@ -22,6 +22,7 @@ import sys import subprocess import tempfile import shlex +import codecs from distutils.spawn import find_executable from Cheetah.Template import Template @@ -107,7 +108,7 @@ class TopBlockGenerator(object): "This is usually undesired. Consider " "removing the throttle block.") # generate - with open(self.get_file_path(), 'w') as fp: + with codecs.open(self.get_file_path(), 'w', encoding = 'utf-8') as fp: fp.write(self._build_python_code_from_template()) try: os.chmod(self.get_file_path(), self._mode) diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl index 35d9239e5e..99390067fe 100644 --- a/grc/python/flow_graph.tmpl +++ b/grc/python/flow_graph.tmpl @@ -1,6 +1,7 @@ #if not $generate_options.startswith('hb') #!/usr/bin/env python2 #end if +# -*- coding: utf-8 -*- ######################################################## ##Cheetah template - gnuradio_python ## |