Client print custom ExtensionObject

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

Moderator: uasdkcpp

Post Reply
sxdev
Full Member
Full Member
Posts: 7
Joined: 25 Mar 2020, 09:07

Client print custom ExtensionObject

Post by sxdev »

Hello,

I have a problem when I want to print a custom stucture that I don't receive from a server but that I create on the client side. In my real case I want to log the parameters of a method call. The logging happens, when the parameter is already a variant! When I get the same structure from the server with an event or by reading, printing works just fine. But printing the parameter I created in my project fails.

You should be able to recreate the problem like I did using the "client_cpp_sdk" demo project (version 1.7.4 with the "same" demo server). I edited the example and I used this place because right before, a Demo::Vector instance from the server is printed successfully:

Code: Select all

void read()
{
        // ... Successfully read and printed the variables, also Demo::Vector instances ...

        // ##### prints "Cannot get a structure definition - check access to type dictionary" #####
        Demo::Vector v(1.1, 2.2, 3.3);
        UaExtensionObject eo;
        v.toExtensionObject(eo);
        printExtensionObject(eo);
    }
}
From what I have seen in the debugger so far, the node id returned from the extension object's dataTypeId() has the correct value but the namespace index 0 (of course, because where should it have gotten it from).

Now the question is: can I set the namespace index to the correct value somehow, or is there another applicable solution for this problem?

Thanks

Post Reply