browsing server with C SDK client

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

Moderator: uasdkc

Post Reply
jinma78
Jr. Member
Jr. Member
Posts: 1
Joined: 24 Oct 2015, 17:04

browsing server with C SDK client

Post by jinma78 »

I am trying to do what I think should be a fairly common operation with OPC client and that is browsing the server address space.
I only see a simple read example with the C SDK but I would like to be able to browse the server. Is this the correct API UaClient_Session_BeginQueryFirst() to use to do this? if so, could you provide some sample code? I see a sample code in C++ SDK but I need one more C SDK. Below is what I have so far but I am getting an error "UaClient_Session_QueryFirst (0x80ab0000).
Not sure what that means. But as you can see from my code I don't know how to use UaClient_Session_BeginQueryFirst() API and how to build the parameter before passing it to that API. I am currently evaluating the C SDK but I need to get through some of these simple items before committing to purchase. thank you.


OpcUa_Void Demo_query_cb(const UaClient_Session *a_pSession,
OpcUa_ResponseHeader *a_pResponseHeader,
OpcUa_Int32 a_NoOfQueryDataSets,
OpcUa_QueryDataSet *a_pQueryDataSets,
OpcUa_ByteString *a_pContinuationPoint,
OpcUa_Int32 a_NoOfParsingResults,
OpcUa_ParsingResult *a_pParsingResults,
OpcUa_Int32 a_NoOfDiagnosticInfos,
OpcUa_DiagnosticInfo *a_pDiagnosticInfos,
OpcUa_ContentFilterResult *a_pFilterResult,
OpcUa_Void *a_pUserData)
{
OpcUa_ReferenceParameter(a_pSession);
OpcUa_ReferenceParameter(a_NoOfDiagnosticInfos);
OpcUa_ReferenceParameter(a_pDiagnosticInfos);
OpcUa_ReferenceParameter(a_pUserData);
if (OpcUa_IsGood(a_pResponseHeader->ServiceResult))
{
OpcUa_Int32 i;
printf("number of query data sets= %d",a_NoOfQueryDataSets);

}
else
{
printf("Demo_query_cb failed (0x%08x)\n", a_pResponseHeader->ServiceResult);
}
PrintActions();
}

OpcUa_StatusCode Demo_browse(UaClient_Session *pSession)
{
OpcUa_NodeTypeDescription nodeTypeDesc;
UaClient_ServiceSettings p_servicesetting;
OpcUa_ViewDescription p_viewdesc;
OpcUa_NodeTypeDescription_Initialize(&nodeTypeDesc);

return UaClient_Session_BeginQueryFirst (pSession, OpcUa_Null,OpcUa_Null,1,&nodeTypeDesc ,OpcUa_Null,0,0,Demo_query_cb,OpcUa_Null);

}

User avatar
Support Team
Hero Member
Hero Member
Posts: 3068
Joined: 18 Mar 2011, 15:09

Re: browsing server with C SDK client

Post by Support Team »

Hello,

what you want to do can be achieved using

Code: Select all

UaClient_Session_BeginBrowseList
and

Code: Select all

UaClient_Session_BeginBrowseListNext
. Unfortunately we cannot yet provide an example on how to use those functions; an example will be provided in the next release of the SDK.

Best regards,
Unified Automation Support Team

Post Reply