Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Integer and UInteger types #1009

Merged
merged 1 commit into from
Sep 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions asyncua/ua/uatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,13 @@ def get_shape(mylist):
return dims


# For completness, these datatypes are abstract!
# If they are used in structs, abstract types are either Variant or ExtensionObjects.
# If they only contain basic types (int16, float, double..) they are Variants
UInteger = Variant
Integer = Variant
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that correct? All data types are defined as

Class UInt32(int):
    pass
but Integer should be a Variant type? Looks strnage but there are so many strange things in ua....

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sry I forget about it. After digging I am not sure if Variant is correct or ExtensionObject. I only found mention that abstract classes should be ExtensionObjects.
But to your point a abstract class can have an unknown content, that is why either Variant or a ExtenstionObject must be used. Otherwise the decoder can't know how long the data is.
I will look in the specs to find the correct handling.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I see, then we should also add Number, Float, etc,... if it is allowed to use them in structs

Copy link
Contributor Author

@schroeder- schroeder- Sep 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if it is allowed, but there are servers in the wild that use them.
Will add them if I know which type they should be. I only know of structs that are subtypes and they are ExtensionObjects.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not find anything about using these insie a struct but maybe you have better sources...



@dataclass(frozen=True)
class DataValue:
"""
Expand Down