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

Prosys returns a DataValue with variant type == 0 #283

Closed
kung-foo opened this issue Sep 26, 2019 · 2 comments · Fixed by #284
Closed

Prosys returns a DataValue with variant type == 0 #283

kung-foo opened this issue Sep 26, 2019 · 2 comments · Fixed by #284
Milestone

Comments

@kung-foo
Copy link
Member

kung-foo commented Sep 26, 2019

Server: Prosys OPC Simulation Server v3.2.0-214

When querying for an attribute (e.g. ua.AttributeIDDescription) Prosys may return a DataValue with the HasValue flag set and with an embedded variant that has a type id of 0x00 (which is not listed in the spec). Looking at the same node in the Prosys UI shows Description=null.

This shows up as an error like: invalid type id: 0

Quick'n'dirty-non-standard-hack:

diff --git a/ua/enums.go b/ua/enums.go
index 6131fd0..73050d2 100644
--- a/ua/enums.go
+++ b/ua/enums.go
@@ -58,6 +58,7 @@ const (
 type TypeID byte
 
 const (
+       TypeIDNull            TypeID = 0
        TypeIDBoolean         TypeID = 1
        TypeIDSByte           TypeID = 2
        TypeIDByte            TypeID = 3
diff --git a/ua/variant.go b/ua/variant.go
index 3d0a32c..dc107c8 100644
--- a/ua/variant.go
+++ b/ua/variant.go
@@ -542,6 +542,7 @@ func (m *Variant) Time() time.Time {
 
 var variantTypeToTypeID = map[reflect.Type]TypeID{}
 var variantTypeIDToType = map[TypeID]reflect.Type{
+       TypeIDNull:            reflect.TypeOf(nil),
        TypeIDBoolean:         reflect.TypeOf(false),
        TypeIDSByte:           reflect.TypeOf(int8(0)),
        TypeIDByte:            reflect.TypeOf(uint8(0)),
@kung-foo
Copy link
Member Author

@magiconair
Copy link
Member

magiconair commented Sep 26, 2019 via email

@magiconair magiconair added this to the v0.1.6 milestone Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants