IAdsNotifications.AdsNotificationEx Event

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

Namespace:  TwinCAT.Ads
Assembly:  TwinCAT.Ads.Abstractions (in TwinCAT.Ads.Abstractions.dll) Version: 6.0.328+39e3229

Syntax

C#

event EventHandler<AdsNotificationExEventArgs> AdsNotificationEx

Value

Type: System.EventHandler.AdsNotificationExEventArgs.

Remarks

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

Examples

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

IAdsNotifications Interface

TwinCAT.Ads Namespace