/// <summary> /// 实时更新比对结果,显示到结果列表中 /// /// </summary> /// <param name="info"></param> /// <returns></returns> public int UpdateRealtimeCmpLBS(RealtimeCmpInfoLBS info) { //return 1; try { if ("WIFI".Equals(GlobalCache.NetworkMode)) { //info.Channelname = info.Channelname.Substring(2); Active(info); } else { if (GlobalCache.AppType == 1) { if (!info.Channelname.StartsWith("##")) { return(-1); } } Active(info); } return(0); } catch (Exception ex) { Logger <UIServerInterForWifi> .Log.Error("UpdateRealtimeCmpLBS", ex); return(-1); } }
/// <summary> /// 更新比对记录标识 /// </summary> /// <param name="info"></param> /// <param name="IP"></param> /// <returns></returns> public static int UpdateCmp(RealtimeCmpInfoLBS info, string IP) { try { // 生成socket套接字; Thrift.Transport.TSocket tsocket = new Thrift.Transport.TSocket(IP, 6000); //设置连接超时为100; tsocket.Timeout = 3000; //生成客户端对象 Thrift.Transport.TTransport transport = tsocket; Thrift.Protocol.TProtocol protocol = new Thrift.Protocol.TBinaryProtocol(transport); UIServer.Client _BusinessServerClient = new UIServer.Client(protocol); transport.Open(); //_BusinessServerClient.UpdateRealtimeCmp(info, "##@" + info.Channel); info.Channelname = "##@" + info.Channelname; _BusinessServerClient.UpdateRealtimeCmpLBS(info); if ("DEBUG".Equals(GlobalCache.AppMode)) { MessageBox.Show("推送成功"); } transport.Close(); return(0); } catch (Exception ex) { if ("DEBUG".Equals(GlobalCache.AppMode)) { MessageBox.Show(ex.Message); } Logger <WarningMessageCmd> .Log.Error("UpdateCmp", ex); return(-1); } }
public int UpdateRealtimeCmpLBS(RealtimeCmpInfoLBS info) { #if !SILVERLIGHT send_UpdateRealtimeCmpLBS(info); return(recv_UpdateRealtimeCmpLBS()); #else var asyncResult = Begin_UpdateRealtimeCmpLBS(null, null, info); return(End_UpdateRealtimeCmpLBS(asyncResult)); #endif }
private static int SendCmpToClient(RealtimeCmpInfoLBS info) { int res = -1; ThriftServiceNameSpace.ThriftService thirft = new ThriftServiceNameSpace.ThriftService(); ThriftServiceUtilities thrift = new ThriftServiceUtilities(); try { string errMsg = string.Empty; if ("WIFI".Equals(GlobalCache.NetworkMode)) { res = thrift.UpdateRealtimeCmpToDbFlag(new List <string> { info.CapID }, GlobalCache.AppRegion); if (res != 0) { MyMessage.Show("推送失败"); } } else { foreach (var area in Config.RegionList) { if (info.Channel.Contains(area.RegionName)) { foreach (var ip in area.Hosts) { if (UpdateCmp(info, ip) != 0) { errMsg += ip + ";"; } else { res = thirft.UpdateCmpLog(info.CapID, info.ObjID, System.DateTime.Now.ToString("yyyyMMdd"), area.RegionNO); } } } } } if (!string.IsNullOrEmpty(errMsg)) { MyMessage.showYes("往" + errMsg + "推送失败!"); } } catch (Exception ex) { MyMessage.showYes("推送比对信息出错"); Logger <WarningMessageCmd> .Log.Error("SendCmpToClient", ex); } return(res); }
public void send_UpdateRealtimeCmpLBS(RealtimeCmpInfoLBS info) #endif { oprot_.WriteMessageBegin(new TMessage("UpdateRealtimeCmpLBS", TMessageType.Call, seqid_)); UpdateRealtimeCmpLBS_args args = new UpdateRealtimeCmpLBS_args(); args.Info = info; args.Write(oprot_); oprot_.WriteMessageEnd(); #if SILVERLIGHT return(oprot_.Transport.BeginFlush(callback, state)); #else oprot_.Transport.Flush(); #endif }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.Struct) { Info = new RealtimeCmpInfoLBS(); Info.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public int UpdateRealtimeCmpLBS(RealtimeCmpInfoLBS info) { return(-1); }
/// <summary> /// 实时更新比对结果,显示到结果列表中 /// /// </summary> /// <param name="info"></param> /// <returns></returns> public int UpdateRealtimeCmpLBS(RealtimeCmpInfoLBS info) { //return 1; try { if (GlobalCache.AppType == 1) { if (!info.Channelname.StartsWith("##")) { return(-1); } } //显示在界面上的结果 if (_IdentifyResults != null) { _IdentifyResults = null; } _IdentifyResults = new IdentifyResults(); _IdentifyResults.ID = info.CapID; if (info.CapID == null || info.CapID == "") { MB_MODULES.Views.MyMessage.showYes("抓拍照片ID为空"); } _IdentifyResults.RegID = info.ObjID; if (info.ObjID == null || info.ObjID == "") { MB_MODULES.Views.MyMessage.showYes("抓拍照片ID为空"); } long _longtime = info.Time; DateTime s = new DateTime(1970, 1, 1); s = s.AddSeconds(_longtime); // 抓拍照片 ChannelManage.snapStream = info.CapImg; //得到主照片 ChannelManage.campareStream = info.ObjImg; //获得主照片这侧信息 StringBuilder strRegster = new StringBuilder(); //注册名称 strRegster.Append(info.Name + "\r\n"); //获得通道名称 string ChannelName = info.Channelname; _IdentifyResults.ChannelName = info.Channelname; strRegster.Append(ChannelName.Replace("##", "").Replace("@", "") + "\r\n"); //抓拍时间 int nIndexS = s.ToString().IndexOf(" "); strRegster.Append(s.ToString().Substring(0, nIndexS) + "\r\n"); int nIndexS1 = s.ToString().Length - nIndexS; strRegster.Append(s.ToString().Substring(nIndexS + 1, nIndexS1 - 1) + "\r\n"); //注册类型 string type = "";//eg:白名单、黑名单、普通... foreach (var basicinfo in GlobalCache.FaceTypeList.Cast <STypeInfo>()) { if (basicinfo.Type == info.Type) { type = basicinfo.Description; // 类型 } } strRegster.Append(type + "\r\n"); _IdentifyResults.TemplateType = type; //相似度。 strRegster.Append(info.Score + "\r\n"); _IdentifyResults.RegInfo = strRegster.ToString(); _IdentifyResults.NewRci = info; //MainWindow.nInfoType = info.Type; Console.WriteLine("推送了一条比对记录"); ChannelManage._IdentifyResults = _IdentifyResults; ChannelManage.ResetServerRealtimeCmpInfo.Set(); ////弹出报警框 //AlarmWindow _AlarmWindow = new AlarmWindow(); //_AlarmWindow.CapimageByteRealtimeCmpInfo = info.CapImg; //_AlarmWindow.CmpimageByteRealtimeCmpInfo = info.CapImg; //_AlarmWindow.RegInfo = strRegster.ToString(); //_AlarmWindow.nInfoType = info.Type; //_AlarmWindow.Show(); info = null; return(0); } catch (Exception ex) { Logger <UIServerInter> .Log.Error("UpdateRealtimeCmpLBS", ex); return(-1); } }
void Active(RealtimeCmpInfoLBS info) { //显示在界面上的结果 if (compareResult != null) { compareResult = null; } compareResult = new IdentifyResults(); compareResult.ID = info.CapID; if (info.CapID == null || info.CapID == "") { MB_MODULES.Views.MyMessage.showYes("抓拍照片ID为空"); } compareResult.RegID = info.ObjID; if (info.ObjID == null || info.ObjID == "") { MB_MODULES.Views.MyMessage.showYes("抓拍照片ID为空"); } long _longtime = info.Time; DateTime s = new DateTime(1970, 1, 1); s = s.AddSeconds(_longtime); //// 抓拍照片 //ChannelManage.snapStream = info.CapImg; ////得到主照片 //ChannelManage.campareStream = info.ObjImg; GlobalCache.SnapStream = info.CapImg; GlobalCache.SnapCompareStream = info.ObjImg; //获得主照片这侧信息 StringBuilder strRegster = new StringBuilder(); //注册名称 strRegster.Append(info.Name + "\r\n"); //获得通道名称 string ChannelName = info.Channelname; compareResult.ChannelName = info.Channelname; strRegster.Append(ChannelName.Replace("##", "").Replace("@", "") + "\r\n"); //抓拍时间 int nIndexS = s.ToString().IndexOf(" "); strRegster.Append(s.ToString().Substring(0, nIndexS) + "\r\n"); int nIndexS1 = s.ToString().Length - nIndexS; strRegster.Append(s.ToString().Substring(nIndexS + 1, nIndexS1 - 1) + "\r\n"); //注册类型 var typeObj = GlobalCache.FaceTypeList.Cast <STypeInfo>().Cast <STypeInfo>().FirstOrDefault(x => x.Type == info.Type) ?? new STypeInfo(); string type = typeObj.Description;//eg:白名单、黑名单、普通... strRegster.Append(type + "\r\n"); compareResult.TemplateType = type; //相似度。 strRegster.Append(info.Score + "\r\n"); compareResult.RegInfo = strRegster.ToString(); compareResult.NewRci = info; //MainWindow.nInfoType = info.Type; Console.WriteLine("推送了一条比对记录"); //ChannelManage._IdentifyResults = compareResult; //ChannelManage.ResetServerRealtimeCmpInfo.Set(); //identifyResult = compareResult; GlobalCache.IdentifyResult = compareResult; resetCompareInfoField.Set(); ////弹出报警框 //AlarmWindow _AlarmWindow = new AlarmWindow(); //_AlarmWindow.CapimageByteRealtimeCmpInfo = info.CapImg; //_AlarmWindow.CmpimageByteRealtimeCmpInfo = info.CapImg; //_AlarmWindow.RegInfo = strRegster.ToString(); //_AlarmWindow.nInfoType = info.Type; //_AlarmWindow.Show(); }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.List) { { Caplist = new List <RealtimeCapInfoLBS>(); TList _list24 = iprot.ReadListBegin(); for (int _i25 = 0; _i25 < _list24.Count; ++_i25) { RealtimeCapInfoLBS _elem26; _elem26 = new RealtimeCapInfoLBS(); _elem26.Read(iprot); Caplist.Add(_elem26); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.List) { { Cmplist = new List <RealtimeCmpInfoLBS>(); TList _list27 = iprot.ReadListBegin(); for (int _i28 = 0; _i28 < _list27.Count; ++_i28) { RealtimeCmpInfoLBS _elem29; _elem29 = new RealtimeCmpInfoLBS(); _elem29.Read(iprot); Cmplist.Add(_elem29); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
/// <summary> /// 推送一条 /// </summary> /// <param name="signleObj"></param> public static int SendOneResultInfo(MyCmpFaceLogWidthImgModel signleObj) { int res = -1; ThriftServiceNameSpace.ThriftService thirft = new ThriftServiceNameSpace.ThriftService(); try { RealtimeCmpInfoLBS newRci = new RealtimeCmpInfoLBS(); newRci.CapID = signleObj.ID; newRci.ObjID = signleObj.tcUuid; newRci.Name = signleObj.name; newRci.Channel = signleObj.channelName; newRci.Longitude = signleObj.Longitude; newRci.Latitude = signleObj.Latitude; newRci.Address = signleObj.Address; List <byte[]> snapImgStream = thirft.QueryCmpLogImageH( signleObj.ID, DataConvert.DatetimeConvertToStr.ConvertToString(Convert.ToDateTime(signleObj.time), "yyyyMMdd") ); if (snapImgStream.Count > 0 && snapImgStream[0].Length > 0) { newRci.CapImg = snapImgStream[0]; } List <FaceObj> templateList = thirft.QueryFaceObj(signleObj.tcUuid); if (templateList.Count > 0) { newRci.Name += "|" + templateList[0].TcRemarks; if (templateList[0].NMain_ftID > 0) { newRci.ObjImg = templateList[0].Tmplate.FirstOrDefault(x => x.NIndex == templateList[0].NMain_ftID - 1).Img; } else { newRci.ObjImg = templateList[0].Tmplate[0].Img; } } #region old //RealtimeCmpInfo info = new RealtimeCmpInfo(); //info.CapID = signleObj.ID; //info.ObjID = signleObj.tcUuid; //info.Name = signleObj.name; //info.Channel = signleObj.channelName; //List<byte[]> listImageBytes = thirft.QueryCmpLogImageH(signleObj.ID, DataConvert.DatetimeConvertToStr.ConvertToString(Convert.ToDateTime(signleObj.time), "yyyyMMdd")); //if (listImageBytes.Count > 0 && listImageBytes[0].Length > 0) //{ // info.CapImg = listImageBytes[0]; // Console.WriteLine("抓拍照片大小为:" + listImageBytes[0].Length); //} //List<FaceObj> ListFaceObj = thirft.QueryFaceObj(signleObj.tcUuid); //if (ListFaceObj.Count > 0) //{ // info.Name += "|" + ListFaceObj[0].TcRemarks; // if (ListFaceObj[0].NMain_ftID > 0) // { // for (int i = 0; i < ListFaceObj[0].Tmplate.Count; i++)//遍历查找主模板照片 // { // if (ListFaceObj[0].NMain_ftID - 1 == ListFaceObj[0].Tmplate[i].NIndex) // { // info.ObjImg = ListFaceObj[0].Tmplate[i].Img; // Console.WriteLine("模版照片大小为:" + ListFaceObj[0].Tmplate[i].Img.Length); // } // } // } // else // { // info.ObjImg = ListFaceObj[0].Tmplate[0].Img; // Console.WriteLine("模版照片大小为:" + ListFaceObj[0].Tmplate[0].Img.Length); // } //} #endregion newRci.Time = DateTimeConvert.ToLongFromSubstract(Convert.ToDateTime(signleObj.time), new DateTime(1970, 1, 1)); //info.Type = cORViewModel.Type.IndexOf(cmpface.type) + 1; newRci.Type = 2; newRci.Score = signleObj.score; res = SendCmpToClient(newRci); } catch (Exception ex) { MB_MODULES.Views.MyMessage.showYes(ex.Message); } return(res); }
public IAsyncResult send_UpdateRealtimeCmpLBS(AsyncCallback callback, object state, RealtimeCmpInfoLBS info)
public IAsyncResult Begin_UpdateRealtimeCmpLBS(AsyncCallback callback, object state, RealtimeCmpInfoLBS info) { return(send_UpdateRealtimeCmpLBS(callback, state, info)); }