emulator_engine.models package
Models used by the emulator engine.
- class emulator_engine.models.ControllerCommand(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
StrEnumEnum containing controller commands.
Implements
StrEnum.- START = 'start'
- STOP = 'stop'
- TERMINATE = 'terminate'
- class emulator_engine.models.ControllerCommandEvent(command: ControllerCommand, value: dict[str, Any] = {}, severity: EventSeverity = EventSeverity.GENERAL, source_timestamp: int = None, update_timestamp: int = None)[source]
Bases:
ManualEventModel for Controller command events (i.e. non-blocking/async API calls).
Subclasses
ManualEvent.- Parameters:
command (
ControllerCommand) – The command to send to the controller.value (
dict[Any, Any], optional) – The value of this event/command, which can be any arbitrary dictionary. Default is {}.severity (
EventSeverity, optional) – The severity of this event/command. Defaults toEventSeverity.GENERAL.source_timestamp (
int, optional) – The timestamp, in milliseconds, for when the event/command was originally created. Defaults to the current system time.update_timestamp (
int, optional) – The timestamp, in milliseconds, for when the event/command was created or last updated. Defaults to the value of source_timestamp.
- command
The command sent to the controller.
- Type:
- value
The value of the event/command.
- Type:
dict[Any, Any]
- severity
The severity of the event/command.
- Type:
EventSeverity
- source_timestamp
The timestamp, in milliseconds, for when the event/command was originally created.
- Type:
- update_timestamp
The timestamp, in milliseconds, for when the event/command was created or last updated. For newly created events, update_timestamp == source_timestamp.
- Type:
- property command: ControllerCommand
The command to send to the controller.
- Type:
- static decode(json_event_str: str) ControllerCommandEvent[source]
Decode a JSON-encoded controller command event.
- Parameters:
encoded_event (
str) – The JSON string containing the event to decode- Returns:
The decoded event
- Return type:
- static encode(event: ControllerCommandEvent) str[source]
Encode a controller command event to a JSON string.
- Parameters:
event (
ControllerCommandEvent) – The event to encode- Returns:
The JSON-encoded event string
- Return type: