High Performance OPC UA Server SDK  1.2.1.203
HP SDK Sample Client

The HP SDK Sample Client is a collection of examples for developing different features of an OPC UA client.

The sample code can be found in the files

Command Line Arguments

The Sample Client application is able to recognize a set of command line arguments. The following command line arguments are recognized:

Usage: ./sampleclient [-h] [-v] [-c <config file>] [-u <URL>] [-d]
  -h: Shows this help
  -v: Shows detailed version information
  -c: Sets the configuration file to use (default=client_settings.conf)
  -u: Sets the URL to use (default is to use the URLs from the configuration file)
  -d: For each 'd' argument, the trace level is increased by one (e.g. '-ddd' for INFO)

Included Examples

The Sample Client provides examples for the most important OPC UA client use cases.

The sample code and the referenced functions in the following list can be found in the file main.c.

It provides examples for:

  • Server discovery
  • Certificate and security handling (methods SetupPKIInfrastructure and ClientMain)
  • Connect to server
  • Disconnect from server
  • Read values from server (method Demo_Read)
  • Create subscription and data monitored items
  • Browse the server address space
  • Call methods

The callback handling for data changes and events is implemented in Demo_Subscription_DataChange_CB and Demo_Subscription_NewEvents_CB.

The configuration parameters for the client (DiscoveryUrl, ServerUrl etc.) are loaded from the file client_settings.conf and stored in the appropriate client and session structures.