private void CanEventHandler_EventIsReached(object sender, ReadCanMessageEventArgs e) { try { lock (LockObj) { var id = e.Id; var data = e.Data.ToArray(); // die könnte man auslagern und dynamisch reinladen anhand eineer interface deklaration this.HandlePulseEvent(id, data); this.HandleBinaryInputState(id, data); this.HandleAlive(id, data); this.HandleChannelConfigResponse(id, data); this.HandleFlipFlopEvent(id, data); this.ActiveSensorResponse(id, data); this.TextResponse(id, data); this.AnalogResponse(id, data); } } catch (Exception ex) { this.Logger.LogError(ex); throw; } }
/// <summary> /// Raises the <see cref="E:NodeReached" /> event. /// </summary> /// <param name="e">The <see cref="ReadCanMessageEventArgs" /> instance containing the event data.</param> public virtual void OnReached(ReadCanMessageEventArgs e) { try { this.Logger.LogBegin(this.GetType()); if (this.EventIsReached == null) { return; // throw new Exception("Event for read can is null"); } this.EventIsReached.Invoke(this, e); } catch (Exception exception) { this.Logger.LogError(exception); throw; } finally { this.Logger.LogEnd(this.GetType()); } }