commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 17/21: controlport: android: cleaning up; b


From: git
Subject: [Commit-gnuradio] [gnuradio] 17/21: controlport: android: cleaning up; better logs; help to support android.
Date: Sat, 9 May 2015 14:05:37 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

trondeau pushed a commit to branch android
in repository gnuradio.

commit e40a5e24b8c0e483e76083e379cd43a7bdb8a1cd
Author: Tom Rondeau <address@hidden>
Date:   Tue May 5 10:10:19 2015 -0400

    controlport: android: cleaning up; better logs; help to support android.
---
 .../include/gnuradio/thrift_application_base.h     |  6 +-
 .../include/gnuradio/thrift_server_template.h      | 64 ++++++++++++----------
 .../controlport/thrift/rpcpmtconverters_thrift.cc  |  2 +-
 .../controlport/thrift/rpcserver_booter_thrift.cc  |  2 +-
 4 files changed, 39 insertions(+), 35 deletions(-)

diff --git a/gnuradio-runtime/include/gnuradio/thrift_application_base.h 
b/gnuradio-runtime/include/gnuradio/thrift_application_base.h
index 4af5e88..967c609 100644
--- a/gnuradio-runtime/include/gnuradio/thrift_application_base.h
+++ b/gnuradio-runtime/include/gnuradio/thrift_application_base.h
@@ -197,14 +197,11 @@ thrift_application_base<TserverBase, 
TserverClass>::thrift_application_base(Tser
 {
   gr::configure_default_loggers(d_logger, d_debug_logger, "controlport");
   d_application = _app;
-  //GR_LOG_DEBUG(d_debug_logger, "thrift_application_base: ctor");
 }
 
 template<typename TserverBase, typename TserverClass>
 void thrift_application_base<TserverBase, TserverClass>::start_application()
 {
-  //std::cerr << "thrift_application_base: start_application" << std::endl;
-
   unsigned int max_init_attempts = \
     static_cast<unsigned int>(gr::prefs::singleton()->get_long("thrift", 
"init_attempts",
                                                                
d_default_max_init_attempts));
@@ -220,7 +217,8 @@ void thrift_application_base<TserverBase, 
TserverClass>::start_application()
     }
 
     if(!app_started) {
-      std::cerr << "thrift_application_base::start_application(), timeout 
waiting to port number might have failed?" << std::endl;
+      GR_LOG_WARN("thrift", "thrift_application_base::start_application(), "
+                  "timeout waiting to port number might have failed?");
     }
 
     p_impl->d_application_initilized = true;
diff --git a/gnuradio-runtime/include/gnuradio/thrift_server_template.h 
b/gnuradio-runtime/include/gnuradio/thrift_server_template.h
index b8f5448..e2d6f63 100644
--- a/gnuradio-runtime/include/gnuradio/thrift_server_template.h
+++ b/gnuradio-runtime/include/gnuradio/thrift_server_template.h
@@ -80,13 +80,13 @@ private:
 };
 
 template<typename TserverBase, typename TserverClass, typename TImplClass>
-thrift_server_template<TserverBase, TserverClass, 
TImplClass>::thrift_server_template
-(TImplClass* _this) : thrift_application_base<TserverBase, TImplClass>(_this),
-d_handler(new TserverClass()),
-d_processor(new GNURadio::ControlPortProcessor(d_handler)),
-d_serverTransport(),
-d_transportFactory(),
-d_protocolFactory(new thrift::protocol::TBinaryProtocolFactory())
+thrift_server_template<TserverBase, TserverClass, 
TImplClass>::thrift_server_template(TImplClass* _this)
+  : thrift_application_base<TserverBase, TImplClass>(_this),
+    d_handler(new TserverClass()),
+    d_processor(new GNURadio::ControlPortProcessor(d_handler)),
+    d_serverTransport(),
+    d_transportFactory(),
+    d_protocolFactory(new thrift::protocol::TBinaryProtocolFactory())
 {
   gr::logger_ptr logger, debug_logger;
   gr::configure_default_loggers(logger, debug_logger, "controlport");
@@ -101,39 +101,45 @@ d_protocolFactory(new 
thrift::protocol::TBinaryProtocolFactory())
   // Collect configuration options from the Thrift config file;
   // defaults if the config file doesn't exist or list the specific
   // options.
-  port = static_cast<unsigned int>(gr::prefs::singleton()->get_long("thrift", 
"port",
-                                                                    
thrift_application_base<TserverBase, TImplClass>::d_default_thrift_port));
-  nthreads = static_cast<unsigned 
int>(gr::prefs::singleton()->get_long("thrift", "nthreads",
-                                                                        
thrift_application_base<TserverBase, 
TImplClass>::d_default_num_thrift_threads));
-  buffersize = static_cast<unsigned 
int>(gr::prefs::singleton()->get_long("thrift", "buffersize",
-                                                                          
thrift_application_base<TserverBase, 
TImplClass>::d_default_thrift_buffer_size));
+  port = static_cast<unsigned int>
+    (gr::prefs::singleton()->get_long("thrift", "port",
+                                      thrift_application_base<TserverBase,
+                                      TImplClass>::d_default_thrift_port));
+  nthreads = static_cast<unsigned int>
+    (gr::prefs::singleton()->get_long("thrift", "nthreads",
+                                      thrift_application_base<TserverBase,
+                                      
TImplClass>::d_default_num_thrift_threads));
+  buffersize = static_cast<unsigned int>
+    (gr::prefs::singleton()->get_long("thrift", "buffersize",
+                                      thrift_application_base<TserverBase,
+                                      
TImplClass>::d_default_thrift_buffer_size));
 
   d_serverTransport.reset(new thrift::transport::TServerSocket(port));
 
   d_transportFactory.reset(new 
thrift_server_template::TBufferedTransportFactory(buffersize));
 
-
   if(nthreads <= 1) {
-      // "Thrift: Single-threaded server"
-      //std::cout << "Thrift Single-threaded server" << std::endl;
-      thrift_application_base<TserverBase, TImplClass>::d_thriftserver.reset(
-          new thrift::server::TSimpleServer(d_processor, d_serverTransport, 
d_transportFactory, d_protocolFactory));
+    // "Thrift: Single-threaded server"
+    //std::cout << "Thrift Single-threaded server" << std::endl;
+    thrift_application_base<TserverBase, TImplClass>::d_thriftserver.reset
+      (new thrift::server::TSimpleServer(d_processor, d_serverTransport,
+                                         d_transportFactory, 
d_protocolFactory));
   }
   else {
-      //std::cout << "Thrift Multi-threaded server : " << d_nthreads << 
std::endl;
-      boost::shared_ptr<thrift::concurrency::ThreadManager> threadManager(
-          
thrift::concurrency::ThreadManager::newSimpleThreadManager(nthreads));
+    //std::cout << "Thrift Multi-threaded server : " << d_nthreads << 
std::endl;
+    boost::shared_ptr<thrift::concurrency::ThreadManager> threadManager
+      (thrift::concurrency::ThreadManager::newSimpleThreadManager(nthreads));
 
-      threadManager->threadFactory(
-          boost::shared_ptr<thrift::concurrency::PlatformThreadFactory>(
-              new thrift::concurrency::PlatformThreadFactory()));
+    threadManager->threadFactory
+      (boost::shared_ptr<thrift::concurrency::PlatformThreadFactory>
+       (new thrift::concurrency::PlatformThreadFactory()));
 
-      threadManager->start();
+    threadManager->start();
 
-      thrift_application_base<TserverBase, TImplClass>::d_thriftserver.reset(
-          new thrift::server::TThreadPoolServer(d_processor, d_serverTransport,
-                                                d_transportFactory, 
d_protocolFactory,
-                                                threadManager));
+    thrift_application_base<TserverBase, TImplClass>::d_thriftserver.reset
+      (new thrift::server::TThreadPoolServer(d_processor, d_serverTransport,
+                                             d_transportFactory, 
d_protocolFactory,
+                                             threadManager));
   }
 }
 
diff --git a/gnuradio-runtime/lib/controlport/thrift/rpcpmtconverters_thrift.cc 
b/gnuradio-runtime/lib/controlport/thrift/rpcpmtconverters_thrift.cc
index 19da05f..cc8804f 100644
--- a/gnuradio-runtime/lib/controlport/thrift/rpcpmtconverters_thrift.cc
+++ b/gnuradio-runtime/lib/controlport/thrift/rpcpmtconverters_thrift.cc
@@ -162,7 +162,7 @@ rpcpmtconverter::to_pmt_int_f::operator()(const 
GNURadio::Knob& knob)
 pmt::pmt_t
 rpcpmtconverter::to_pmt_long_f::operator()(const GNURadio::Knob& knob)
 {
-  return pmt::mp(knob.value.a_long);
+  return pmt::from_long(knob.value.a_long);
 }
 
 pmt::pmt_t
diff --git a/gnuradio-runtime/lib/controlport/thrift/rpcserver_booter_thrift.cc 
b/gnuradio-runtime/lib/controlport/thrift/rpcserver_booter_thrift.cc
index 1d6cafe..3284fa0 100644
--- a/gnuradio-runtime/lib/controlport/thrift/rpcserver_booter_thrift.cc
+++ b/gnuradio-runtime/lib/controlport/thrift/rpcserver_booter_thrift.cc
@@ -124,7 +124,7 @@ bool thrift_application_base<rpcserver_base, 
rpcserver_booter_thrift>::applicati
 
     set_endpoint(endpoint);
 
-    GR_LOG_INFO(d_logger, "Apache Thrift: " + endpoint);
+    GR_INFO("thrift_application_base", "Apache Thrift: " + endpoint);
     d_thirft_is_running = true;
     result = true;
   }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]