diff --git a/tangostationcontrol/tangostationcontrol/devices/station_manager.py b/tangostationcontrol/tangostationcontrol/devices/station_manager.py index 10a65bc407b4be04106c1b7bb8a20a98e93e414f..727ec10c2507dff966b447bdee9708b4ef882f7a 100644 --- a/tangostationcontrol/tangostationcontrol/devices/station_manager.py +++ b/tangostationcontrol/tangostationcontrol/devices/station_manager.py @@ -22,8 +22,8 @@ logger = logging.getLogger() __all__ = ["StationManager", "main"] -class StationState: +class StationState: # all station states OFF = "OFF" HIBERNATE = "HIBERNATE" @@ -41,7 +41,6 @@ class StationState: @device_logging_to_python() class StationManager(LOFARDevice): - # ----------------- # Device Properties # ----------------- @@ -54,14 +53,15 @@ class StationManager(LOFARDevice): # Attributes # ---------- station_name_R = attribute(dtype=str, fisallowed="is_attribute_access_allowed") + def read_station_name_R(self): return self.Station_Name station_state_R = attribute(dtype=str, fisallowed="is_attribute_access_allowed") + def read_station_state_R(self): return self.Station_State - # -------- # overloaded functions # -------- @@ -80,24 +80,23 @@ class StationManager(LOFARDevice): # -------- def _is_transition_allowed(self, to_state) -> bool: - # get allowed transitions for the current state allowed_transitions = StationState.allowed_transitions[self.station_state] # check if the station is already in state it wants to go to if to_state == self.station_state: logger.warning( - f"Requested to go to {to_state} state, " - f"but am already in {self.station_state} state." + f"Requested to go to {to_state} state, " + f"but am already in {self.station_state} state." ) return False # check if it is allowed to transition to the desired state elif to_state not in allowed_transitions: raise Exception( - f"State transition to {to_state} state " - f"only allowed in {allowed_transitions} " - f"Current state: {self.station_state}" + f"State transition to {to_state} state " + f"only allowed in {allowed_transitions} " + f"Current state: {self.station_state}" ) else: @@ -105,7 +104,7 @@ class StationManager(LOFARDevice): return True def _off_to_hibernate(self): - #TODO: functionality + # TODO: functionality return def _hibernate_to_off(self): @@ -128,7 +127,6 @@ class StationManager(LOFARDevice): # TODO: functionality return - # -------- # Commands # -------- @@ -182,7 +180,6 @@ class StationManager(LOFARDevice): # update the station_state variable when successful self.station_state = StationState.STANDBY - @command() @DebugIt() @log_exceptions() @@ -198,6 +195,7 @@ class StationManager(LOFARDevice): # update the station_state variable when successful self.station_state = StationState.ON + # ---------- # Run server # ----------