NodeJS OPC UA Client - Extension Object Handling|OPC UA Implementation: Stacks, Tools, and Samples|Forum|OPC Foundation

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
NodeJS OPC UA Client - Extension Object Handling
Avatar
Mohit Agarwal
Member
Members
Forum Posts: 55
Member Since:
10/18/2019
sp_UserOfflineSmall Offline
1
01/04/2022 - 02:41
sp_Permalink sp_Print

Hello,

I have an OPC UA Server which is running and has few complex data types.

I am trying to use the OPC UA Client from Node JS - https://github.com/node-opcua/.....cua-sample and trying to read an extension object.

I have also referred to the NodeJS Handbook - node-opcuabyexample.pdf and the example says, to parse the Extension Object, it says just do the following: console.log(dataValue.toString());

But, when I try to do that, I get the following output for one of the structures:

New Value = { /* DataValue */
value: Variant(Array<ExtensionObject>, l= 2, value=[/* OpaqueStructure */ {
nodeId ns=1;i=5017
buffer =
00000000: 03 00 00 00 56 49 4e 08 00 00 00 45 59 58 31 32 34 35 36 ....VIN....EYX12456

},/* OpaqueStructure */ {
nodeId ns=1;i=5017
buffer =
00000000: 0d 00 00 00 53 4f 43 4b 45 54 5f 4e 55 4d 42 45 52 01 00 00 00 33 ....SOCKET_NUMBER....3

}])
statusCode: Good (0x00000)
serverTimestamp: 2022-01-04T09:35:12.501Z $ 526.000.000
sourceTimestamp: 1601-01-01T00:00:00.000Z $ 000.000.000
}

 

How DO I parse extension objects so that I can map respective values correctly. Currently the output is in the binary form but the NodeJS example does NOT any details on parsing the structure field accordingly.

Can anyone who has knowledge on NodeJS help us in parsing the structure correctly and getting the required values in the NodeJS Client?

Avatar
Randy Armstrong
Admin
Forum Posts: 1564
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
01/04/2022 - 06:31
sp_Permalink sp_Print

node-opcua must have code to parse UA binary data. You need to find those APIs and use them to manually decode the ExtensionObject body.

That said. you will need to get the DataTypeDefinition for the type "ns=1;i=5017". The server exposes it in the DataTypeDictionary or in the DataTypeDefinition Attribute.

You should post on the node-opcua since they should have more detailed knowledge of the APIs available.

Avatar
Mohit Agarwal
Member
Members
Forum Posts: 55
Member Since:
10/18/2019
sp_UserOfflineSmall Offline
3
01/04/2022 - 07:01
sp_Permalink sp_Print

Thanks Randy, I will check with node opcua community.

Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online:
Guest(s) 39
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1435
Posts: 4855