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.
Opc Ua ExtensionObject
There are 2 options (I haven't actually tried them, but the principles should work):
1) You need to "tell" the compiler that it is dealing with an ExtensionObject, by typecasting the received value to Opc.Ua.ExtensionObject, and then you will get the data from its Body property. In order to make the type cast, however, you will need to reference the Opc.Ua.Core assembly, and here is where the necessity to select the installation of Embedded Assemblies comes to play. And, as a third execution step, you will need to type cast the value from Body to Byte[], because Body is an 'object'.
2) Or, you can do an equivalent of that, but without referencing the Opc.Ua.Core assembly, using .NET reflection: locate the "Body" property getter on the received value, and invoke it.
( A third option, for VB users only: It will probably work, with late binding, by simply accessing .Body property, because VB is not strong-typed as C#).
Regards
Please Log in or Create an account to join the conversation.
BR,
Carsten Voort
Please Log in or Create an account to join the conversation.
According to OPC UA spec Part 6,
andAll floating point values shall be encoded with the appropriate X200 : ITU-T X.200 – Open
Systems Interconnection – Basic Reference Model
www.itu.int/rec/T-REC-X.200-199407-I/en
All integer types shall be encoded as little endian values where the least significant byte
appears first in the stream.
With .NET class BitConverter (msdn.microsoft.com/en-us/library/system.bitconverter(v=vs.110).aspx) and methods like ToSingle() and ToInt16(), it shouldn't be too difficult to decode it.
Please Log in or Create an account to join the conversation.
<opc:Field Name="Max_Spanmaat" TypeName="opc:Float"/>
<opc:Field Name="Min_Spanmaat" TypeName="opc:Float"/>
<opc:Field Name="ZeefType" TypeName="opc:Int16"/>
</opc:StructuredType>
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
I know the xml description but I cannot do anything with the Byte[10]. Since it is an extension object there is no way to cast it or extract any bytes using normal system methods. Does QuickOPC provide such methods?
BR,
Carsten Voort
Please Log in or Create an account to join the conversation.
BR,
Carsten Voort
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
STRUCT
ZeefType : INT; //2 bytes
Min_Spanmaat : REAL; //4 bytes
Max_Spanmaat : REAL; //4 bytes
END_STRUCT
which makes a total of 10 bytes. How can I decode the Byte[10]? Which methods do I use? Could you provide me with a few lines of (pseudo) code?
BR,
Carsten Voort
Please Log in or Create an account to join the conversation.
Let's say you are dealing with one custom data type, which is represented by 10 bytes inside the ExtensionObject. As part of you development (i.e. not directly in the program you are writing), you can read the DataType and determine the DataTypeDescription using my hints - but just once, manually. You will end up with an XML fragment that describes the fields of the custom data type. You will then write a custom decoding algorithm (into the actual project you are developing) that would take these 10 bytes and interpret them accordingly to the data type description - that should be just couple of lines of code. If you have just one data type or a handful of them, this approach is *much* simpler than trying to write a generic solution, which is what I assumed in my hints.
Best regards
Please Log in or Create an account to join the conversation.