/// <summary> /// 解析保活消息 /// </summary> /// <param name="eSight">The e sight.</param> /// <param name="json">The json.</param> private void AnalysisAlive(HWESightHost eSight, string json) { HWLogger.GetESightSubscribeLogger(eSight.HostIP).Info($"Analysis Alive Message. "); var instance = this.FindInstance(eSight); instance.UpdateAliveTime(DateTime.Now); }
/// <summary> /// Analysises the TCP MSG. /// </summary> /// <param name="json">The json.</param> /// <exception cref="System.Exception">can not find eSight:" + tcpMessage.ESightIp</exception> /// <exception cref="System.ArgumentOutOfRangeException"></exception> public void AnalysisTcpMsg(string json) { try { var tcpMessage = JsonUtil.DeserializeObject <TcpMessage <object> >(json); var eSightList = ESightDal.Instance.GetList(); var eSight = eSightList.FirstOrDefault(x => x.SubscribeID == tcpMessage.SubscribeId); if (eSight == null) { throw new Exception("can not find eSight:" + tcpMessage.SubscribeId); } if (tcpMessage.MsgType != TcpMessageType.KeepAlive) { HWLogger.GetESightNotifyLogger(eSight.HostIP).Info($"RecieveTcpMsg. data:{json}"); } else { HWLogger.GetESightSubscribeLogger(eSight.HostIP).Info($"RecieveTcpMsg. data:{json}"); } switch (tcpMessage.MsgType) { case TcpMessageType.Alarm: this.AnalysisAlarm(eSight, json); break; case TcpMessageType.NeDevice: this.AnalysisNeDevice(eSight, json); break; case TcpMessageType.KeepAlive: this.AnalysisAlive(eSight, json); break; default: throw new ArgumentOutOfRangeException(); } } catch (Exception ex) { this.OnError("AnalysisTcpMsg Error: ", ex); } }