Coverage for /opt/conda/envs/apienv/lib/python3.10/site-packages/daiquiri/core/hardware/tango/gauge.py: 0%

16 statements  

« 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 

4 

5from daiquiri.core.hardware.abstract import HardwareProperty 

6from daiquiri.core.hardware.abstract.gauge import Gauge as AbstractGauge 

7from daiquiri.core.hardware.tango.object import TangoObject 

8 

9import logging 

10 

11logger = logging.getLogger(__name__) 

12 

13 

14class GaugeStateProperty(HardwareProperty): 

15 def translate_from(self, value): 

16 val_map = {DevState.ON: "ON", DevState.OFF: "OFF", DevState.UNKNOWN: "UNKNOWN"} 

17 for k, v in val_map.items(): 

18 if k == value: 

19 return v 

20 

21 return "UNKNOWN" 

22 

23 

24class Gauge(TangoObject, AbstractGauge): 

25 PROPERTY_MAP = { 

26 "state": GaugeStateProperty("state"), 

27 "status": HardwareProperty("status"), 

28 "pressure": HardwareProperty("pressure"), 

29 } 

30 

31 CALLABLE_MAP = {"on": "on", "off": "off"}