UA Server SDK C++ Bundle
1.3.2.200
|
The lesson uses callback.h from examples.
Set up a console application.
Windows:
Create a new project. Use the following settings:
Add [SDK Installation Directory]\examples\client_cpp_sdk\callback.h to your application.
Add the following include paths to your application:
[SDK Installation Directory]\examples\client_cpp_sdk
[SDK Installation Directory]\include\uastack
[SDK Installation Directory]\include\uabase
[SDK Installation Directory]\include\uaclient
[SDK Installation Directory]\include\uapki
[SDK Installation Directory]\third-party\win32\[VisualStudioVersion]\openssl\inc32
Linux:
[SDK Installation Directory]/examples/utilities/linux
For more information see LibraryOverview.
Windows:
For Additional Library Directories enter the following values:
[SDK Installation Directory]\lib
[SDK Installation Directory]\third-party\win32\[VisualStudioVersion]\openssl\out32dll.dbg (Debug)
[SDK Installation Directory]\third-party\win32\[VisualStudioVersion]\openssl\out32dll (Release)
For Additional Dependencies (Debug) enter:
uastackd.lib
uabased.lib
uapkid.lib
uaclientd.lib
crypt32.lib
libeay32d.lib
ws2_32.lib
rpcrt4.lib
For Additional Dependencies (Release) enter:
uastack.lib
uabase.lib
uapki.lib
uaclient.lib
crypt32.lib
libeay32.lib
ws2_32.lib
rpcrt4.lib
Linux:
For Additional Library Directories enter the following values:
-L[SDK Installation Directory]/lib
For Additional Dependencies (Debug) enter:
-luastackd -luaclientd -luabased -luapkid -lpthread -lrt -lssl
For Additional Dependencies (Release) enter:
-luastack -luaclient -luabase -luapki -lpthread -lrt -lssl
Add
OPCUA_SUPPORT_SECURITYPOLICY_BASIC128RSA15=1
OPCUA_SUPPORT_SECURITYPOLICY_BASIC256=1
OPCUA_SUPPORT_SECURITYPOLICY_NONE=1
OPCUA_SUPPORT_PKI=1
_UA_STACK_USE_DLL
Additional defines for Windows:
UNICODE
_UNICODE
_CRT_SECURE_NO_WARNINGS
_CRT_SECURE_NO_DEPRECATE
Set output path to bin where the config file resides.
Windows:
Enter these values:
First of all we add the file client_cpp_sdk_tutorial.cpp and write down the following code snippet:
The code shown above will be described in Lesson 2: Connecting to Server, so just use this code and learn more about it in the next lesson.
In the file client_cpp_sdk_tutorial.cpp we have to implement a function to shut down the client with a simple press on the key “x”. It is a simple function to handle the keypress event:
You do not have to use the key 'x', it is just a suggestion. Use can use every key you want.
Main only calls the WaitForKeypress function if any key was pressed. That is all for now. Compile your first lesson and get familiar with the code. The complete client_cpp_sdk_tutorial.cpp;