Reading custom datatype - client side

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

Moderator: uasdkcpp

Post Reply
barbeuk
Jr. Member
Jr. Member
Posts: 2
Joined: 16 Apr 2019, 10:36

Reading custom datatype - client side

Post by barbeuk »

Hello,

First of all, know that I browsed the whole 36 pages of this forum section and still haven't found my answer.

1. A bit of context :
gcc version 4.8.5 using C++11
SDK version : 1.6.3.406
built using builSdk.sh with option to enable shared lib and debug

I have 3 namespaces, 2 of them are registred in the code thanks to the class UaModeler generated, the last one is not registred because it is kind of declared in a nodesetimport.xml and registering it in the code make the server bug. Although I do not understand why, it is not the main subjet.

In the nodeset, variables nodes are declared with datatypes from the 2 namespace registered in the code.

Once imported, the server historize the variable.

2. The problem

2.1 Server side
Following server_cpp_exemple...

It is impossible to get the datatype from the UaDataValue nor UaExtensionObject nor UaVariant in the datachange() callback. Even when providing namespaceTable or nodeManager or whatever. I can only get the dataType node ID thanks to the UaVariable member of the class HistorizedVariable.

To me it seems like it is not normal.

I can access the value of my custom types if I cast their value to the corresponding DataType (following the exemple). But it is impossible to read their structure if I want to use the printExtensionObject (I would like something generic).

2.2 Client side
Thanks to UaExpert, I can check that my objects have the correct datatype and that their value change. So by double-clicking on the value, I can see the values of my custom dataType being read as ExtensionObject (although I need to double-click again to update the values, whereas a simple variable gets updated automatically on the UI).

The problem is that the client_cpp_sdk example cannot read the structure whereas UaExpert can (I changed the hardcoded Id in the example and made the few necessary change).

Even with my own code, using registeredStructureDatatypes on the client, it still cannot get the values. (I tried to read it using the read() function and the datachange() callback, as I need realtime display).

Trying every kind of code, the closest I get to one of the topic is this one https://forum.unified-automation.com/topic1823.html.
As I get this error
Cannot get a structure definition - check access to type dictionary
from the client_cpp_sdk.

So I searched a lot and found that

Code: Select all

UaSession::loadDataTypeDictionaries()
seems to not load anything else than the basic type, although I'm not sure.

You say
Do you have disabled XML parser support for the client SDK (only possible if you build the SDK from source)?
, what does it mean ? Should it be enabled or disabled to work ? (On my end it is supported as the server needs it and the client use the same libraries).
The dictionary do not have to be completed by hand, does it ?

I am running out of solution, I know UaExpert can read structure that does not even have their type registered on the client code. While I cannot get value, registered or not.

Thanks in advance for your patience.

barbeuk
Jr. Member
Jr. Member
Posts: 2
Joined: 16 Apr 2019, 10:36

Re: Reading custom datatype - client side

Post by barbeuk »

Resolved

Although I was sure that I called registerStructuredTypes on the client while testing, I did not...

So it works when I registered the datatype. I am still wondering why I can't read any sort of ExtensionObject without having their types registered beforehand.

Post Reply