TcAdsClient.AddDeviceNotification Method (String, AdsStream, Int32, Int32, AdsTransMode, Int32, Int32, Object)

Connects a variable to the ADS client. The ADS client will be notified by the AdsNotification event.

Namespace:  TwinCAT.Ads
Assembly:  TwinCAT.Ads (in TwinCAT.Ads.dll) Version: 4.3.0.0

Syntax

C#

public int AddDeviceNotification(
    string variableName,
    AdsStream dataStream,
    int offset,
    int length,
    AdsTransMode transMode,
    int cycleTime,
    int maxDelay,
    Object userData
)

VB

Public Function AddDeviceNotification ( 
    variableName As String,
    dataStream As AdsStream,
    offset As Integer,
    length As Integer,
    transMode As AdsTransMode,
    cycleTime As Integer,
    maxDelay As Integer,
    userData As Object
) As Integer

Parameters

variableName

Type: System.String
Name of the ADS variable.

dataStream

Type: TwinCAT.Ads.AdsStream
The stream that should receive the data.

offset

Type: System.Int32
Offset of the data in dataStream.

length

Type: System.Int32
Length of the data in dataStream.

transMode

Type: TwinCAT.Ads.AdsTransMode
Specifies if the event should be fired cyclically or only if the variable has changed.

cycleTime

Type: System.Int32
The ADS server checks whether the variable has changed after this time interval. Unit is in ms.

maxDelay

Type: System.Int32
The AdsNotification event is fired at the latest when this time has elapsed. The unit is ms.

userData

Type: System.Object
This object can be used to store user specific data.

Return Value

Type: Int32
The handle of the notification.

Implements

IAdsNotifications.AddDeviceNotification(String, AdsStream, Int32, Int32, AdsTransMode, Int32, Int32, Object)

Exceptions

Exception

Condition

ObjectDisposedException

AdsErrorException

Thrown when the ADS call fails.

Remarks

AdsTransMode

Parameter semantic

CyclicInContext

Value of parameter is interpreted as task context number ContextMask

OnChangeInContext

Value of parameter is interpreted as task context number ContextMask

Reference

TcAdsClient Class

AddDeviceNotification Overload

TwinCAT.Ads Namespace

TcAdsClient.DeleteDeviceNotification(Int32)

TcAdsClient.AdsNotification

AddDeviceNotificationEx Overload