UA Ansi C Server Professional
1.3.2.233
|
There are two main development tasks to implement an OPC UA Server using the SDK.
One is to integrate the SDK and the UA Server into a new or an existing application. The second task is to integrate the data sources into the SDK. This tutorial gives an introduction on how to integrate the ANSI C UA SDK into a new application or an existing application.
The provided sample code implements the start up and the shut down code in the main function of the console application. For integration in existing applications the start up code for the SDK can be integrated into the start up sequence of the application and the shutdown code of the SDK into the shut down sequence of the application.
Please read the Introduction section before working through this tutorial.
Contents:
There are two variables needed during the whole runtime of the OPC UA Server. The one variable is the handle of the UA Stack platform layer. The other one is the UaServer object containing the configuration and management data for the OPC UA Server instance. The variables can be global variables or part of an application management structure available during the runtime of the Server.
The first step in the start up code is the initialization of the UA Stack. This requires filling the ProxyStubConfiguration structure with the configuration setting for the UA Stack. The helper function OpcUa_ProxyStubConfiguration_InitializeDefault is setting default values configured for the stack. The trace and serializer settings can be changed. In a second step the stack is initialized and the platform layer is assigned to the stack.
The second step is to initialize the UaServer object. With the first call UaServer_Initialize the structure and contained structures will be initialized. This includes the server instance specific settings like EndpointUrl, ApplicationUri and ApplicationName and product specific settings like the ProductUri.
The third step is to start the Ua Server. After this call, clients are able to connect to the server.
The shut down sequence clears the UaServer object first which also closes the Endpoints. Clients are not longer able to connect to the server after this call. In the second call the UA stack is cleaned up.