[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 04/50: controlport: restructuring to add su
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 04/50: controlport: restructuring to add subdirs for different cp backends. |
Date: |
Wed, 15 Apr 2015 21:07:51 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch master
in repository gnuradio.
commit 73907cb13744f6f9bf7b5a7f3cd48f15fbd02941
Author: Tom Rondeau <address@hidden>
Date: Thu Feb 12 15:18:28 2015 -0500
controlport: restructuring to add subdirs for different cp backends.
---
gnuradio-runtime/lib/controlport/CMakeLists.txt | 28 ++-
gnuradio-runtime/lib/controlport/gnuradio.thrift | 97 ----------
.../lib/controlport/rpcpmtconverters_thrift.cc | 109 -----------
.../lib/controlport/rpcserver_thrift.cc | 202 ---------------------
.../python/gnuradio/ctrlport/CMakeLists.txt | 10 +
.../python/gnuradio/ctrlport/GrDataPlotter.py | 3 +-
6 files changed, 33 insertions(+), 416 deletions(-)
diff --git a/gnuradio-runtime/lib/controlport/CMakeLists.txt
b/gnuradio-runtime/lib/controlport/CMakeLists.txt
index 9963362..65d5ebf 100644
--- a/gnuradio-runtime/lib/controlport/CMakeLists.txt
+++ b/gnuradio-runtime/lib/controlport/CMakeLists.txt
@@ -29,15 +29,29 @@ list(APPEND gnuradio_ctrlport_sources
${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_aggregator.cc
${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_booter_aggregator.cc
${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_selector.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_thrift.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/rpcpmtconverters_thrift.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/thrift_application_base.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/rpcserver_booter_thrift.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio_types.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio_constants.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/ControlPort.cpp
)
+# FIXME: create actual cmake test to find and enable Thrift
+set(ENABLE_THRIFT "True")
+
+if(ENABLE_THRIFT)
+list(APPEND gnuradio_ctrlport_sources
+ ${CMAKE_CURRENT_SOURCE_DIR}/thrift/rpcserver_thrift.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/thrift/rpcpmtconverters_thrift.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/thrift/rpcserver_booter_thrift.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/thrift/thrift_application_base.cc
+)
+
+# add files built by compiling gnuradio.thrift
+# FIXME: Add cmake execute_process to do this for cpp and py
+list(APPEND gnuradio_ctrlport_sources
+ ${CMAKE_CURRENT_BINARY_DIR}/gnuradio_types.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/gnuradio_constants.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/ControlPort.cpp
+)
+
+endif(ENABLE_THRIFT)
+
########################################################################
# Add controlport stuff to gnuradio-runtime
########################################################################
diff --git a/gnuradio-runtime/lib/controlport/gnuradio.thrift
b/gnuradio-runtime/lib/controlport/gnuradio.thrift
deleted file mode 100644
index bc1c809..0000000
--- a/gnuradio-runtime/lib/controlport/gnuradio.thrift
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright 2014 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.
- */
-
-namespace cpp GNURadio
-namespace py GNURadio
-
-struct complex {
- 1: double re;
- 2: double im;
-}
-
-enum BaseTypes { BOOL, BYTE, SHORT, LONG, DOUBLE, STRING, COMPLEX }
-
-union KnobBase {
- 1: bool a_bool;
- 2: byte a_byte;
- 3: i32 a_short;
- 4: i64 a_long;
- 5: double a_double;
- 6: string a_string;
- 7: complex a_complex;
-}
-
-struct Knob {
- 1: BaseTypes type;
- 2: KnobBase value;
-}
-
-typedef list<bool> VectorB
-typedef list<byte> VectorC
-typedef list<i32> VectorI
-typedef list<double> VectorF
-typedef list<double> VectorD
-typedef list<string> VectorS
-typedef list<i64> VectorL
-typedef list<i32> VectorT
-
-enum KnobType { KNOBBOOL, KNOBCHAR, KNOBINT, KNOBDOUBLE, KNOBSTRING,
- KNOBLONG, KNOBVECBOOL, KNOBVECCHAR, KNOBVECINT,
- KNOBVECDOUBLE, KNOBVECSTRING, KNOBVECLONG, KNOBSHORT}
-
-const i32 DISPNULL = 0x0000
-const i32 DISPTIME = 0x0001
-const i32 DISPXY = 0x0002
-const i32 DISPPSD = 0x0004
-const i32 DISPSPEC = 0x0008
-const i32 DISPRAST = 0x0010
-const i32 DISPOPTCPLX = 0x0100
-const i32 DISPOPTLOG = 0x0200
-const i32 DISPOPTSTEM = 0x0400
-const i32 DISPOPTSTRIP = 0x0800
-const i32 DISPOPTSCATTER = 0x1000
-
-struct KnobProp {
- 1: KnobType type,
- 2: string units,
- 3: string description,
- 4: i32 display,
- 5: Knob min,
- 6: Knob max,
- 7: Knob defaultvalue
-}
-
-typedef list<string> KnobIDList
-typedef map<string, Knob> KnobMap
-typedef map<string, KnobProp> KnobPropMap
-typedef map<string, string> WaveformArgMap
-
-service StreamReceiver {
- void push(1:VectorC data);
-}
-
-service ControlPort {
- void setKnobs(1:KnobMap knobs);
- KnobMap getKnobs(1:KnobIDList knobs);
- KnobMap getRe(1:KnobIDList knobs);
- KnobPropMap properties(1:KnobIDList knobs);
- void shutdown();
-}
diff --git a/gnuradio-runtime/lib/controlport/rpcpmtconverters_thrift.cc
b/gnuradio-runtime/lib/controlport/rpcpmtconverters_thrift.cc
deleted file mode 100644
index bb2da62..0000000
--- a/gnuradio-runtime/lib/controlport/rpcpmtconverters_thrift.cc
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright 2014 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_thrift.h>
-#include "gnuradio_types.h"
-#include <iostream>
-
-GNURadio::Knob
-rpcpmtconverter::from_pmt(const pmt::pmt_t& knob)
-{
- if(pmt::is_real(knob)) {
-
- GNURadio::Knob result;
- result.type = GNURadio::BaseTypes::DOUBLE;
- result.value.__set_a_double(pmt::to_double(knob));
- return result;
- }
- else if(pmt::is_symbol(knob)) {
- std::string value = pmt::symbol_to_string(knob);
- GNURadio::Knob result;
- result.type = GNURadio::BaseTypes::STRING;
- result.value.__set_a_string(value);
- return result;
- }
- else if(pmt::is_integer(knob)) {
- GNURadio::Knob result;
- result.type = GNURadio::BaseTypes::LONG;
- result.value.__set_a_long(pmt::to_long(knob));
- return result;
- }
- else if(pmt::is_bool(knob)) {
- GNURadio::Knob result;
- result.type = GNURadio::BaseTypes::BOOL;
- result.value.__set_a_bool(pmt::to_bool(knob));
- return result;
- }
- else if(pmt::is_uint64(knob)) {
- GNURadio::Knob result;
- result.type = GNURadio::BaseTypes::LONG;
- result.value.__set_a_long(pmt::to_uint64(knob));
- return result;
- }
- else if(pmt::is_complex(knob)) {
- GNURadio::Knob result;
- result.type = GNURadio::BaseTypes::COMPLEX;
- std::complex<double> tmp = pmt::to_complex(knob);
- GNURadio::complex cpx;
- cpx.re = tmp.real();
- cpx.im = tmp.imag();
- result.value.__set_a_complex(cpx);
- return result;
- } //TODO Vectors
- else {
- std::cerr << "Error: Don't know how to handle Knob Type (from): " <<
std::endl; assert(0);}
- return GNURadio::Knob();
-}
-
-pmt::pmt_t
-rpcpmtconverter::to_pmt(const GNURadio::Knob& knob)
-{
-
- if(knob.type == GNURadio::BaseTypes::BYTE) {
- return pmt::mp(knob.value.a_byte);
- }
- else if(knob.type == GNURadio::BaseTypes::SHORT) {
- return pmt::mp(knob.value.a_short);
- }
- else if(knob.type == GNURadio::BaseTypes::LONG) {
- return pmt::mp(knob.value.a_long);
- }
- else if(knob.type == GNURadio::BaseTypes::DOUBLE) {
- return pmt::mp(knob.value.a_double);
- }
- else if(knob.type == GNURadio::BaseTypes::STRING) {
- return pmt::string_to_symbol(knob.value.a_string);
- }
- else if(knob.type == GNURadio::BaseTypes::BOOL) {
- if (knob.value.a_bool)
- return pmt::PMT_T;
- else
- return pmt::PMT_F;
- }
- else if(knob.type == GNURadio::BaseTypes::COMPLEX) {
- std::complex<double> cpx(knob.value.a_complex.re, knob.value.a_complex.im);
- return pmt::from_complex(cpx);
- }
- else {
- std::cerr << "Error: Don't know how to handle Knob Type: " << knob.type <<
std::endl; assert(0);
- }
- return pmt::pmt_t();
-}
diff --git a/gnuradio-runtime/lib/controlport/rpcserver_thrift.cc
b/gnuradio-runtime/lib/controlport/rpcserver_thrift.cc
deleted file mode 100644
index 6643050..0000000
--- a/gnuradio-runtime/lib/controlport/rpcserver_thrift.cc
+++ /dev/null
@@ -1,202 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2014 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_thrift.h>
-#include <iostream>
-#include <sstream>
-#include <stdexcept>
-#include <pmt/pmt.h>
-#include <thrift/protocol/TBinaryProtocol.h>
-#include <thrift/transport/TSocket.h>
-#include <thrift/transport/TTransportUtils.h>
-#include <boost/xpressive/xpressive.hpp>
-#include "ControlPort.h"
-
-#define DEBUG 0
-
-using namespace rpcpmtconverter;
-
-rpcserver_thrift::rpcserver_thrift()
-{
- std::cout << "rpcserver_thrift::ctor" << std::endl;
-}
-
-rpcserver_thrift::~rpcserver_thrift()
-{
- std::cout << "rpcserver_thrift::dtor" << std::endl;
-}
-
-void
-rpcserver_thrift::registerConfigureCallback(const std::string &id, const
configureCallback_t callback)
-{
- {
- std::cout << "thrift::registerConfigureCallback: " << id << std::endl;
- ConfigureCallbackMap_t::const_iterator iter(d_setcallbackmap.find(id));
- if(iter != d_setcallbackmap.end()) {
- std::stringstream s;
- s << "rpcserver_thrift:: rpcserver_thrift ERROR registering set, already
registered: "
- << id << std::endl;
- throw std::runtime_error(s.str().c_str());
- }
- }
-
- if(DEBUG) {
- std::cout << "rpcserver_thrift registering set: " << id << std::endl;
- }
- d_setcallbackmap.insert(ConfigureCallbackMap_t::value_type(id, callback));
-}
-
-void
-rpcserver_thrift::unregisterConfigureCallback(const std::string &id)
-{
- std::cout << "thrift::unregisterConfigureCallback: " << id << std::endl;
- ConfigureCallbackMap_t::iterator iter(d_setcallbackmap.find(id));
- if(iter == d_setcallbackmap.end()) {
- std::stringstream s;
- s << "rpcserver_thrift:: rpcserver_thrift ERROR unregistering set, not
registered: "
- << id << std::endl;
- throw std::runtime_error(s.str().c_str());
- }
-
- if(DEBUG)
- std::cout << "rpcserver_thrift unregistering set: " << id << std::endl;
-
- d_setcallbackmap.erase(iter);
-}
-
-void
-rpcserver_thrift::registerQueryCallback(const std::string &id,
- const queryCallback_t callback)
-{
- {
- std::cout << "thrift::registerQueryCallback: " << id << std::endl;
- QueryCallbackMap_t::const_iterator iter(d_getcallbackmap.find(id));
- if(iter != d_getcallbackmap.end()) {
- std::stringstream s;
- s << "rpcserver_thrift:: rpcserver_thrift ERROR registering get, already
registered: "
- << id << std::endl;
- throw std::runtime_error(s.str().c_str());
- }
- }
-
- if(DEBUG) {
- std::cout << "rpcserver_thrift registering get: " << id << std::endl;
- }
- d_getcallbackmap.insert(QueryCallbackMap_t::value_type(id, callback));
-}
-
-void
-rpcserver_thrift::unregisterQueryCallback(const std::string &id)
-{
- std::cout << "thrift::unregisterQueryCallback: " << id << std::endl;
- QueryCallbackMap_t::iterator iter(d_getcallbackmap.find(id));
- if(iter == d_getcallbackmap.end()) {
- std::stringstream s;
- s << "rpcserver_thrift:: rpcserver_thrift ERROR unregistering get,
registered: "
- << id << std::endl;
- throw std::runtime_error(s.str().c_str());
- }
-
- if(DEBUG) {
- std::cout << "rpcserver_thrift unregistering get: " << id << std::endl;
- }
-
- d_getcallbackmap.erase(iter);
-}
-
-void
-rpcserver_thrift::setKnobs(const GNURadio::KnobMap& knobs)
-{
- std::for_each(knobs.begin(), knobs.end(),
- set_f<GNURadio::KnobMap::value_type,ConfigureCallbackMap_t>
- (d_setcallbackmap, cur_priv));
-}
-
-
-void
-rpcserver_thrift::getKnobs(GNURadio::KnobMap& _return, const
GNURadio::KnobIDList& knobs)
-{
- 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>
- (d_getcallbackmap, cur_priv, outknobs));
- }
- else {
- std::for_each(knobs.begin(), knobs.end(),
- get_f<GNURadio::KnobIDList::value_type, QueryCallbackMap_t>
- (d_getcallbackmap, cur_priv, outknobs));
- }
- _return = outknobs;
-}
-
-void
-rpcserver_thrift::getRe(GNURadio::KnobMap& _return, const
GNURadio::KnobIDList& knobs)
-{
- 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>
- (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>
- (d_getcallbackmap, cur_priv, outknobs)(it->first);
- break;
- }
- }
- }
- }
- _return = outknobs;
-}
-
-void
-rpcserver_thrift::properties(GNURadio::KnobPropMap& _return, const
GNURadio::KnobIDList& knobs)
-{
- 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>(d_getcallbackmap, cur_priv, outknobs));
- }
- else {
- std::for_each(knobs.begin(), knobs.end(),
- properties_f<GNURadio::KnobIDList::value_type,
- QueryCallbackMap_t,
GNURadio::KnobPropMap>(d_getcallbackmap, cur_priv, outknobs));
- }
- _return = outknobs;
-}
-
-void
-rpcserver_thrift::shutdown() {
- if (DEBUG) {
- std::cout << "Shutting down..." << std::endl;
- }
-}
diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt
b/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt
index 1d5a292..d208763 100644
--- a/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt
+++ b/gnuradio-runtime/python/gnuradio/ctrlport/CMakeLists.txt
@@ -29,8 +29,18 @@ install(
GR_PYTHON_INSTALL(
FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py
${CMAKE_CURRENT_SOURCE_DIR}/GrDataPlotter.py
${CMAKE_CURRENT_SOURCE_DIR}/monitor.py
+ ${CMAKE_CURRENT_SOURCE_DIR}/ThriftRadioClient.py
DESTINATION ${GR_PYTHON_DIR}/gnuradio/ctrlport/
COMPONENT "runtime_python"
)
+
+GR_PYTHON_INSTALL(
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/gr-perf-monitorx
+ DESTINATION ${GR_RUNTIME_DIR}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
+ COMPONENT "runtime_python"
+)
diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py
b/gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py
index 661705d..5d75197 100644
--- a/gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py
+++ b/gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py
@@ -23,7 +23,8 @@
from gnuradio import gr
from gnuradio import blocks
from gnuradio import filter
-from gnuradio.ctrlport import GNURadio
+#from gnuradio.ctrlport import GNURadio
+from gnuradio.ControlPort import GNURadio
import sys, time, struct
try:
- [Commit-gnuradio] [gnuradio] branch master updated (676d5cb -> b092142), git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 03/50: controlport: working controlport server using thrift., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 06/50: controlport: quick fix, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 02/50: ctrlport: thrift: "py" instead of "python" -- guessing a version thing, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 04/50: controlport: restructuring to add subdirs for different cp backends.,
git <=
- [Commit-gnuradio] [gnuradio] 18/50: controlport: improving transport layer throughput., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 07/50: controlport: Addes a FindThrift cmake module to find the Thrift headers, libraries, and Python files., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 17/50: controlport: convert to To_PMT registration objects, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 20/50: runtime: more generic version of prefs class., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 22/50: cmake: force QA tests to turn ControlPort off by default., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 15/50: controlport: convert rpcpmtconverter::to_pmt() if statement to a function object map, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 01/50: Initial thrift definition for gnuradio, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 14/50: controlport: Thrift's binary type, git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 09/50: controlport: cleanup and switching over to new Python common interface., git, 2015/04/16
- [Commit-gnuradio] [gnuradio] 23/50: controlport: cleaning up and using logger to display endpoint., git, 2015/04/16