diff --git a/SiLA_Features/DeviceInfoProvider-v1_1.sila.xml b/SiLA_Features/DeviceInfoProvider-v1_1.sila.xml new file mode 100644 index 0000000..0ac61fd --- /dev/null +++ b/SiLA_Features/DeviceInfoProvider-v1_1.sila.xml @@ -0,0 +1,455 @@ + + + DeviceInfoProvider + Device Info Provider + + This SiLA feature provides detailed information about a device, like device name, device type, + device manufacturer, device product name, device version, device manual, device quick start guide, + device service manual, device serial number, device registration number, device barcode, device production date, + device purchase date, device end of warrenty, device service dates, device service information, etc. + + + + SetOutputFormat + + Set Output Format + + + Set the output format of the device information, like TEXT, JSON-LD, XML, etc. + The recommended default output format is JSON-LD, which allows to provide detailed information about the device in a structured way with semantic annotations / context, referencing to defined vocabularies. + + No + + OutputFormat + + Output Format + + + Output format of the device information. + + + String + + + + OutputFormatNotSupported + + + + + + DeviceName + + Device Name + + + Name of the Device. + + No + + String + + + + DeviceType + + Device Type, like incubator, shaker, etc., in JSON-LD format. + + + Type of the Device. + + No + + String + + + + DeviceManufacturer + + Device Manufacturer, like Eppendorf, ThermoFisher, etc., in JSON-LD format. + + + Manufacturer of the Device. + + No + + String + + + + DeviceProductName + + Device Product Name, like Eppendorf 5415R, ThermoFisher 1234, etc., in JSON-LD format. + + + Product Name of the Device. + + No + + String + + + + DeviceVersion + + Device Version, like Eppendorf 5415R, ThermoFisher 1234, etc., in JSON-LD format. + + + Version of the Device. + + No + + String + + + + DeviceFirmwareVersion + + Device Firmware Version, like 50122578-B, 1.2, 0.0.2, in JSON-LD format. + + + Version of the Device Firmware. + + No + + String + + + + DeviceManual + + Device Manual, like Eppendorf 5415R, ThermoFisher 1234, etc., URL. + + + URL to Manual of the Device. + + No + + String + + + + DeviceQuickStartGuide + + URL to Device Quick Start Guide, like Eppendorf 5415R, ThermoFisher 1234, etc., URL. + + + URL to Quick Start Guide of the Device. + + No + + String + + + + DeviceServiceManual + + Device Service Manual, like Eppendorf 5415R, ThermoFisher 1234, etc., URL. + + + URL to Service Manual of the Device. + + No + + String + + + + HardwareSettings + + Hardware Settings + + + Hardware Settings of the Device, like serial port settings, etc., preferably in JSON-LD format. + + No + + String + + + + HardwareConfiguration + + Hardware Configuration + + + Hardware Configuration of the Device, like racks with n slots, slot spacing, shakers, barcode reader, CO2 unit, etc., + preferably in JSON-LD format. + + No + + String + + + + + DeviceInfo + + Device Information + + + Detailed Information about the Device. + + No + + DeviceInfo + + + + ServiceDates + + Service Dates + + + Service Dates of the Device. + + No + + + + ServiceInfoList + + Service Information List + + + List of Service Information of the Device. + + + + + ServiceInfo + + + + + + LastServiceDate + + Last Service Date + + + Last Service Date of the Device. + + + Date + + + + NextServiceDate + + Next Service Date + + + Next Service Date of the Device. + + + Date + + + + + + + + DeviceInfo + Device Information + Detailed Information about the Device. + + + + + SerialNo + + Serial Number + + + Serial Number of the Device. + + + String + + + + PartNo + + Part Number + + + Part Number of the Device. + + + String + + + + RegistrationNo + + Registration Number + + + Registration Number of the Device. + + + String + + + + Barcode + + Barcode + + + Barcode of the Device. + + + String + + + + ProductionDate + + Production Date + + + Production Date of the Device. + + + Date + + + + PurchaseDate + + Purchase Date + + + Purchase Date of the Device. + + + Date + + + + EndOfWarrenty + + End of Warrenty + + + End of Warrenty of the Device. + + + Date + + + + SemanticDeviceInfo + + Semantic Device Information + + + Semantic Device Information of the Device. In JSON-LD format. + + + String + + + + + + + ServiceInfo + Service Information + Detailed Information about the Service. + + + + + ServiceDate + + Service Date + + + Service Date of the Device. + + + Date + + + + ServiceType + + Service Type + + + Service Type of the Device. + + + String + + + + ServiceDescription + + Service Description + + + Service Description of the Device. + + + String + + + + ServiceReport + + Service Report + + + Service Report of the Device. In JSON-LD format. + + + String + + + + + ServiceCompany + + Service Company + + + Service Company of the Device. Info in JSON-LD format + + + String + + + + ServiceEngineer + + ServiceEngineer + + + Service Engineer of Device in JSON-LD format. + + + String + + + + + + + + OutputFormatNotSupported + + Output Format Not Supported + + + The output format is not supported. + + + \ No newline at end of file diff --git a/SiLA_Features/LoggingService-v0_3.sila.xml b/SiLA_Features/LoggingService-v0_3.sila.xml new file mode 100644 index 0000000..9f825fd --- /dev/null +++ b/SiLA_Features/LoggingService-v0_3.sila.xml @@ -0,0 +1,238 @@ + + + LoggingService + Logging Service + Provides services for integration of SiLA server logging. + The service is intended to be used by the server to provide logging information to the client. + The client can use the service to listen for log entries from the server. + It is possible to listen for all log entries or only for log entries from a specific Stream. + Error handling: If the server is not able to provide the requested information, it shall return an error message. + + + + + ListenToLoggingStream + Listen to logging stream + Starts listening to a logging stream from the SiLA server + Yes + + LoggingStreamName + Logging Stream Name (URL) + The logging stream name (recommended: in form of a URL) to listen to. + + String + + + + IntermediateLoggingText + Intermediate Logging Text + The current logging text of a certain logging stream as it is created by the server + + String + + + + LogginStreamNotAvailable + + + + ListenToAllLogEntries + Listen to all log entries + Starts listening to a stream of all consecutive log entries from the SiLA server + Yes + + IntermediateLoggingEntry + IntermediateLoggingEntry + Intermediate Log Entries as they are created by the server + + + + LogEntry + + + + + + + GetLogFile + Get Log File + Gets the log file from the server. + No + + LogFileName + Log File Name (URL) + The name of the log file (recommended: in URL format) to get. + + String + + + + LogFile + Log File (text) + Log File as text + + String + + + + LogFileNotAvailable + + + + SetLogLevel + Set Log Level + Sets the log level of the server. + No + + LogLevel + Log Level + The log level to set. + + + + String + + + + Notset + Debug + Info + Warning + Error + Critical + + + + + + + + + + LoggingStreamList + Logging Stream (URL) List + Provides a list of URLs of all logging streams that are currently available on the server. + No + + + + String + + + + + + LogFileList + Log Files (URL) List + Provides a list of URLs of all log files that are currently available on the server. + No + + + + String + + + + + + LogLevel + Log Level + The current log level of the server. + No + + + + String + + + + Notset + Debug + Info + Warning + Error + Critical + + + + + + + + + LogEntry + Log Entry + Describes a log entry + + + + Message + Message + The log message. + + String + + + + StreamName + StreamName (URL) + The Stream name (recommended: in URL form), including a hint to the software part that is responsible for the log entry. + + String + + + + Severity + Severity + The severity level. + + Severity + + + + ExtraInfo + Extra Information + The additional information in JSON-LD format. + + String + + + + + + + Severity + Severity + + + + + String + + + + Debug + Info + Warning + Error + Critical + + + + + + + + LogginStreamNotAvailable + Loggin Stream Not Available + The specified Logging Stream is unavailable. Please check the spelling of the stream URL + + + LogFileNotAvailable + Log File Not Available + The specified Log File is unavailable. Please check the spelling of the file URL + + \ No newline at end of file diff --git a/SiLA_Features/SimulationController-v1_0.sila.xml b/SiLA_Features/SimulationController-v1_0.sila.xml new file mode 100644 index 0000000..27a9f04 --- /dev/null +++ b/SiLA_Features/SimulationController-v1_0.sila.xml @@ -0,0 +1,76 @@ + + + SimulationController + Simulation Controller + + This Feature provides control over the simulation behaviour of a SiLA Server. + + A SiLA Server can run in two modes: + (a) Real Mode - with real activities, e.g. addressing or controlling real hardware, e.g. through serial/CANBus commands, + writing to real databases, moving real objects etc. + (b) Simulation Mode - where every command is only simulated and responses are just example returns. + + Note that certain commands and properties might not be affected by this feature if they + do not interact with the real world. + + + StartSimulationMode + Start Simulation Mode + + Sets the SiLA Server to run in Simulation Mode, i.e. all following commands are executed in simulation mode. + + The Simulation Mode can only be entered, if all hardware operations have been safely terminated + or are in a controlled, safe state. + + The simulation mode can be stopped by issuing the 'Start Real Mode' command. + + No + + StartSimulationModeFailed + + + + StartRealMode + Start Real Mode + + Sets the SiLA Server to run in real mode, i.e. all following commands are executed with real-world + interactions, like serial port/CAN communication, motor actions etc. + + If the server is in Simulation Mode it can be interrupted at any time. A re-initialization of + the hardware might be required. The Real Mode can be stopped by issuing the 'Start Simulation Mode' command. + + No + + StartRealModeFailed + + + + SimulationMode + SimulationMode + Indication whether SiLA Server is in Simulation Mode or not. + No + + Boolean + + + + StartSimulationModeFailed + The start of Simulation Mode failed. + + The server cannot change to Simulation Mode. + This error can, e.g., be thrown, if a real-world process needs to be ended before switching to simulation + mode. + + + + StartRealModeFailed + The start of Real Mode failed. + + The server cannot change to Real Mode. + This error can, e.g., be thrown, if a device is not ready to change into Real Mode. + + + diff --git a/plr_sila_bridge/plr_sila_bridge/__init__.py b/plr_sila_bridge/plr_sila_bridge/__init__.py new file mode 100644 index 0000000..9cc1da8 --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/__init__.py @@ -0,0 +1,8 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +from .generated import Client +from .server import Server + +__all__ = [ + "Client", + "Server", +] diff --git a/plr_sila_bridge/plr_sila_bridge/__main__.py b/plr_sila_bridge/plr_sila_bridge/__main__.py new file mode 100644 index 0000000..d72874b --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/__main__.py @@ -0,0 +1,128 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +# Generated by sila2.code_generator; sila2.__version__: 0.10.3 +import contextlib +import logging +import signal +from pathlib import Path +from typing import Optional +from uuid import UUID + +import typer +from sila2.framework.utils import running_in_docker +from typer import BadParameter, Option + +from .server import Server + +logger = logging.getLogger(__name__) + +_DEFAULT_IP = "0.0.0.0" if running_in_docker() else "127.0.0.1" # noqa: S104, possible bind to all interfaces + + +def main( + ip_address: str = Option(_DEFAULT_IP, "-a", "--ip-address", help="The IP address"), + port: int = Option(50052, "-p", "--port", help="The port"), + server_uuid: Optional[str] = Option( + None, "--server-uuid", help="The server UUID [default: generate random UUID]", show_default=False + ), + server_name: Optional[str] = Option( + None, "--server-name", help="The server name [default: defined by implementation]", show_default=False + ), + server_description: Optional[str] = Option( + None, + "--server-description", + help="The server description [default: defined by implementation]", + show_default=False, + ), + disable_discovery: bool = Option(False, "--disable-discovery", help="Disable SiLA Server Discovery"), + insecure: bool = Option(False, "--insecure", help="Start without encryption"), + private_key_file: Optional[str] = Option( + None, "-k", "--private-key-file", help="Private key file (e.g. 'server-key.pem')" + ), + cert_file: Optional[str] = Option(None, "-c", "--cert-file", help="Certificate file (e.g. 'server-cert.pem')"), + ca_file_for_discovery: Optional[str] = Option( + None, + "--ca-file-for-discovery", + help="Certificate Authority file for distribution via the SiLA Server Discovery (e.g. 'server-ca.pem')", + ), + ca_export_file: Optional[str] = Option( + None, help="When using a self-signed certificate, write the generated CA to this file" + ), + quiet: bool = Option(False, "--quiet", help="Only log errors"), + verbose: bool = Option(False, "--verbose", help="Enable verbose logging"), + debug: bool = Option(False, "--debug", help="Enable debug logging"), +): + # validate parameters + if (insecure or ca_export_file is not None) and (cert_file is not None or private_key_file is not None): + raise BadParameter("Cannot use --insecure or --ca-export-file with --private-key-file or --cert-file") + if (cert_file is None and private_key_file is not None) or (private_key_file is None and cert_file is not None): + raise BadParameter("Either provide both --private-key-file and --cert-file, or none of them") + if insecure and ca_export_file is not None: + raise BadParameter("Cannot use --export-ca-file with --insecure") + + # prepare server parameters + cert = Path(cert_file).read_bytes() if cert_file is not None else None + private_key = Path(private_key_file).read_bytes() if private_key_file is not None else None + ca_for_discovery = Path(ca_file_for_discovery).read_bytes() if ca_file_for_discovery is not None else None + parsed_server_uuid = UUID(server_uuid) if server_uuid is not None else None + + # logging setup + initialize_logging(quiet=quiet, verbose=verbose, debug=debug) + + # run server + server = Server(server_uuid=parsed_server_uuid, name=server_name, description=server_description) + + def start_server(): + if insecure: + server.start_insecure(ip_address, port, enable_discovery=not disable_discovery) + else: + server.start( + ip_address, + port, + cert_chain=cert, + private_key=private_key, + enable_discovery=not disable_discovery, + ca_for_discovery=ca_for_discovery, + ) + if ca_export_file is not None: + with open(ca_export_file, "wb") as fp: + fp.write(server.generated_ca) + logger.info(f"Wrote generated CA to '{ca_export_file}'") + + try: + start_server() + except: + logger.exception("Server startup failed, shutting down") + if server.running: + server.stop() + logger.info("Server shutdown complete") + return + + logger.info("Server startup complete") + signal.signal(signal.SIGTERM, lambda *args: server.grpc_server.stop()) + + with contextlib.suppress(KeyboardInterrupt): + server.grpc_server.wait_for_termination() + + server.stop() + logger.info("Server shutdown complete") + + +def initialize_logging(*, quiet: bool = False, verbose: bool = False, debug: bool = False): + if sum((quiet, verbose, debug)) > 1: + raise BadParameter("--quiet, --verbose and --debug are mutually exclusive") + + level = logging.WARNING + if verbose: + level = logging.INFO + if debug: + level = logging.DEBUG + if quiet: + level = logging.ERROR + + logging.basicConfig(level=level, format="%(asctime)s:%(levelname)s:%(name)s:%(message)s") + logger.setLevel(logging.INFO) + logging.getLogger("xmlschema").setLevel(logging.WARNING) + + +if __name__ == "__main__": + typer.run(main) diff --git a/plr_sila_bridge/plr_sila_bridge/feature_implementations/__init__.py b/plr_sila_bridge/plr_sila_bridge/feature_implementations/__init__.py new file mode 100644 index 0000000..cecd2af --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/feature_implementations/__init__.py @@ -0,0 +1 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 diff --git a/plr_sila_bridge/plr_sila_bridge/feature_implementations/deviceinfoprovider_impl.py b/plr_sila_bridge/plr_sila_bridge/feature_implementations/deviceinfoprovider_impl.py new file mode 100644 index 0000000..d3d572c --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/feature_implementations/deviceinfoprovider_impl.py @@ -0,0 +1,58 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +from __future__ import annotations + +from typing import TYPE_CHECKING, Any + +from sila2.server import MetadataDict + +from ..generated.deviceinfoprovider import DeviceInfo, DeviceInfoProviderBase, SetOutputFormat_Responses + +if TYPE_CHECKING: + from ..server import Server + + +class DeviceInfoProviderImpl(DeviceInfoProviderBase): + def __init__(self, parent_server: Server) -> None: + super().__init__(parent_server=parent_server) + + def get_DeviceName(self, *, metadata: MetadataDict) -> str: + raise NotImplementedError # TODO + + def get_DeviceType(self, *, metadata: MetadataDict) -> str: + raise NotImplementedError # TODO + + def get_DeviceManufacturer(self, *, metadata: MetadataDict) -> str: + raise NotImplementedError # TODO + + def get_DeviceProductName(self, *, metadata: MetadataDict) -> str: + raise NotImplementedError # TODO + + def get_DeviceVersion(self, *, metadata: MetadataDict) -> str: + raise NotImplementedError # TODO + + def get_DeviceFirmwareVersion(self, *, metadata: MetadataDict) -> str: + raise NotImplementedError # TODO + + def get_DeviceManual(self, *, metadata: MetadataDict) -> str: + raise NotImplementedError # TODO + + def get_DeviceQuickStartGuide(self, *, metadata: MetadataDict) -> str: + raise NotImplementedError # TODO + + def get_DeviceServiceManual(self, *, metadata: MetadataDict) -> str: + raise NotImplementedError # TODO + + def get_HardwareSettings(self, *, metadata: MetadataDict) -> str: + raise NotImplementedError # TODO + + def get_HardwareConfiguration(self, *, metadata: MetadataDict) -> str: + raise NotImplementedError # TODO + + def get_DeviceInfo(self, *, metadata: MetadataDict) -> DeviceInfo: + raise NotImplementedError # TODO + + def get_ServiceDates(self, *, metadata: MetadataDict) -> Any: + raise NotImplementedError # TODO + + def SetOutputFormat(self, OutputFormat: str, *, metadata: MetadataDict) -> SetOutputFormat_Responses: + raise NotImplementedError # TODO diff --git a/plr_sila_bridge/plr_sila_bridge/feature_implementations/loggingservice_impl.py b/plr_sila_bridge/plr_sila_bridge/feature_implementations/loggingservice_impl.py new file mode 100644 index 0000000..56202ce --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/feature_implementations/loggingservice_impl.py @@ -0,0 +1,69 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +from __future__ import annotations + +from datetime import timedelta +from typing import TYPE_CHECKING, List + +from sila2.server import MetadataDict, ObservableCommandInstanceWithIntermediateResponses + +from ..generated.loggingservice import ( + GetLogFile_Responses, + ListenToAllLogEntries_IntermediateResponses, + ListenToAllLogEntries_Responses, + ListenToLoggingStream_IntermediateResponses, + ListenToLoggingStream_Responses, + LoggingServiceBase, + SetLogLevel_Responses, +) + +if TYPE_CHECKING: + from ..server import Server + + +class LoggingServiceImpl(LoggingServiceBase): + def __init__(self, parent_server: Server) -> None: + super().__init__(parent_server=parent_server) + + # Default lifetime of observable command instances. Possible values: + # None: Command instance is valid and stored in memory until server shutdown + # datetime.timedelta: Command instance is deleted after this duration, can be increased during command runtime + self.ListenToLoggingStream_default_lifetime_of_execution = timedelta(minutes=30) + self.ListenToAllLogEntries_default_lifetime_of_execution = timedelta(minutes=30) + + def get_LoggingStreamList(self, *, metadata: MetadataDict) -> List[str]: + raise NotImplementedError # TODO + + def get_LogFileList(self, *, metadata: MetadataDict) -> List[str]: + raise NotImplementedError # TODO + + def get_LogLevel(self, *, metadata: MetadataDict) -> str: + raise NotImplementedError # TODO + + def GetLogFile(self, LogFileName: str, *, metadata: MetadataDict) -> GetLogFile_Responses: + raise NotImplementedError # TODO + + def SetLogLevel(self, LogLevel: str, *, metadata: MetadataDict) -> SetLogLevel_Responses: + raise NotImplementedError # TODO + + def ListenToLoggingStream( + self, + LoggingStreamName: str, + *, + metadata: MetadataDict, + instance: ObservableCommandInstanceWithIntermediateResponses[ListenToLoggingStream_IntermediateResponses], + ) -> ListenToLoggingStream_Responses: + # set execution status from `waiting` to `running` + instance.begin_execution() + + raise NotImplementedError # TODO + + def ListenToAllLogEntries( + self, + *, + metadata: MetadataDict, + instance: ObservableCommandInstanceWithIntermediateResponses[ListenToAllLogEntries_IntermediateResponses], + ) -> ListenToAllLogEntries_Responses: + # set execution status from `waiting` to `running` + instance.begin_execution() + + raise NotImplementedError # TODO diff --git a/plr_sila_bridge/plr_sila_bridge/feature_implementations/simulationcontroller_impl.py b/plr_sila_bridge/plr_sila_bridge/feature_implementations/simulationcontroller_impl.py new file mode 100644 index 0000000..e55427c --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/feature_implementations/simulationcontroller_impl.py @@ -0,0 +1,29 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +from __future__ import annotations + +from typing import TYPE_CHECKING + +from sila2.server import MetadataDict + +from ..generated.simulationcontroller import ( + SimulationControllerBase, + StartRealMode_Responses, + StartSimulationMode_Responses, +) + +if TYPE_CHECKING: + from ..server import Server + + +class SimulationControllerImpl(SimulationControllerBase): + def __init__(self, parent_server: Server) -> None: + super().__init__(parent_server=parent_server) + + def get_SimulationMode(self, *, metadata: MetadataDict) -> bool: + raise NotImplementedError # TODO + + def StartSimulationMode(self, *, metadata: MetadataDict) -> StartSimulationMode_Responses: + raise NotImplementedError # TODO + + def StartRealMode(self, *, metadata: MetadataDict) -> StartRealMode_Responses: + raise NotImplementedError # TODO diff --git a/plr_sila_bridge/plr_sila_bridge/generated/__init__.py b/plr_sila_bridge/plr_sila_bridge/generated/__init__.py new file mode 100644 index 0000000..6c575d6 --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/__init__.py @@ -0,0 +1,4 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +from .client import Client + +__all__ = ["Client"] diff --git a/plr_sila_bridge/plr_sila_bridge/generated/client.py b/plr_sila_bridge/plr_sila_bridge/generated/client.py new file mode 100644 index 0000000..5bfe128 --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/client.py @@ -0,0 +1,52 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +from __future__ import annotations + +from typing import Set + +from sila2.client import SilaClient +from sila2.framework import FullyQualifiedFeatureIdentifier + +from . import deviceinfoprovider, loggingservice, simulationcontroller + + +class Client(SilaClient): + DeviceInfoProvider: deviceinfoprovider.DeviceInfoProviderClient + + LoggingService: loggingservice.LoggingServiceClient + + SimulationController: simulationcontroller.SimulationControllerClient + + _expected_features: Set[FullyQualifiedFeatureIdentifier] = { + FullyQualifiedFeatureIdentifier("org.silastandard/core/SiLAService/v1"), + FullyQualifiedFeatureIdentifier("de.unigreifswald.biochemie/device/DeviceInfoProvider/v1"), + FullyQualifiedFeatureIdentifier("de.unigreifswald/infrastructure/LoggingService/v0"), + FullyQualifiedFeatureIdentifier("org.silastandard/core/SimulationController/v1"), + } + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + self._register_defined_execution_error_class( + deviceinfoprovider.DeviceInfoProviderFeature.defined_execution_errors["OutputFormatNotSupported"], + deviceinfoprovider.OutputFormatNotSupported, + ) + + self._register_defined_execution_error_class( + loggingservice.LoggingServiceFeature.defined_execution_errors["LogginStreamNotAvailable"], + loggingservice.LogginStreamNotAvailable, + ) + + self._register_defined_execution_error_class( + loggingservice.LoggingServiceFeature.defined_execution_errors["LogFileNotAvailable"], + loggingservice.LogFileNotAvailable, + ) + + self._register_defined_execution_error_class( + simulationcontroller.SimulationControllerFeature.defined_execution_errors["StartSimulationModeFailed"], + simulationcontroller.StartSimulationModeFailed, + ) + + self._register_defined_execution_error_class( + simulationcontroller.SimulationControllerFeature.defined_execution_errors["StartRealModeFailed"], + simulationcontroller.StartRealModeFailed, + ) diff --git a/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/DeviceInfoProvider.proto b/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/DeviceInfoProvider.proto new file mode 100644 index 0000000..9ccfbdf --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/DeviceInfoProvider.proto @@ -0,0 +1,223 @@ +syntax = "proto3"; + +import "SiLAFramework.proto"; + +package sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1; + +/* This SiLA feature provides detailed information about a device, like device name, device type, device manufacturer, device product name, device version, device manual, device quick start guide, device service manual, device serial number, device registration number, device barcode, device production date, device purchase date, device end of warrenty, device service dates, device service information, etc. */ +service DeviceInfoProvider { + /* Set the output format of the device information, like TEXT, JSON-LD, XML, etc. The recommended default output format is JSON-LD, which allows to provide detailed information about the device in a structured way with semantic annotations / context, referencing to defined vocabularies. */ + rpc SetOutputFormat (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.SetOutputFormat_Parameters) returns (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.SetOutputFormat_Responses) {} + /* + Name of the Device. + */ + rpc Get_DeviceName (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_DeviceName_Parameters) returns (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_DeviceName_Responses) {} + /* + Type of the Device. + */ + rpc Get_DeviceType (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_DeviceType_Parameters) returns (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_DeviceType_Responses) {} + /* + Manufacturer of the Device. + */ + rpc Get_DeviceManufacturer (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_DeviceManufacturer_Parameters) returns (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_DeviceManufacturer_Responses) {} + /* + Product Name of the Device. + */ + rpc Get_DeviceProductName (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_DeviceProductName_Parameters) returns (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_DeviceProductName_Responses) {} + /* + Version of the Device. + */ + rpc Get_DeviceVersion (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_DeviceVersion_Parameters) returns (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_DeviceVersion_Responses) {} + /* + Version of the Device Firmware. + */ + rpc Get_DeviceFirmwareVersion (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_DeviceFirmwareVersion_Parameters) returns (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_DeviceFirmwareVersion_Responses) {} + /* + URL to Manual of the Device. + */ + rpc Get_DeviceManual (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_DeviceManual_Parameters) returns (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_DeviceManual_Responses) {} + /* + URL to Quick Start Guide of the Device. + */ + rpc Get_DeviceQuickStartGuide (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_DeviceQuickStartGuide_Parameters) returns (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_DeviceQuickStartGuide_Responses) {} + /* + URL to Service Manual of the Device. + */ + rpc Get_DeviceServiceManual (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_DeviceServiceManual_Parameters) returns (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_DeviceServiceManual_Responses) {} + /* + Hardware Settings of the Device, like serial port settings, etc., preferably in JSON-LD format. + */ + rpc Get_HardwareSettings (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_HardwareSettings_Parameters) returns (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_HardwareSettings_Responses) {} + /* + Hardware Configuration of the Device, like racks with n slots, slot spacing, shakers, barcode reader, CO2 unit, etc., + preferably in JSON-LD format. + */ + rpc Get_HardwareConfiguration (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_HardwareConfiguration_Parameters) returns (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_HardwareConfiguration_Responses) {} + /* + Detailed Information about the Device. + */ + rpc Get_DeviceInfo (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_DeviceInfo_Parameters) returns (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_DeviceInfo_Responses) {} + /* + Service Dates of the Device. + */ + rpc Get_ServiceDates (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_ServiceDates_Parameters) returns (sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_ServiceDates_Responses) {} +} + +/* Detailed Information about the Device. */ +message DataType_DeviceInfo { + message DeviceInfo_Struct { + sila2.org.silastandard.String SerialNo = 1; /* Serial Number of the Device. */ + sila2.org.silastandard.String PartNo = 2; /* Part Number of the Device. */ + sila2.org.silastandard.String RegistrationNo = 3; /* Registration Number of the Device. */ + sila2.org.silastandard.String Barcode = 4; /* Barcode of the Device. */ + sila2.org.silastandard.Date ProductionDate = 5; /* Production Date of the Device. */ + sila2.org.silastandard.Date PurchaseDate = 6; /* Purchase Date of the Device. */ + sila2.org.silastandard.Date EndOfWarrenty = 7; /* End of Warrenty of the Device. */ + sila2.org.silastandard.String SemanticDeviceInfo = 8; /* Semantic Device Information of the Device. In JSON-LD format. */ + } + sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.DataType_DeviceInfo.DeviceInfo_Struct DeviceInfo = 1; /* Detailed Information about the Device. */ +} + +/* Detailed Information about the Service. */ +message DataType_ServiceInfo { + message ServiceInfo_Struct { + sila2.org.silastandard.Date ServiceDate = 1; /* Service Date of the Device. */ + sila2.org.silastandard.String ServiceType = 2; /* Service Type of the Device. */ + sila2.org.silastandard.String ServiceDescription = 3; /* Service Description of the Device. */ + sila2.org.silastandard.String ServiceReport = 4; /* Service Report of the Device. In JSON-LD format. */ + sila2.org.silastandard.String ServiceCompany = 5; /* Service Company of the Device. Info in JSON-LD format */ + sila2.org.silastandard.String ServiceEngineer = 6; /* Service Engineer of Device in JSON-LD format. */ + } + sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.DataType_ServiceInfo.ServiceInfo_Struct ServiceInfo = 1; /* Detailed Information about the Service. */ +} + +/* Parameters for SetOutputFormat */ +message SetOutputFormat_Parameters { + sila2.org.silastandard.String OutputFormat = 1; /* Output format of the device information. */ +} + +/* Responses of SetOutputFormat */ +message SetOutputFormat_Responses { +} + +/* Parameters for DeviceName */ +message Get_DeviceName_Parameters { +} + +/* Responses of DeviceName */ +message Get_DeviceName_Responses { + sila2.org.silastandard.String DeviceName = 1; /* Name of the Device. */ +} + +/* Parameters for DeviceType */ +message Get_DeviceType_Parameters { +} + +/* Responses of DeviceType */ +message Get_DeviceType_Responses { + sila2.org.silastandard.String DeviceType = 1; /* Type of the Device. */ +} + +/* Parameters for DeviceManufacturer */ +message Get_DeviceManufacturer_Parameters { +} + +/* Responses of DeviceManufacturer */ +message Get_DeviceManufacturer_Responses { + sila2.org.silastandard.String DeviceManufacturer = 1; /* Manufacturer of the Device. */ +} + +/* Parameters for DeviceProductName */ +message Get_DeviceProductName_Parameters { +} + +/* Responses of DeviceProductName */ +message Get_DeviceProductName_Responses { + sila2.org.silastandard.String DeviceProductName = 1; /* Product Name of the Device. */ +} + +/* Parameters for DeviceVersion */ +message Get_DeviceVersion_Parameters { +} + +/* Responses of DeviceVersion */ +message Get_DeviceVersion_Responses { + sila2.org.silastandard.String DeviceVersion = 1; /* Version of the Device. */ +} + +/* Parameters for DeviceFirmwareVersion */ +message Get_DeviceFirmwareVersion_Parameters { +} + +/* Responses of DeviceFirmwareVersion */ +message Get_DeviceFirmwareVersion_Responses { + sila2.org.silastandard.String DeviceFirmwareVersion = 1; /* Version of the Device Firmware. */ +} + +/* Parameters for DeviceManual */ +message Get_DeviceManual_Parameters { +} + +/* Responses of DeviceManual */ +message Get_DeviceManual_Responses { + sila2.org.silastandard.String DeviceManual = 1; /* URL to Manual of the Device. */ +} + +/* Parameters for DeviceQuickStartGuide */ +message Get_DeviceQuickStartGuide_Parameters { +} + +/* Responses of DeviceQuickStartGuide */ +message Get_DeviceQuickStartGuide_Responses { + sila2.org.silastandard.String DeviceQuickStartGuide = 1; /* URL to Quick Start Guide of the Device. */ +} + +/* Parameters for DeviceServiceManual */ +message Get_DeviceServiceManual_Parameters { +} + +/* Responses of DeviceServiceManual */ +message Get_DeviceServiceManual_Responses { + sila2.org.silastandard.String DeviceServiceManual = 1; /* URL to Service Manual of the Device. */ +} + +/* Parameters for HardwareSettings */ +message Get_HardwareSettings_Parameters { +} + +/* Responses of HardwareSettings */ +message Get_HardwareSettings_Responses { + sila2.org.silastandard.String HardwareSettings = 1; /* Hardware Settings of the Device, like serial port settings, etc., preferably in JSON-LD format. */ +} + +/* Parameters for HardwareConfiguration */ +message Get_HardwareConfiguration_Parameters { +} + +/* Responses of HardwareConfiguration */ +message Get_HardwareConfiguration_Responses { + sila2.org.silastandard.String HardwareConfiguration = 1; /* Hardware Configuration of the Device, like racks with n slots, slot spacing, shakers, barcode reader, CO2 unit, etc., preferably in JSON-LD format. */ +} + +/* Parameters for DeviceInfo */ +message Get_DeviceInfo_Parameters { +} + +/* Responses of DeviceInfo */ +message Get_DeviceInfo_Responses { + sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.DataType_DeviceInfo DeviceInfo = 1; /* Detailed Information about the Device. */ +} + +/* Parameters for ServiceDates */ +message Get_ServiceDates_Parameters { +} + +/* Responses of ServiceDates */ +message Get_ServiceDates_Responses { + message ServiceDates_Struct { + repeated sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.DataType_ServiceInfo ServiceInfoList = 1; /* List of Service Information of the Device. */ + sila2.org.silastandard.Date LastServiceDate = 2; /* Last Service Date of the Device. */ + sila2.org.silastandard.Date NextServiceDate = 3; /* Next Service Date of the Device. */ + } + sila2.de.unigreifswald.biochemie.device.deviceinfoprovider.v1.Get_ServiceDates_Responses.ServiceDates_Struct ServiceDates = 1; /* Service Dates of the Device. */ +} diff --git a/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/DeviceInfoProvider.sila.xml b/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/DeviceInfoProvider.sila.xml new file mode 100644 index 0000000..5d16022 --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/DeviceInfoProvider.sila.xml @@ -0,0 +1,316 @@ + + DeviceInfoProvider + Device Info Provider + This SiLA feature provides detailed information about a device, like device name, device type, + device manufacturer, device product name, device version, device manual, device quick start guide, + device service manual, device serial number, device registration number, device barcode, device production date, + device purchase date, device end of warrenty, device service dates, device service information, etc. + + + SetOutputFormat + Set Output Format + Set the output format of the device information, like TEXT, JSON-LD, XML, etc. + The recommended default output format is JSON-LD, which allows to provide detailed information about the device in a structured way with semantic annotations / context, referencing to defined vocabularies. + No + + OutputFormat + Output Format + Output format of the device information. + + String + + + + OutputFormatNotSupported + + + + + + DeviceName + Device Name + Name of the Device. + No + + String + + + + DeviceType + Device Type, like incubator, shaker, etc., in JSON-LD format. + Type of the Device. + No + + String + + + + DeviceManufacturer + Device Manufacturer, like Eppendorf, ThermoFisher, etc., in JSON-LD format. + Manufacturer of the Device. + No + + String + + + + DeviceProductName + Device Product Name, like Eppendorf 5415R, ThermoFisher 1234, etc., in JSON-LD format. + Product Name of the Device. + No + + String + + + + DeviceVersion + Device Version, like Eppendorf 5415R, ThermoFisher 1234, etc., in JSON-LD format. + Version of the Device. + No + + String + + + + DeviceFirmwareVersion + Device Firmware Version, like 50122578-B, 1.2, 0.0.2, in JSON-LD format. + Version of the Device Firmware. + No + + String + + + + DeviceManual + Device Manual, like Eppendorf 5415R, ThermoFisher 1234, etc., URL. + URL to Manual of the Device. + No + + String + + + + DeviceQuickStartGuide + URL to Device Quick Start Guide, like Eppendorf 5415R, ThermoFisher 1234, etc., URL. + URL to Quick Start Guide of the Device. + No + + String + + + + DeviceServiceManual + Device Service Manual, like Eppendorf 5415R, ThermoFisher 1234, etc., URL. + URL to Service Manual of the Device. + No + + String + + + + HardwareSettings + Hardware Settings + Hardware Settings of the Device, like serial port settings, etc., preferably in JSON-LD format. + No + + String + + + + HardwareConfiguration + Hardware Configuration + Hardware Configuration of the Device, like racks with n slots, slot spacing, shakers, barcode reader, CO2 unit, etc., + preferably in JSON-LD format. + No + + String + + + + DeviceInfo + Device Information + Detailed Information about the Device. + No + + DeviceInfo + + + + ServiceDates + Service Dates + Service Dates of the Device. + No + + + + ServiceInfoList + Service Information List + List of Service Information of the Device. + + + + ServiceInfo + + + + + + LastServiceDate + Last Service Date + Last Service Date of the Device. + + Date + + + + NextServiceDate + Next Service Date + Next Service Date of the Device. + + Date + + + + + + + + DeviceInfo + Device Information + Detailed Information about the Device. + + + + + SerialNo + Serial Number + Serial Number of the Device. + + String + + + + PartNo + Part Number + Part Number of the Device. + + String + + + + RegistrationNo + Registration Number + Registration Number of the Device. + + String + + + + Barcode + Barcode + Barcode of the Device. + + String + + + + ProductionDate + Production Date + Production Date of the Device. + + Date + + + + PurchaseDate + Purchase Date + Purchase Date of the Device. + + Date + + + + EndOfWarrenty + End of Warrenty + End of Warrenty of the Device. + + Date + + + + SemanticDeviceInfo + Semantic Device Information + Semantic Device Information of the Device. In JSON-LD format. + + String + + + + + + + ServiceInfo + Service Information + Detailed Information about the Service. + + + + + ServiceDate + Service Date + Service Date of the Device. + + Date + + + + ServiceType + Service Type + Service Type of the Device. + + String + + + + ServiceDescription + Service Description + Service Description of the Device. + + String + + + + ServiceReport + Service Report + Service Report of the Device. In JSON-LD format. + + String + + + + + ServiceCompany + Service Company + Service Company of the Device. Info in JSON-LD format + + String + + + + ServiceEngineer + ServiceEngineer + Service Engineer of Device in JSON-LD format. + + String + + + + + + + + OutputFormatNotSupported + Output Format Not Supported + The output format is not supported. + + diff --git a/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/__init__.py b/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/__init__.py new file mode 100644 index 0000000..0aacd77 --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/__init__.py @@ -0,0 +1,16 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +from .deviceinfoprovider_base import DeviceInfoProviderBase +from .deviceinfoprovider_client import DeviceInfoProviderClient +from .deviceinfoprovider_errors import OutputFormatNotSupported +from .deviceinfoprovider_feature import DeviceInfoProviderFeature +from .deviceinfoprovider_types import DeviceInfo, ServiceInfo, SetOutputFormat_Responses + +__all__ = [ + "DeviceInfoProviderBase", + "DeviceInfoProviderFeature", + "DeviceInfoProviderClient", + "SetOutputFormat_Responses", + "OutputFormatNotSupported", + "DeviceInfo", + "ServiceInfo", +] diff --git a/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/deviceinfoprovider_base.py b/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/deviceinfoprovider_base.py new file mode 100644 index 0000000..1992dea --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/deviceinfoprovider_base.py @@ -0,0 +1,215 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +from __future__ import annotations + +from abc import ABC, abstractmethod +from typing import TYPE_CHECKING, Any + +from sila2.server import FeatureImplementationBase, MetadataDict + +from .deviceinfoprovider_types import DeviceInfo, SetOutputFormat_Responses + +if TYPE_CHECKING: + from ...server import Server + + +class DeviceInfoProviderBase(FeatureImplementationBase, ABC): + parent_server: Server + + def __init__(self, parent_server: Server): + """ + + This SiLA feature provides detailed information about a device, like device name, device type, + device manufacturer, device product name, device version, device manual, device quick start guide, + device service manual, device serial number, device registration number, device barcode, device production date, + device purchase date, device end of warrenty, device service dates, device service information, etc. + + """ + super().__init__(parent_server=parent_server) + + @abstractmethod + def get_DeviceName(self, *, metadata: MetadataDict) -> str: + """ + + Name of the Device. + + + :param metadata: The SiLA Client Metadata attached to the call + :return: + Name of the Device. + + """ + + @abstractmethod + def get_DeviceType(self, *, metadata: MetadataDict) -> str: + """ + + Type of the Device. + + + :param metadata: The SiLA Client Metadata attached to the call + :return: + Type of the Device. + + """ + + @abstractmethod + def get_DeviceManufacturer(self, *, metadata: MetadataDict) -> str: + """ + + Manufacturer of the Device. + + + :param metadata: The SiLA Client Metadata attached to the call + :return: + Manufacturer of the Device. + + """ + + @abstractmethod + def get_DeviceProductName(self, *, metadata: MetadataDict) -> str: + """ + + Product Name of the Device. + + + :param metadata: The SiLA Client Metadata attached to the call + :return: + Product Name of the Device. + + """ + + @abstractmethod + def get_DeviceVersion(self, *, metadata: MetadataDict) -> str: + """ + + Version of the Device. + + + :param metadata: The SiLA Client Metadata attached to the call + :return: + Version of the Device. + + """ + + @abstractmethod + def get_DeviceFirmwareVersion(self, *, metadata: MetadataDict) -> str: + """ + + Version of the Device Firmware. + + + :param metadata: The SiLA Client Metadata attached to the call + :return: + Version of the Device Firmware. + + """ + + @abstractmethod + def get_DeviceManual(self, *, metadata: MetadataDict) -> str: + """ + + URL to Manual of the Device. + + + :param metadata: The SiLA Client Metadata attached to the call + :return: + URL to Manual of the Device. + + """ + + @abstractmethod + def get_DeviceQuickStartGuide(self, *, metadata: MetadataDict) -> str: + """ + + URL to Quick Start Guide of the Device. + + + :param metadata: The SiLA Client Metadata attached to the call + :return: + URL to Quick Start Guide of the Device. + + """ + + @abstractmethod + def get_DeviceServiceManual(self, *, metadata: MetadataDict) -> str: + """ + + URL to Service Manual of the Device. + + + :param metadata: The SiLA Client Metadata attached to the call + :return: + URL to Service Manual of the Device. + + """ + + @abstractmethod + def get_HardwareSettings(self, *, metadata: MetadataDict) -> str: + """ + + Hardware Settings of the Device, like serial port settings, etc., preferably in JSON-LD format. + + + :param metadata: The SiLA Client Metadata attached to the call + :return: + Hardware Settings of the Device, like serial port settings, etc., preferably in JSON-LD format. + + """ + + @abstractmethod + def get_HardwareConfiguration(self, *, metadata: MetadataDict) -> str: + """ + + Hardware Configuration of the Device, like racks with n slots, slot spacing, shakers, barcode reader, CO2 unit, etc., + preferably in JSON-LD format. + + + :param metadata: The SiLA Client Metadata attached to the call + :return: + Hardware Configuration of the Device, like racks with n slots, slot spacing, shakers, barcode reader, CO2 unit, etc., + preferably in JSON-LD format. + + """ + + @abstractmethod + def get_DeviceInfo(self, *, metadata: MetadataDict) -> DeviceInfo: + """ + + Detailed Information about the Device. + + + :param metadata: The SiLA Client Metadata attached to the call + :return: + Detailed Information about the Device. + + """ + + @abstractmethod + def get_ServiceDates(self, *, metadata: MetadataDict) -> Any: + """ + + Service Dates of the Device. + + + :param metadata: The SiLA Client Metadata attached to the call + :return: + Service Dates of the Device. + + """ + + @abstractmethod + def SetOutputFormat(self, OutputFormat: str, *, metadata: MetadataDict) -> SetOutputFormat_Responses: + """ + + Set the output format of the device information, like TEXT, JSON-LD, XML, etc. + The recommended default output format is JSON-LD, which allows to provide detailed information about the device in a structured way with semantic annotations / context, referencing to defined vocabularies. + + + + :param OutputFormat: + Output format of the device information. + + + :param metadata: The SiLA Client Metadata attached to the call + + """ diff --git a/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/deviceinfoprovider_client.py b/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/deviceinfoprovider_client.py new file mode 100644 index 0000000..98998e6 --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/deviceinfoprovider_client.py @@ -0,0 +1,129 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +# ----- +# This class does not do anything useful at runtime. Its only purpose is to provide type annotations. +# Since sphinx does not support .pyi files (yet?), this is a .py file. +# ----- + +from __future__ import annotations + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from typing import Any, Iterable, Optional + + from deviceinfoprovider_types import SetOutputFormat_Responses + from sila2.client import ClientMetadataInstance, ClientUnobservableProperty + + +class DeviceInfoProviderClient: + """ + + This SiLA feature provides detailed information about a device, like device name, device type, + device manufacturer, device product name, device version, device manual, device quick start guide, + device service manual, device serial number, device registration number, device barcode, device production date, + device purchase date, device end of warrenty, device service dates, device service information, etc. + + """ + + DeviceName: ClientUnobservableProperty[str] + """ + + Name of the Device. + + """ + + DeviceType: ClientUnobservableProperty[str] + """ + + Type of the Device. + + """ + + DeviceManufacturer: ClientUnobservableProperty[str] + """ + + Manufacturer of the Device. + + """ + + DeviceProductName: ClientUnobservableProperty[str] + """ + + Product Name of the Device. + + """ + + DeviceVersion: ClientUnobservableProperty[str] + """ + + Version of the Device. + + """ + + DeviceFirmwareVersion: ClientUnobservableProperty[str] + """ + + Version of the Device Firmware. + + """ + + DeviceManual: ClientUnobservableProperty[str] + """ + + URL to Manual of the Device. + + """ + + DeviceQuickStartGuide: ClientUnobservableProperty[str] + """ + + URL to Quick Start Guide of the Device. + + """ + + DeviceServiceManual: ClientUnobservableProperty[str] + """ + + URL to Service Manual of the Device. + + """ + + HardwareSettings: ClientUnobservableProperty[str] + """ + + Hardware Settings of the Device, like serial port settings, etc., preferably in JSON-LD format. + + """ + + HardwareConfiguration: ClientUnobservableProperty[str] + """ + + Hardware Configuration of the Device, like racks with n slots, slot spacing, shakers, barcode reader, CO2 unit, etc., + preferably in JSON-LD format. + + """ + + DeviceInfo: ClientUnobservableProperty[DeviceInfo] + """ + + Detailed Information about the Device. + + """ + + ServiceDates: ClientUnobservableProperty[Any] + """ + + Service Dates of the Device. + + """ + + def SetOutputFormat( + self, OutputFormat: str, *, metadata: Optional[Iterable[ClientMetadataInstance]] = None + ) -> SetOutputFormat_Responses: + """ + + Set the output format of the device information, like TEXT, JSON-LD, XML, etc. + The recommended default output format is JSON-LD, which allows to provide detailed information about the device in a structured way with semantic annotations / context, referencing to defined vocabularies. + + """ + ... diff --git a/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/deviceinfoprovider_errors.py b/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/deviceinfoprovider_errors.py new file mode 100644 index 0000000..961a4bb --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/deviceinfoprovider_errors.py @@ -0,0 +1,17 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +from __future__ import annotations + +from typing import Optional + +from sila2.framework.errors.defined_execution_error import DefinedExecutionError + +from .deviceinfoprovider_feature import DeviceInfoProviderFeature + + +class OutputFormatNotSupported(DefinedExecutionError): + def __init__(self, message: Optional[str] = None): + if message is None: + message = "The output format is not supported." + super().__init__( + DeviceInfoProviderFeature.defined_execution_errors["OutputFormatNotSupported"], message=message + ) diff --git a/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/deviceinfoprovider_feature.py b/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/deviceinfoprovider_feature.py new file mode 100644 index 0000000..f3e63e0 --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/deviceinfoprovider_feature.py @@ -0,0 +1,6 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +from os.path import dirname, join + +from sila2.framework import Feature + +DeviceInfoProviderFeature = Feature(join(dirname(__file__), "DeviceInfoProvider.sila.xml")) diff --git a/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/deviceinfoprovider_types.py b/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/deviceinfoprovider_types.py new file mode 100644 index 0000000..6b28160 --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/deviceinfoprovider/deviceinfoprovider_types.py @@ -0,0 +1,13 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +from __future__ import annotations + +from typing import Any, NamedTuple + + +class SetOutputFormat_Responses(NamedTuple): + pass + + +DeviceInfo = Any + +ServiceInfo = Any diff --git a/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/LoggingService.proto b/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/LoggingService.proto new file mode 100644 index 0000000..58a29ff --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/LoggingService.proto @@ -0,0 +1,124 @@ +syntax = "proto3"; + +import "SiLAFramework.proto"; + +package sila2.de.unigreifswald.infrastructure.loggingservice.v0; + +/* Provides services for integration of SiLA server logging. The service is intended to be used by the server to provide logging information to the client. The client can use the service to listen for log entries from the server. It is possible to listen for all log entries or only for log entries from a specific Stream. Error handling: If the server is not able to provide the requested information, it shall return an error message. */ +service LoggingService { + /* Starts listening to a logging stream from the SiLA server */ + rpc ListenToLoggingStream (sila2.de.unigreifswald.infrastructure.loggingservice.v0.ListenToLoggingStream_Parameters) returns (sila2.org.silastandard.CommandConfirmation) {} + /* Monitor the state of ListenToLoggingStream */ + rpc ListenToLoggingStream_Info (sila2.org.silastandard.CommandExecutionUUID) returns (stream sila2.org.silastandard.ExecutionInfo) {} + /* Retrieve intermediate responses of ListenToLoggingStream */ + rpc ListenToLoggingStream_Intermediate (sila2.org.silastandard.CommandExecutionUUID) returns (stream sila2.de.unigreifswald.infrastructure.loggingservice.v0.ListenToLoggingStream_IntermediateResponses) {} + /* Retrieve result of ListenToLoggingStream */ + rpc ListenToLoggingStream_Result(sila2.org.silastandard.CommandExecutionUUID) returns (sila2.de.unigreifswald.infrastructure.loggingservice.v0.ListenToLoggingStream_Responses) {} + /* Starts listening to a stream of all consecutive log entries from the SiLA server */ + rpc ListenToAllLogEntries (sila2.de.unigreifswald.infrastructure.loggingservice.v0.ListenToAllLogEntries_Parameters) returns (sila2.org.silastandard.CommandConfirmation) {} + /* Monitor the state of ListenToAllLogEntries */ + rpc ListenToAllLogEntries_Info (sila2.org.silastandard.CommandExecutionUUID) returns (stream sila2.org.silastandard.ExecutionInfo) {} + /* Retrieve intermediate responses of ListenToAllLogEntries */ + rpc ListenToAllLogEntries_Intermediate (sila2.org.silastandard.CommandExecutionUUID) returns (stream sila2.de.unigreifswald.infrastructure.loggingservice.v0.ListenToAllLogEntries_IntermediateResponses) {} + /* Retrieve result of ListenToAllLogEntries */ + rpc ListenToAllLogEntries_Result(sila2.org.silastandard.CommandExecutionUUID) returns (sila2.de.unigreifswald.infrastructure.loggingservice.v0.ListenToAllLogEntries_Responses) {} + /* Gets the log file from the server. */ + rpc GetLogFile (sila2.de.unigreifswald.infrastructure.loggingservice.v0.GetLogFile_Parameters) returns (sila2.de.unigreifswald.infrastructure.loggingservice.v0.GetLogFile_Responses) {} + /* Sets the log level of the server. */ + rpc SetLogLevel (sila2.de.unigreifswald.infrastructure.loggingservice.v0.SetLogLevel_Parameters) returns (sila2.de.unigreifswald.infrastructure.loggingservice.v0.SetLogLevel_Responses) {} + /* Provides a list of URLs of all logging streams that are currently available on the server. */ + rpc Get_LoggingStreamList (sila2.de.unigreifswald.infrastructure.loggingservice.v0.Get_LoggingStreamList_Parameters) returns (sila2.de.unigreifswald.infrastructure.loggingservice.v0.Get_LoggingStreamList_Responses) {} + /* Provides a list of URLs of all log files that are currently available on the server. */ + rpc Get_LogFileList (sila2.de.unigreifswald.infrastructure.loggingservice.v0.Get_LogFileList_Parameters) returns (sila2.de.unigreifswald.infrastructure.loggingservice.v0.Get_LogFileList_Responses) {} + /* The current log level of the server. */ + rpc Get_LogLevel (sila2.de.unigreifswald.infrastructure.loggingservice.v0.Get_LogLevel_Parameters) returns (sila2.de.unigreifswald.infrastructure.loggingservice.v0.Get_LogLevel_Responses) {} +} + +/* Describes a log entry */ +message DataType_LogEntry { + message LogEntry_Struct { + sila2.org.silastandard.String Message = 1; /* The log message. */ + sila2.org.silastandard.String StreamName = 2; /* The Stream name (recommended: in URL form), including a hint to the software part that is responsible for the log entry. */ + sila2.de.unigreifswald.infrastructure.loggingservice.v0.DataType_Severity Severity = 3; /* The severity level. */ + sila2.org.silastandard.String ExtraInfo = 4; /* The additional information in JSON-LD format. */ + } + sila2.de.unigreifswald.infrastructure.loggingservice.v0.DataType_LogEntry.LogEntry_Struct LogEntry = 1; /* Describes a log entry */ +} + +/* */ +message DataType_Severity { + sila2.org.silastandard.String Severity = 1; /* */ +} + +/* Parameters for ListenToLoggingStream */ +message ListenToLoggingStream_Parameters { + sila2.org.silastandard.String LoggingStreamName = 1; /* The logging stream name (recommended: in form of a URL) to listen to. */ +} + +/* Responses of ListenToLoggingStream */ +message ListenToLoggingStream_Responses { +} + +/* Intermediate responses of ListenToLoggingStream */ +message ListenToLoggingStream_IntermediateResponses { + sila2.org.silastandard.String IntermediateLoggingText = 1; /* The current logging text of a certain logging stream as it is created by the server */ +} + +/* Parameters for ListenToAllLogEntries */ +message ListenToAllLogEntries_Parameters { +} + +/* Responses of ListenToAllLogEntries */ +message ListenToAllLogEntries_Responses { +} + +/* Intermediate responses of ListenToAllLogEntries */ +message ListenToAllLogEntries_IntermediateResponses { + repeated sila2.de.unigreifswald.infrastructure.loggingservice.v0.DataType_LogEntry IntermediateLoggingEntry = 1; /* Intermediate Log Entries as they are created by the server */ +} + +/* Parameters for GetLogFile */ +message GetLogFile_Parameters { + sila2.org.silastandard.String LogFileName = 1; /* The name of the log file (recommended: in URL format) to get. */ +} + +/* Responses of GetLogFile */ +message GetLogFile_Responses { + sila2.org.silastandard.String LogFile = 1; /* Log File as text */ +} + +/* Parameters for SetLogLevel */ +message SetLogLevel_Parameters { + sila2.org.silastandard.String LogLevel = 1; /* The log level to set. */ +} + +/* Responses of SetLogLevel */ +message SetLogLevel_Responses { +} + +/* Parameters for LoggingStreamList */ +message Get_LoggingStreamList_Parameters { +} + +/* Responses of LoggingStreamList */ +message Get_LoggingStreamList_Responses { + repeated sila2.org.silastandard.String LoggingStreamList = 1; /* Provides a list of URLs of all logging streams that are currently available on the server. */ +} + +/* Parameters for LogFileList */ +message Get_LogFileList_Parameters { +} + +/* Responses of LogFileList */ +message Get_LogFileList_Responses { + repeated sila2.org.silastandard.String LogFileList = 1; /* Provides a list of URLs of all log files that are currently available on the server. */ +} + +/* Parameters for LogLevel */ +message Get_LogLevel_Parameters { +} + +/* Responses of LogLevel */ +message Get_LogLevel_Responses { + sila2.org.silastandard.String LogLevel = 1; /* The current log level of the server. */ +} diff --git a/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/LoggingService.sila.xml b/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/LoggingService.sila.xml new file mode 100644 index 0000000..eccfe65 --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/LoggingService.sila.xml @@ -0,0 +1,230 @@ + + LoggingService + Logging Service + Provides services for integration of SiLA server logging. + The service is intended to be used by the server to provide logging information to the client. + The client can use the service to listen for log entries from the server. + It is possible to listen for all log entries or only for log entries from a specific Stream. + Error handling: If the server is not able to provide the requested information, it shall return an error message. + + + ListenToLoggingStream + Listen to logging stream + Starts listening to a logging stream from the SiLA server + Yes + + LoggingStreamName + Logging Stream Name (URL) + The logging stream name (recommended: in form of a URL) to listen to. + + String + + + + IntermediateLoggingText + Intermediate Logging Text + The current logging text of a certain logging stream as it is created by the server + + String + + + + LogginStreamNotAvailable + + + + ListenToAllLogEntries + Listen to all log entries + Starts listening to a stream of all consecutive log entries from the SiLA server + Yes + + IntermediateLoggingEntry + IntermediateLoggingEntry + Intermediate Log Entries as they are created by the server + + + + LogEntry + + + + + + + GetLogFile + Get Log File + Gets the log file from the server. + No + + LogFileName + Log File Name (URL) + The name of the log file (recommended: in URL format) to get. + + String + + + + LogFile + Log File (text) + Log File as text + + String + + + + LogFileNotAvailable + + + + SetLogLevel + Set Log Level + Sets the log level of the server. + No + + LogLevel + Log Level + The log level to set. + + + + String + + + + Notset + Debug + Info + Warning + Error + Critical + + + + + + + + + LoggingStreamList + Logging Stream (URL) List + Provides a list of URLs of all logging streams that are currently available on the server. + No + + + + String + + + + + + LogFileList + Log Files (URL) List + Provides a list of URLs of all log files that are currently available on the server. + No + + + + String + + + + + + LogLevel + Log Level + The current log level of the server. + No + + + + String + + + + Notset + Debug + Info + Warning + Error + Critical + + + + + + + + LogEntry + Log Entry + Describes a log entry + + + + Message + Message + The log message. + + String + + + + StreamName + StreamName (URL) + The Stream name (recommended: in URL form), including a hint to the software part that is responsible for the log entry. + + String + + + + Severity + Severity + The severity level. + + Severity + + + + ExtraInfo + Extra Information + The additional information in JSON-LD format. + + String + + + + + + + Severity + Severity + + + + + String + + + + Debug + Info + Warning + Error + Critical + + + + + + + + LogginStreamNotAvailable + Loggin Stream Not Available + The specified Logging Stream is unavailable. Please check the spelling of the stream URL + + + LogFileNotAvailable + Log File Not Available + The specified Log File is unavailable. Please check the spelling of the file URL + + diff --git a/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/__init__.py b/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/__init__.py new file mode 100644 index 0000000..21116d8 --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/__init__.py @@ -0,0 +1,31 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +from .loggingservice_base import LoggingServiceBase +from .loggingservice_client import LoggingServiceClient +from .loggingservice_errors import LogFileNotAvailable, LogginStreamNotAvailable +from .loggingservice_feature import LoggingServiceFeature +from .loggingservice_types import ( + GetLogFile_Responses, + ListenToAllLogEntries_IntermediateResponses, + ListenToAllLogEntries_Responses, + ListenToLoggingStream_IntermediateResponses, + ListenToLoggingStream_Responses, + LogEntry, + SetLogLevel_Responses, + Severity, +) + +__all__ = [ + "LoggingServiceBase", + "LoggingServiceFeature", + "LoggingServiceClient", + "GetLogFile_Responses", + "SetLogLevel_Responses", + "ListenToLoggingStream_Responses", + "ListenToLoggingStream_IntermediateResponses", + "ListenToAllLogEntries_Responses", + "ListenToAllLogEntries_IntermediateResponses", + "LogginStreamNotAvailable", + "LogFileNotAvailable", + "Severity", + "LogEntry", +] diff --git a/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/loggingservice_base.py b/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/loggingservice_base.py new file mode 100644 index 0000000..16b4913 --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/loggingservice_base.py @@ -0,0 +1,133 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +from __future__ import annotations + +from abc import ABC, abstractmethod +from datetime import timedelta +from typing import TYPE_CHECKING, List, Optional + +from sila2.server import FeatureImplementationBase, MetadataDict, ObservableCommandInstanceWithIntermediateResponses + +from .loggingservice_types import ( + GetLogFile_Responses, + ListenToAllLogEntries_IntermediateResponses, + ListenToAllLogEntries_Responses, + ListenToLoggingStream_IntermediateResponses, + ListenToLoggingStream_Responses, + SetLogLevel_Responses, +) + +if TYPE_CHECKING: + from ...server import Server + + +class LoggingServiceBase(FeatureImplementationBase, ABC): + parent_server: Server + + ListenToLoggingStream_default_lifetime_of_execution: Optional[timedelta] + + ListenToAllLogEntries_default_lifetime_of_execution: Optional[timedelta] + + def __init__(self, parent_server: Server): + """ + Provides services for integration of SiLA server logging. + The service is intended to be used by the server to provide logging information to the client. + The client can use the service to listen for log entries from the server. + It is possible to listen for all log entries or only for log entries from a specific Stream. + Error handling: If the server is not able to provide the requested information, it shall return an error message. + + """ + super().__init__(parent_server=parent_server) + + self.ListenToLoggingStream_default_lifetime_of_execution = None + self.ListenToAllLogEntries_default_lifetime_of_execution = None + + @abstractmethod + def get_LoggingStreamList(self, *, metadata: MetadataDict) -> List[str]: + """ + Provides a list of URLs of all logging streams that are currently available on the server. + + :param metadata: The SiLA Client Metadata attached to the call + :return: Provides a list of URLs of all logging streams that are currently available on the server. + """ + + @abstractmethod + def get_LogFileList(self, *, metadata: MetadataDict) -> List[str]: + """ + Provides a list of URLs of all log files that are currently available on the server. + + :param metadata: The SiLA Client Metadata attached to the call + :return: Provides a list of URLs of all log files that are currently available on the server. + """ + + @abstractmethod + def get_LogLevel(self, *, metadata: MetadataDict) -> str: + """ + The current log level of the server. + + :param metadata: The SiLA Client Metadata attached to the call + :return: The current log level of the server. + """ + + @abstractmethod + def GetLogFile(self, LogFileName: str, *, metadata: MetadataDict) -> GetLogFile_Responses: + """ + Gets the log file from the server. + + + :param LogFileName: The name of the log file (recommended: in URL format) to get. + + :param metadata: The SiLA Client Metadata attached to the call + + :return: + + - LogFile: Log File as text + + + """ + + @abstractmethod + def SetLogLevel(self, LogLevel: str, *, metadata: MetadataDict) -> SetLogLevel_Responses: + """ + Sets the log level of the server. + + + :param LogLevel: The log level to set. + + :param metadata: The SiLA Client Metadata attached to the call + + """ + + @abstractmethod + def ListenToLoggingStream( + self, + LoggingStreamName: str, + *, + metadata: MetadataDict, + instance: ObservableCommandInstanceWithIntermediateResponses[ListenToLoggingStream_IntermediateResponses], + ) -> ListenToLoggingStream_Responses: + """ + Starts listening to a logging stream from the SiLA server + + + :param LoggingStreamName: The logging stream name (recommended: in form of a URL) to listen to. + + :param metadata: The SiLA Client Metadata attached to the call + :param instance: The command instance, enabling sending status updates to subscribed clients + + """ + + @abstractmethod + def ListenToAllLogEntries( + self, + *, + metadata: MetadataDict, + instance: ObservableCommandInstanceWithIntermediateResponses[ListenToAllLogEntries_IntermediateResponses], + ) -> ListenToAllLogEntries_Responses: + """ + Starts listening to a stream of all consecutive log entries from the SiLA server + + + :param metadata: The SiLA Client Metadata attached to the call + :param instance: The command instance, enabling sending status updates to subscribed clients + + """ diff --git a/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/loggingservice_client.py b/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/loggingservice_client.py new file mode 100644 index 0000000..95b787f --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/loggingservice_client.py @@ -0,0 +1,88 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +# ----- +# This class does not do anything useful at runtime. Its only purpose is to provide type annotations. +# Since sphinx does not support .pyi files (yet?), this is a .py file. +# ----- + +from __future__ import annotations + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from typing import Iterable, List, Optional + + from loggingservice_types import ( + GetLogFile_Responses, + ListenToAllLogEntries_IntermediateResponses, + ListenToAllLogEntries_Responses, + ListenToLoggingStream_IntermediateResponses, + ListenToLoggingStream_Responses, + SetLogLevel_Responses, + ) + from sila2.client import ( + ClientMetadataInstance, + ClientObservableCommandInstanceWithIntermediateResponses, + ClientUnobservableProperty, + ) + + +class LoggingServiceClient: + """ + Provides services for integration of SiLA server logging. + The service is intended to be used by the server to provide logging information to the client. + The client can use the service to listen for log entries from the server. + It is possible to listen for all log entries or only for log entries from a specific Stream. + Error handling: If the server is not able to provide the requested information, it shall return an error message. + + """ + + LoggingStreamList: ClientUnobservableProperty[List[str]] + """ + Provides a list of URLs of all logging streams that are currently available on the server. + """ + + LogFileList: ClientUnobservableProperty[List[str]] + """ + Provides a list of URLs of all log files that are currently available on the server. + """ + + LogLevel: ClientUnobservableProperty[str] + """ + The current log level of the server. + """ + + def GetLogFile( + self, LogFileName: str, *, metadata: Optional[Iterable[ClientMetadataInstance]] = None + ) -> GetLogFile_Responses: + """ + Gets the log file from the server. + """ + ... + + def SetLogLevel( + self, LogLevel: str, *, metadata: Optional[Iterable[ClientMetadataInstance]] = None + ) -> SetLogLevel_Responses: + """ + Sets the log level of the server. + """ + ... + + def ListenToLoggingStream( + self, LoggingStreamName: str, *, metadata: Optional[Iterable[ClientMetadataInstance]] = None + ) -> ClientObservableCommandInstanceWithIntermediateResponses[ + ListenToLoggingStream_IntermediateResponses, ListenToLoggingStream_Responses + ]: + """ + Starts listening to a logging stream from the SiLA server + """ + ... + + def ListenToAllLogEntries( + self, *, metadata: Optional[Iterable[ClientMetadataInstance]] = None + ) -> ClientObservableCommandInstanceWithIntermediateResponses[ + ListenToAllLogEntries_IntermediateResponses, ListenToAllLogEntries_Responses + ]: + """ + Starts listening to a stream of all consecutive log entries from the SiLA server + """ + ... diff --git a/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/loggingservice_errors.py b/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/loggingservice_errors.py new file mode 100644 index 0000000..32e226c --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/loggingservice_errors.py @@ -0,0 +1,22 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +from __future__ import annotations + +from typing import Optional + +from sila2.framework.errors.defined_execution_error import DefinedExecutionError + +from .loggingservice_feature import LoggingServiceFeature + + +class LogginStreamNotAvailable(DefinedExecutionError): + def __init__(self, message: Optional[str] = None): + if message is None: + message = "The specified Logging Stream is unavailable. Please check the spelling of the stream URL" + super().__init__(LoggingServiceFeature.defined_execution_errors["LogginStreamNotAvailable"], message=message) + + +class LogFileNotAvailable(DefinedExecutionError): + def __init__(self, message: Optional[str] = None): + if message is None: + message = "The specified Log File is unavailable. Please check the spelling of the file URL" + super().__init__(LoggingServiceFeature.defined_execution_errors["LogFileNotAvailable"], message=message) diff --git a/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/loggingservice_feature.py b/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/loggingservice_feature.py new file mode 100644 index 0000000..8f604cb --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/loggingservice_feature.py @@ -0,0 +1,6 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +from os.path import dirname, join + +from sila2.framework import Feature + +LoggingServiceFeature = Feature(join(dirname(__file__), "LoggingService.sila.xml")) diff --git a/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/loggingservice_types.py b/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/loggingservice_types.py new file mode 100644 index 0000000..cb085cf --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/loggingservice/loggingservice_types.py @@ -0,0 +1,42 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +from __future__ import annotations + +from typing import Any, List, NamedTuple + + +class GetLogFile_Responses(NamedTuple): + LogFile: str + """ + Log File as text + """ + + +class SetLogLevel_Responses(NamedTuple): + pass + + +class ListenToLoggingStream_Responses(NamedTuple): + pass + + +class ListenToAllLogEntries_Responses(NamedTuple): + pass + + +class ListenToLoggingStream_IntermediateResponses(NamedTuple): + IntermediateLoggingText: str + """ + The current logging text of a certain logging stream as it is created by the server + """ + + +class ListenToAllLogEntries_IntermediateResponses(NamedTuple): + IntermediateLoggingEntry: List[LogEntry] + """ + Intermediate Log Entries as they are created by the server + """ + + +Severity = str + +LogEntry = Any diff --git a/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/SimulationController.proto b/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/SimulationController.proto new file mode 100644 index 0000000..c5ba1a0 --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/SimulationController.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; + +import "SiLAFramework.proto"; + +package sila2.org.silastandard.core.simulationcontroller.v1; + +/* This Feature provides control over the simulation behaviour of a SiLA Server. A SiLA Server can run in two modes: (a) Real Mode - with real activities, e.g. addressing or controlling real hardware, e.g. through serial/CANBus commands, writing to real databases, moving real objects etc. (b) Simulation Mode - where every command is only simulated and responses are just example returns. Note that certain commands and properties might not be affected by this feature if they do not interact with the real world. */ +service SimulationController { + /* Sets the SiLA Server to run in Simulation Mode, i.e. all following commands are executed in simulation mode. The Simulation Mode can only be entered, if all hardware operations have been safely terminated or are in a controlled, safe state. The simulation mode can be stopped by issuing the 'Start Real Mode' command. */ + rpc StartSimulationMode (sila2.org.silastandard.core.simulationcontroller.v1.StartSimulationMode_Parameters) returns (sila2.org.silastandard.core.simulationcontroller.v1.StartSimulationMode_Responses) {} + /* Sets the SiLA Server to run in real mode, i.e. all following commands are executed with real-world interactions, like serial port/CAN communication, motor actions etc. If the server is in Simulation Mode it can be interrupted at any time. A re-initialization of the hardware might be required. The Real Mode can be stopped by issuing the 'Start Simulation Mode' command. */ + rpc StartRealMode (sila2.org.silastandard.core.simulationcontroller.v1.StartRealMode_Parameters) returns (sila2.org.silastandard.core.simulationcontroller.v1.StartRealMode_Responses) {} + /* Indication whether SiLA Server is in Simulation Mode or not. */ + rpc Get_SimulationMode (sila2.org.silastandard.core.simulationcontroller.v1.Get_SimulationMode_Parameters) returns (sila2.org.silastandard.core.simulationcontroller.v1.Get_SimulationMode_Responses) {} +} + +/* Parameters for StartSimulationMode */ +message StartSimulationMode_Parameters { +} + +/* Responses of StartSimulationMode */ +message StartSimulationMode_Responses { +} + +/* Parameters for StartRealMode */ +message StartRealMode_Parameters { +} + +/* Responses of StartRealMode */ +message StartRealMode_Responses { +} + +/* Parameters for SimulationMode */ +message Get_SimulationMode_Parameters { +} + +/* Responses of SimulationMode */ +message Get_SimulationMode_Responses { + sila2.org.silastandard.Boolean SimulationMode = 1; /* Indication whether SiLA Server is in Simulation Mode or not. */ +} diff --git a/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/SimulationController.sila.xml b/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/SimulationController.sila.xml new file mode 100644 index 0000000..e773782 --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/SimulationController.sila.xml @@ -0,0 +1,62 @@ + + SimulationController + Simulation Controller + This Feature provides control over the simulation behaviour of a SiLA Server. + + A SiLA Server can run in two modes: + (a) Real Mode - with real activities, e.g. addressing or controlling real hardware, e.g. through serial/CANBus commands, + writing to real databases, moving real objects etc. + (b) Simulation Mode - where every command is only simulated and responses are just example returns. + + Note that certain commands and properties might not be affected by this feature if they + do not interact with the real world. + + StartSimulationMode + Start Simulation Mode + Sets the SiLA Server to run in Simulation Mode, i.e. all following commands are executed in simulation mode. + + The Simulation Mode can only be entered, if all hardware operations have been safely terminated + or are in a controlled, safe state. + + The simulation mode can be stopped by issuing the 'Start Real Mode' command. + No + + StartSimulationModeFailed + + + + StartRealMode + Start Real Mode + Sets the SiLA Server to run in real mode, i.e. all following commands are executed with real-world + interactions, like serial port/CAN communication, motor actions etc. + + If the server is in Simulation Mode it can be interrupted at any time. A re-initialization of + the hardware might be required. The Real Mode can be stopped by issuing the 'Start Simulation Mode' command. + No + + StartRealModeFailed + + + + SimulationMode + SimulationMode + Indication whether SiLA Server is in Simulation Mode or not. + No + + Boolean + + + + StartSimulationModeFailed + The start of Simulation Mode failed. + The server cannot change to Simulation Mode. + This error can, e.g., be thrown, if a real-world process needs to be ended before switching to simulation + mode. + + + StartRealModeFailed + The start of Real Mode failed. + The server cannot change to Real Mode. + This error can, e.g., be thrown, if a device is not ready to change into Real Mode. + + diff --git a/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/__init__.py b/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/__init__.py new file mode 100644 index 0000000..4939d99 --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/__init__.py @@ -0,0 +1,16 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +from .simulationcontroller_base import SimulationControllerBase +from .simulationcontroller_client import SimulationControllerClient +from .simulationcontroller_errors import StartRealModeFailed, StartSimulationModeFailed +from .simulationcontroller_feature import SimulationControllerFeature +from .simulationcontroller_types import StartRealMode_Responses, StartSimulationMode_Responses + +__all__ = [ + "SimulationControllerBase", + "SimulationControllerFeature", + "SimulationControllerClient", + "StartSimulationMode_Responses", + "StartRealMode_Responses", + "StartSimulationModeFailed", + "StartRealModeFailed", +] diff --git a/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/simulationcontroller_base.py b/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/simulationcontroller_base.py new file mode 100644 index 0000000..5350524 --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/simulationcontroller_base.py @@ -0,0 +1,74 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +from __future__ import annotations + +from abc import ABC, abstractmethod +from typing import TYPE_CHECKING + +from sila2.server import FeatureImplementationBase, MetadataDict + +from .simulationcontroller_types import StartRealMode_Responses, StartSimulationMode_Responses + +if TYPE_CHECKING: + from ...server import Server + + +class SimulationControllerBase(FeatureImplementationBase, ABC): + parent_server: Server + + def __init__(self, parent_server: Server): + """ + + This Feature provides control over the simulation behaviour of a SiLA Server. + + A SiLA Server can run in two modes: + (a) Real Mode - with real activities, e.g. addressing or controlling real hardware, e.g. through serial/CANBus commands, + writing to real databases, moving real objects etc. + (b) Simulation Mode - where every command is only simulated and responses are just example returns. + + Note that certain commands and properties might not be affected by this feature if they + do not interact with the real world. + + """ + super().__init__(parent_server=parent_server) + + @abstractmethod + def get_SimulationMode(self, *, metadata: MetadataDict) -> bool: + """ + Indication whether SiLA Server is in Simulation Mode or not. + + :param metadata: The SiLA Client Metadata attached to the call + :return: Indication whether SiLA Server is in Simulation Mode or not. + """ + + @abstractmethod + def StartSimulationMode(self, *, metadata: MetadataDict) -> StartSimulationMode_Responses: + """ + + Sets the SiLA Server to run in Simulation Mode, i.e. all following commands are executed in simulation mode. + + The Simulation Mode can only be entered, if all hardware operations have been safely terminated + or are in a controlled, safe state. + + The simulation mode can be stopped by issuing the 'Start Real Mode' command. + + + + :param metadata: The SiLA Client Metadata attached to the call + + """ + + @abstractmethod + def StartRealMode(self, *, metadata: MetadataDict) -> StartRealMode_Responses: + """ + + Sets the SiLA Server to run in real mode, i.e. all following commands are executed with real-world + interactions, like serial port/CAN communication, motor actions etc. + + If the server is in Simulation Mode it can be interrupted at any time. A re-initialization of + the hardware might be required. The Real Mode can be stopped by issuing the 'Start Simulation Mode' command. + + + + :param metadata: The SiLA Client Metadata attached to the call + + """ diff --git a/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/simulationcontroller_client.py b/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/simulationcontroller_client.py new file mode 100644 index 0000000..1660f3e --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/simulationcontroller_client.py @@ -0,0 +1,63 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +# ----- +# This class does not do anything useful at runtime. Its only purpose is to provide type annotations. +# Since sphinx does not support .pyi files (yet?), this is a .py file. +# ----- + +from __future__ import annotations + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from typing import Iterable, Optional + + from sila2.client import ClientMetadataInstance, ClientUnobservableProperty + from simulationcontroller_types import StartRealMode_Responses, StartSimulationMode_Responses + + +class SimulationControllerClient: + """ + + This Feature provides control over the simulation behaviour of a SiLA Server. + + A SiLA Server can run in two modes: + (a) Real Mode - with real activities, e.g. addressing or controlling real hardware, e.g. through serial/CANBus commands, + writing to real databases, moving real objects etc. + (b) Simulation Mode - where every command is only simulated and responses are just example returns. + + Note that certain commands and properties might not be affected by this feature if they + do not interact with the real world. + + """ + + SimulationMode: ClientUnobservableProperty[bool] + """ + Indication whether SiLA Server is in Simulation Mode or not. + """ + + def StartSimulationMode( + self, *, metadata: Optional[Iterable[ClientMetadataInstance]] = None + ) -> StartSimulationMode_Responses: + """ + + Sets the SiLA Server to run in Simulation Mode, i.e. all following commands are executed in simulation mode. + + The Simulation Mode can only be entered, if all hardware operations have been safely terminated + or are in a controlled, safe state. + + The simulation mode can be stopped by issuing the 'Start Real Mode' command. + + """ + ... + + def StartRealMode(self, *, metadata: Optional[Iterable[ClientMetadataInstance]] = None) -> StartRealMode_Responses: + """ + + Sets the SiLA Server to run in real mode, i.e. all following commands are executed with real-world + interactions, like serial port/CAN communication, motor actions etc. + + If the server is in Simulation Mode it can be interrupted at any time. A re-initialization of + the hardware might be required. The Real Mode can be stopped by issuing the 'Start Simulation Mode' command. + + """ + ... diff --git a/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/simulationcontroller_errors.py b/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/simulationcontroller_errors.py new file mode 100644 index 0000000..6553c0e --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/simulationcontroller_errors.py @@ -0,0 +1,24 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +from __future__ import annotations + +from typing import Optional + +from sila2.framework.errors.defined_execution_error import DefinedExecutionError + +from .simulationcontroller_feature import SimulationControllerFeature + + +class StartSimulationModeFailed(DefinedExecutionError): + def __init__(self, message: Optional[str] = None): + if message is None: + message = "The server cannot change to Simulation Mode.\n This error can, e.g., be thrown, if a real-world process needs to be ended before switching to simulation\n mode." + super().__init__( + SimulationControllerFeature.defined_execution_errors["StartSimulationModeFailed"], message=message + ) + + +class StartRealModeFailed(DefinedExecutionError): + def __init__(self, message: Optional[str] = None): + if message is None: + message = "The server cannot change to Real Mode.\n This error can, e.g., be thrown, if a device is not ready to change into Real Mode." + super().__init__(SimulationControllerFeature.defined_execution_errors["StartRealModeFailed"], message=message) diff --git a/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/simulationcontroller_feature.py b/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/simulationcontroller_feature.py new file mode 100644 index 0000000..ae6dd86 --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/simulationcontroller_feature.py @@ -0,0 +1,6 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +from os.path import dirname, join + +from sila2.framework import Feature + +SimulationControllerFeature = Feature(join(dirname(__file__), "SimulationController.sila.xml")) diff --git a/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/simulationcontroller_types.py b/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/simulationcontroller_types.py new file mode 100644 index 0000000..7b7960f --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/generated/simulationcontroller/simulationcontroller_types.py @@ -0,0 +1,12 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 +from __future__ import annotations + +from typing import NamedTuple + + +class StartSimulationMode_Responses(NamedTuple): + pass + + +class StartRealMode_Responses(NamedTuple): + pass diff --git a/plr_sila_bridge/plr_sila_bridge/py.typed b/plr_sila_bridge/plr_sila_bridge/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/plr_sila_bridge/plr_sila_bridge/server.py b/plr_sila_bridge/plr_sila_bridge/server.py new file mode 100644 index 0000000..3afe93f --- /dev/null +++ b/plr_sila_bridge/plr_sila_bridge/server.py @@ -0,0 +1,44 @@ +# Generated by sila2.code_generator; sila2.__version__: 0.12.2 + +from typing import Optional +from uuid import UUID, uuid4 + +from sila2.server import SilaServer + +from .feature_implementations.deviceinfoprovider_impl import DeviceInfoProviderImpl +from .feature_implementations.loggingservice_impl import LoggingServiceImpl +from .feature_implementations.simulationcontroller_impl import SimulationControllerImpl +from .generated.deviceinfoprovider import DeviceInfoProviderFeature +from .generated.loggingservice import LoggingServiceFeature +from .generated.simulationcontroller import SimulationControllerFeature + + +class Server(SilaServer): + def __init__( + self, + server_uuid: Optional[UUID] = None, + name: Optional[str] = None, + description: Optional[str] = None, + ): + # TODO: fill in your server information + if name is None: + name = "TODO" + if description is None: + description = "TODO" + super().__init__( + server_name=name, + server_description=description, + server_type="TODO", + server_version="0.1", + server_vendor_url="https://gitlab.com/SiLA2/sila_python", + server_uuid=server_uuid if server_uuid is not None else uuid4(), + ) + + self.deviceinfoprovider = DeviceInfoProviderImpl(self) + self.set_feature_implementation(DeviceInfoProviderFeature, self.deviceinfoprovider) + + self.loggingservice = LoggingServiceImpl(self) + self.set_feature_implementation(LoggingServiceFeature, self.loggingservice) + + self.simulationcontroller = SimulationControllerImpl(self) + self.set_feature_implementation(SimulationControllerFeature, self.simulationcontroller) diff --git a/plr_sila_bridge/pyproject.toml b/plr_sila_bridge/pyproject.toml new file mode 100644 index 0000000..ccc3b2c --- /dev/null +++ b/plr_sila_bridge/pyproject.toml @@ -0,0 +1,21 @@ +[project] +name = "plr_sila_bridge" +version = "0.0.0" +requires-python = ">=3.8" +dependencies = [ + "sila2", + "typer", +] + +[build-system] +requires = ["setuptools>=61.0.0"] +build-backend = "setuptools.build_meta" + +[tool.setuptools.packages.find] +include = ["plr_sila_bridge*"] + +[tool.setuptools.package-data] +"plr_sila_bridge.generated" = [ + "*/*.sila.xml", + "*/*.proto", +]