controller_interface
interfaces.controller_interface
Module providing functions to interact with the drunc controller.
Attributes
MSG_TYPE = {Argument.Type.INT: int_msg, Argument.Type.FLOAT: float_msg, Argument.Type.STRING: string_msg, Argument.Type.BOOL: bool_msg}
module-attribute
Mapping of argument types to their protobuf message types.
Functions
get_arguments(event)
Get the arguments required to run an event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
str
|
The event to get the arguments for. |
required |
Returns:
| Type | Description |
|---|---|
list[Argument]
|
The arguments for the event. |
Source code in interfaces/controller_interface.py
get_controller_driver()
get_controller_status()
get_controller_uri()
cached
Find where the root controller is running via the connectivity service.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The URI of the root controller. |
Source code in interfaces/controller_interface.py
get_detectors(description=None)
Get the detectors available in the controller for each application.
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
The detectors available in the controller. |
Source code in interfaces/controller_interface.py
get_fsm_state()
Get the finite state machine state.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The state the FSM is in. |
process_arguments(event, arguments)
Process the arguments for an event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
str
|
The event to process. |
required |
arguments
|
dict[str, Any]
|
The arguments to process. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict[str, Any]
|
The processed arguments in a form compatible with the protobuf definition. |
Source code in interfaces/controller_interface.py
send_event(event, arguments)
Send an event to the controller.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
str
|
The event to send. |
required |
arguments
|
dict[str, Any]
|
The arguments for the event. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the event failed, reporting the flag. |