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()"); }
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); }