p5control.gateway.basegw

This module provides an interface to control devices on an instrument server.

exception p5control.gateway.basegw.BaseGatewayError

Bases: Exception

Raised for failures related to the BaseGateway.

class p5control.gateway.basegw.BaseGateway(addr: str = 'localhost', port: int = 42068, conn_timeout: float = 0.0, allow_callback: bool = False)

Bases: object

Base class for a connection to an rpyc server.

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

  • port (inst = INSERV_DEFAULT_PORT) – port of the server

  • conn_timeout (float = 0.0) – how long to try to connect to the server before raising an exception

  • allow_callback (bool = False) – whether callbacks are allowed. If True, starts rpyc.BgServingThread to handle incoming 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

disconnect()

Disconnect form the server

reconnect()

Reconnect to the server

property connected

Pings the connection and returns True if connected to the server.