C++ Based OPC UA Client/Server SDK  1.5.5.355
OpcUaDi::LockingServicesCallback Class Referenceabstract

Callback interface used to implement the LockingServices interface in the user application. More...

#include <opcuadi_lockingservicestype.h>

Public Member Functions

virtual UaStatus InitLock (const ServiceContext &serviceContext, const UaString &CurrentContext, OpcUa_Int32 &InitLockStatus)=0
 InitLock restricts access to the Device for other Clients. More...
 
virtual UaStatus ExitLock (const ServiceContext &serviceContext, OpcUa_Int32 &ExitLockStatus)=0
 ExitLock removes the lock from the Device. More...
 
virtual UaStatus RenewLock (const ServiceContext &serviceContext, OpcUa_Int32 &RenewLockStatus)=0
 Renew the lock of a device. More...
 
virtual UaStatus BreakLock (const ServiceContext &serviceContext, OpcUa_Int32 &BreakLockStatus)=0
 Break the lock of a device. More...
 

Detailed Description

Callback interface used to implement the LockingServices interface in the user application.

Locking is the means to avoid concurrent modifications to a Device or Network and their components. Clients shall use the locking services if they need to make a set of changes (for example, several write operations and Method invocations) and where a consistent state is available only after all of these changes have been performed. The main purpose of locking a Device is avoiding concurrent modifications. The main purpose of locking a Network is avoiding concurrent topology changes.

A Lock from one Client usually allows other Clients to view (navigate / read) the locked element. Servers may choose to implement an exclusive locking where other Clients have no access at all (e.g. in cases where even read operations require certain settings in a Device).

When locking a Device, the lock applies to the complete device (including all components like blocks or modules).

When locking a Modular Device, the lock applies to the complete Device (including all modules). Equally, when locking a block-oriented Device (see 9.2), the lock applies to the complete Device (including all Blocks). Servers may allow independent locking of Sub-Devices or Blocks, respectively, if no lock is applied to the top-level Device (for Modular Device or for Block Device).

If the Online / Offline model is supported, the lock always applies to both the online and the offline version.

When locking a Network, the lock applies to the Network and all connected Devices. If any of the connected Devices provides access to a sub-ordinate Network (like a gateway), the sub-ordinate Network and its connected Devices are locked as well.

Member Function Documentation

virtual UaStatus OpcUaDi::LockingServicesCallback::BreakLock ( const ServiceContext serviceContext,
OpcUa_Int32 &  BreakLockStatus 
)
pure virtual

Break the lock of a device.

BreakLock allows a Client (with sufficiently high user rights) to break the lock held by another Client. This Method will typically be available only to users with administrator privileges. BreakLock should be used with care as the locked element may be in an inconsistent state.

Parameters
[in]serviceContextThe session and client call context
[out]BreakLockStatus0 - OK, -1 - E_NotLocked
virtual UaStatus OpcUaDi::LockingServicesCallback::ExitLock ( const ServiceContext serviceContext,
OpcUa_Int32 &  ExitLockStatus 
)
pure virtual

ExitLock removes the lock from the Device.

This Method may only be called from the same Session from which InitLock had been called.

Parameters
[in]serviceContextThe session and client call context
[out]ExitLockStatus0 - OK, -1 - E_NotLocked
virtual UaStatus OpcUaDi::LockingServicesCallback::InitLock ( const ServiceContext serviceContext,
const UaString CurrentContext,
OpcUa_Int32 &  InitLockStatus 
)
pure virtual

InitLock restricts access to the Device for other Clients.

A call of this Method for an element that is already locked will be rejected. This may also be due to an implicit lock created by the Server. If InitLock is requested for a Network, it will be rejected if any of the Devices connected to this Network or any sub-ordinate Network including their connected Devices is already locked.

While locked, requests from other Clients to modify the locked element (e.g., writing to Parameters, modifying the topology, or invoking Methods) will be rejected. However, requests to read or navigate will typically work. Servers may choose to implement an exclusive locking where other Clients have no access at all (e.g. in cases where even read operations require certain settings in a Device).

The lock is removed when ExitLock is called. It is automatically removed when the Session ends. This is typically the case when the connection to the Client breaks and the Session times out. Servers shall also maintain an automatic unlock if Clients do not access the locked element for a certain time.

Parameters
[in]serviceContextThe session and client call context
[in]CurrentContextA string used to provide context information about the current activity going on in the Client.
[out]InitLockStatus0 - OK, -1 - E_AlreadyLocked, -2 - E_Invalid
virtual UaStatus OpcUaDi::LockingServicesCallback::RenewLock ( const ServiceContext serviceContext,
OpcUa_Int32 &  RenewLockStatus 
)
pure virtual

Renew the lock of a device.

The lock timer is automatically renewed whenever the Client initiates a request for the locked element or while Nodes of the locked element are subscribed to. RenewLock is used to reset the lock timer to the value of the MaxInactiveLockTime Property and prevent the Server from automatically aborting the lock. This Method may only be called from the same Session from which InitLock had been called.

Parameters
[in]serviceContextThe session and client call context
[out]RenewLockStatus0 - OK, -1 - E_NotLocked

The documentation for this class was generated from the following file: