diff --git a/BlobStorages/skyscraper5.Data.Minio/MinioObjectStorage.cs b/BlobStorages/skyscraper5.Data.Minio/MinioObjectStorage.cs index aed5720..c224d35 100644 --- a/BlobStorages/skyscraper5.Data.Minio/MinioObjectStorage.cs +++ b/BlobStorages/skyscraper5.Data.Minio/MinioObjectStorage.cs @@ -17,6 +17,7 @@ using System.Net; using System.Runtime.InteropServices; using System.Threading.Tasks; using Minio.DataModel.Response; +using skyscraper5.Dvb.Descriptors; namespace skyscraper5.Data { @@ -330,5 +331,30 @@ namespace skyscraper5.Data WriteObject(fullName, ms); } + + private bool DeleteFile(string fullname) + { + RemoveObjectArgs removeObject = new RemoveObjectArgs(); + removeObject.WithObject(fullname); + removeObject.WithBucket(_minioBucket); + Task task = _minioClient.RemoveObjectAsync(removeObject); + task.Wait(); + if (task.Exception != null) + return false; + return true; + } + + public void DeleteIqGraph(Guid selectedGuid, int frequencyItem1, SatelliteDeliverySystemDescriptor.PolarizationEnum frequencyItem2) + { + char polarityChar = frequencyItem2.ToString()[0]; + string fullName = String.Format("/iq/{0}/{1}_{2}.iq", selectedGuid.ToString("D"), frequencyItem1, polarityChar); + DeleteFile(fullName); + } + + public void DeleteRfSpectrum(Guid selectedGuid) + { + string fullName = String.Format("/rf/{0}.rf", selectedGuid.ToString("D")); + DeleteFile(fullName); + } } } diff --git a/DataTableStorages/skyscraper5.Data.PostgreSql/BlindscanJobs.cs b/DataTableStorages/skyscraper5.Data.PostgreSql/BlindscanJobs.cs index 8854a5e..c3d986a 100644 --- a/DataTableStorages/skyscraper5.Data.PostgreSql/BlindscanJobs.cs +++ b/DataTableStorages/skyscraper5.Data.PostgreSql/BlindscanJobs.cs @@ -1,4 +1,9 @@ -using skyscraper5.Skyscraper.IO.CrazycatStreamReader; +using Npgsql; +using NpgsqlTypes; +using skyscraper5.Dvb.Descriptors; +using skyscraper5.Skyscraper; +using skyscraper5.Skyscraper.Gps; +using skyscraper5.Skyscraper.IO.CrazycatStreamReader; using skyscraper5.src.Skyscraper.FrequencyListGenerator; using System; using System.Collections.Generic; @@ -8,10 +13,6 @@ using System.Linq; using System.Net.NetworkInformation; using System.Text; using System.Threading.Tasks; -using Npgsql; -using NpgsqlTypes; -using skyscraper5.Skyscraper; -using skyscraper5.Skyscraper.Gps; namespace skyscraper5.Data.PostgreSql { @@ -568,5 +569,27 @@ namespace skyscraper5.Data.PostgreSql connection.Close(); } } + + public IEnumerable> GetBlindscanResultFrequencies(Guid selectedGuid) + { + using (NpgsqlConnection connection = new NpgsqlConnection(connectionStringBuilder.ToString())) + { + connection.Open(); + NpgsqlCommand command = connection.CreateCommand(); + command.CommandText = "SELECT freq, pol FROM skyscraper5_blindscan_search_results WHERE related_job = @job"; + command.Parameters.AddWithValue("@job", NpgsqlDbType.Uuid, selectedGuid); + NpgsqlDataReader dataReader = command.ExecuteReader(); + while (dataReader.Read()) + { + int freq = dataReader.GetInt32(0); + int pol = dataReader.GetInt32(1); + Tuple child = new Tuple(freq, (SatelliteDeliverySystemDescriptor.PolarizationEnum)pol); + yield return child; + } + dataReader.Close(); + dataReader.Dispose(); + connection.Close(); + } + } } } diff --git a/DataTableStorages/skyscraper5.Data.PostgreSql/Dvbi.cs b/DataTableStorages/skyscraper5.Data.PostgreSql/Dvbi.cs index 58531af..8e0a895 100644 --- a/DataTableStorages/skyscraper5.Data.PostgreSql/Dvbi.cs +++ b/DataTableStorages/skyscraper5.Data.PostgreSql/Dvbi.cs @@ -7,6 +7,7 @@ using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; +using skyscraper5.Dvb.Descriptors; using skyscraper8.DvbNip; using skyscraper8.Skyscraper.Scraper.Storage; @@ -351,6 +352,8 @@ namespace skyscraper5.Data.PostgreSql return result; } + + private Dictionary _knownDvbiServiceListUpdateDates; public DateTime GetDvbiServiceListLastUpdateDate(string id) diff --git a/GUIs/skyscraper8.UI.ImGui/Forms/BlindscanJobDeleter.cs b/GUIs/skyscraper8.UI.ImGui/Forms/BlindscanJobDeleter.cs index da4be70..ac7a501 100644 --- a/GUIs/skyscraper8.UI.ImGui/Forms/BlindscanJobDeleter.cs +++ b/GUIs/skyscraper8.UI.ImGui/Forms/BlindscanJobDeleter.cs @@ -8,34 +8,45 @@ using System.Linq; using System.Runtime.Intrinsics.X86; using System.Text; using System.Threading.Tasks; +using skyscraper5.Dvb.Descriptors; using skyscraper8.Skyscraper.Scraper.Storage; namespace SDL2Demo.Forms { class BlindscanJobDeleter : IRenderable { - private readonly DataStorage storage; + private readonly DataStorage dataStorage; + private readonly ObjectStorage objectStorage; private List blindscanJobs; private Guid selectedGuid; private string tableGuid; public bool Closed { get; private set; } - public BlindscanJobDeleter(DataStorage storage) + public BlindscanJobDeleter(DataStorage dataStorage,ObjectStorage objectStorage) { - this.storage = storage; + this.dataStorage = dataStorage; + this.objectStorage = objectStorage; this.LoadPastBlindscans(); this.tableGuid = Guid.NewGuid().ToString(); } private void LoadPastBlindscans() { - blindscanJobs = storage.GetDbBlindscanJobs().ToList(); + blindscanJobs = dataStorage.GetDbBlindscanJobs().ToList(); selectedGuid = Guid.Empty; } private void DeleteSelectedJob() { - storage.DeleteBlindscanJob(selectedGuid); + IEnumerable> frequencies = dataStorage.GetBlindscanResultFrequencies(selectedGuid); + foreach (Tuple frequency in frequencies) + { + objectStorage.DeleteIqGraph(selectedGuid, frequency.Item1, frequency.Item2); + } + + objectStorage.DeleteRfSpectrum(selectedGuid); + + dataStorage.DeleteBlindscanJob(selectedGuid); LoadPastBlindscans(); } diff --git a/GUIs/skyscraper8.UI.ImGui/Jobs/CoopBlindscan.cs b/GUIs/skyscraper8.UI.ImGui/Jobs/CoopBlindscan.cs index 83fb13e..7ad08ff 100644 --- a/GUIs/skyscraper8.UI.ImGui/Jobs/CoopBlindscan.cs +++ b/GUIs/skyscraper8.UI.ImGui/Jobs/CoopBlindscan.cs @@ -818,7 +818,12 @@ namespace SDL2Demo.Jobs */ IqChartData result = IqChartData.Create(); IqWindow iqWindow = new IqWindow(JobContext.ImgUiDevice, result); + + Monitor.Enter(JobContext.Renderables); JobContext.Renderables.Add(iqWindow); + Monitor.Exit(JobContext.Renderables); + + sbyte[] buffer = new sbyte[400]; DateTime started = DateTime.Now; while (!result.IsComplete) diff --git a/GUIs/skyscraper8.UI.ImGui/Program.cs b/GUIs/skyscraper8.UI.ImGui/Program.cs index 68c6712..7839f4e 100644 --- a/GUIs/skyscraper8.UI.ImGui/Program.cs +++ b/GUIs/skyscraper8.UI.ImGui/Program.cs @@ -555,7 +555,7 @@ namespace SkyscraperUI { if (ImGui.MenuItem("Delete Blindscan Jobs", CanOpenJobDeleter())) { - jobDeleter = new BlindscanJobDeleter(dataStorage); + jobDeleter = new BlindscanJobDeleter(dataStorage, objectStorage); } ImGui.EndMenu(); } @@ -749,13 +749,12 @@ namespace SkyscraperUI { if (jobContext.Renderables.Count > 0) { - lock (jobContext.Renderables) - { - foreach (IRenderable jobContextRenderable in jobContext.Renderables) - { - jobContextRenderable.Render(); - } - } + Monitor.Enter(jobContext.Renderables); + foreach (IRenderable jobContextRenderable in jobContext.Renderables) + { + jobContextRenderable.Render(); + } + Monitor.Exit(jobContext.Renderables); } } diff --git a/GUIs/skyscraper8.UI.ImGui/Tools/TestFixtureFromIntelsat/bl_continue.json b/GUIs/skyscraper8.UI.ImGui/Tools/TestFixtureFromIntelsat/bl_continue.json deleted file mode 100644 index e80fc9f..0000000 --- a/GUIs/skyscraper8.UI.ImGui/Tools/TestFixtureFromIntelsat/bl_continue.json +++ /dev/null @@ -1 +0,0 @@ -{"target":{"name":"TBS 6903x DVBS/S2 Tuner 0","tunerIndex":4,"tunerStandard":1,"diseqcType":0,"satPosition":{"angle":34.5,"cardinalDirection":1,"name":"Intelsat 35e","lof1":9750,"lof2":10600,"lofSw":11700,"minFreq":10700,"maxFreq":12750,"Checksum":1107983411},"satIndex":0,"buttonUuid":"2dd66076-0417-4835-8311-7da0fb980021"},"willCaptureFiles":true,"hasSwitchingLnb":true,"willScanHorizontalLow":true,"willScanHorizontalHigh":true,"willScanVerticalLow":true,"willScanVerticalHigh":true,"results":[{"sr1":{"Lock":true,"Freq":11013599,"Pol":0,"SR":999988,"StdType":2,"ModType":5,"FEC":1,"Inversion":2,"RollOff":1,"Pilot":2,"Frame":1,"CodingType":0,"StreamType":1,"MIS":0,"IS":"AAAAAAAAAAAAAAAAAAAAAA==","ISSYI":0,"NPD":0,"PLS":1349,"CW":988011,"BitRate":-57,"RFLevel":-858993459,"SNR":0.0078,"BER":0.0078,"preBER":0.0},"sr2":{"Lock":false,"Freq":0,"BW":0,"SR":0,"StdType":0,"ModType":0,"FEC":0,"FECLP":0,"Inversion":0,"TransMode":0,"Guard":0,"Hierarchy":0,"PLP":0,"LID":null,"Pilot":0,"S1Type":0,"Payload":0,"Frame":0,"BwExt":0,"ModeT2":0,"VerT2":0,"CellID":0,"NetID":0,"BitRate":0,"RFLevel":0,"SNR":0.0,"BER":0.0,"preBER":0.0},"Visible":true,"Position":"195, 360","State":0},{"sr1":{"Lock":true,"Freq":11030252,"Pol":0,"SR":5618803,"StdType":2,"ModType":2,"FEC":3,"Inversion":2,"RollOff":1,"Pilot":2,"Frame":0,"CodingType":0,"StreamType":1,"MIS":0,"IS":"AAAAAAAAAAAAAAAAAAAAAA==","ISSYI":0,"NPD":0,"PLS":7585,"CW":12522522,"BitRate":-50,"RFLevel":-858993459,"SNR":0.008032,"BER":0.008032,"preBER":0.0},"sr2":{"Lock":false,"Freq":0,"BW":0,"SR":0,"StdType":0,"ModType":0,"FEC":0,"FECLP":0,"Inversion":0,"TransMode":0,"Guard":0,"Hierarchy":0,"PLP":0,"LID":null,"Pilot":0,"S1Type":0,"Payload":0,"Frame":0,"BwExt":0,"ModeT2":0,"VerT2":0,"CellID":0,"NetID":0,"BitRate":0,"RFLevel":0,"SNR":0.0,"BER":0.0,"preBER":0.0},"Visible":true,"Position":"206, 360","State":0},{"sr1":{"Lock":true,"Freq":11100003,"Pol":0,"SR":51427181,"StdType":2,"ModType":3,"FEC":5,"Inversion":2,"RollOff":6,"Pilot":2,"Frame":0,"CodingType":0,"StreamType":1,"MIS":0,"IS":"AAAAAAAAAAAAAAAAAAAAAA==","ISSYI":0,"NPD":0,"PLS":53998,"CW":170223370,"BitRate":-40,"RFLevel":-1717986918,"SNR":0.0,"BER":0.0,"preBER":0.0},"sr2":{"Lock":false,"Freq":0,"BW":0,"SR":0,"StdType":0,"ModType":0,"FEC":0,"FECLP":0,"Inversion":0,"TransMode":0,"Guard":0,"Hierarchy":0,"PLP":0,"LID":null,"Pilot":0,"S1Type":0,"Payload":0,"Frame":0,"BwExt":0,"ModeT2":0,"VerT2":0,"CellID":0,"NetID":0,"BitRate":0,"RFLevel":0,"SNR":0.0,"BER":0.0,"preBER":0.0},"Visible":true,"Position":"249, 360","State":0},{"sr1":{"Lock":true,"Freq":11468099,"Pol":0,"SR":14973745,"StdType":1,"ModType":1,"FEC":5,"Inversion":2,"RollOff":1,"Pilot":0,"Frame":0,"CodingType":0,"StreamType":0,"MIS":0,"IS":"AAAAAAAAAAAAAAAAAAAAAA==","ISSYI":0,"NPD":0,"PLS":20214,"CW":22998880,"BitRate":-48,"RFLevel":-1717986918,"SNR":0.0,"BER":0.0,"preBER":0.0},"sr2":{"Lock":false,"Freq":0,"BW":0,"SR":0,"StdType":0,"ModType":0,"FEC":0,"FECLP":0,"Inversion":0,"TransMode":0,"Guard":0,"Hierarchy":0,"PLP":0,"LID":null,"Pilot":0,"S1Type":0,"Payload":0,"Frame":0,"BwExt":0,"ModeT2":0,"VerT2":0,"CellID":0,"NetID":0,"BitRate":0,"RFLevel":0,"SNR":0.0,"BER":0.0,"preBER":0.0},"Visible":true,"Position":"479, 360","State":0},{"sr1":{"Lock":true,"Freq":11558991,"Pol":0,"SR":19999786,"StdType":2,"ModType":2,"FEC":3,"Inversion":2,"RollOff":3,"Pilot":2,"Frame":1,"CodingType":0,"StreamType":1,"MIS":0,"IS":"AAAAAAAAAAAAAAAAAAAAAA==","ISSYI":0,"NPD":0,"PLS":23999,"CW":44577771,"BitRate":-46,"RFLevel":1717986918,"SNR":0.249835,"BER":0.249835,"preBER":0.0},"sr2":{"Lock":false,"Freq":0,"BW":0,"SR":0,"StdType":0,"ModType":0,"FEC":0,"FECLP":0,"Inversion":0,"TransMode":0,"Guard":0,"Hierarchy":0,"PLP":0,"LID":null,"Pilot":0,"S1Type":0,"Payload":0,"Frame":0,"BwExt":0,"ModeT2":0,"VerT2":0,"CellID":0,"NetID":0,"BitRate":0,"RFLevel":0,"SNR":0.0,"BER":0.0,"preBER":0.0},"Visible":true,"Position":"535, 360","State":0},{"sr1":{"Lock":true,"Freq":11595491,"Pol":0,"SR":15454398,"StdType":2,"ModType":0,"FEC":0,"Inversion":2,"RollOff":1,"Pilot":1,"Frame":1,"CodingType":0,"StreamType":1,"MIS":0,"IS":"AAAAAAAAAAAAAAAAAAAAAA==","ISSYI":0,"NPD":0,"PLS":20863,"CW":0,"BitRate":-45,"RFLevel":858993459,"SNR":0.0,"BER":0.0,"preBER":0.0},"sr2":{"Lock":false,"Freq":0,"BW":0,"SR":0,"StdType":0,"ModType":0,"FEC":0,"FECLP":0,"Inversion":0,"TransMode":0,"Guard":0,"Hierarchy":0,"PLP":0,"LID":null,"Pilot":0,"S1Type":0,"Payload":0,"Frame":0,"BwExt":0,"ModeT2":0,"VerT2":0,"CellID":0,"NetID":0,"BitRate":0,"RFLevel":0,"SNR":0.0,"BER":0.0,"preBER":0.0},"Visible":true,"Position":"558, 360","State":0},{"sr1":{"Lock":true,"Freq":11634990,"Pol":0,"SR":32726484,"StdType":2,"ModType":3,"FEC":3,"Inversion":2,"RollOff":3,"Pilot":2,"Frame":1,"CodingType":0,"StreamType":1,"MIS":0,"IS":"AAAAAAAAAAAAAAAAAAAAAA==","ISSYI":0,"NPD":0,"PLS":39271,"CW":97523480,"BitRate":-43,"RFLevel":0,"SNR":0.34255599999999997,"BER":0.34255599999999997,"preBER":0.0},"sr2":{"Lock":false,"Freq":0,"BW":0,"SR":0,"StdType":0,"ModType":0,"FEC":0,"FECLP":0,"Inversion":0,"TransMode":0,"Guard":0,"Hierarchy":0,"PLP":0,"LID":null,"Pilot":0,"S1Type":0,"Payload":0,"Frame":0,"BwExt":0,"ModeT2":0,"VerT2":0,"CellID":0,"NetID":0,"BitRate":0,"RFLevel":0,"SNR":0.0,"BER":0.0,"preBER":0.0},"Visible":true,"Position":"583, 360","State":0},{"sr1":{"Lock":true,"Freq":11674992,"Pol":0,"SR":34284453,"StdType":2,"ModType":3,"FEC":15,"Inversion":2,"RollOff":6,"Pilot":2,"Frame":0,"CodingType":0,"StreamType":1,"MIS":0,"IS":"AAAAAAAAAAAAAAAAAAAAAA==","ISSYI":0,"NPD":0,"PLS":35998,"CW":0,"BitRate":-45,"RFLevel":858993459,"SNR":0.048361999999999995,"BER":0.048361999999999995,"preBER":0.0},"sr2":{"Lock":false,"Freq":0,"BW":0,"SR":0,"StdType":0,"ModType":0,"FEC":0,"FECLP":0,"Inversion":0,"TransMode":0,"Guard":0,"Hierarchy":0,"PLP":0,"LID":null,"Pilot":0,"S1Type":0,"Payload":0,"Frame":0,"BwExt":0,"ModeT2":0,"VerT2":0,"CellID":0,"NetID":0,"BitRate":0,"RFLevel":0,"SNR":0.0,"BER":0.0,"preBER":0.0},"Visible":true,"Position":"608, 360","State":0}]} \ No newline at end of file diff --git a/skyscraper8/Skyscraper/Scraper/Storage/DataStorage.cs b/skyscraper8/Skyscraper/Scraper/Storage/DataStorage.cs index 7ab8b8e..9168604 100644 --- a/skyscraper8/Skyscraper/Scraper/Storage/DataStorage.cs +++ b/skyscraper8/Skyscraper/Scraper/Storage/DataStorage.cs @@ -190,5 +190,6 @@ namespace skyscraper8.Skyscraper.Scraper.Storage object[] GetPluginConnector(); void Ping(); + IEnumerable> GetBlindscanResultFrequencies(Guid selectedGuid); } } diff --git a/skyscraper8/Skyscraper/Scraper/Storage/Filesystem/FilesystemStorage.cs b/skyscraper8/Skyscraper/Scraper/Storage/Filesystem/FilesystemStorage.cs index e696612..ade5add 100644 --- a/skyscraper8/Skyscraper/Scraper/Storage/Filesystem/FilesystemStorage.cs +++ b/skyscraper8/Skyscraper/Scraper/Storage/Filesystem/FilesystemStorage.cs @@ -1116,6 +1116,11 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem } } + public IEnumerable> GetBlindscanResultFrequencies(Guid selectedGuid) + { + throw new NotImplementedException(); + } + public IEnumerable> SelectAllPmt() { throw new NotImplementedException(); @@ -1465,6 +1470,16 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem throw new NotImplementedException(); } + public void DeleteIqGraph(Guid selectedGuid, int frequencyItem1, SatelliteDeliverySystemDescriptor.PolarizationEnum frequencyItem2) + { + throw new NotImplementedException(); + } + + public void DeleteRfSpectrum(Guid selectedGuid) + { + throw new NotImplementedException(); + } + public bool DvbNipPrivateDataSpecifier(NipActualCarrierInformation currentCarrierInformation, DateTime versionUpdate, uint privateDataSpecifier, List privateDataSessions) { diff --git a/skyscraper8/Skyscraper/Scraper/Storage/InMemory/InMemoryScraperStorage.cs b/skyscraper8/Skyscraper/Scraper/Storage/InMemory/InMemoryScraperStorage.cs index 13ac51c..21c7cc2 100644 --- a/skyscraper8/Skyscraper/Scraper/Storage/InMemory/InMemoryScraperStorage.cs +++ b/skyscraper8/Skyscraper/Scraper/Storage/InMemory/InMemoryScraperStorage.cs @@ -924,6 +924,11 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.InMemory } + public IEnumerable> GetBlindscanResultFrequencies(Guid selectedGuid) + { + throw new NotImplementedException(); + } + public IEnumerable> SelectAllPmt() { for (int x = 0; x < pmtEntries.Length; x++) diff --git a/skyscraper8/Skyscraper/Scraper/Storage/NullObjectStorage.cs b/skyscraper8/Skyscraper/Scraper/Storage/NullObjectStorage.cs index 5771f11..8c092aa 100644 --- a/skyscraper8/Skyscraper/Scraper/Storage/NullObjectStorage.cs +++ b/skyscraper8/Skyscraper/Scraper/Storage/NullObjectStorage.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using skyscraper5.Dvb.DataBroadcasting.SkyscraperVfs; +using skyscraper5.Dvb.Descriptors; using skyscraper8.DvbNip; using skyscraper8.Ietf.FLUTE; using skyscraper8.Skyscraper.Drawing; @@ -88,5 +89,15 @@ namespace skyscraper8.Skyscraper.Scraper.Storage { throw new NotImplementedException(); } + + public void DeleteIqGraph(Guid selectedGuid, int frequencyItem1, SatelliteDeliverySystemDescriptor.PolarizationEnum frequencyItem2) + { + throw new NotImplementedException(); + } + + public void DeleteRfSpectrum(Guid selectedGuid) + { + throw new NotImplementedException(); + } } } diff --git a/skyscraper8/Skyscraper/Scraper/Storage/ObjectStorage.cs b/skyscraper8/Skyscraper/Scraper/Storage/ObjectStorage.cs index 45e9b1b..270b21a 100644 --- a/skyscraper8/Skyscraper/Scraper/Storage/ObjectStorage.cs +++ b/skyscraper8/Skyscraper/Scraper/Storage/ObjectStorage.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using skyscraper5.Dvb.DataBroadcasting.SkyscraperVfs; +using skyscraper5.Dvb.Descriptors; using skyscraper5.Teletext; using skyscraper8.DvbNip; using skyscraper8.Ietf.FLUTE; @@ -28,5 +29,7 @@ namespace skyscraper8.Skyscraper.Scraper.Storage void DvbNipFileArrival(NipActualCarrierInformation carrier, FluteListener listener); void StoreIqGraph(Guid jobGuid, long frequency, char polarity, IqChartData plot); void StoreRfSpectrum(Guid jobGuid, RfSpectrumData rfSpectrum); + void DeleteIqGraph(Guid selectedGuid, int frequencyItem1, SatelliteDeliverySystemDescriptor.PolarizationEnum frequencyItem2); + void DeleteRfSpectrum(Guid selectedGuid); } }