From 11fb05749b917f1ffa77fd3598daf394605dcfa8 Mon Sep 17 00:00:00 2001 From: Jan David Mol <mol@astron.nl> Date: Mon, 21 Jun 2021 13:06:26 +0200 Subject: [PATCH] L2SS-261: Allow annotation about the class of attribute the comms_annotation is for. To distinguish attributes tied to different interfaces within the same device. --- devices/clients/attribute_wrapper.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/devices/clients/attribute_wrapper.py b/devices/clients/attribute_wrapper.py index 73b8d2039..99312919c 100644 --- a/devices/clients/attribute_wrapper.py +++ b/devices/clients/attribute_wrapper.py @@ -14,11 +14,12 @@ class attribute_wrapper(attribute): Wraps all the attributes in a wrapper class to manage most of the redundant code behind the scenes """ - def __init__(self, comms_annotation=None, datatype=None, dims=(1,), access=AttrWriteType.READ, init_value=None, **kwargs): + def __init__(self, comms_id=None, comms_annotation=None, datatype=None, dims=(1,), access=AttrWriteType.READ, init_value=None, **kwargs): """ wraps around the tango Attribute class. Provides an easier interface for 1d or 2d arrays. Also provides a way to abstract managing the communications interface. + comms_id: user-supplied identifier that is attached to this object, to identify which communication class will need to be attached comms_annotation: data passed along to the attribute. can be given any form of data. handling is up to client implementation datatype: any numpy datatype dims: dimensions of the attribute as a tuple, or (1,) for a scalar. @@ -31,6 +32,7 @@ class attribute_wrapper(attribute): if "numpy" not in str(datatype) and datatype != str: raise TypeError("Attribute needs to be a Tango-supported numpy or str type, but has type \"%s\"" % (datatype,)) + self.comms_id = comms_id # store data that can be used to identify the comms interface to use. not used by the wrapper itself self.comms_annotation = comms_annotation # store data that can be used by the comms interface. not used by the wrapper itself self.numpy_type = datatype # tango changes our attribute to their representation (E.g numpy.int64 becomes "DevLong64") -- GitLab