CommandManager Module#
SPDX-FileCopyrightText: 2024 DESY and the Constellation authors SPDX-License-Identifier: EUPL-1.2
This module provides classes for managing CSCP requests/replies within Constellation Satellites.
- class core.commandmanager.CommandReceiver(name: str, cmd_port: int, **kwds: Any)#
Bases:
BaseSatelliteFrameClass for handling incoming CSCP requests.
Commands will call specific methods of the inheriting class which should have the following signature:
def COMMAND(self, request: CSCP1Message) -> (str, any, dict):
The expected return values are: - reply message (string) - payload (any) - map (dictionary) (e.g. for meta information)
Inheriting classes need to decorate such command methods with @cscp_requestable() to make them callable through CSCP requests.
- add_cscp_command(method: str, doc: str | None = None, allowed_states: list[SatelliteState] | None = None) None#
Add a method to CSCP.
This is an alternative to using the @cscp_requestable() decorator.
Arguments:
method (str): name of the method.
doc (str): a short string providing documentation to the command. If no doc argument is given, the doc-string of the method will be used instead.
allowed_states (list[SatelliteState]): list of states in which the command is allowed
- get_commands(_request: CSCP1Message | None = None) tuple[str, dict[str, str], None]#
Return all commands supported by the Satellite.
No payload argument.
This will include all methods with the @cscp_requestable() decorator. The doc string of the function will be used to derive the summary and payload argument description for each command by using the first and the second line of the doc string, respectively (not counting empty lines).