Threw over the IQ data.

This commit is contained in:
feyris-tan 2025-07-27 18:30:01 +02:00
parent bc9bc35c5b
commit e140175289
9 changed files with 240 additions and 18 deletions

View File

@ -23,6 +23,7 @@ namespace skyscraper8.AnagramViewer.Handlers
public Image AsImage(Stream input)
{
IqChartData iqChartData = IqChartData.LoadFrom(input);
iqChartData.AutoScale();
Bitmap bitmap = new Bitmap(256, 256,PixelFormat.Format24bppRgb);
BitmapData bitmapData = bitmap.LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb);

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.42000
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace skyscraper8.AnagramViewer.Properties {
using System;
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("skyscraper8.AnagramViewer.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -2,7 +2,7 @@
"profiles": {
"skyscraper8.AnagramViewer": {
"commandName": "Project",
"commandLineArgs": "\"Y:\\data\\outputs\\txt2img-images\\2025-07-20\\00025-394627821.png\""
"commandLineArgs": "\"C:\\Users\\Sascha Schiemann\\source\\repos\\skyscraper8\\skyscraper8\\bin\\Debug\\net8.0\\iq.bin\""
}
}
}

View File

@ -12,4 +12,19 @@
<ProjectReference Include="..\..\skyscraper8\skyscraper8.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

View File

@ -41,10 +41,8 @@ namespace skyscraper5
class Program
{
private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name);
private static void IntegrationTest()
{
}
static void Main(string[] args)

View File

@ -24,6 +24,7 @@ namespace skyscraper8.Skyscraper.Drawing
public byte[][] IQ;
private List<byte[]> packets;
private byte progress;
private long totalSamples;
public static IqChartData Create()
{
@ -50,7 +51,13 @@ namespace skyscraper8.Skyscraper.Drawing
return result;
}
public bool IsComplete { get; private set; }
public bool IsComplete
{
get
{
return totalSamples >= 100000;
}
}
public void PushPacket(sbyte[] buffer)
@ -69,14 +76,11 @@ namespace skyscraper8.Skyscraper.Drawing
Console.WriteLine(progress);
}
}
else
{
IsComplete = true;
}
}
byte[] writableBuffer = Array.ConvertAll(buffer, x => (byte)x);
packets.Add(writableBuffer);
totalSamples += (buffer.Length / 2);
}
public void SaveTo(FileStream fs)
@ -88,5 +92,32 @@ namespace skyscraper8.Skyscraper.Drawing
fs.Write(packet, 0, packet.Length);
}
}
private bool scaled;
public void AutoScale()
{
if (scaled)
return;
if (progress == 255)
return;
double maxByte = byte.MaxValue;
double maxProgress = progress;
double scaleFactor = maxByte / maxProgress;
for (int x = 0; x < 256; x++)
{
for (int y = 0; y < 256; y++)
{
double currentValue = IQ[x][y];
currentValue *= scaleFactor;
if (currentValue > byte.MaxValue)
currentValue = byte.MaxValue;
IQ[x][y] = (byte)currentValue;
}
}
scaled = true;
}
}
}

View File

@ -497,12 +497,15 @@ namespace skyscraper5.Skyscraper.IO.RemoteStreamReader
public bool RFScan(int freq, int pol, int lof1, int lof2, int lofsw, out double pRFLevel)
{
NetworkStreamExtensions.WriteUInt32BE(TcpStream, (uint)RemoteStreamReaderConstants.REQUEST_RF_SCAN);
TcpStream.WriteInt32BE(freq);
TcpStream.WriteInt32BE(pol);
TcpStream.WriteInt32BE(lof1);
TcpStream.WriteInt32BE(lof2);
TcpStream.WriteInt32BE(lofsw);
byte[] cmdBuffer = new byte[24];
MemoryStream cmdStream = new MemoryStream(cmdBuffer, 0, 24, true);
cmdStream.WriteUInt32BE((uint)RemoteStreamReaderConstants.REQUEST_RF_SCAN);
cmdStream.WriteInt32BE(freq);
cmdStream.WriteInt32BE(pol);
cmdStream.WriteInt32BE(lof1);
cmdStream.WriteInt32BE(lof2);
cmdStream.WriteInt32BE(lofsw);
TcpStream.Write(cmdBuffer, 0, 24);
TcpStream.Flush();
RemoteStreamReaderConstants result = (RemoteStreamReaderConstants)TcpStream.ReadUInt32BE();
@ -637,10 +640,12 @@ namespace skyscraper5.Skyscraper.IO.RemoteStreamReader
public bool IQScan(uint input, sbyte[] pIQ, uint num)
{
NetworkStreamExtensions.WriteUInt32BE(TcpStream, (uint)RemoteStreamReaderConstants.REQUEST_IQ_SCAN);
NetworkStreamExtensions.WriteUInt32BE(TcpStream, input);
NetworkStreamExtensions.WriteUInt32BE(TcpStream, num);
TcpStream.Flush();
byte[] cmdBuffer = new byte[12];
MemoryStream ms = new MemoryStream(cmdBuffer, 0, 12, true);
ms.WriteUInt32BE((uint)RemoteStreamReaderConstants.REQUEST_IQ_SCAN);
ms.WriteUInt32BE(input);
ms.WriteUInt32BE(num);
TcpStream.Write(cmdBuffer, 0, 12);
RemoteStreamReaderConstants result = (RemoteStreamReaderConstants)TcpStream.ReadUInt32BE();
switch (result)

View File

@ -205,6 +205,14 @@ namespace skyscraper5.Skyscraper.IO
stream.Write(buffer, 0, 2);
}
public static void WriteInt32BE(this Stream stream, int value)
{
byte[] buffer = BitConverter.GetBytes(value);
if (BitConverter.IsLittleEndian)
(buffer[0], buffer[1], buffer[2], buffer[3]) = (buffer[3], buffer[2], buffer[1], buffer[0]);
stream.Write(buffer, 0, 4);
}
public static void WriteUInt32BE(this Stream stream, uint value)
{
byte[] buffer = BitConverter.GetBytes(value);