/// <summary> /// 数据接收完成 /// </summary> /// <param name="m_pSocket"></param> /// <param name="m_pDatagram"></param> private void AsynTcp_AsyncDataAcceptedEvent(SuperFramework.SuperSocket.TCP.TCPAsyncSocketHelper m_pSocket, byte[] m_pDatagram) { HYAlarmData.MsgStrut msg = HYAlarmAnalysis.GetObjectData(m_pDatagram); if (msg.DataId == "") { return; } HYAlarmAnalysis.AnalysisAlarmData(address, msg); }
/// <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); ////} }