AdsConnection.TryAddDeviceNotification Method

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 AdsErrorCode TryAddDeviceNotification(
    string variableName,
    AdsStream dataStream,
    int offset,
    int length,
    NotificationSettings settings,
    Object userData,
    out uint handle
)

VB

Public Function TryAddDeviceNotification ( 
    variableName As String,
    dataStream As AdsStream,
    offset As Integer,
    length As Integer,
    settings As NotificationSettings,
    userData As Object,
    <OutAttribute> ByRef handle As UInteger
) As AdsErrorCode

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.

settings

Type: TwinCAT.Ads.NotificationSettings
The settings.

userData

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

handle

Type: System.UInt32.
The handle.

Return Value

Type: AdsErrorCode
The ADS ErrorCode.

Implements

IAdsNotifications.TryAddDeviceNotification(String, AdsStream, Int32, Int32, NotificationSettings, Object, UInt32.)

Exceptions

Exception

Condition

ObjectDisposedException

Reference

AdsConnection Class

TwinCAT.Ads Namespace