Coverage for /opt/conda/envs/apienv/lib/python3.10/site-packages/daiquiri/core/hardware/tango/valve.py: 0%
16 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.valve import Valve as AbstractValve
7from daiquiri.core.hardware.tango.object import TangoObject
9import logging
11logger = logging.getLogger(__name__)
14class ValveStateProperty(HardwareProperty):
15 def translate_from(self, value):
16 val_map = {
17 DevState.OPEN: "OPEN",
18 DevState.CLOSE: "CLOSED",
19 DevState.UNKNOWN: "UNKNOWN",
20 DevState.FAULT: "FAULT",
21 }
22 for k, v in val_map.items():
23 if k == value:
24 return v
26 return "UNKNOWN"
29class Valve(TangoObject, AbstractValve):
30 PROPERTY_MAP = {
31 "state": ValveStateProperty("state"),
32 "status": HardwareProperty("status"),
33 }
35 CALLABLE_MAP = {"open": "open", "close": "close", "reset": "reset"}