public override DataEvent SelectByID(long id) { ReadsDataEvent readsDataEvent = base.SelectByID(id) as ReadsDataEvent; readsDataEvent.SystemRepository = this.DataFile.DataRepository as SystemRepository; return(readsDataEvent); }
protected override void OnUpdating(DataEvent ev) { ReadsDataEvent read = ev as ReadsDataEvent; // // IsSynced keeps track of initial sync, Resync keeps track of resync. // This convoluted logic is because of retrofitting PAGIS to allow // already synced reads to be resent via Wi-Fi. // // Also don't delete our linked tables if this is a scrubbed read because we can't recreate the hit // DataEvents are like the coolest thing ever if (!read.IsSynced && !read.Resync && read.VRM != "LPN_SCRUB") { foreach (DataTableBase linkedTable in this.LinkedTables) { foreach (DataEvent linkedEvent in ev.LinkedDataEvents(linkedTable)) { linkedTable.Delete(linkedEvent); } ev.LinkedDataEvents(linkedTable).Clear(); } if (this.DataFile.DataRepository is SystemRepository) { (this.DataFile.DataRepository as SystemRepository).HotLists.HotLists.ProcessRead(read); } } base.OnUpdating(ev); }
private string GetLocation(ReadsDataEvent read, string desc) { string cam = string.Empty; for (int i = 0; i < read.Camera.Length; i++) { if (char.IsLetterOrDigit(read.Camera, i)) { cam = cam + read.Camera[i]; } } return(string.Format("{0}_{1}_{2}_{3}_{4}.img", read.Timestamp.Ticks, cam, read.Confidence, read.VRM, desc)); }
protected override void OnInserted(DataEvent ev) { //PIPS.Logger.WriteLine("AnprResult.OnInserted()"); //PIPS.Logger.WriteLine("Reads.OnInserted()"); DateTime start = DateTime.Now; SoundsDataFile sounds = this.DataFile.DataRepository.DataFiles[typeof(SoundsDataFile)] as SoundsDataFile; if (sounds != null) { if (lastPing < (DateTime.Now.Ticks - TimeSpan.FromMilliseconds(500).Ticks)) { lastPing = DateTime.Now.Ticks; sounds.Sounds.PlaySound(SoundEvents.CameraDetection); } ReadsDataEvent read = ev as ReadsDataEvent; if (read.LinkedDataEvents(this.Hits).Count > 0) { foreach (HitsDataEvent hit in read.LinkedDataEvents(Hits)) { if (hit.Alerting) { if (hit.Alarm.ToUpper() == "LOW") { sounds.Sounds.PlaySound(SoundEvents.AlarmLow); } else if (hit.Alarm.ToUpper() == "HIGH") { sounds.Sounds.PlaySound(SoundEvents.AlarmHigh); } else if ((hit.Alarm.ToUpper() == "MED") || (hit.Alarm.ToUpper() == "MEDIUM")) { sounds.Sounds.PlaySound(SoundEvents.AlarmMedium); } else { sounds.Sounds.PlaySound(hit.Alarm); } break; } } } } //PIPS.Logger.WriteLine("Reads.OnInserted({0}).PlayedSound", (DateTime.Now - start).TotalMilliseconds); base.OnInserted(ev); //PIPS.Logger.WriteLine("Reads.OnInserted().Complete()"); }
protected override void OnInserting(DataEvent ev) { //PIPS.Logger.WriteLine("AnprResult.OnInserting()"); //DateTime start = DateTime.Now; ReadsDataEvent read = ev as ReadsDataEvent; if (this.DataFile.DataRepository is SystemRepository) { (this.DataFile.DataRepository as SystemRepository).HotLists.HotLists.ProcessRead(read); } //PIPS.Logger.WriteLine("ReadsDataTable.ProcessRead({0})", (DateTime.Now - start).TotalMilliseconds); //read.OverviewLocation = this.ImageStorage.Save(this.GetLocation(read, "O"), read.Overview); //read.PatchLocation = this.ImageStorage.Save(this.GetLocation(read, "P"), read.Patch); //PIPS.Logger.WriteLine("Assigned '{0}' = '{1}'", read.VRM, id); //PIPS.Logger.WriteLine("ReadsDataTable.SavedImages({0})", (DateTime.Now - start).TotalMilliseconds); base.OnInserting(ev); }
public void Save(XmlPackets.ReadHit readPacket, SystemRepository systemRepository) { ReadsDataEvent read = this.CreateReadsDataEvent(systemRepository); read.VRM = readPacket.VRM; read.Login = "******"; read.Timestamp = readPacket.Timestamp; // // Set lat/lon from the SDK if available, otherwise it will use local GPS // //PIPS.Logger.WriteLine("xml packet read lat/lon {0},{1}", readPacket.Latitude, readPacket.Longitude); read.Location = "0"; read.Latitude = 0.0; read.Longitude = 0.0; read.Camera = readPacket.CameraName; read.CameraID = readPacket.CameraID; if (readPacket.Images[0].ImageName == "Patch") { read.Patch = readPacket.Images[0].AnprImage; } else // it is overview pic { read.Overview = readPacket.Images[0].AnprImage; } if (readPacket.Images[1].ImageName == "Patch") { read.Patch = readPacket.Images[1].AnprImage; } else // it is overview pic { read.Overview = readPacket.Images[1].AnprImage; } read.Confidence = (int)readPacket.Confidence; read.IsManual = false; read.IsMisread = false; read.IsSynced = false; read.BossID = -1; this.Save(read); }
public HitsDataEvent Save(ReadsDataEvent read, HitsDataEvent hit, string information) { if (this.DataFile.DataRepository is SystemRepository) { var start = DateTime.Now; hit.Information = information; this.Save(hit); //PIPS.Logger.WriteLine("HitsDataTable: new hit save = {0} ms", (DateTime.Now - start).TotalMilliseconds); // this read already exists so we need to resynce it with boss var indy = read.Hits.FindIndex( h => h.HotList == hit.HotList); if (indy != -1) { read.Hits[indy].Information = information; } read.SaveAndQueueForSync(); return(hit); } return(null); }
public HitsDataEvent Save(long read_id, string hotlist, string information) { if (this.DataFile.DataRepository is SystemRepository) { var start = DateTime.Now; ReadsDataEvent read = (this.DataFile.DataRepository as SystemRepository).Events.Reads.SelectByID(read_id) as ReadsDataEvent; HitsDataEvent hit = this.CreateHitsDataEvent(); hit.Alarm = "MED"; hit.DisplayColor = Color.Blue; hit.Field1 = hit.Field2 = hit.Field3 = hit.Field4 = hit.Field5 = string.Empty; hit.HotList = hotlist; hit.IsCovert = false; hit.PNCID = string.Empty; hit.Priority = 500; hit.ReadID = read.ID; hit.VRM = read.VRM; var result = Save(read, hit, information); //PIPS.Logger.WriteLine("HitsDataTable: new hit save = {0} ms", (DateTime.Now - start).TotalMilliseconds); return(result); } return(null); }
public ReadsDataEvent Save(string vrm, bool permit) { if (this.DataFile.DataRepository is SystemRepository) { ReadsDataEvent read = this.CreateReadsDataEvent(this.DataFile.DataRepository as SystemRepository); read.VRM = vrm; read.BossID = -1; read.Timestamp = DateTime.Now; read.Patch = null; read.Overview = null; read.Login = "******"; read.Location = "0"; read.Latitude = 0.0; read.Longitude = 0.0; read.IsSynced = false; read.IsManual = true; read.IsMisread = false; read.Syntax = string.Empty; read.Confidence = 100; read.Camera = string.Empty; read.CameraID = 0; read.Permit = permit; this.Save(read); if (read.LinkedDataEvents(this.Hits).Count == 0) { SoundsDataFile sounds = this.DataFile.DataRepository.DataFiles[typeof(SoundsDataFile)] as SoundsDataFile; if (sounds != null) { sounds.Sounds.PlaySound(SoundEvents.NoMatchInDatabase); } } return(read); } return(null); }
protected override void OnDeleted(DataEvent ev) { ReadsDataEvent read = ev as ReadsDataEvent; base.OnDeleted(ev); }