Skip to content

XML-RPC Tools

Tools for connecting to running flowgraphs via XML-RPC and controlling variables.

connect

Connect to a GNU Radio XML-RPC endpoint by URL.

Parameters

NameTypeDefaultDescription
urlstr-XML-RPC URL (e.g., http://localhost:8080)

Returns

Type: ConnectionInfoModel

Connection details including URL and port.

Example

connect(url="http://localhost:8080")
# Returns: ConnectionInfoModel(
# url="http://localhost:8080",
# xmlrpc_port=8080,
# container_name=None
# )

connect_to_container

Connect to a flowgraph by container name (resolves port automatically).

Parameters

NameTypeDefaultDescription
namestr-Container name

Returns

Type: ConnectionInfoModel

Connection details.

Example

connect_to_container(name="fm-radio")
# Returns: ConnectionInfoModel(
# url="http://localhost:32768",
# xmlrpc_port=32768,
# container_name="fm-radio"
# )

disconnect

Disconnect from the current XML-RPC (and ControlPort) endpoint.

Returns

Type: bool

True if successful.

Example

disconnect()
# Returns: True

get_status

Get runtime status including connection and container info.

Returns

Type: RuntimeStatusModel

Current runtime state.

Example

status = get_status()
# Returns: RuntimeStatusModel(
# connected=True,
# connection=ConnectionInfoModel(...),
# containers=[ContainerModel(...), ...]
# )

list_variables

List all XML-RPC-exposed variables.

Returns

Type: list[VariableModel]

List of variables with name, value, and type.

Example

vars = list_variables()
# Returns: [
# VariableModel(name="freq", value=101100000.0, type="float"),
# VariableModel(name="gain", value=40, type="int"),
# VariableModel(name="samp_rate", value=2000000.0, type="float"),
# ]

get_variable

Get a variable value.

Parameters

NameTypeDefaultDescription
namestr-Variable name

Returns

Type: Any

Current variable value.

Example

101100000.0
freq = get_variable(name="freq")

set_variable

Set a variable value.

Parameters

NameTypeDefaultDescription
namestr-Variable name
valueAny-New value

Returns

Type: bool

True if successful.

Example

set_variable(name="freq", value=98.5e6)
# Returns: True

start

Start the connected flowgraph.

Returns

Type: bool

True if successful.

Example

start()
# Returns: True

stop

Stop the connected flowgraph.

Returns

Type: bool

True if successful.

Example

stop()
# Returns: True

lock

Lock the flowgraph for thread-safe parameter updates.

Returns

Type: bool

True if successful.

Example

lock()
set_variable(name="freq", value=102.7e6)
set_variable(name="gain", value=35)
unlock()

unlock

Unlock the flowgraph after parameter updates.

Returns

Type: bool

True if successful.

Example

unlock()
# Returns: True