/// <summary> /// This /// </summary> public async void DoTimeEventNonRealTime(object source, ElapsedEventArgs e) { try { timerNonRealTime.Interval = 750; if (EcStateMachine == EC_SM.EC_STATE_OPER || EcStateMachine == EC_SM.EC_STATE_SAFE_OP || EcStateMachine == EC_SM.EC_STATE_PRE_OP || COMM.commType == CommType.COMM_UDP) { uint temp; SdoRead(0x1002, 0x00); /* Read manufacturer status register */ SdoRead(Gauges[0].Index, Gauges[0].Subindex); /* Read the default value for the 0th Gauge */ SdoRead(Gauges[1].Index, Gauges[1].Subindex); /* Read the default value for the 1th Gauge */ for (byte i = 1; i <= EmcyMsgs.Count; i++) { SdoRead(0x1003, i); /* Ask all the emergency messages */ } await Task.Delay(150); /* Delay to await responses (because EoE is asyncronous) */ /* Get value from object dictionary */ ManufacturerStatus = (uint)ObjectDictionary.GetItem(0x1002, 0x00).Value; /* Get values from object dictionary */ Gauges[0].CurrentValue = Convert.ToDouble(ObjectDictionary.GetItem(Gauges[0].Index, Gauges[0].Subindex).Value) / Gauges[0].DisplayFactor; Gauges[1].CurrentValue = Convert.ToDouble(ObjectDictionary.GetItem(Gauges[1].Index, Gauges[1].Subindex).Value) / Gauges[1].DisplayFactor;; /* Get emergency message values from object dictionary */ for (byte i = 1; i <= EmcyMsgs.Count; i++) { DictItem item = ObjectDictionary.GetItem(0x1003, i); temp = (uint)item.Value; EmcyMsgs[i - 1].SequenceNumber = (temp >> 16).ToString(); if (((temp) & 0xFF00) == 0x6100 || ((temp) & 0xFF00) == 0x6200 || ((temp) & 0xFF00) == 0x6300) { EmcyMsgs[i - 1].EmcyMsgID = temp; EmcyMsgs[i - 1].messageDict.TryGetValue((temp & 0xFF00), out string value); EmcyMsgs[i - 1].Msg = string.Format("{0} - Page {1}", value, (temp & 0xFF)); } else { EmcyMsgs[i - 1].EmcyMsgID = temp; EmcyMsgs[i - 1].messageDict.TryGetValue((temp & 0x0000FFFF), out string value); EmcyMsgs[i - 1].Msg = value; } } } } catch (Exception err) { timerNonRealTime.Stop(); MessageBox.Show(err.ToString()); MessageBox.Show("Measurement timers stopped beacuse of exception."); } }