Features

Why it is easy to use

  • Written in modern C++17.

  • Whenever possible uses native C++ types. For example, for strings, std::string is used, for arrays std::vector.

  • Designed following Low Code philosophy: applications using it would need to write minimal code. Example of connecting to the server and writing value to the single node:

    auto connection = Connection::create("opc.tcp://localhost:4840", true);
    auto connectResult = connection->connect().get();
    if (connectResult.isGood())
    {
      WriteRequest::Ptr req(new WriteRequest(
          WriteValue (NodeId("Demo.Static.Scalar.UInt32", 2), DataValue((uint32_t) 123))));
      auto writeResult = connection->send(req).get();
      if (writeResult->isGood())
      {
        // Handle successful result
      }
      connection->disconnect(false, true).get();
    }
    
  • Asynchronous interface, which can also be used as synchronous. The interface uses std::future type to return OPC UA service call results and optionally possible to handle call result via callback handlers, defined as std::function. Callbacks are made from dedicated for that threads, so they do not affect other threads such as IO service threads. This simplifies using the SDK for GUI applications for example.

  • Requests can store arbitrary user data in the member context of std::any type. This makes easy to store and access context-specific data in asynchronous callback handlers.

  • Callback handlers have both OPC UA Servcie response and corresponding to it request, so no need in the user application to store the request until the response is received.

  • Using smart pointers eliminates memory leaks as well as simplifies applicatoin design and redices source code size.

  • Powerfull Variant struct:

    • Allows easy storage of data values of any type;

    • Standard C++ base data type values as well as arrays of those types can be assigned or converted to, using standard C++ assignment statements.

    • Complex data type values are supported too. Data type information is retrieved from the server automatically during connection stage. Complex type values are stored in the Variant instances in binary encoded format, and can be expanded when required.

    • No need to call explicitely init nor clear functions like in some C SDKs. All done in the constructor and destructor automatically.

    • Easy conversion of data values to string or JSON, which makes easy to display values in the GUI and serialization.

  • Supports automatic re-connection with automatic creation of subscriptions and adding monitored items. Subscriptions and monitored items can be created also in offline mode, when connection with the server is not available yet. This eliminates need on handling of disconnections and re-connections at the application level.

  • Easy handling of date and time with DateTime struct.

    • Supports initialization to the current time;

    • Built-in support for parsing of string values;

    • Has methods to convert to string (local time zone as well as UTC time), to Unix epoch time and to standard C++ time std::chrono::time_point.

    • Has methods to increment timestamp by microseconds. milliseconds or seconds;

    • Has method to calculate difference between 2 timestamps.

  • Includes ThreadPool and Timer classes that make writing multithreaded applications easy.

  • For troubleshooting, includes logging to file, with configurable log level and limits on number of log files and maximum size of them.

Supported OPC UA functionality

  • Establishing of TCP connection and initial handshake (OPC UA Hello, Acknowledge and Error messages);

  • Implemented OPC UA Services:

    • OpenSecureChannel

    • FindServers

    • GetEndpoints

    • CreateSession

    • ActivateSession

    • CloseSession

    • Call

    • Read

    • Write

    • HistoryRead

    • Browse

    • BrowseNext

    • CreateSubscription

    • DeleteSubscriptions

    • CreateMonitoredItems (for Data Changes only, adding support for Alarms/Events is in progress)

    • DeleteMonitoredItems;

    • Publish

    • CloseSecureChannel

  • Communication in secured mode and infrastructure to support it:

    • Generating self-signed root certificate and application instance certificate signed by it;

    • Creation of secure channel in secured mode (sign and encryption). Currently only security policy Basic256Sha256 is supported.

  • OPC Binary encoding * Implemented for most data types, which are required to send requests and receive responses for functionality listed above. * Encoding and Decoding of complex data type values is also implemented.