public void OnAlarmEvent() // Event handler { if (AlarmEvent != null) { AlarmEvent.Invoke(); } }
public AndroidAlarmService() { MessagingCenter.Subscribe <ScheduledAlarmHandler>(this, "OnAlarm", (args) => { AlarmEvent.Invoke(this, null); }); }
public void ClearAlarm() { _alarming = false; if (_acknowledged) { AlarmEvent?.Invoke(this, new AlarmEventArgs(AlarmEventType.Cleared, _name)); } }
public void AcknowledgeAlarm() { _acknowledged = true; AlarmEvent?.Invoke(this, new AlarmEventArgs(AlarmEventType.Acknowledged, _name)); if (_clearOnAck || !_alarming) { ClearAlarm(); } }
public void PostAlarm() { if (!_alarming) { _alarming = true; _acknowledged = false; _postTime = DateTime.Now; AlarmEvent?.Invoke(this, new AlarmEventArgs(AlarmEventType.Posted, _name)); } }
protected void CheckAlarms() { List <TimeData> toRemove = new List <TimeData>(); foreach (TimeData td in alarms) { if (td.IsAtOrPastTime(CurrentTime)) { if (AlarmTriggered != null) { AlarmTriggered.Invoke(td); } toRemove.Add(td); } } if (toRemove.Count > 0) { foreach (TimeData td in toRemove) { alarms.Remove(td); } alarms = alarms.Where(x => x != null).ToList(); } }
/// <summary> /// 解析报警数据 /// </summary> /// <param name="deviceIp">设备ip</param> /// <param name="msg">结构数据</param> public static void AnalysisAlarmData(string deviceIp, HYAlarmData.MsgStrut msg) { try { if (msg.XmlData == "" || msg.XmlData == "null") { return; } switch (msg.AlarmType) { case HYAlarmData.XmlType.AlarmEventMsg: AlarmEvent?.Invoke(deviceIp, SuperFramework.SuperConfig.Xml.XmlSerialization.XmlDeserialize <AlarmEventMsg>(msg.XmlData)); break; case HYAlarmData.XmlType.XMLLayoutMessage: TrackEvent?.Invoke(deviceIp, SuperFramework.SuperConfig.Xml.XmlSerialization.XmlDeserialize <XMLLayoutMessage>(msg.XmlData)); break; case HYAlarmData.XmlType.CountingEventMsg: PersonEvent?.Invoke(deviceIp, SuperFramework.SuperConfig.Xml.XmlSerialization.XmlDeserialize <CountingEventMsg>(msg.XmlData)); break; } } catch (Exception) { } //string str; //int offset = 0; //GetObjectData(buffer); //if (GetSync()) //{ // offset = 0; // if (GetMsgLength() > 0) // { // goto Label_00B7; // } //} //return ; //Label_0095: ////offset += Sock.Receive(buffer, offset, header.GetMsgLength() - 12 - offset, SocketFlags.None); //if (offset >= GetMsgLength() - 12) // goto Label_00C9; //else // goto Label_00B7; //Label_00B7: //if (offset < GetMsgLength()) // goto Label_0095; //Label_00C9: //str = Encoding.ASCII.GetString(buffer, 0, GetMsgLength() - 12); ////return .SuperConfig.Xml.XmlSerialization.XmlDeserialize<AlarmData>(str); //XmlDocument document = new XmlDocument(); //document.LoadXml(str); //string localName = document.DocumentElement.LocalName; //object[] args = new object[2]; //args[0] = str; //args[1] = localName; //// base.Invoke(new dlgt_RefreshGui(this.RefreshGui), args); ////} }
public static void SendAlarm() { AlarmEvent?.Invoke("ALARM"); }