public void ProcessReport(ReportBase report) { try { if (report is CardEventReport) { CardEventReport r = report as CardEventReport; ReportHandle(r); } else if (report is ParkVacantReport) { ParkVacantReport r = report as ParkVacantReport; ReportHandle(r); } else if (report is CarSenseReport) { CarSenseReport r = report as CarSenseReport; //车到、车走时清空刷卡事件信息 ReportHandle(r); } else if (report is UpdateSystemParamSettingReport) { UpdateSystemParamSettingReport r = report as UpdateSystemParamSettingReport; ReportHandle(r); } } catch (Exception ex) { Ralid.GeneralLibrary.ExceptionHandling.ExceptionPolicy.HandleException(ex); } }
protected virtual void OnCarSenseReporting(CarSenseReport report) { if (this.CarSenseReporting != null) { this.CarSenseReporting(this, report); } }
private ReportBase DeformatCarSensePacket(Packet packet) { CarSenseReport report = new CarSenseReport(); report.Address = packet.Address; report.Loop = 1; report.InOrOutFlag = (byte)(packet.Parameters[0] == 0 ? 0 : 1); return(report); }
private void CarSenseHandler(CarSenseReport report) { if (report.InOrOutFlag == 1) { OptStatus = EntranceOperationStatus.CarArrival; } else { OptStatus = EntranceOperationStatus.CarLeave; } if (IsExitDevice) { StopCapture(); //出口在收到车到车走事件时取消收卡 } OnCarSenseReporting(report); }
private void CarSenseHandler(CarSenseReport report) { if (report.InOrOutFlag == 1) { OptStatus = EntranceOperationStatus.CarArrival; CarplateRecReport re = new CarplateRecReport(report.ParkID, report.EntranceID, report.EventDateTime, this.EntranceName); AddToReportPool(re); } else { OptStatus = EntranceOperationStatus.CarLeave; } if (IsExitDevice) { StopCapture(); //出口在收到车到车走事件时取消收卡 } OnCarSenseReporting(report); }
private void ReportSink(CarSenseReport report) { List <IReportSinker> faultSinkers = new List <IReportSinker>(); foreach (IReportSinker reportSinker in _reportSinkers) { try { reportSinker.CarSenseSink(report); } catch (Exception ex) { faultSinkers.Add(reportSinker); ExceptionPolicy.HandleException(ex); } } if (faultSinkers.Count > 0) { RemoveFaultSinkers(faultSinkers); } }
private void ReportHandle(CarSenseReport report) { ClearCardEventMessage(report.EntranceID); }
public void ProcessReport(ReportBase r) { ParkInfo park = ParkBuffer.Current.GetPark(r.ParkID); if (park != null && park.RootParkID > 0) { park = ParkBuffer.Current.GetPark(park.RootParkID); } if (park == null) { return; } if (park.HostWorkstation == WorkStationInfo.CurrentStation.StationID) //如果本机是停车场的通讯主机,则它要负责抓拍图片 { EntranceInfo entrance = ParkBuffer.Current.GetEntrance(r.EntranceID); if (entrance != null) { foreach (VideoSourceInfo video in entrance.VideoSources) { if (r is CarSenseReport) { CarSenseReport cp = r as CarSenseReport; if (cp.InOrOutFlag == 1) //车到时打开视频 { VideoPanel vp = videoGrid.VideoPanelCollection.SingleOrDefault(v => (v.VideoSource == video)); if (vp != null) { if (UserSetting.Current.SnapshotWhenCarArrive) //车压地感时抓拍图片 { string path = Path.Combine(TempFolderManager.GetCurrentFolder(), string.Format("{0}_{1}_{2}.jpg", "CarArrive", Guid.NewGuid().ToString(), video.VideoID)); if (SnapShotTo(video, ref path, false, false)) { SnapShot shot = new SnapShot(cp.EventDateTime, video.VideoID, string.Empty, path); string master = AppSettings.CurrentSetting.ImageDBConnStr; string standby = AppSettings.CurrentSetting.CurrentStandbyConnect; CommandResult result = (new SnapShotBll(master)).Insert(shot); if (result.Result != ResultCode.Successful && !string.IsNullOrEmpty(standby)) { (new SnapShotBll(standby)).Insert(shot); } //(new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).Insert(shot); } else { if (AppSettings.CurrentSetting.Debug) { string logmsg = string.Format("【{0}】车压地感时抓拍图片失败 ", vp.VideoSource.VideoName); Ralid.GeneralLibrary.LOG.FileLog.Log("FrmSnapShoter", logmsg); } } } else { vp.OpenForSnapshot(true); } } } else { if (AppSettings.CurrentSetting.Optimized) //启用视频优化车走时关闭视频 { VideoPanel vp = videoGrid.VideoPanelCollection.SingleOrDefault(v => (v.VideoSource == video)); if (vp != null) { vp.Close(); } } } } else if (r is CardEventReport) { CardEventReport cardEvent = r as CardEventReport; if (cardEvent.EventStatus == CardEventStatus.Valid) { VideoPanel vp = videoGrid.VideoPanelCollection.SingleOrDefault(v => (v.VideoSource == video)); if (vp != null) //如果视频已经抓拍了一张,则此次用同一张图 { object tag = null; lock (_TagLocker) //加锁是防止多个线程同时写 { tag = vp.Tag; vp.Tag = null; } if (tag != null) { string path = tag.ToString(); if (path != "fail") { SnapShot shot = new SnapShot(cardEvent.EventDateTime, video.VideoID, cardEvent.CardID, path); string master = AppSettings.CurrentSetting.ImageDBConnStr; string standby = AppSettings.CurrentSetting.CurrentStandbyConnect; CommandResult result = (new SnapShotBll(master)).Insert(shot); if (result.Result != ResultCode.Successful && !string.IsNullOrEmpty(standby)) { (new SnapShotBll(standby)).Insert(shot); } //(new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).Insert(shot); } else { if (AppSettings.CurrentSetting.Debug) { string logmsg = string.Format("【{0}】刷卡事件之前的视频抓拍失败,无图片 ", vp.VideoSource.VideoName); Ralid.GeneralLibrary.LOG.FileLog.Log("FrmSnapShoter", logmsg); } } } else { string path = Path.Combine(TempFolderManager.GetCurrentFolder(), string.Format("{0}_{1}_{2}.jpg", "CardEvent", Guid.NewGuid().ToString(), video.VideoID)); if (SnapShotTo(video, ref path, false, false)) { SnapShot shot = new SnapShot(cardEvent.EventDateTime, video.VideoID, cardEvent.CardID, path); string master = AppSettings.CurrentSetting.ImageDBConnStr; string standby = AppSettings.CurrentSetting.CurrentStandbyConnect; CommandResult result = (new SnapShotBll(master)).Insert(shot); if (result.Result != ResultCode.Successful && !string.IsNullOrEmpty(standby)) { (new SnapShotBll(standby)).Insert(shot); } //(new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).Insert(shot); } else { if (AppSettings.CurrentSetting.Debug) { string logmsg = string.Format("【{0}】刷卡事件抓拍图片失败 ", vp.VideoSource.VideoName); Ralid.GeneralLibrary.LOG.FileLog.Log("FrmSnapShoter", logmsg); } } } vp.ClearSnapShot();//清空抓拍图片信息 } } } else if (r is AlarmReport) { AlarmReport ar = r as AlarmReport; if (ar.AlarmType == Ralid.Park.BusinessModel.Enum.AlarmType.Opendoor || ar.AlarmType == Ralid.Park.BusinessModel.Enum.AlarmType.GateAlarm) { string path = Path.Combine(TempFolderManager.GetCurrentFolder(), string.Format("{0}_{1}_{2}.jpg", "OpenDoor", Guid.NewGuid().ToString(), video.VideoID)); if (SnapShotTo(video, ref path, false, true)) { //这里清除抓拍图片信息,是因为使用信路通或大华进行抓拍时,会保存抓拍图片和识别到的车牌,如果不清除,有可能会用到下一辆车上 ClearSnapShot(video); SnapShot shot = new SnapShot(ar.EventDateTime, video.VideoID, string.Empty, path); string master = AppSettings.CurrentSetting.ImageDBConnStr; string standby = AppSettings.CurrentSetting.CurrentStandbyConnect; CommandResult result = (new SnapShotBll(master)).Insert(shot); if (result.Result != ResultCode.Successful && !string.IsNullOrEmpty(standby)) { (new SnapShotBll(standby)).Insert(shot); } //(new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).Insert(shot); } else { if (AppSettings.CurrentSetting.Debug) { string logmsg = string.Format("【{0}】报警抓拍图片失败 ", video.VideoName); Ralid.GeneralLibrary.LOG.FileLog.Log("FrmSnapShoter", logmsg); } } } } } } } }
public void ProcessReport(ReportBase r) { if (r is CarSenseReport) { CarSenseReport cp = r as CarSenseReport; if (cp.InOrOutFlag == 0)//车走时清空识别结果 { foreach (CarPlateDevice device in _Devices) { if (device.EntranceID == r.EntranceID && device.VideoSource != null) { lock (device) { device.ResetResult(); } } } } } #region 以下操作由FrmSnapShoter完成 //ParkInfo park = ParkBuffer.Current.GetPark(r.ParkID); //if (park != null && park.RootParkID > 0) park = ParkBuffer.Current.GetPark(park.RootParkID); //if (park == null) return; //if (park.HostWorkstation == WorkStationInfo.CurrentStation.StationID) //如果本机是停车场的通讯主机,则它要负责抓拍图片 //{ //foreach (CarPlateDevice device in _Devices) //{ // if (device.EntranceID == r.EntranceID && device.VideoSource != null) // { // if (r is CardEventReport) // { // CardEventReport cardEvent = r as CardEventReport; // if (cardEvent.EventStatus == CardEventStatus.Valid && SnapShotTo(device, false)) // { // string snappath = device.SnapPath; // //事件有效抓拍后,清空识别结果 // lock (device) // { // device.ResetResult(); // } // SnapShot shot = new SnapShot(cardEvent.EventDateTime, device.VideoSource.VideoID, cardEvent.CardID, snappath); // if (!string.IsNullOrEmpty(AppSettings.CurrentSetting.ImageDBConnStr)) // { // CommandResult result = (new SnapShotBll(AppSettings.CurrentSetting.ImageDBConnStr)).Insert(shot); // string standby = AppSettings.CurrentSetting.CurrentStandbyConnect; // if (result.Result != ResultCode.Successful && !string.IsNullOrEmpty(standby)) (new SnapShotBll(standby)).Insert(shot); // } // else // { // string master = AppSettings.CurrentSetting.CurrentMasterConnect; // string standby = AppSettings.CurrentSetting.CurrentStandbyConnect; // CommandResult result = (new SnapShotBll(master)).Insert(shot); // if (result.Result != ResultCode.Successful && !string.IsNullOrEmpty(standby)) (new SnapShotBll(standby)).Insert(shot); // } // //(new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).Insert(shot); // } // } // else if (r is CarSenseReport) // { // CarSenseReport cp = r as CarSenseReport; // if (cp.InOrOutFlag == 1)//车到时 // { // if (UserSetting.Current.SnapshotWhenCarArrive) //车压地感时抓拍图片 // { // if (SnapShotTo(device, false)) // { // SnapShot shot = new SnapShot(cp.EventDateTime, device.VideoSource.VideoID, string.Empty, device.SnapPath); // if (!string.IsNullOrEmpty(AppSettings.CurrentSetting.ImageDBConnStr)) // { // CommandResult result = (new SnapShotBll(AppSettings.CurrentSetting.ImageDBConnStr)).Insert(shot); // string standby = AppSettings.CurrentSetting.CurrentStandbyConnect; // if (result.Result != ResultCode.Successful && !string.IsNullOrEmpty(standby)) (new SnapShotBll(standby)).Insert(shot); // } // else // { // string master = AppSettings.CurrentSetting.CurrentMasterConnect; // string standby = AppSettings.CurrentSetting.CurrentStandbyConnect; // CommandResult result = (new SnapShotBll(master)).Insert(shot); // if (result.Result != ResultCode.Successful && !string.IsNullOrEmpty(standby)) (new SnapShotBll(standby)).Insert(shot); // } // //(new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).Insert(shot); // } // } // } // else//车走时清空识别结果 // { // lock (device) // { // device.ResetResult(); // } // } // } // else if (r is AlarmReport) // { // AlarmReport ar = r as AlarmReport; // if (ar.AlarmType == Ralid.Park.BusinessModel.Enum.AlarmType.Opendoor // || ar.AlarmType == Ralid.Park.BusinessModel.Enum.AlarmType.GateAlarm) // { // if (SnapShotTo(device, true)) // { // string snappath = device.SnapPath; // //抓拍后,清空识别结果 // lock (device) // { // device.ResetResult(); // } // SnapShot shot = new SnapShot(ar.EventDateTime, device.VideoSource.VideoID, string.Empty, snappath); // if (!string.IsNullOrEmpty(AppSettings.CurrentSetting.ImageDBConnStr)) // { // CommandResult result = (new SnapShotBll(AppSettings.CurrentSetting.ImageDBConnStr)).Insert(shot); // string standby = AppSettings.CurrentSetting.CurrentStandbyConnect; // if (result.Result != ResultCode.Successful && !string.IsNullOrEmpty(standby)) (new SnapShotBll(standby)).Insert(shot); // } // else // { // string master = AppSettings.CurrentSetting.CurrentMasterConnect; // string standby = AppSettings.CurrentSetting.CurrentStandbyConnect; // CommandResult result = (new SnapShotBll(master)).Insert(shot); // if (result.Result != ResultCode.Successful && !string.IsNullOrEmpty(standby)) (new SnapShotBll(standby)).Insert(shot); // } // //(new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).Insert(shot); // } // } // } // } //} //} #endregion }
public void ProcessReport(ReportBase r) { ParkInfo park = ParkBuffer.Current.GetPark(r.ParkID); if (park != null && park.RootParkID > 0) { park = ParkBuffer.Current.GetPark(park.RootParkID); } if (park == null) { return; } if (park.HostWorkstation == WorkStationInfo.CurrentStation.StationID) //如果本机是停车场的通讯主机,则它要负责抓拍图片 { EntranceInfo entrance = ParkBuffer.Current.GetEntrance(r.EntranceID); if (entrance != null) { foreach (VideoSourceInfo video in entrance.VideoSources) { if (r is CarSenseReport) { CarSenseReport cp = r as CarSenseReport; if (cp.InOrOutFlag == 1) //车到时打开视频 { VideoPanel vp = videoGrid.VideoPanelCollection.SingleOrDefault(v => (v.VideoSource == video)); if (vp != null) { if (UserSetting.Current.SnapshotWhenCarArrive) //车压地感时抓拍图片 { string path = Path.Combine(TempFolderManager.GetCurrentFolder(), string.Format("{0}_{1}_{2}.jpg", "CarArrive", Guid.NewGuid().ToString(), video.VideoID)); vp.Play(false); if (vp.Status == VideoStatus.Playing && vp.SnapShotTo(path)) { SnapShot shot = new SnapShot(cp.EventDateTime, video.VideoID, string.Empty, path); (new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).Insert(shot); } } else { vp.Play(true); } } } else { if (AppSettings.CurrentSetting.Optimized) //启用视频优化车走时关闭视频 { VideoPanel vp = videoGrid.VideoPanelCollection.SingleOrDefault(v => (v.VideoSource == video)); if (vp != null) { vp.Close(); } } } } else if (r is CardEventReport) { CardEventReport cardEvent = r as CardEventReport; if (cardEvent.EventStatus == CardEventStatus.Valid) { VideoPanel vp = videoGrid.VideoPanelCollection.SingleOrDefault(v => (v.VideoSource == video)); if (vp != null) //如果视频已经抓拍了一张,则此次用同一张图 { object tag = null; lock (_TagLocker) //加锁是防止多个线程同时写 { tag = vp.Tag; vp.Tag = null; } if (tag != null) { string path = tag.ToString(); if (path != "fail") { SnapShot shot = new SnapShot(cardEvent.EventDateTime, video.VideoID, cardEvent.CardID, path); (new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).Insert(shot); } } else { string path = Path.Combine(TempFolderManager.GetCurrentFolder(), string.Format("{0}_{1}_{2}.jpg", "CardEvent", Guid.NewGuid().ToString(), video.VideoID)); if (SnapShotTo(video, path, false)) { SnapShot shot = new SnapShot(cardEvent.EventDateTime, video.VideoID, cardEvent.CardID, path); (new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).Insert(shot); } } } } } else if (r is AlarmReport) { AlarmReport ar = r as AlarmReport; if (ar.AlarmType == Ralid.Park.BusinessModel.Enum.AlarmType.Opendoor) { string path = Path.Combine(TempFolderManager.GetCurrentFolder(), string.Format("{0}_{1}_{2}.jpg", "OpenDoor", Guid.NewGuid().ToString(), video.VideoID)); if (SnapShotTo(video, path, false)) { SnapShot shot = new SnapShot(ar.EventDateTime, video.VideoID, string.Empty, path); (new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).Insert(shot); } } } } } } }
private void park_CarSenseReporting(object sender, CarSenseReport report) { ReportEnqueue(report); }
public void ProcessReport(ReportBase r) { if (r is CarSenseReport) { CarSenseReport cp = r as CarSenseReport; if (cp.InOrOutFlag == 0)//车走时清空识别结果 { foreach (CarPlateDevice device in _Devices) { if (device.EntranceID == r.EntranceID) { lock (device) { device.ResetResult(); } } } } } #region 以下操作由FrmSnapShoter完成 //ParkInfo park = ParkBuffer.Current.GetPark(r.ParkID); //if (park != null && park.RootParkID > 0) park = ParkBuffer.Current.GetPark(park.RootParkID); //if (park == null) return; //foreach (DataGridViewRow row in this.dataGridView1.Rows) //{ // CarPlateDevice device = row.Tag as CarPlateDevice; // if (device.EntranceID == r.EntranceID) // { // if (r is CardEventReport) // { // CardEventReport cardEvent = r as CardEventReport; // if (cardEvent.EventStatus == CardEventStatus.Valid && !string.IsNullOrEmpty(device.SnapPath)) // { // EntranceInfo entrace = ParkBuffer.Current.GetEntrance(r.EntranceID); // int videoSourceID = -1; // if (entrace != null) // { // VideoSourceInfo videoSource = entrace.VideoSources.FirstOrDefault(item => item.MediaSource == device.IP && item.Channel == device.VideoID); // if (videoSource != null) videoSourceID = videoSource.VideoID; // } // if (videoSourceID == -1) videoSourceID = r.EntranceID * 1000 + device.VideoID;//没有找到视频ID的,手动生成一个,通道id*1000+视频路数 // SnapShot shot = new SnapShot(cardEvent.EventDateTime, videoSourceID, cardEvent.CardID, device.SnapPath); // if (!string.IsNullOrEmpty(AppSettings.CurrentSetting.ImageDBConnStr)) // { // CommandResult result = (new SnapShotBll(AppSettings.CurrentSetting.ImageDBConnStr)).Insert(shot); // string standby = AppSettings.CurrentSetting.CurrentStandbyConnect; // if (result.Result != ResultCode.Successful && !string.IsNullOrEmpty(standby)) (new SnapShotBll(standby)).Insert(shot); // } // else // { // string master = AppSettings.CurrentSetting.CurrentMasterConnect; // string standby = AppSettings.CurrentSetting.CurrentStandbyConnect; // CommandResult result = (new SnapShotBll(master)).Insert(shot); // if (result.Result != ResultCode.Successful && !string.IsNullOrEmpty(standby)) (new SnapShotBll(standby)).Insert(shot); // } // //(new SnapShotBll(AppSettings.CurrentSetting.ParkConnect)).Insert(shot); // } // } // } //} #endregion }