AdsClientAdsNotificationEx Event

Occurs when the ADS devices sends a notification to the client.


Namespace: TwinCAT.Ads
Assembly: TwinCAT.Ads (in TwinCAT.Ads.dll) Version: 7.0.0+e56d35ccc4675faac24789a4aab60071fc61d470

Syntax

C#

public event EventHandler<AdsNotificationExEventArgs> AdsNotificationEx

Value

EventHandler AdsNotificationExEventArgs

Implements

IAdsNotificationsAdsNotificationEx

Remarks

The Notification event arguments marshals the data value automatically to the specified .NET Type with ANY_TYPE marshallers.

Example

Example of receiving AdsNotificationEx events.

Trigger on changed values by ADS Notifications

CancellationToken cancel = CancellationToken.None;

using (AdsClient client = new AdsClient())
{
    client.AdsNotificationEx += Client_AdsNotificationEx;
    client.Connect(AmsNetId.Local, 851);

    // Add UDINT
    ResultHandle resultHandle = await client.AddDeviceNotificationExAsync("MAIN.udint", new NotificationSettings(AdsTransMode.OnChange, 200, 200), null, typeof(uint),null, cancel);
    await Task.Delay(5000, cancel); // Wait ....
    ResultAds resultHandleDelete = await client.DeleteDeviceNotificationAsync(resultHandle.Handle,cancel); // Unregister Event
}

Reference

AdsClient Class TwinCAT.Ads Namespace

Beckhoff Automation GmbH & Co. KG 2001-2026