State

class State(value)[source]

Bases: SuperEnum

Enum representing the state of the village system.

__init__(description: str) None[source]

Initializes the State enum with a description.

Methods

keys()

Returns a list of all enum names.

values()

Returns a list of all enum values.

get_index_from_value(value)

Gets the index of an enum member by its value.

get_index_from_string(string)

Gets the index of an enum member by its string value.

can_exit()

Checks if the system can exit in this state.

can_edit_data()

Checks if data editing is allowed in this state.

can_calibrate_scale()

Checks if scale calibration is allowed in this state.

can_stop_task()

Checks if the running task can be stopped.

can_stop_syncing()

Checks if syncing process can be stopped.

can_go_to_wait()

Checks if the state can transition to WAIT.

__init__(description)

Initializes the State enum with a description.

Attributes

WAIT = 'All subjects are at home, waiting for RFID detection'
DETECTION = 'Gathering subject data, checking requirements to enter'
ACCESS = 'Closing door1, opening door2'
LAUNCH_AUTO = 'Automatically launching the task'
RUN_FIRST = 'Task running, waiting for the corridor to become empty'
CLOSE_DOOR2 = 'Closing door2'
RUN_CLOSED = 'Task running, the subject cannot leave yet'
OPEN_DOOR2 = 'Opening door2'
RUN_OPENED = 'Task running, the subject can leave'
EXIT_UNSAVED = 'Closing door2, opening door1; data still not saved'
SAVE_OUTSIDE = 'Stopping the task, saving the data; the subject is already outside'
SAVE_INSIDE = 'Stopping the task, saving the data; the subject is still inside'
WAIT_EXIT = 'Task finished, waiting for the subject to leave'
EXIT_SAVED = 'Closing door2, opening door1; data already saved'
OPEN_DOOR2_STOP = 'Opening door2, disconnecting RFID'
MANUAL_MODE = 'Settings are being changed or task is being manually prepared'
LAUNCH_MANUAL = 'Manually launching the task'
RUN_MANUAL = 'Task running manually'
SAVE_MANUAL = 'Stopping the task, saving the data; task is running manually'
SYNC = 'Synchronizing data or doing user-defined tasks'
EXIT_GUI = 'In the GUI window, ready to exit the app'
can_exit() bool[source]

Checks if the system can exit in this state.

Returns:

True if exit is allowed.

Return type:

bool

can_edit_data() bool[source]

Checks if data editing is allowed in this state.

Returns:

True if editing is allowed.

Return type:

bool

can_calibrate_scale() bool[source]

Checks if scale calibration is allowed in this state.

Returns:

True if calibration is allowed.

Return type:

bool

can_stop_task() bool[source]

Checks if the running task can be stopped.

Returns:

True if task can be stopped.

Return type:

bool

can_stop_syncing() bool[source]

Checks if syncing process can be stopped.

Returns:

True if syncing can be stopped.

Return type:

bool

can_go_to_wait() bool[source]

Checks if the state can transition to WAIT.

Returns:

True if transition to WAIT is allowed.

Return type:

bool

classmethod keys() list[str]

Returns a list of all enum names.

Returns:

usage: [e.name for e in cls]

Return type:

list[str]

classmethod values() list[Any]

Returns a list of all enum values.

Returns:

usage: [e.value for e in cls]

Return type:

list[Any]

classmethod get_index_from_value(value: Enum) int

Gets the index of an enum member by its value.

Parameters:

value (Enum) – The enum member or value.

Returns:

The index.

Return type:

int

classmethod get_index_from_string(string: str) int

Gets the index of an enum member by its string value.

Parameters:

string (str) – The string string.

Returns:

The index.

Return type:

int