summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/python/gnuradio/ctrlport/RPCConnectionThrift.py
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-runtime/python/gnuradio/ctrlport/RPCConnectionThrift.py')
-rw-r--r--gnuradio-runtime/python/gnuradio/ctrlport/RPCConnectionThrift.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/RPCConnectionThrift.py b/gnuradio-runtime/python/gnuradio/ctrlport/RPCConnectionThrift.py
index f086b85834..f662a66c90 100644
--- a/gnuradio-runtime/python/gnuradio/ctrlport/RPCConnectionThrift.py
+++ b/gnuradio-runtime/python/gnuradio/ctrlport/RPCConnectionThrift.py
@@ -26,6 +26,7 @@ from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from gnuradio.ctrlport.GNURadio import ControlPort
from gnuradio.ctrlport import RPCConnection
+from gnuradio import gr
import sys
class ThriftRadioClient:
@@ -64,8 +65,19 @@ class RPCConnectionThrift(RPCConnection.RPCConnection):
self.BaseTypes = ttypes.BaseTypes
self.KnobBase = ttypes.KnobBase
+ # If not set by the user, get the port number from the thrift
+ # config file, if one is set. Defaults to 9090 otherwise.
if port is None:
- port = 9090
+ p = gr.prefs()
+ thrift_config_file = p.get_string("ControlPort", "config", "");
+ if(len(thrift_config_file) > 0):
+ p.add_config_file(thrift_config_file)
+ port = p.get_long("thrift", "port", 9090)
+ else:
+ port = 9090
+ else:
+ port = int(port)
+
super(RPCConnectionThrift, self).__init__(method='thrift', port=port, host=host)
self.newConnection(host, port)