p5control.gateway.datagw

This module provides an interface to the data server

class p5control.gateway.datagw.DataGateway(addr: str = 'localhost', port: int = 30000, conn_timeout: float = 0.0, allow_callback: bool = False)

Bases: BaseGateway

Gateway to the data server. Use this to add and retrieve data as well as install callbacks.

Parameters:
  • addr (str = 'localhost') – address of the data server

  • port (int = DATASERV_DEFAULT_PORT) – port of the data server

  • conn_timeout (float = 0.0) – how long to try to connect to the server, at least one try is made

  • allow_callback (bool = False) – whether to allow registering of callbacks.

connect(config=None)

Attempt connection to the rpyc server.

Parameters:

config (dict = None) – can be used to configure the connection to the rpyc server.

Raises:

BaseGatewayError – Connection to the Server failed

get_data(path, indices: slice = (), field: str | None = None)

Wraps self._connection.root.get_data to use obtain on the result in order to transfer the data to a local object.

register_callback(path, func, is_group: bool = False)

Wraps self._connection.root.register_callback to check whether callbacks are enabled.