diff options
author | Tom Rondeau <tom@trondeau.com> | 2015-10-07 07:15:56 -0400 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2015-10-16 15:48:47 -0400 |
commit | 09b03871e81da2b09792a454ee3caf28bdad4c3c (patch) | |
tree | 577b2ca08026ce833963e7e494069e593b5a489f /gnuradio-runtime/python | |
parent | ce28185909272d2aebc0e8279a4ab2c3cca16c02 (diff) |
ctrlport: provides a ControlPort model that connects directly with a
block's message handler.
We still need to register this in setup_rpc, but there might be a way
to automate the registering of this during set_msg_handler if
ControlPort is enabled.
Diffstat (limited to 'gnuradio-runtime/python')
-rw-r--r-- | gnuradio-runtime/python/gnuradio/ctrlport/RPCConnection.py | 3 | ||||
-rw-r--r-- | gnuradio-runtime/python/gnuradio/ctrlport/RPCConnectionThrift.py | 17 |
2 files changed, 20 insertions, 0 deletions
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) |