Coverage for /opt/conda/envs/apienv/lib/python3.10/site-packages/daiquiri/core/hardware/tango/frontend.py: 0%
23 statements
« prev ^ index » next coverage.py v7.6.5, created at 2024-11-15 02:12 +0000
« prev ^ index » next coverage.py v7.6.5, created at 2024-11-15 02:12 +0000
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3from tango import DevState
5from daiquiri.core.hardware.abstract import HardwareProperty
6from daiquiri.core.hardware.abstract.frontend import Frontend as AbstractFrontend
7from daiquiri.core.hardware.tango.object import TangoObject
9import logging
11logger = logging.getLogger(__name__)
14class ItlkStateProperty(HardwareProperty):
15 def translate_from(self, value):
16 val_map = {DevState.ON: "ON", DevState.FAULT: "FAULT"}
18 for k, v in val_map.items():
19 if k == value:
20 return v
22 return "UNKNOWN"
25class FrontendStateProperty(HardwareProperty):
26 def translate_from(self, value):
27 val_map = {
28 DevState.OPEN: "OPEN",
29 DevState.RUNNING: "RUNNING",
30 DevState.CLOSE: "CLOSED",
31 DevState.STANDBY: "STANDBY",
32 DevState.FAULT: "FAULT",
33 DevState.UNKNOWN: "UNKNOWN",
34 }
35 for k, v in val_map.items():
36 if k == value:
37 return v
39 return "UNKNOWN"
42class Frontend(TangoObject, AbstractFrontend):
43 PROPERTY_MAP = {
44 "state": FrontendStateProperty("state"),
45 "status": HardwareProperty("status"),
46 "automatic": HardwareProperty("Automatic_Mode"),
47 "frontend": HardwareProperty("FE_State"),
48 "current": HardwareProperty("SR_Current"),
49 "mode": HardwareProperty("SR_Mode"),
50 "refill": HardwareProperty("SR_Refill_Countdown"),
51 "message": HardwareProperty("SR_Operator_Mesg"),
52 "feitlk": ItlkStateProperty("FE_Itlk_State"),
53 "pssitlk": ItlkStateProperty("PSS_Itlk_State"),
54 "expitlk": ItlkStateProperty("EXP_Itlk_State"),
55 }
57 CALLABLE_MAP = {"open": "Open", "close": "Close", "reset": "Reset"}