Storing IQ Data inside MinIO!
This commit is contained in:
parent
c618e87a4a
commit
ee13de9594
@ -1,8 +1,4 @@
|
|||||||
using System;
|
using CommunityToolkit.HighPerformance.Buffers;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Minio;
|
using Minio;
|
||||||
using Minio.DataModel;
|
using Minio.DataModel;
|
||||||
using Minio.DataModel.Args;
|
using Minio.DataModel.Args;
|
||||||
@ -10,7 +6,16 @@ using Minio.Exceptions;
|
|||||||
using skyscraper5.Dvb.DataBroadcasting.SkyscraperVfs;
|
using skyscraper5.Dvb.DataBroadcasting.SkyscraperVfs;
|
||||||
using skyscraper8.DvbNip;
|
using skyscraper8.DvbNip;
|
||||||
using skyscraper8.Ietf.FLUTE;
|
using skyscraper8.Ietf.FLUTE;
|
||||||
|
using skyscraper8.Skyscraper.Drawing;
|
||||||
using skyscraper8.Skyscraper.Scraper.Storage;
|
using skyscraper8.Skyscraper.Scraper.Storage;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Minio.DataModel.Response;
|
||||||
|
|
||||||
namespace skyscraper5.Data
|
namespace skyscraper5.Data
|
||||||
{
|
{
|
||||||
@ -38,6 +43,10 @@ namespace skyscraper5.Data
|
|||||||
//putObjectArgs = putObjectArgs.WithObjectSize(buffer.Length);
|
//putObjectArgs = putObjectArgs.WithObjectSize(buffer.Length);
|
||||||
putObjectArgs = putObjectArgs.WithContentType(mime);
|
putObjectArgs = putObjectArgs.WithContentType(mime);
|
||||||
putObjectArgs = putObjectArgs.WithHeaders(optionalData);
|
putObjectArgs = putObjectArgs.WithHeaders(optionalData);
|
||||||
|
if (buffer.CanSeek)
|
||||||
|
{
|
||||||
|
putObjectArgs = putObjectArgs.WithObjectSize(buffer.Length);
|
||||||
|
}
|
||||||
|
|
||||||
lock (_tasks)
|
lock (_tasks)
|
||||||
{
|
{
|
||||||
@ -250,6 +259,31 @@ namespace skyscraper5.Data
|
|||||||
{
|
{
|
||||||
GetVersioningArgs args = new GetVersioningArgs().WithBucket(_minioBucket);
|
GetVersioningArgs args = new GetVersioningArgs().WithBucket(_minioBucket);
|
||||||
VersioningConfiguration vc = _minioClient.GetVersioningAsync(args).Result;
|
VersioningConfiguration vc = _minioClient.GetVersioningAsync(args).Result;
|
||||||
|
|
||||||
|
byte[] buffer = new byte[2048];
|
||||||
|
Random rng = new Random();
|
||||||
|
rng.NextBytes(buffer);
|
||||||
|
string fname = String.Format("/test_write_{0}.bin", rng.NextInt64());
|
||||||
|
|
||||||
|
PutObjectArgs putObjectArgs = new PutObjectArgs();
|
||||||
|
putObjectArgs = putObjectArgs.WithBucket(_minioBucket);
|
||||||
|
putObjectArgs = putObjectArgs.WithObject(fname);
|
||||||
|
putObjectArgs = putObjectArgs.WithStreamData(new MemoryStream(buffer));
|
||||||
|
putObjectArgs = putObjectArgs.WithContentType("application/octet-stream");
|
||||||
|
putObjectArgs = putObjectArgs.WithObjectSize(2048);
|
||||||
|
|
||||||
|
PutObjectResponse objectResponse = _minioClient.PutObjectAsync(putObjectArgs).Result;
|
||||||
|
if (objectResponse.ResponseStatusCode != HttpStatusCode.OK)
|
||||||
|
throw new Exception(objectResponse.ResponseContent);
|
||||||
|
|
||||||
|
RemoveObjectArgs removeObjectArgs = new RemoveObjectArgs();
|
||||||
|
removeObjectArgs = removeObjectArgs.WithBucket(_minioBucket);
|
||||||
|
removeObjectArgs = removeObjectArgs.WithObject(fname);
|
||||||
|
|
||||||
|
Task removeObjectResponse = _minioClient.RemoveObjectAsync(removeObjectArgs);
|
||||||
|
removeObjectResponse.Wait();
|
||||||
|
if (removeObjectResponse.Exception != null)
|
||||||
|
throw removeObjectResponse.Exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DvbNipTestForFile(string announcedFileContentLocation)
|
public bool DvbNipTestForFile(string announcedFileContentLocation)
|
||||||
@ -265,5 +299,20 @@ namespace skyscraper5.Data
|
|||||||
Stream stream = listener.ToStream();
|
Stream stream = listener.ToStream();
|
||||||
WriteObject(path, stream);
|
WriteObject(path, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void StoreIqGraph(Guid jobGuid, long frequency, char polarity, IqChartData plot)
|
||||||
|
{
|
||||||
|
if (definetlyKnownFiles == null)
|
||||||
|
definetlyKnownFiles = new HashSet<string>();
|
||||||
|
if (definetlyMissingFiles == null)
|
||||||
|
definetlyMissingFiles = new HashSet<string>();
|
||||||
|
|
||||||
|
string fullName = String.Format("/iq/{0}/{1}_{2}.iq", jobGuid.ToString("D"),frequency,polarity);
|
||||||
|
MemoryStream ms = new MemoryStream();
|
||||||
|
plot.SaveTo(ms);
|
||||||
|
ms.Position = 0;
|
||||||
|
|
||||||
|
WriteObject(fullName, ms);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -353,27 +353,39 @@ namespace SDL2Demo.Jobs
|
|||||||
public SearchResult2 sr2;
|
public SearchResult2 sr2;
|
||||||
|
|
||||||
public bool Satellite { get; private set; }
|
public bool Satellite { get; private set; }
|
||||||
|
|
||||||
public string FrequencyAndPolarityToString()
|
public long GetFrequency()
|
||||||
{
|
{
|
||||||
if (Satellite)
|
if (Satellite)
|
||||||
{
|
{
|
||||||
char polarity;
|
return sr1.Freq;
|
||||||
switch (sr1.Pol)
|
|
||||||
{
|
|
||||||
case 0: polarity = 'H'; break;
|
|
||||||
case 1: polarity = 'V'; break;
|
|
||||||
case 2: polarity = 'L'; break;
|
|
||||||
case 3: polarity = 'R'; break;
|
|
||||||
default: polarity = 'W'; break; //W for WTF?
|
|
||||||
}
|
|
||||||
return String.Format("{0}_{1}", sr1.Freq, polarity);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return String.Format("{0}", sr2.Freq);
|
return sr2.Freq;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public char GetPolarity()
|
||||||
|
{
|
||||||
|
if (Satellite)
|
||||||
|
{
|
||||||
|
char polarity;
|
||||||
|
switch (sr1.Pol)
|
||||||
|
{
|
||||||
|
case 0: polarity = 'H'; break;
|
||||||
|
case 1: polarity = 'V'; break;
|
||||||
|
case 2: polarity = 'L'; break;
|
||||||
|
case 3: polarity = 'R'; break;
|
||||||
|
default: polarity = 'W'; break; //W for WTF?
|
||||||
|
}
|
||||||
|
return polarity;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 'C';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool RunBlindscan()
|
public bool RunBlindscan()
|
||||||
|
|||||||
@ -843,12 +843,11 @@ namespace SDL2Demo.Jobs
|
|||||||
{
|
{
|
||||||
result.State = BlindscanResultState.IqCollecting;
|
result.State = BlindscanResultState.IqCollecting;
|
||||||
IqChartData plot = GatherIqGraph();
|
IqChartData plot = GatherIqGraph();
|
||||||
result.State = BlindscanResultState.IqSaving;
|
if (plot != null)
|
||||||
string fname = String.Format("{0}_{1}.bin", jobInDb.JobGuid.ToString("D"), result.FrequencyAndPolarityToString());
|
{
|
||||||
FileStream fileStream = File.OpenWrite(fname);
|
result.State = BlindscanResultState.IqSaving;
|
||||||
plot.SaveTo(fileStream);
|
JobContext.ObjectStorage.StoreIqGraph(jobInDb.JobGuid, result.GetFrequency(), result.GetPolarity(), plot);
|
||||||
fileStream.Flush();
|
}
|
||||||
fileStream.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int mis = 0; mis < misCounter; mis++)
|
for (int mis = 0; mis < misCounter; mis++)
|
||||||
|
|||||||
@ -8,6 +8,7 @@ using System.Linq;
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using skyscraper5.src.Sophtainer;
|
||||||
|
|
||||||
namespace skyscraper8.Skyscraper.Drawing
|
namespace skyscraper8.Skyscraper.Drawing
|
||||||
{
|
{
|
||||||
@ -89,13 +90,14 @@ namespace skyscraper8.Skyscraper.Drawing
|
|||||||
totalSamples += (buffer.Length / 2);
|
totalSamples += (buffer.Length / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveTo(FileStream fs)
|
public void SaveTo(Stream fs)
|
||||||
{
|
{
|
||||||
fs.WriteUInt8(0x41);
|
Sophtainer sophtainer = Sophtainer.CreateSophtainer(fs, 538988873, new Version(1, 1, 0, 0));
|
||||||
|
OffsetStream offsetStream = sophtainer.GetStream();
|
||||||
foreach (byte[] packet in packets)
|
foreach (byte[] packet in packets)
|
||||||
{
|
{
|
||||||
fs.WriteInt32LE(packet.Length);
|
offsetStream.WriteInt32LE(packet.Length);
|
||||||
fs.Write(packet, 0, packet.Length);
|
offsetStream.Write(packet, 0, packet.Length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,6 +37,7 @@ using skyscraper8.DvbI;
|
|||||||
using skyscraper8.DvbNip;
|
using skyscraper8.DvbNip;
|
||||||
using skyscraper8.Ietf.FLUTE;
|
using skyscraper8.Ietf.FLUTE;
|
||||||
using skyscraper8.Ses;
|
using skyscraper8.Ses;
|
||||||
|
using skyscraper8.Skyscraper.Drawing;
|
||||||
using skyscraper8.Skyscraper.Scraper.Storage;
|
using skyscraper8.Skyscraper.Scraper.Storage;
|
||||||
using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform;
|
using Platform = skyscraper5.Dvb.SystemSoftwareUpdate.Model.Platform;
|
||||||
|
|
||||||
@ -1454,6 +1455,11 @@ namespace skyscraper5.Skyscraper.Scraper.Storage.Filesystem
|
|||||||
inStream.Dispose();
|
inStream.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void StoreIqGraph(Guid jobGuid, long frequency, char polarity, IqChartData plot)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public bool DvbNipPrivateDataSpecifier(NipActualCarrierInformation currentCarrierInformation, DateTime versionUpdate,
|
public bool DvbNipPrivateDataSpecifier(NipActualCarrierInformation currentCarrierInformation, DateTime versionUpdate,
|
||||||
uint privateDataSpecifier, List<string> privateDataSessions)
|
uint privateDataSpecifier, List<string> privateDataSessions)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
|||||||
using skyscraper5.Dvb.DataBroadcasting.SkyscraperVfs;
|
using skyscraper5.Dvb.DataBroadcasting.SkyscraperVfs;
|
||||||
using skyscraper8.DvbNip;
|
using skyscraper8.DvbNip;
|
||||||
using skyscraper8.Ietf.FLUTE;
|
using skyscraper8.Ietf.FLUTE;
|
||||||
|
using skyscraper8.Skyscraper.Drawing;
|
||||||
|
|
||||||
namespace skyscraper8.Skyscraper.Scraper.Storage
|
namespace skyscraper8.Skyscraper.Scraper.Storage
|
||||||
{
|
{
|
||||||
@ -77,5 +78,10 @@ namespace skyscraper8.Skyscraper.Scraper.Storage
|
|||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void StoreIqGraph(Guid jobGuid, long frequency, char polarity, IqChartData plot)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ using skyscraper5.Dvb.DataBroadcasting.SkyscraperVfs;
|
|||||||
using skyscraper5.Teletext;
|
using skyscraper5.Teletext;
|
||||||
using skyscraper8.DvbNip;
|
using skyscraper8.DvbNip;
|
||||||
using skyscraper8.Ietf.FLUTE;
|
using skyscraper8.Ietf.FLUTE;
|
||||||
|
using skyscraper8.Skyscraper.Drawing;
|
||||||
|
|
||||||
namespace skyscraper8.Skyscraper.Scraper.Storage
|
namespace skyscraper8.Skyscraper.Scraper.Storage
|
||||||
{
|
{
|
||||||
@ -25,5 +26,6 @@ namespace skyscraper8.Skyscraper.Scraper.Storage
|
|||||||
void Ping();
|
void Ping();
|
||||||
bool DvbNipTestForFile(string announcedFileContentLocation);
|
bool DvbNipTestForFile(string announcedFileContentLocation);
|
||||||
void DvbNipFileArrival(NipActualCarrierInformation carrier, FluteListener listener);
|
void DvbNipFileArrival(NipActualCarrierInformation carrier, FluteListener listener);
|
||||||
|
void StoreIqGraph(Guid jobGuid, long frequency, char polarity, IqChartData plot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user