diff options
author | Tom Rondeau <tom@trondeau.com> | 2014-08-08 11:28:05 -0400 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2014-08-08 16:37:43 -0400 |
commit | 3d5df0ddd3aa8d5a94285b95f487747f25d4ee06 (patch) | |
tree | 715007cafdc7ac2b6eb954562be0b3a4a4612e2e /gnuradio-runtime/lib | |
parent | 3d18f70c66c974a82c5096acc4cbd37a47b6b55c (diff) |
controlport: removing use of ice for a controlport rpc.
This effectively disables the use of ControlPort for now until we build in a new middleware layer. The ControlPort API and interfaces exist but will function as nops for now.
Diffstat (limited to 'gnuradio-runtime/lib')
-rw-r--r-- | gnuradio-runtime/lib/controlport/CMakeLists.txt | 26 | ||||
-rw-r--r-- | gnuradio-runtime/lib/controlport/ICE_LICENSE | 54 | ||||
-rw-r--r-- | gnuradio-runtime/lib/controlport/frontend.ice | 151 | ||||
-rw-r--r-- | gnuradio-runtime/lib/controlport/gnuradio.ice | 105 | ||||
-rw-r--r-- | gnuradio-runtime/lib/controlport/ice_application_base.cc | 43 | ||||
-rw-r--r-- | gnuradio-runtime/lib/controlport/rpcpmtconverters_ice.cc | 151 | ||||
-rw-r--r-- | gnuradio-runtime/lib/controlport/rpcserver_booter_ice.cc | 54 | ||||
-rw-r--r-- | gnuradio-runtime/lib/controlport/rpcserver_ice.cc | 192 | ||||
-rw-r--r-- | gnuradio-runtime/lib/controlport/rpcserver_selector.cc | 3 |
9 files changed, 4 insertions, 775 deletions
diff --git a/gnuradio-runtime/lib/controlport/CMakeLists.txt b/gnuradio-runtime/lib/controlport/CMakeLists.txt index bd46659eb2..c41d87b1f7 100644 --- a/gnuradio-runtime/lib/controlport/CMakeLists.txt +++ b/gnuradio-runtime/lib/controlport/CMakeLists.txt @@ -19,44 +19,24 @@ if(ENABLE_GR_CTRLPORT) -include_directories(${ICE_INCLUDE_DIR}) - # Add definition so we can compile in ControlPort to the blocks. ADD_DEFINITIONS(-DGR_CTRLPORT) -######################################################################## -# Run ICE To compile Slice files -######################################################################## -EXECUTE_PROCESS( - COMMAND "${ICE_SLICE2CPP}" "-I${CMAKE_CURRENT_SOURCE_DIR}" - "--output-dir=${CMAKE_CURRENT_BINARY_DIR}/" - "${CMAKE_CURRENT_SOURCE_DIR}/gnuradio.ice" - ) - list(APPEND gnuradio_runtime_sources - ${CMAKE_CURRENT_SOURCE_DIR}/ice_application_base.cc ${CMAKE_CURRENT_SOURCE_DIR}/rpcmanager.cc - ${CMAKE_CURRENT_SOURCE_DIR}/rpcpmtconverters_ice.cc ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_aggregator.cc ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_booter_aggregator.cc - ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_booter_ice.cc - ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_ice.cc ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_selector.cc ) -# Append generated file in build directory -list(APPEND gnuradio_runtime_sources - ${CMAKE_CURRENT_BINARY_DIR}/gnuradio.cpp -) - ######################################################################## # Add controlport stuff to gnuradio-runtime ######################################################################## include_directories(${CMAKE_CURRENT_BINARY_DIR}) -list(APPEND gnuradio_runtime_libs - ${ICE_LIBRARIES} -) +# Add any required libraries here +#list(APPEND gnuradio_runtime_libs +#) endif(ENABLE_GR_CTRLPORT) diff --git a/gnuradio-runtime/lib/controlport/ICE_LICENSE b/gnuradio-runtime/lib/controlport/ICE_LICENSE deleted file mode 100644 index 51ab60d453..0000000000 --- a/gnuradio-runtime/lib/controlport/ICE_LICENSE +++ /dev/null @@ -1,54 +0,0 @@ -Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved. - -This copy of Ice is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License version 2 as -published by the Free Software Foundation. - -Ice is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details. - -You should have received a copy of the GNU General Public License version -2 along with this program; if not, see http://www.gnu.org/licenses. - -Linking Ice statically or dynamically with other software (such as a -library, module or application) is making a combined work based on Ice. -Thus, the terms and conditions of the GNU General Public License version -2 cover this combined work. - -If such software can only be used together with Ice, then not only the -combined work but the software itself is a work derived from Ice and as -such shall be licensed under the terms of the GNU General Public License -version 2. This includes the situation where Ice is only being used -through an abstraction layer. - -As a special exception to the above, ZeroC grants to the contributors for -the following projects the permission to license their Ice-based software -under the terms of the GNU Lesser General Public License (LGPL) version -2.1 or of the BSD license: - - - Orca Robotics (http://orca-robotics.sourceforge.net) - - - Mumble (http://mumble.sourceforge.net) - -This exception does not extend to the parts of Ice used by these -projects, or to any other derived work: as a whole, any work based on Ice -shall be licensed under the terms and conditions of the GNU General -Public License version 2. - -You may also combine Ice with any software not derived from Ice, provided -the license of such software is compatible with the GNU General Public -License version 2. In addition, as a special exception, ZeroC grants you -permission to combine Ice with: - - - the OpenSSL library, or with a modified version of the OpenSSL library - that uses the same license as OpenSSL - - - any library not derived from Ice and licensed under the terms of - the Apache License, version 2.0 - (http://www.apache.org/licenses/LICENSE-2.0.html) - -If you modify this copy of Ice, you may extend any of the exceptions -provided above to your version of Ice, but you are not obligated to -do so. diff --git a/gnuradio-runtime/lib/controlport/frontend.ice b/gnuradio-runtime/lib/controlport/frontend.ice deleted file mode 100644 index e4d346dba0..0000000000 --- a/gnuradio-runtime/lib/controlport/frontend.ice +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright 2013 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <gnuradio.ice> - -[["python:package:gnuradio.ctrlport"]] -module GNURadio { - module Frontend { - - // primitive types - dictionary<string, string> StrStrDict; - dictionary<string, string> TunerArgs; - struct F32Range - { - float min; - float max; - }; - - // exception types - exception NotSupported {}; - exception InvalidSetting { string msg; }; - exception ReceiverFailure { string msg; }; - exception NotExist {}; - - - // Status Types - struct TunerStatus { - float freq; - float rate; - int a2dbits; - float gain; - F32Range gainrange; - bool isInverted; - StrStrDict info; - }; - - struct StreamInfo { - string uri; - StrStrDict info; - }; - - struct ReceiverInfo { - string uid; - string name; - StrStrDict info; - }; - - struct ChannelStatus { - string uid; - string name; - bool active; - float freq; - float bandwidth; - bool isComplex; - StrStrDict info; - }; - - struct ChannelizerStatus { - string uid; - string name; - StrStrDict info; - }; - - // Interfaces - interface Component { - void setName(string newName); - }; - - interface AbstractReceiver extends Component { - idempotent ReceiverInfo getReceiverInfo(); - }; - - interface Tuner extends Component { - TunerStatus configureTuner(TunerArgs args) throws ReceiverFailure, InvalidSetting; - idempotent TunerStatus status(); - idempotent float setGain(float gain) throws ReceiverFailure, NotSupported, InvalidSetting; - idempotent bool setInversion(bool inverted) throws ReceiverFailure, NotSupported, InvalidSetting; - idempotent float setCenterFreq(float freq) throws ReceiverFailure, NotSupported, InvalidSetting; - idempotent float setBandwidth(float bw) throws ReceiverFailure, NotSupported, InvalidSetting; - idempotent void setInfo(string k, string v) throws ReceiverFailure, NotSupported, InvalidSetting; - }; - - interface Channel extends Tuner { - void start(); - void stop(); - void destroyChannel() throws NotSupported; - idempotent bool active(); - idempotent ChannelStatus channelStat(); - idempotent StreamInfo stream(); - idempotent bool setComplex(bool complex) throws ReceiverFailure, NotSupported, InvalidSetting; - idempotent void setStreamInfo(string k, string v) throws ReceiverFailure, NotSupported, InvalidSetting; - }; - - sequence<Tuner*> TunerSeq; - sequence<Channel*> ChannelSeq; - - interface Channelizer extends AbstractReceiver { - idempotent ChannelizerStatus status(); - idempotent Tuner* getTuner(); - idempotent ChannelSeq getChannels(); - idempotent ChannelSeq getActiveChannels(); - idempotent ChannelSeq getInactiveChannels(); - Channel* createChannel(float freq, float bw, StrStrDict args) throws NotSupported; - }; - - sequence<Channelizer*> ChannelizerSeq; - - interface Receiver extends AbstractReceiver { - idempotent ChannelizerSeq getInputs(); - idempotent Channel* getChannelByID(string id) throws NotExist; - idempotent Channelizer* getChannelizerByID(string id) throws NotExist; - idempotent void setInfo(string k, string v) throws ReceiverFailure, NotSupported, InvalidSetting; - }; - - }; - - module Booter { - dictionary<string, string> WaveformArgs; - exception WaveformRunningError { - string waveformClass; - float centerFrequencyHz; - }; - exception SignalSourceError {string msg; }; - interface WaveformBooter extends Frontend::Receiver, ControlPort { - string launchWaveform(string waveformClass, WaveformArgs args) - throws WaveformRunningError, SignalSourceError; - WaveformArgMap getDriverEnum(); - WaveformArgMap getSourceInfo(); - idempotent bool waveformRunning(); - idempotent string getWaveformClass(); - }; - }; -}; diff --git a/gnuradio-runtime/lib/controlport/gnuradio.ice b/gnuradio-runtime/lib/controlport/gnuradio.ice deleted file mode 100644 index 01db91b7be..0000000000 --- a/gnuradio-runtime/lib/controlport/gnuradio.ice +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -[["python:package:gnuradio.ctrlport"]] - -#ifndef GNURADIO_DEBUG -#define GNURADIO_DEBUG - -module GNURadio { - -struct complex { - float re; - float im; -}; - -class Knob {}; -class KnobB extends Knob { bool value; }; -class KnobC extends Knob { byte value; }; -class KnobI extends Knob { int value; }; -class KnobT extends Knob { short value; }; -class KnobF extends Knob { float value; }; -class KnobD extends Knob { double value; }; -class KnobL extends Knob { long value; }; -class KnobS extends Knob { string value; }; -class KnobZ extends Knob { complex value; }; - -sequence<bool> VectorB; sequence<byte> VectorC; -sequence<int> VectorI; sequence<float> VectorF; -sequence<double> VectorD; sequence<string> VectorS; -sequence<long> VectorL; sequence<short> VectorT; - -class KnobVecB extends Knob { VectorB value; }; -class KnobVecC extends Knob { VectorC value; }; -class KnobVecI extends Knob { VectorI value; }; -class KnobVecT extends Knob { VectorT value; }; -class KnobVecF extends Knob { VectorF value; }; -class KnobVecD extends Knob { VectorD value; }; -class KnobVecL extends Knob { VectorL value; }; -class KnobVecS extends Knob { VectorS value; }; - -enum KnobType { KNOBBOOL, KNOBCHAR, KNOBINT, KNOBFLOAT, - KNOBDOUBLE, KNOBSTRING, KNOBLONG, KNOBVECBOOL, - KNOBVECCHAR, KNOBVECINT, KNOBVECFLOAT, KNOBVECDOUBLE, - KNOBVECSTRING, KNOBVECLONG, KNOBSHORT}; - -const int DISPNULL = 0x0000; -const int DISPTIME = 0x0001; -const int DISPXY = 0x0002; -const int DISPPSD = 0x0004; -const int DISPSPEC = 0x0008; -const int DISPRAST = 0x0010; -const int DISPOPTCPLX = 0x0100; -const int DISPOPTLOG = 0x0200; -const int DISPOPTSTEM = 0x0400; -const int DISPOPTSTRIP = 0x0800; -const int DISPOPTSCATTER = 0x1000; - -struct KnobProp { - KnobType type; - string units; - string description; - int display; - Knob min; - Knob max; - Knob defaultvalue; -}; - -sequence<string> KnobIDList; -dictionary<string, Knob> KnobMap; -dictionary<string, KnobProp> KnobPropMap; -dictionary<string, string> WaveformArgMap; - -interface StreamReceiver { - void push(VectorC data); -}; - -interface ControlPort { - void set(KnobMap knobs); - idempotent KnobMap get(KnobIDList knobs); - idempotent KnobMap getRe(KnobIDList knobs); - idempotent KnobPropMap properties(KnobIDList knobs); - void shutdown(); -}; - -}; - -#endif diff --git a/gnuradio-runtime/lib/controlport/ice_application_base.cc b/gnuradio-runtime/lib/controlport/ice_application_base.cc deleted file mode 100644 index b390c77c84..0000000000 --- a/gnuradio-runtime/lib/controlport/ice_application_base.cc +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <gnuradio/ice_application_base.h> - -int ice_application_common::d_reacquire_attributes(0); -bool ice_application_common::d_main_called(false); -bool ice_application_common::d_have_ice_config(false); -boost::shared_ptr<boost::thread> ice_application_common::d_thread; -std::string ice_application_common::d_endpointStr(""); - -boost::shared_ptr<ice_application_common> -ice_application_common::Instance() -{ - static boost::shared_ptr<ice_application_common> - instance(new ice_application_common()); - return instance; -} - -int ice_application_common::run(int, char**) -{ - communicator()->waitForShutdown(); - return EXIT_SUCCESS; -} diff --git a/gnuradio-runtime/lib/controlport/rpcpmtconverters_ice.cc b/gnuradio-runtime/lib/controlport/rpcpmtconverters_ice.cc deleted file mode 100644 index 1477ae2c8d..0000000000 --- a/gnuradio-runtime/lib/controlport/rpcpmtconverters_ice.cc +++ /dev/null @@ -1,151 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <gnuradio/rpcpmtconverters_ice.h> -#include <Ice/Ice.h> -#include <gnuradio.h> - -GNURadio::KnobPtr -rpcpmtconverter::from_pmt(const pmt::pmt_t& knob, const Ice::Current& c) -{ - if(pmt::is_real(knob)) { - return new GNURadio::KnobD(Ice::Double(pmt::to_double(knob))); - } - else if(pmt::is_symbol(knob)) { - std::string stuff = pmt::symbol_to_string(knob); - return new GNURadio::KnobS(stuff); - } - else if(pmt::is_integer(knob)) { - return new GNURadio::KnobI(pmt::to_long(knob)); - } - else if(pmt::is_bool(knob)) { - return new GNURadio::KnobB(pmt::to_bool(knob)); - } - else if(pmt::is_uint64(knob)) { - return new GNURadio::KnobL(pmt::to_uint64(knob)); - } - else if(pmt::is_complex(knob)) { - std::complex<double> tmp = pmt::to_complex(knob); - GNURadio::complex cpx; - cpx.re = tmp.real(); - cpx.im = tmp.imag(); - return new GNURadio::KnobZ(cpx); - } - else if(pmt::is_c32vector(knob)) { // c32 sent as interleaved floats - size_t size(pmt::length(knob)); - const float* start((const float*) pmt::c32vector_elements(knob,size)); - return new GNURadio::KnobVecF(std::vector<float>(start,start+size*2)); - } - else if (pmt::is_s32vector(knob)) { - size_t size(pmt::length(knob)); - const int* start((const int*) pmt::s32vector_elements(knob,size)); - return new GNURadio::KnobVecI(std::vector<int>(start,start+size)); - } - else if (pmt::is_s16vector(knob)) { - size_t size(pmt::length(knob)); - const short* start((const short*) pmt::s16vector_elements(knob,size)); - return new GNURadio::KnobVecT(std::vector<short>(start,start+size)); - } - else if(pmt::is_f32vector(knob)) { - size_t size(pmt::length(knob)); - const float* start((const float*) pmt::f32vector_elements(knob,size)); - return new GNURadio::KnobVecF(std::vector<float>(start,start+size)); - } - else if (pmt::is_u8vector(knob)) { - size_t size(pmt::length(knob)); - const uint8_t* start((const uint8_t*) pmt::u8vector_elements(knob,size)); - return new GNURadio::KnobVecC(std::vector<Ice::Byte>(start,start+size)); - } - else if (pmt::is_s8vector(knob)) { - size_t size(pmt::length(knob)); - const int8_t* start((const int8_t*) pmt::s8vector_elements(knob,size)); - return new GNURadio::KnobVecC(std::vector<Ice::Byte>(start,start+size)); - } - else { - std::cerr << "Error: Don't know how to handle Knob Type (from): " << std::endl; assert(0);} - //TODO: VECTORS!!! - return new GNURadio::Knob(); -} - -pmt::pmt_t -rpcpmtconverter::to_pmt(const GNURadio::KnobPtr& knob, const Ice::Current& c) -{ - std::string id(knob->ice_id(c).substr(12)); - if(id == "KnobD") { - GNURadio::KnobDPtr k(GNURadio::KnobDPtr::dynamicCast(knob)); - return pmt::mp(k->value); - } - else if(id == "KnobF") { - GNURadio::KnobFPtr k(GNURadio::KnobFPtr::dynamicCast(knob)); - return pmt::mp(k->value); - } - else if(id == "KnobI") { - GNURadio::KnobIPtr k(GNURadio::KnobIPtr::dynamicCast(knob)); - return pmt::mp(k->value); - } - else if(id == "KnobT") { - GNURadio::KnobTPtr k(GNURadio::KnobTPtr::dynamicCast(knob)); - return pmt::mp(k->value); - } - else if(id == "KnobS") { - GNURadio::KnobSPtr k(GNURadio::KnobSPtr::dynamicCast(knob)); - return pmt::string_to_symbol(k->value); - } - else if(id == "KnobB") { - GNURadio::KnobBPtr k(GNURadio::KnobBPtr::dynamicCast(knob)); - if((k->value == true) || (k->value > 0)) - return pmt::PMT_T; - else - return pmt::PMT_F; - } - else if(id == "KnobC") { - GNURadio::KnobCPtr k(GNURadio::KnobCPtr::dynamicCast(knob)); - return pmt::mp(k->value); - } - else if(id == "KnobL") { - GNURadio::KnobLPtr k(GNURadio::KnobLPtr::dynamicCast(knob)); - return pmt::mp((long)k->value); - } - else if(id == "KnobZ") { - GNURadio::KnobZPtr k(GNURadio::KnobZPtr::dynamicCast(knob)); - std::complex<double> cpx(k->value.re, k->value.im); - return pmt::from_complex(cpx); - } - else if(id == "KnobVecC") { - GNURadio::KnobVecCPtr k(GNURadio::KnobVecCPtr::dynamicCast(knob)); - return pmt::init_u8vector(k->value.size(), &k->value[0]); - } - else if(id == "KnobVecI") { - GNURadio::KnobVecIPtr k(GNURadio::KnobVecIPtr::dynamicCast(knob)); - return pmt::init_s32vector(k->value.size(), &k->value[0]); - } - //else if(id == "KnobVecF") { - // GNURadio::KnobVecFPtr k(GNURadio::KnobVecFPtr::dynamicCast(knob)); - // return pmt::mp(k->value); - //TODO: FLOAT!!! - //TODO: VECTORS!!! - else { - std::cerr << "Error: Don't know how to handle Knob Type: " << id << std::endl; assert(0); - } - - return pmt::pmt_t(); -} diff --git a/gnuradio-runtime/lib/controlport/rpcserver_booter_ice.cc b/gnuradio-runtime/lib/controlport/rpcserver_booter_ice.cc deleted file mode 100644 index f60a218747..0000000000 --- a/gnuradio-runtime/lib/controlport/rpcserver_booter_ice.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <gnuradio/rpcserver_ice.h> -#include <gnuradio/rpcserver_booter_ice.h> - -namespace { - static const char* const CONTROL_PORT_CLASS("ice"); - static const char* const CONTROL_PORT_NAME("ControlPort"); - static const char* const ENDPOINT_NAME("gnuradio"); -}; - -rpcserver_booter_ice::rpcserver_booter_ice() : - ice_server_template<rpcserver_base, rpcserver_ice, - rpcserver_booter_ice, GNURadio::ControlPortPtr> - (this, std::string(CONTROL_PORT_NAME), std::string(ENDPOINT_NAME)), - d_type(std::string(CONTROL_PORT_CLASS)) -{;} - -rpcserver_booter_ice::~rpcserver_booter_ice() -{;} - -rpcserver_base* -rpcserver_booter_ice::i() -{ - return ice_server_template<rpcserver_base, rpcserver_ice, - rpcserver_booter_ice, GNURadio::ControlPortPtr>::i(); -} - -const std::vector<std::string> -rpcserver_booter_ice::endpoints() -{ - return ice_server_template<rpcserver_base, rpcserver_ice, - rpcserver_booter_ice, GNURadio::ControlPortPtr>::endpoints(); -} diff --git a/gnuradio-runtime/lib/controlport/rpcserver_ice.cc b/gnuradio-runtime/lib/controlport/rpcserver_ice.cc deleted file mode 100644 index cba6be578e..0000000000 --- a/gnuradio-runtime/lib/controlport/rpcserver_ice.cc +++ /dev/null @@ -1,192 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <gnuradio/rpcserver_ice.h> -#include <IceUtil/IceUtil.h> -#include <Ice/Ice.h> -#include <iostream> -#include <sstream> -#include <stdexcept> -#include <pmt/pmt.h> -#include <boost/xpressive/xpressive.hpp> - -#define DEBUG 0 - -using namespace rpcpmtconverter; - -rpcserver_ice::rpcserver_ice() -{} - -rpcserver_ice::~rpcserver_ice() -{} - -void -rpcserver_ice::registerConfigureCallback(const std::string &id, - const configureCallback_t callback) -{ - { - ConfigureCallbackMap_t::const_iterator iter(d_setcallbackmap.find(id)); - if(iter != d_setcallbackmap.end()) { - std::stringstream s; - s << "rpcserver_ice:: rpcserver_ice ERROR registering set, already registered: " - << id << std::endl; - throw std::runtime_error(s.str().c_str()); - } - } - - if(DEBUG) - std::cout << "rpcserver_ice registering set: " << id << std::endl; - - d_setcallbackmap.insert(ConfigureCallbackMap_t::value_type(id, callback)); -} - -void -rpcserver_ice::unregisterConfigureCallback(const std::string &id) -{ - ConfigureCallbackMap_t::iterator iter(d_setcallbackmap.find(id)); - if(iter == d_setcallbackmap.end()) { - std::stringstream s; - s << "rpcserver_ice:: rpcserver_ice ERROR unregistering set, not registered: " - << id << std::endl; - throw std::runtime_error(s.str().c_str()); - } - - if(DEBUG) - std::cout << "rpcserver_ice unregistering set: " << id << std::endl; - - d_setcallbackmap.erase(iter); -} - -void -rpcserver_ice::registerQueryCallback(const std::string &id, - const queryCallback_t callback) -{ - { - QueryCallbackMap_t::const_iterator iter(d_getcallbackmap.find(id)); - if(iter != d_getcallbackmap.end()) { - std::stringstream s; - s << "rpcserver_ice:: rpcserver_ice ERROR registering get, already registered: " - << id << std::endl; - throw std::runtime_error(s.str().c_str()); - } - } - - if(DEBUG) - std::cout << "rpcserver_ice registering get: " << id << std::endl; - - d_getcallbackmap.insert(QueryCallbackMap_t::value_type(id, callback)); -} - -void -rpcserver_ice::unregisterQueryCallback(const std::string &id) -{ - QueryCallbackMap_t::iterator iter(d_getcallbackmap.find(id)); - if(iter == d_getcallbackmap.end()) { - std::stringstream s; - s << "rpcserver_ice:: rpcserver_ice ERROR unregistering get, registered: " - << id << std::endl; - throw std::runtime_error(s.str().c_str()); - } - - if(DEBUG) - std::cout << "rpcserver_ice unregistering get: " << id << std::endl; - - d_getcallbackmap.erase(iter); -} - -void -rpcserver_ice::set(const GNURadio::KnobMap& knobs, const Ice::Current& c) -{ - std::for_each(knobs.begin(), knobs.end(), - set_f<GNURadio::KnobMap::value_type,ConfigureCallbackMap_t> - (c, d_setcallbackmap, cur_priv)); -} - -GNURadio::KnobMap -rpcserver_ice::getRe(const GNURadio::KnobIDList& knobs, const Ice::Current& c) -{ - GNURadio::KnobMap outknobs; - - if(knobs.size() == 0) { - std::for_each(d_getcallbackmap.begin(), d_getcallbackmap.end(), - get_all_f<QueryCallbackMap_t::value_type, QueryCallbackMap_t, GNURadio::KnobMap> - (c, d_getcallbackmap, cur_priv, outknobs)); - } - else { - QueryCallbackMap_t::iterator it; - for(it = d_getcallbackmap.begin(); it != d_getcallbackmap.end(); it++){ - for(size_t j=0; j<knobs.size(); j++){ - const boost::xpressive::sregex re(boost::xpressive::sregex::compile(knobs[j])); - if(boost::xpressive::regex_match(it->first, re)){ - get_f<GNURadio::KnobIDList::value_type, QueryCallbackMap_t> - (c, d_getcallbackmap, cur_priv, outknobs)(it->first); - break; - } - } - } - } - return outknobs; -} - -GNURadio::KnobMap -rpcserver_ice::get(const GNURadio::KnobIDList& knobs, const Ice::Current& c) -{ - GNURadio::KnobMap outknobs; - - if(knobs.size() == 0) { - std::for_each(d_getcallbackmap.begin(), d_getcallbackmap.end(), - get_all_f<QueryCallbackMap_t::value_type, QueryCallbackMap_t, GNURadio::KnobMap> - (c, d_getcallbackmap, cur_priv, outknobs)); - } - else { - std::for_each(knobs.begin(), knobs.end(), - get_f<GNURadio::KnobIDList::value_type, QueryCallbackMap_t> - (c, d_getcallbackmap, cur_priv, outknobs)); - } - return outknobs; -} - -GNURadio::KnobPropMap -rpcserver_ice::properties(const GNURadio::KnobIDList& knobs, const Ice::Current& c) -{ - GNURadio::KnobPropMap outknobs; - - if(knobs.size() == 0) { - std::for_each(d_getcallbackmap.begin(), d_getcallbackmap.end(), - properties_all_f<QueryCallbackMap_t::value_type, - QueryCallbackMap_t,GNURadio::KnobPropMap>(c, d_getcallbackmap, cur_priv, outknobs)); - } - else { - std::for_each(knobs.begin(), knobs.end(), - properties_f<GNURadio::KnobIDList::value_type, - QueryCallbackMap_t, GNURadio::KnobPropMap>(c, d_getcallbackmap, cur_priv, outknobs)); - } - return outknobs; -} - -void -rpcserver_ice::shutdown(const Ice::Current& c) -{ - if(DEBUG) - std::cout << "Shutting down..." << std::endl; - c.adapter->getCommunicator()->shutdown(); -} diff --git a/gnuradio-runtime/lib/controlport/rpcserver_selector.cc b/gnuradio-runtime/lib/controlport/rpcserver_selector.cc index d515e78963..692f151958 100644 --- a/gnuradio-runtime/lib/controlport/rpcserver_selector.cc +++ b/gnuradio-runtime/lib/controlport/rpcserver_selector.cc @@ -27,8 +27,7 @@ bool rpcmanager::make_aggregator(false); #ifdef RPCSERVER_ICE - #include <gnuradio/rpcserver_booter_ice.h> - rpcmanager::rpcserver_booter_register_helper<rpcserver_booter_ice> boot_ice; + #error TODO ICE #endif #ifdef RPCSERVER_ERLANG |