1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
|
# SPDX-FileCopyrightText: All Contributors to the PyTango project
# SPDX-License-Identifier: LGPL-3.0-or-later
"""
This is an internal PyTango module.
"""
__all__ = ("device_attribute_init",)
__docformat__ = "restructuredtext"
import copy
from tango.utils import document_method as __document_method
from tango._tango import DeviceAttribute, ExtractAs
def __DeviceAttribute__get_data(self):
return self.get_data_raw().extract()
def __DeviceAttribute__init(self, da=None):
if da is None:
DeviceAttribute.__init_orig(self)
else:
DeviceAttribute.__init_orig(self, da)
try:
self.value = copy.deepcopy(da.value)
except Exception:
pass
try:
self.w_value = copy.deepcopy(da.w_value)
except Exception:
pass
try:
self.scalar_w_value = da.scalar_w_value
except Exception:
pass
self.type = da.type
self.is_empty = da.is_empty
self.has_failed = da.has_failed
def __doc_DeviceAttribute():
def document_method(method_name, desc, append=True):
return __document_method(DeviceAttribute, method_name, desc, append)
DeviceAttribute.__doc__ = """
This is the fundamental type for RECEIVING data from device attributes.
It contains several fields. The most important ones depend on the
ExtractAs method used to get the value. Normally they are:
- value : Normal scalar value or numpy array of values.
- w_value : The write part of the attribute.
See other ExtractAs for different possibilities. There are some more
fields, these really fixed:
- name : (str)
- data_format : (AttrDataFormat) Attribute format
- quality : (AttrQuality)
- time : (TimeVal)
- dim_x : (int) attribute dimension x
- dim_y : (int) attribute dimension y
- w_dim_x : (int) attribute written dimension x
- w_dim_y : (int) attribute written dimension y
- r_rimension : (tuple<int,int>) Attribute read dimensions.
- w_dimension : (tuple<int,int>) Attribute written dimensions.
- nb_read : (int) attribute read total length
- nb_written : (int) attribute written total length
And two methods:
- get_date
- get_err_stack
"""
document_method(
"get_date",
"""
get_date(self) -> TimeVal
Get the time at which the attribute was read by the server.
Note: It's the same as reading the "time" attribute.
Parameters : None
Return : (TimeVal) The attribute read timestamp.
""",
)
document_method(
"get_err_stack",
"""
get_err_stack(self) -> sequence<DevError>
Returns the error stack reported by the server when the
attribute was read.
Parameters : None
Return : (sequence<DevError>)
""",
)
document_method(
"set_w_dim_x",
"""
set_w_dim_x(self, val) -> None
Sets the write value dim x.
Parameters :
- val : (int) new write dim x
Return : None
New in PyTango 8.0.0
""",
)
document_method(
"set_w_dim_y",
"""
set_w_dim_y(self, val) -> None
Sets the write value dim y.
Parameters :
- val : (int) new write dim y
Return : None
New in PyTango 8.0.0
""",
)
def __init_DeviceAttribute():
DeviceAttribute.__init_orig = DeviceAttribute.__init__
DeviceAttribute.__init__ = __DeviceAttribute__init
DeviceAttribute.ExtractAs = ExtractAs
def device_attribute_init(doc=True):
__init_DeviceAttribute()
if doc:
__doc_DeviceAttribute()
|