Coverage for /opt/conda/envs/apienv/lib/python3.10/site-packages/daiquiri/core/hardware/abstract/tangoattr.py: 100%
25 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 marshmallow import fields
5from daiquiri.core.hardware.abstract import HardwareObject
6from daiquiri.core.schema.hardware import HardwareSchema
7from daiquiri.core.schema.validators import OneOf
9import logging
11logger = logging.getLogger(__name__)
13TangoDeviceStates = [
14 "ON",
15 "OFF",
16 "CLOSE",
17 "OPEN",
18 "INSERT",
19 "EXTRACT",
20 "MOVING",
21 "STANDBY",
22 "FAULT",
23 "INIT",
24 "RUNNING",
25 "ALARM",
26 "DISABLE",
27 "UNKNOWN",
28]
30TangoQualities = [
31 "VALID",
32 "INVALID",
33 "ALARM",
34 "CHANGING",
35 "WARNING",
36]
38TangoDataTypes = [
39 "DevVoid",
40 "DevBoolean",
41 "DevShort",
42 "DevLong",
43 "DevLong64",
44 "DevUChar",
45 "DevUShort",
46 "DevULong",
47 "DevULong64",
48 "DevFloat",
49 "DevDouble",
50 "DevString",
51 "DevVarBooleanArray",
52 "DevVarDoubleArray",
53 "DevVarFloatArray",
54 "DevVarShortArray",
55 "DevVarLongArray",
56 "DevVarLong64Array",
57 "DevVarCharArray",
58 "DevVarStringArray",
59 "DevVarUShortArray",
60 "DevVarULongArray",
61 "DevVarULong64Array",
62 "DevEncoded",
63 "DevVarEncodedArray",
64 "DevVarLongStringArray",
65 "DevVarDoubleStringArray",
66 "DevState",
67 "DevVarStateArray",
68 "DevEnum",
69 "DevPipeBlob",
70 "DevFailed",
71]
74class TangoAttrPropertiesSchema(HardwareSchema):
75 # Device state
77 state = OneOf(TangoDeviceStates)
78 status = fields.Str(metadata={"readOnly": True})
80 # Attribute properties
82 name = fields.Str(metadata={"readOnly": True})
83 value = fields.Raw()
84 # read_value
85 # read_dim_x
86 # read_dim_y
87 # set_value
88 # write_dim_x
89 # write_dim_y
90 quality = OneOf(TangoQualities)
91 data_type = OneOf(TangoDataTypes)
92 # data_format
94 # Attribute config
96 description = fields.Str()
97 label = fields.Str()
98 unit = fields.Str()
99 # standard_unit = fields.Str()
100 display_unit = fields.Str()
101 format = fields.Str()
102 # min_value = fields.Number()
103 # max_value = fields.Number()
104 # min_alarm = fields.Number()
105 # max_alarm = fields.Number()
106 # min_warning = fields.Number()
107 # max_warning = fields.Number()
108 # delta_val = fields.Number()
109 # delta_t = fields.Number()
110 # rel_change = fields.Number()
111 # abs_change = fields.Number()
112 # archive_rel_change = fields.Number()
113 # archive_abs_change = fields.Number()
114 # period = fields.Number()
115 # archive_period = fields.Number()
116 # writable
117 # display_level
120class TangoAttr(HardwareObject):
121 _type = "tangoattr"
122 _state_ok = [
123 "ON",
124 "RUNNING",
125 "STANDBY",
126 "MOVING",
127 "CLOSE",
128 "OPEN",
129 "INSERT",
130 "EXTRACT",
131 ]
133 _properties = TangoAttrPropertiesSchema()