instrumentserver.server.core#
instrumentserver.server.core#
Core functionality of the instrument server.
Functions
|
Create a server and run in a separate thread. |
Classes
|
The main server object. |
- class instrumentserver.server.core.StationServer(parent: QObject | None = None, port: int = 5555, allowUserShutdown: bool = False, addresses: List[str] = [], initScript: str | None = None, serverConfig: Dict[str, Any] | None = None, stationConfig: str | None = None, guiConfig: dict[str, Any] | None = None, pollingThread: QThread | None = None, ipAddresses: Dict[str, str] | None = None)[source]#
Bases:
QObjectThe main server object.
Encapsulated in a separate object so we can run it in a separate thread.
Port should always be an odd number to allow the next even number to be its corresponding publishing port.
- SAFEWORD = 'BANANA'#
- executeServerInstruction(instruction: ServerInstruction) Tuple[ServerResponse, str][source]#
This is the interpreter function that the server will call to translate the dictionary received from the proxy to instrument calls.
- Parameters:
instruction – The instruction object.
- Returns:
The results returned from performing the operation.
- finished#
Signal() – emitted when we shut down.
- funcCalled#
Signal(str, List[Any], Dict[str, Any], Any) – emitted when a function was called Arguments: full function location as string, arguments, kw arguments, return value.
- instrumentCreated#
Signal(Dict) – emitted when a new instrument was created. Argument is the blueprint of the instrument, the args and kwargs used to create it.
- messageReceived#
Signal(str, str) – emit messages for display in the gui (or other stuff the gui wants to do with it. Arguments: the message received, and the reply sent.
- parameterGet#
Signal(str, Any) – emitted when a parameter was retrieved Arguments: full parameter location as string, value.
- parameterSet#
Signal(str, Any) – emitted when a parameter was set Arguments: full parameter location as string, value.
- serverStarted#
Signal(int) – emitted when the server is started. Arguments: the port.
- instrumentserver.server.core.startServer(port: int = 5555, allowUserShutdown: bool = False, addresses: List[str] = [], initScript: str | None = None, serverConfig: Dict[str, Any] | None = None, stationConfig: str | None = None, guiConfig: dict[str, Any] | None = None, pollingThread: QThread | None = None, ipAddresses: Dict[str, str] | None = None) Tuple[StationServer, QThread][source]#
Create a server and run in a separate thread.
- Returns:
The server object and the thread it’s running in.