ANSI C Based OPC UA Client/Server SDK  1.9.0.430
Subscription

Overview

The UaClient_Subscription class represents a single Subscription on a server. The data and event streams created with monitored items are provided as callbacks through UaClient_Subscription_Callback.

The UaClient_Subscription class does not maintain a local copy of the parameters and MonitoredItems. If the Subscription is no longer valid, the user of the SDK is responsible for recreating the Subscription on the server. Invalid Subscriptions are reported through UaClient_Subscription_StatusChanged_CB.

A UaClient_Subscription object is not thread-safe and can only be used from within the main thread.

Handles and IDs

SubscriptionId

The UaClient_Subscription::SubscriptionId is an internal Server created handle for communicating between Server and Client (SDK). Since the SubscriptionId is necessary to transfer a Subscription to another Session, the SubscriptionId is exposed to the SDK user.

UserData

The UaClient_Subscription::pUserData is a Client (SDK user) defined pointer to arbitrary data. The SDK will never modify this member of the subscription, so the user is responsible for freeing any memory associated with the pointer. The UserData can be used to distinguish Subscriptions in callback functions like UaClient_Subscription_StatusChanged_CB.

The service user data (argument a_pUserData to every service call function) is a client (SDK user) defined pointer to arbitrary data. The SDK will never modify or dereference this pointer, so the user is responsible for freeing any memory associated with the pointer. It can be used to distinguish service invocations that use the same callback function.

Monitored Items

The MonitoredItemId is a Server defined handle returned in OpcUa_MonitoredItemCreateResult. It is necessary to modify or delete monitored items.

The ClientHandle is assigned by the SDK user and should be unique per UaClient_Subscription_Callback instance. If unique monitored item ClientHandles are assigned across subscriptions, the UaClient_Subscription::pUserData is not relevant for data change or event callbacks. In this case, the UaClient_Subscription::pUserData handle is only relevant for Subscription status change callbacks.