AdsConnection.AdsNotificationEx Event
Occurs when the ADS devices sends a notification to the client.
Namespace: TwinCAT.Ads
Assembly: TwinCAT.Ads (in TwinCAT.Ads.dll)
Version: 6.0.328+39e3229
Syntax
C#
public event EventHandler<AdsNotificationExEventArgs> AdsNotificationEx
Exceptions
Exception |
Condition |
---|---|
Remarks
The Notification event arguments marshals the data value automatically to the specified .NET Type with ANY_TYPE marshallers.
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
}