Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Getting the image type, when reading image nodes

More
03 Mar 2021 08:17 #9478 by support
Hi Lars,
welcome to the forums!

Yes, UAAttributeData.ValueType just gets you the .NET type of the value. And the .NET type is derived from the "type on the wire". And on the wire, in OPC UA, all Image data types are encoded as ByteArray, so it is not possible to distinguish between them. So, simply by reading the Value attribute, you cannot determine the image type - and that applies to UAExpert too.

What you are really interested in is not the "type on the wire", but the DataType of the node in OPC UA sense. To obtain that, you need to read the DataType attribute of the node (in addition to the Value attribute which you are already reading). So you may end up with twice as much items in your ReadMultiple call.

Example of reading the UA data types is here: opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...d%20DataType%20attributes.html

You need to pass in UAAttributeId.DataType somewhere - depending on the concrete method overload you are using.

What you get back is a value for that attribute node ID (UANodeId object, in QuickOPC). And you can compare it to predefined values from the OPC specification: reference.opcfoundation.org/v104/Core/DataTypes/#ImageBMP

In QuickOPC, you can use following symbols for the comparison (namespace OpcLabs.EasyOpc.UA.AddressSpace.Standard):
  • UADataTypeIds.ImageBMP
  • UADataTypeIds.ImageGIF
  • UADataTypeIds.ImageJPG
  • UADataTypeIds.ImagePNG

Note: For complete correctness, because there is no way in OPC UA to "seal" the types, one would have to consider that somebody may derive his own type from one of these types, and use it, and the consuming software should still be able to deal with it. In this case the comparisons against predefined DataTypes won't work, and it would be necessary to walk through the DataType hierarchy in the server to figure out the type inheritance. If you are interested, I can elaborate on that, but frankly, I would not bother with it in your case.

Best regards

Please Log in or Create an account to join the conversation.

More
03 Mar 2021 07:48 #9477 by Lars Otte
Hello,

currently we are implementing images in our software. The images are read from an OPC UA Server using QuickOPC.NET. I’ve already done some tests and reading images works fine using QuickOPC.

I use the EasyUAClient.ReadMultiple method to read an image node. To get the Data Type, I use the AttributeData.ValueType.

When I read an image node, QuickOPC indicates, that the data type is a byte array. QuickOPC shows the Data Type apparently as a .NET-Type. When I read the node using other OPC UA-Software (we use UA-Expert), the data type is either ImageBMP, ImageJPG or ImagePNG according to the node value. I would like to get the type of the image, that the node contains.

Is it possible to retrieve the image data type (and not just “byte array”) using QuickOPC?

Best regards

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.042 seconds