From 86e9cc158bcc1835f1c8b28309457933698ebaff Mon Sep 17 00:00:00 2001 From: oroulet Date: Thu, 11 Nov 2021 19:45:06 +0100 Subject: [PATCH] do not overwite args in VariableAttribute and Argument --- asyncua/ua/uaprotocol_hand.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/asyncua/ua/uaprotocol_hand.py b/asyncua/ua/uaprotocol_hand.py index a08b91acf..4c9f99288 100644 --- a/asyncua/ua/uaprotocol_hand.py +++ b/asyncua/ua/uaprotocol_hand.py @@ -1,5 +1,6 @@ import struct from dataclasses import dataclass, field +from typing import List from asyncua.ua import uaprotocol_auto as auto from asyncua.ua import uatypes @@ -247,16 +248,11 @@ def __post_init__(self): @dataclass class VariableAttributes(auto.VariableAttributes): - def __post_init__(self): - self.SpecifiedAttributes = ana.DisplayName | ana.Description | ana.WriteMask | ana.UserWriteMask | ana.Value | ana.DataType | ana.ValueRank | ana.ArrayDimensions | ana.AccessLevel | ana.UserAccessLevel | ana.MinimumSamplingInterval | ana.Historizing - #FIXME: following lines are very bad, we overwrite what user specified - self.Historizing = False - # force read access for all - self.AccessLevel = AccessLevel.CurrentRead.mask if self.AccessLevel == 0 else self.AccessLevel - self.UserAccessLevel = AccessLevel.CurrentRead.mask if self.UserAccessLevel == 0 else self.UserAccessLevel - # remove [] as default array dimensions. Spec says it should be None - if self.ArrayDimensions is not None and not self.ArrayDimensions: - self.ArrayDimensions = None + ArrayDimensions: List[uatypes.UInt32] = None + Historizing: uatypes.Boolean = True + AccessLevel: uatypes.Byte = auto.AccessLevel.CurrentRead.mask + UserAccessLevel: uatypes.Byte = auto.AccessLevel.CurrentRead.mask + SpecifiedAttributes: uatypes.UInt32 = ana.DisplayName | ana.Description | ana.WriteMask | ana.UserWriteMask | ana.Value | ana.DataType | ana.ValueRank | ana.ArrayDimensions | ana.AccessLevel | ana.UserAccessLevel | ana.MinimumSamplingInterval | ana.Historizing @dataclass @@ -302,8 +298,7 @@ def __post_init__(self): @dataclass class Argument(auto.Argument): - def __post_init__(self): - self.ValueRank = -2 + ValueRank: auto.Int32 = -1 @dataclass