Statuses

from dgisim import EquipmentStatuses, Statuses

__eq__ and __hash__ are implemented so that any two Statuses with the equivalent content are equal to each other and have the same hash.

Statuses

class Statuses(statuses: tuple[dgisim.status.status.Status, ...])

A container for easy statuses managing.

add_status(incoming_status: type[dgisim.status.status.Status]) Self
Parameters:

incoming_status – the status to be added.

Adds the incoming status to the current statuses. If the status of the same type already exists, then the existing status will be notified to be updating knowing this is intended to be an addition.

contains(status: type[dgisim.status.status.Status]) bool
Returns:

True if status can be found.

encoding(encoding_plan: EncodingPlan, fixed_len: None | int = None) list[int]
Returns:

the encoding of this Statuses object.

find(status: type[dgisim.status.status.Status]) None | Status
Returns:

the status of the exact type status, or None if not found.

find_type(status: type[dgisim.status.status.Status]) None | Status
Returns:

the status of the type status, or None if not found.

just_find(status: type[__InputStatus]) __InputStatus
Returns:

the status of the exact type status, or an exception is thrown.

just_find_type(status: type[__InputStatus]) __InputStatus
Returns:

the status of the type status, or an exception is thrown.

remove(status: type[dgisim.status.status.Status]) Self
Returns:

the Statuses where status is removed.

property statuses: tuple[dgisim.status.status.Status, ...]
Returns:

tuple of statuses.

update_status(incoming_status: Status, override: bool = False) Self
Parameters:

override – set to True if the incoming_status unconditionally overrides the existing status of the same type. (or simple add to statuses if there’s not one)

Updates existing status of the same type with the incoming_status, or append the new_status to the end of current statuses.

Equipment Statuses