Hello.
We would like to read user defined structure from the server. Values of this structure are displayed correctly in different OPC UA browsers like UaExpert, Softing client etc.
When we try to get the structure definiton with the following code, we get return value null also definition.isNull()
Here is code snippet:
UaStatus status = m_pUaSession->read(serviceSettings, 0, OpcUa_TimestampsToReturn_Both, nodesToRead, values, diagnosticInfos);
if (status.isGood())
{
OpcUa_StatusCode statusCode = OpcUa_IsGood(values[0].StatusCode);
if (statusCode)
{
UaVariant vVal = UaVariant(values[0].Value);
UaExtensionObject extObj;
if (vVal.arrayType() == OpcUa_VariantArrayType_Scalar)
{
vVal.toExtensionObject(extObj);
status = vVal.toExtensionObject(extObj);
if (status.isGood())
{
if (extObj.encoding() == UaExtensionObject::Binary)
{
UaStructureDefinition definition = m_pUaSession->structureDefinition(extObj.encodingTypeId());
if (!definition.isNull())
{
We have checked, the dictionary is read from the server. Did we forget anything else?
Kind regards
Reading of user structure from server
Moderator: uasdkcpp
- Support Team
- Hero Member
- Posts: 3071
- Joined: 18 Mar 2011, 15:09
Re: Reading of user structure from server
Hello 2garin,
there's an example in the C++ console client doing exactly this.
See examples/client_cpp_sdk/callback.h method printExtensionObjects() - you find the full source code there to print the content of an ExtensionObject.
there's an example in the C++ console client doing exactly this.
See examples/client_cpp_sdk/callback.h method printExtensionObjects() - you find the full source code there to print the content of an ExtensionObject.
Best regards
Unified Automation Support Team
Unified Automation Support Team