private void ModuleInterfaceTagChanged(Tag sender, TagValueChangedEventArgs e) { var plcActualValues = (ModuleActualValues)e.Value; if (plcActualValues == null) { return; } HandlePlcKeepAlive(plcActualValues.KeepAliveHost, plcActualValues.KeepAlivePlc); InterfaceChanged(this, new PlcModuleInterfaceEventArgs( plcActualValues.MaxCapacity, plcActualValues.NumberOfItems)); lock (_isPortFullLock) { for (int i = 0; i < plcActualValues.IsFull.Length; i++) { if (IsPortFull[i] != plcActualValues.IsFull[i]) { IsPortFull[i] = plcActualValues.IsFull[i]; IsPortFullChanged(i); } } } PlcHeartbeatFast(); }
private void HandleAlarmsChanged(Tag sender, TagValueChangedEventArgs e) { IEnumerable <PlcAlarmStruct> alarmStructs = sender.ArrayValues <PlcAlarmStruct>(); UpdateCache(alarmStructs); AlarmsChanged(GetAllImportedAlarms()); }
private void TagValueChanged(Tag sender, TagValueChangedEventArgs e) { _subject.OnNext(sender); if (TagChanged != null) { TagChanged(this, new TagChangedEventArgs(sender)); } }
private void StateTagValueChanged(Tag sender, TagValueChangedEventArgs eventArgs) { if (eventArgs.Value == null) { StateChanged((short)StandardStates.Off); SubStateNameChanged("<unknown>"); return; } StateChanged((short)eventArgs.Value); }
private void StateNameTagValueChanged(Tag sender, TagValueChangedEventArgs eventArgs) { try { _oldStateName = _stateName; _stateName = (string)_stateNameTag.Value; EquipmentState = _stateName; _logger.InfoFormat("MainStateChanged: '{0}' to '{1}'", _oldStateName, _stateName); } catch (PlcCommunicationException exception) { _logger.Error("Can't read state name from PLC", exception); } StateNameChanged(_stateName); }
private void NotifySubscribers(Tag tag, TagValueChangedEventArgs args) { List <Tuple <int, Action <IController> > > subscribers; lock (_lockSubscribers) { subscribers = new List <Tuple <int, Action <IController> > >(_subscribers); } foreach (Tuple <int, Action <IController> > subscriber in subscribers) { IController controller = ControllerTree.TryGetController(subscriber.Item1); if (controller != null) { subscriber.Item2(controller); } } }
private void SubStateNameTagValueChanged(Tag sender, TagValueChangedEventArgs eventArgs) { try { var oldSubStateName = _subStateName; _subStateName = (string)_subStateNameTag.Value; if (_enableSubStateLogging) { _logger.InfoFormat("SubStateChanged: '{0}' to '{1}'", oldSubStateName, _subStateName); } } catch (PlcCommunicationException exception) { _subStateName = "<unknown comm err>"; _logger.Error("Can't read sub state name from PLC", exception); } SubStateNameChanged(_subStateName); }