Tom - namccart/201507_codesprint GitHub Wiki

Building ControlPort Client in Java to allow Android apps to call into running GNU Radio flowgraphs and get/set info over ControlPort.

  • ThriftRadioClient.java: handles the basic network connection over a Thrift-based ControlPort.
  • RPCConnectionThrift.java: Manages getting and setting of knobs. This is only partly done, implementing getKnobs and getRe, but will eventually look like RPCConnectionThrift.py that we use for the similar abstraction in Python.

The client Android app uses RPCConnectionThrift classes to open up a connection and read and write knobs.

To get knobs of a running flowgraph:

  • Create a connection: "conn = new RPCConnectionThrift(host, port);" ** Where "host" can be a host name or an IP address. ** "port" is the Integer port number of the endpoint.
  • Create a List of strings ("List") that define which knobs to get. When passed to getKnobs, this is a filter for all knobs that are in that string. If the list is empty, we get all knobs back. ** Returns: Map<String, RPCConnectionThrift.KnobInfo> *** NOTE: KnobInfo should not be a member of the RPCConnectionThrift class, but a general class to contain Knob info (key, value, type) for any type of connection backend. ** Use getRe instead of getKnobs to use a regular expression -- ".*::work time" to get the Work Time Performance Counter from all blocks.

NOTE: Must not make the RPC connection in an Activity's main thread -- we created an Executor (Executor.newSingleThreadExecutor) to launch a Runnable ("implements Runnable") class that does the actual connection.

Opening page of App to get config info of the running flowgraph:

Config Page

Gets knobs and display results on another activity page:

Config Page

In Python, we have another layer that asks/checks what type of ControlPort backend is in use and calls the appropriate RPCConnection client. Each client class has the same API to get/set knobs to make the user-level use very easy regardless of the backend.

⚠️ **GitHub.com Fallback** ⚠️