Force Binary encoding instead of Encodable_Object encoding

Questions regarding the use of the C++ SDK for Server or Client development or integration into customer products ...

Moderator: uasdkcpp

Post Reply
bveldhoen
Sr. Member
Sr. Member
Posts: 11
Joined: 07 May 2015, 14:38

Force Binary encoding instead of Encodable_Object encoding

Post by bveldhoen »

Dear Support Team,

* We are using C++ SDK 1.5.5 (will upgrade to 1.7.0 soon, most likely).
* We have unit tests which run both the client and the service within the same process.
* The service exposes a node which is an array of structures (OPC Binary struct array). These data types were defined and created using UaModeler.
* The client reads these nodes, and interprets the nodes by the following steps:
-- Read the node as UaVariant.
-- Convert the UaVariant to an ExtensionObjectArray (using UaVariant::toExtensionObjectArray).
-- Retrieve the UaStructureDefinition for the UaExtensionObject from the service.
-- Convert each element of the extension object array to a UaGenaricStructureValue, using UaGenericStructureValue::setGenericValue(item, structureDefinition).
-- This calls UaGenaricStructureValue::checkExtensionObject(...), which basically checks the encoding of the extension object.
* When the client runs within the same process as the service, the encoding is ExtensionObjectEncoding::EncodeableObject. This is not supported, with an empty UaGenericStructureValue as the result.
* When we execute the same code, but with the client running in a different process, the encoding is ExtensionObjectEncoding::Binary, and the deserialization works correctly.

Can you confirm our findings, or are we doing something wrong/unintended?
How does this mechanism of selecting the encoding work? (which sources?)
Are there configuration (or programmatical) settings, which can be used to force the used encoding? (If so, where to find those/how to set those)?

Thanks in advance for your feedback.

Kind regards,

bveldhoen
Sr. Member
Sr. Member
Posts: 11
Joined: 07 May 2015, 14:38

Re: Force Binary encoding instead of Encodable_Object encodi

Post by bveldhoen »

I think my question might be related to <mynamespace>::DataTypes::registerStructuredTypes(), see for instance the post below:
https://forum.unified-automation.com/to ... turedTypes

Since we run the client when registerStructuredTypes() is called, the data type is known, and deserialization is expected to be done through Encodeable_Object encoding. Is this correct?
(I tested our client and server running in different processes with and without calling registerStructuredTypes, and this seems to confirm it. When calling registerStructuredTypes in the client process before calling the server, the client side encoding during deserialization is EncodeableObject for "known" types).

From the generated types created from our model in UaModeler, only the Structures are reusable on the client side, as other types (i.e. those that derive from BaseObjectType) have a dependency on the NodeManager, which makes those types only usable on the server side (please correct me if I'm wrong!). Therefore, we do not use the generated types on the client side (yet, but that may change based on the answers to this post).

My questions then become:
1. Can you confirm our findings, or are we doing something wrong/unintended?
2. Are my assumptions above (on why Encodeable_Object encoding is used) correct? Please correct or fill in missing information where necessary.
3. Are there client-side configuration (or programmatical) settings, which can be used to force the used client-side encoding while deserializing? If so, where to find those/how to set those?
4. More specifically, can we force client-side deserialization with Binary encoding, even for types registered with registerStructuredTypes()? (If so, how?)
5. Why were most types, generated with UaModeler, designed to be unusable on the client side? Are there plans to change this? Or should we have modelled our types to use Structures instead of Objects (so they are reusable on the client side)?
6. How does the above relate to the PubSub module, where I can imagine an alternative way to share structure definitions between publishers and subscribers? Does UaModeler support types to be used with the PubSub module?

Thanks!

Post Reply