-> Hier kostenlos registrieren
Hallo zusammen,
in meiner C# Anwendung registriere ich mir über den TcAdsClient die AdsNotifications für mein Event.
Und über eine Hilfsfunktion registriere ich mir die Variablen für welche ich eine Notification erhalten möchte.
Solange ich für 1-2 Variablen die Notification hinzufüge, läuft das auch alles ganz gut. Sobald das allerdings mehr werden, wird das Event
1. für die registrierten Notifications mehrmals gerufen oO
2. wenn ich in der SPS eine Variable ändere wird das Event für alle Variablen aktiviert und dann auch wieder mehrmals für alle...
Hat jemand eine Idee woran das liegen könnte?
Danke!
in meiner C# Anwendung registriere ich mir über den TcAdsClient die AdsNotifications für mein Event.
Code:
this.tcClient.AdsNotification += (s, e) =>
{
this.OnAdsNotification(s, e);
};
Und über eine Hilfsfunktion registriere ich mir die Variablen für welche ich eine Notification erhalten möchte.
Code:
public void ActivateNotifications(string name, ushort iD)
{
try
{
int varHandle = this.tcClient.AddDeviceNotification(
name,
this.deviceNotificationStream,
AdsTransMode.OnChange,
100,
0,
null);
}
catch (AdsException ex)
{
PlcFaultDto plcException = new PlcFaultDto()
{
ErrorMessage = ex.Message,
Description = "AdsException raised at PlcService.ActivateNotifications()"
};
this.RaiseException(plcException, nameof(this.ActivateNotifications));
}
}
Solange ich für 1-2 Variablen die Notification hinzufüge, läuft das auch alles ganz gut. Sobald das allerdings mehr werden, wird das Event
1. für die registrierten Notifications mehrmals gerufen oO
2. wenn ich in der SPS eine Variable ändere wird das Event für alle Variablen aktiviert und dann auch wieder mehrmals für alle...
Hat jemand eine Idee woran das liegen könnte?
Danke!