This commit is contained in:
Kurt Moraw
2020-11-05 19:11:57 +01:00
parent f72c347e30
commit caff38495d
73 changed files with 21836 additions and 225449 deletions
Binary file not shown.
+169 -33
View File
@@ -71,7 +71,14 @@
this.bt_file_html = new System.Windows.Forms.Button();
this.bt_file_ascii = new System.Windows.Forms.Button();
this.tabPage5 = new System.Windows.Forms.TabPage();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.cb_audioCAP = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.cb_audioPB = new System.Windows.Forms.ComboBox();
this.bt_resetmodem = new System.Windows.Forms.Button();
this.tb_shutdown = new System.Windows.Forms.TextBox();
this.bt_shutdown = new System.Windows.Forms.Button();
this.cb_savegoodfiles = new System.Windows.Forms.CheckBox();
this.cb_stampcall = new System.Windows.Forms.CheckBox();
@@ -80,6 +87,9 @@
this.cb_speed = new System.Windows.Forms.ComboBox();
this.label_speed = new System.Windows.Forms.Label();
this.timer_searchmodem = new System.Windows.Forms.Timer(this.components);
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.statusStrip1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
@@ -89,6 +99,9 @@
this.tabControl1.SuspendLayout();
this.tabPage3.SuspendLayout();
this.tabPage5.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.SuspendLayout();
//
// timer_udpTX
@@ -498,12 +511,9 @@
//
// tabPage5
//
this.tabPage5.Controls.Add(this.textBox1);
this.tabPage5.Controls.Add(this.bt_shutdown);
this.tabPage5.Controls.Add(this.cb_savegoodfiles);
this.tabPage5.Controls.Add(this.cb_stampcall);
this.tabPage5.Controls.Add(this.tb_callsign);
this.tabPage5.Controls.Add(this.label1);
this.tabPage5.Controls.Add(this.groupBox4);
this.tabPage5.Controls.Add(this.groupBox3);
this.tabPage5.Controls.Add(this.groupBox2);
this.tabPage5.Location = new System.Drawing.Point(4, 22);
this.tabPage5.Name = "tabPage5";
this.tabPage5.Size = new System.Drawing.Size(1291, 553);
@@ -511,22 +521,91 @@
this.tabPage5.Text = "Setup";
this.tabPage5.UseVisualStyleBackColor = true;
//
// textBox1
// textBox3
//
this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textBox1.ForeColor = System.Drawing.Color.Red;
this.textBox1.Location = new System.Drawing.Point(379, 78);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(259, 55);
this.textBox1.TabIndex = 5;
this.textBox1.Text = "before switching off the modem SBC\r\nclick here to avoid defective SD-cards.\r\nWAIT" +
" 1 minute before powering OFF the modem.";
this.textBox3.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBox3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textBox3.ForeColor = System.Drawing.Color.Black;
this.textBox3.Location = new System.Drawing.Point(138, 73);
this.textBox3.Multiline = true;
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(177, 19);
this.textBox3.TabIndex = 12;
this.textBox3.Text = "(HDMI is usually not used)";
//
// textBox2
//
this.textBox2.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textBox2.ForeColor = System.Drawing.Color.Black;
this.textBox2.Location = new System.Drawing.Point(189, 48);
this.textBox2.Multiline = true;
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(126, 50);
this.textBox2.TabIndex = 11;
this.textBox2.Text = "in case the RX has sync\r\nproblems, it can be\r\nre-initialized here.";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(12, 50);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(112, 13);
this.label4.TabIndex = 10;
this.label4.Text = "Audio Record Device:";
//
// cb_audioCAP
//
this.cb_audioCAP.FormattingEnabled = true;
this.cb_audioCAP.Location = new System.Drawing.Point(138, 46);
this.cb_audioCAP.Name = "cb_audioCAP";
this.cb_audioCAP.Size = new System.Drawing.Size(230, 21);
this.cb_audioCAP.TabIndex = 9;
this.cb_audioCAP.Text = "Default";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 23);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(121, 13);
this.label3.TabIndex = 8;
this.label3.Text = "Audio Playback Device:";
//
// cb_audioPB
//
this.cb_audioPB.FormattingEnabled = true;
this.cb_audioPB.Location = new System.Drawing.Point(138, 19);
this.cb_audioPB.Name = "cb_audioPB";
this.cb_audioPB.Size = new System.Drawing.Size(230, 21);
this.cb_audioPB.TabIndex = 7;
this.cb_audioPB.Text = "Default";
//
// bt_resetmodem
//
this.bt_resetmodem.Location = new System.Drawing.Point(189, 19);
this.bt_resetmodem.Name = "bt_resetmodem";
this.bt_resetmodem.Size = new System.Drawing.Size(117, 23);
this.bt_resetmodem.TabIndex = 6;
this.bt_resetmodem.Text = "Reset RX Modem";
this.bt_resetmodem.UseVisualStyleBackColor = true;
this.bt_resetmodem.Click += new System.EventHandler(this.bt_resetmodem_Click);
//
// tb_shutdown
//
this.tb_shutdown.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.tb_shutdown.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tb_shutdown.ForeColor = System.Drawing.Color.Red;
this.tb_shutdown.Location = new System.Drawing.Point(17, 48);
this.tb_shutdown.Multiline = true;
this.tb_shutdown.Name = "tb_shutdown";
this.tb_shutdown.Size = new System.Drawing.Size(155, 50);
this.tb_shutdown.TabIndex = 5;
this.tb_shutdown.Text = "before switching off the \r\nmodem SBC click here to \r\navoid defective SD-cards.\r\n";
//
// bt_shutdown
//
this.bt_shutdown.Location = new System.Drawing.Point(379, 49);
this.bt_shutdown.Location = new System.Drawing.Point(17, 19);
this.bt_shutdown.Name = "bt_shutdown";
this.bt_shutdown.Size = new System.Drawing.Size(155, 23);
this.bt_shutdown.TabIndex = 4;
@@ -539,7 +618,7 @@
this.cb_savegoodfiles.AutoSize = true;
this.cb_savegoodfiles.Checked = true;
this.cb_savegoodfiles.CheckState = System.Windows.Forms.CheckState.Checked;
this.cb_savegoodfiles.Location = new System.Drawing.Point(106, 136);
this.cb_savegoodfiles.Location = new System.Drawing.Point(71, 90);
this.cb_savegoodfiles.Name = "cb_savegoodfiles";
this.cb_savegoodfiles.Size = new System.Drawing.Size(159, 17);
this.cb_savegoodfiles.TabIndex = 3;
@@ -551,7 +630,7 @@
this.cb_stampcall.AutoSize = true;
this.cb_stampcall.Checked = true;
this.cb_stampcall.CheckState = System.Windows.Forms.CheckState.Checked;
this.cb_stampcall.Location = new System.Drawing.Point(106, 113);
this.cb_stampcall.Location = new System.Drawing.Point(71, 67);
this.cb_stampcall.Name = "cb_stampcall";
this.cb_stampcall.Size = new System.Drawing.Size(146, 17);
this.cb_stampcall.TabIndex = 2;
@@ -561,7 +640,7 @@
// tb_callsign
//
this.tb_callsign.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.tb_callsign.Location = new System.Drawing.Point(106, 49);
this.tb_callsign.Location = new System.Drawing.Point(71, 28);
this.tb_callsign.Name = "tb_callsign";
this.tb_callsign.Size = new System.Drawing.Size(151, 20);
this.tb_callsign.TabIndex = 1;
@@ -569,7 +648,7 @@
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(49, 52);
this.label1.Location = new System.Drawing.Point(14, 31);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(46, 13);
this.label1.TabIndex = 0;
@@ -579,19 +658,21 @@
//
this.cb_speed.FormattingEnabled = true;
this.cb_speed.Items.AddRange(new object[] {
"3000 QPSK BW: 1800 Hz ",
"3150 QPSK BW: 1900 Hz ",
"3675 QPSK BW: 2200 Hz ",
"3000 QPSK BW: 1700 Hz ",
"3150 QPSK BW: 1800 Hz ",
"3675 QPSK BW: 2100 Hz ",
"4000 QPSK BW: 2400 Hz ",
"4410 QPSK BW: 2700 Hz (default QO-100)",
"4800 QPSK BW: 2900 Hz (experimental)",
"4410 QPSK BW: 2500 Hz (QO-100)",
"4800 QPSK BW: 2700 Hz",
"5500 8PSK BW: 2300 Hz",
"6000 8PSK BW: 2500 Hz (QO-100 beacon)"});
"6000 8PSK BW: 2500 Hz (QO-100)",
"6600 8PSK BW: 2600 Hz",
"7200 8PSK BW: 2700 Hz"});
this.cb_speed.Location = new System.Drawing.Point(636, 644);
this.cb_speed.Name = "cb_speed";
this.cb_speed.Size = new System.Drawing.Size(324, 21);
this.cb_speed.TabIndex = 11;
this.cb_speed.Text = "4410 QPSK BW: 2700 Hz (default QO-100)";
this.cb_speed.Text = "4410 QPSK BW: 2500 Hz (QO-100)";
this.cb_speed.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
//
// label_speed
@@ -608,6 +689,46 @@
this.timer_searchmodem.Interval = 1000;
this.timer_searchmodem.Tick += new System.EventHandler(this.timer_searchmodem_Tick);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.tb_callsign);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Controls.Add(this.cb_stampcall);
this.groupBox2.Controls.Add(this.cb_savegoodfiles);
this.groupBox2.Location = new System.Drawing.Point(12, 13);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(384, 126);
this.groupBox2.TabIndex = 13;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Personal Settings";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.cb_audioPB);
this.groupBox3.Controls.Add(this.label3);
this.groupBox3.Controls.Add(this.textBox3);
this.groupBox3.Controls.Add(this.cb_audioCAP);
this.groupBox3.Controls.Add(this.label4);
this.groupBox3.Location = new System.Drawing.Point(12, 146);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(384, 107);
this.groupBox3.TabIndex = 14;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Transceiver Audio";
//
// groupBox4
//
this.groupBox4.Controls.Add(this.bt_shutdown);
this.groupBox4.Controls.Add(this.tb_shutdown);
this.groupBox4.Controls.Add(this.bt_resetmodem);
this.groupBox4.Controls.Add(this.textBox2);
this.groupBox4.Location = new System.Drawing.Point(12, 259);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(384, 105);
this.groupBox4.TabIndex = 15;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Maintenance";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -622,7 +743,7 @@
this.ForeColor = System.Drawing.SystemColors.ControlText;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Form1";
this.Text = "QO-100 NB Transponder HS Transmission AMSAT-DL V0.1 by DJ0ABR";
this.Text = "QO-100 NB Transponder HS Transmission AMSAT-DL V0.2 by DJ0ABR";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
@@ -637,7 +758,12 @@
this.tabPage3.ResumeLayout(false);
this.tabPage3.PerformLayout();
this.tabPage5.ResumeLayout(false);
this.tabPage5.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -693,8 +819,18 @@
private System.Windows.Forms.Label label1;
private System.Windows.Forms.CheckBox cb_stampcall;
private System.Windows.Forms.CheckBox cb_savegoodfiles;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox tb_shutdown;
private System.Windows.Forms.Button bt_shutdown;
private System.Windows.Forms.Button bt_resetmodem;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ComboBox cb_audioCAP;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox cb_audioPB;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.GroupBox groupBox2;
}
}
+139 -39
View File
@@ -52,7 +52,11 @@ namespace oscardata
OperatingSystem osversion = System.Environment.OSVersion;
statics.OSversion = osversion.Platform.ToString();
if (osversion.VersionString.Contains("indow"))
{
statics.ostype = 0;
tb_shutdown.Visible = false;
bt_shutdown.Visible = false;
}
else
statics.ostype = 1; // Linux
@@ -90,8 +94,8 @@ namespace oscardata
{
if (Udp.GetBufferCount() > 3) return;
Byte[] txdata = new byte[statics.PayloadLen+2];
Byte[] txdata = new byte[statics.PayloadLen + 2];
txdata[0] = (Byte)statics.BERtest; // BER Test Marker
txdata[1] = frameinfo;
@@ -173,6 +177,22 @@ namespace oscardata
comboBox1_SelectedIndexChanged(null, null); // send speed to modem
}
}
if (statics.GotAudioDevices == 1)
{
statics.GotAudioDevices = 2;
// populate combo boxes
foreach (String s in statics.AudioPBdevs)
{
if(s.Length > 1)
cb_audioPB.Items.Add(s);
}
foreach (String s in statics.AudioCAPdevs)
{
if (s.Length > 1)
cb_audioCAP.Items.Add(s);
}
}
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
@@ -188,6 +208,7 @@ namespace oscardata
int speed;
int tmpnum = 0;
int file_lostframes = 0;
int last_fileid = 0;
private void timer_udprx_Tick(object sender, EventArgs e)
{
while (true)
@@ -246,7 +267,11 @@ namespace oscardata
//Console.WriteLine("first, single");
rxdata = ArraySend.GetAndRemoveHeader(rxdata);
if (rxdata == null) return;
if (last_fileid == ArraySend.FileID) return; // got first frame for this ID already
last_fileid = ArraySend.FileID;
}
else
last_fileid = 0;
// collect all received data into zip_RXtempfilename
Byte[] ba = null;
@@ -280,6 +305,11 @@ namespace oscardata
// reduce for the real file length
Byte[] fc = File.ReadAllBytes(statics.zip_RXtempfilename);
Byte[] fdst = new byte[ArraySend.FileSize];
if(fc.Length < ArraySend.FileSize)
{
Console.WriteLine("len=" + fc.Length + " fz=" + ArraySend.FileSize);
return;
}
Array.Copy(fc, 0, fdst, 0, ArraySend.FileSize);
File.WriteAllBytes(statics.zip_RXtempfilename, fdst);
@@ -330,8 +360,11 @@ namespace oscardata
if (minfo == statics.FirstFrame)
{
rxdata = ArraySend.GetAndRemoveHeader(rxdata);
if (rxdata == null) return;
if (last_fileid == ArraySend.FileID) return; // got first frame for this ID already
last_fileid = ArraySend.FileID;
}
else
last_fileid = 0;
Byte[] ba = null;
Byte[] nba;
@@ -410,8 +443,11 @@ namespace oscardata
{
//Console.WriteLine("first, single");
rxdata = ArraySend.GetAndRemoveHeader(rxdata);
if (rxdata == null) return;
if (last_fileid == ArraySend.FileID) return; // got first frame for this ID already
last_fileid = ArraySend.FileID;
}
else
last_fileid = 0;
// collect all received data into zip_RXtempfilename
Byte[] ba = null;
@@ -445,6 +481,12 @@ namespace oscardata
// reduce for the real file length
Byte[] fc = File.ReadAllBytes(statics.zip_RXtempfilename);
Byte[] fdst = new byte[ArraySend.FileSize];
if (fc.Length < ArraySend.FileSize)
{
Console.WriteLine("len=" + fc.Length + " fz=" + ArraySend.FileSize);
return;
}
Console.WriteLine("copy final binary file");
Array.Copy(fc, 0, fdst, 0, ArraySend.FileSize);
File.WriteAllBytes(statics.zip_RXtempfilename, fdst);
@@ -587,35 +629,24 @@ namespace oscardata
private void timer_qpsk_Tick(object sender, EventArgs e)
{
panel_constel.Invalidate();
if(Udp.IQavail())
panel_constel.Invalidate();
panel_txspectrum.Invalidate();
}
private void panel_constel_Paint(object sender, PaintEventArgs e)
{
Pen pen = new Pen(Brushes.LightGray);
e.Graphics.DrawEllipse(pen, 0, 0, panel_constel.Size.Width-1, panel_constel.Size.Height-1);
e.Graphics.DrawLine(pen, panel_constel.Size.Width / 2, 0, panel_constel.Size.Width / 2, panel_constel.Size.Height);
e.Graphics.DrawLine(pen, 0, panel_constel.Size.Height / 2, panel_constel.Size.Width, panel_constel.Size.Height/2);
while (true)
Bitmap bm = Udp.UdpBitmap();
if (bm != null)
{
qpskitem qi = Udp.UdpGetIQ();
if (qi == null) break;
Pen pen = new Pen(Brushes.LightGray);
e.Graphics.DrawEllipse(pen, 0, 0, panel_constel.Size.Width - 1, panel_constel.Size.Height - 1);
e.Graphics.DrawLine(pen, panel_constel.Size.Width / 2, 0, panel_constel.Size.Width / 2, panel_constel.Size.Height);
e.Graphics.DrawLine(pen, 0, panel_constel.Size.Height / 2, panel_constel.Size.Width, panel_constel.Size.Height / 2);
// re and im are in the range of +/- 2^24 (16777216)
// scale it to +/- 128
double fre = qi.re;
double fim = qi.im;
fre = fre * panel_constel.Size.Width / 2 / 16777216.0;
fim = fim * panel_constel.Size.Width / 2 / 16777216.0;
// scale it to the picture
int x = panel_constel.Size.Width / 2 + (int)fre - 2;
int y = panel_constel.Size.Height / 2 + (int)fim - 2;
e.Graphics.FillEllipse(Brushes.Blue, x, y, 2, 2);
e.Graphics.DrawImage(bm, 0, 0);
bm.Dispose();
}
}
@@ -959,6 +990,35 @@ namespace oscardata
else
line += " sequence OK";
int bits = rxframecounter * 258 * 8;
int bytes = rxframecounter * 258;
String sbit = "b";
String sbyt = "B";
if (bits > 1000)
{
bits /= 1000;
sbit = "kb";
}
if (bits > 1000)
{
bits /= 1000;
sbit = "Mb";
}
if (bytes > 1000)
{
bytes /= 1000;
sbyt = "kB";
}
if (bytes > 1000)
{
bytes /= 1000;
sbyt = "MB";
}
line += " " + bits.ToString() + " " + sbit + " " + bytes.ToString() + " " + sbyt;
line += " BER: " + string.Format("{0:#.##E+0}", ber); // ber.ToString("E3");
line += "\r\n";
@@ -1062,16 +1122,38 @@ namespace oscardata
return ip;
}
Byte getPBaudioDevice()
{
String s = cb_audioPB.Text;
Byte x = (Byte)cb_audioPB.Items.IndexOf(s);
//if (s.ToUpper() == "DEFAULT") x = 255;
return x;
}
Byte getCAPaudioDevice()
{
String s = cb_audioCAP.Text;
Byte x = (Byte)cb_audioCAP.Items.IndexOf(s);
//if (s.ToUpper() == "DEFAULT") x = 255;
return x;
}
/*
* search for the modem IP:
* send a search message (2 bytes) via UDP to port UdpBCport
* send a search message via UDP to port UdpBCport
* if a modem receives this message, it returns with an
* UDP message to UdpBCport containing a String with it's IP address
* this message also contains the selected Audio Devices
*/
private void search_modem()
{
Udp.UdpBCsend(new Byte[] { (Byte)0x3c }, GetMyBroadcastIP(), statics.UdpBCport_AppToModem);
Byte[] txb = new byte[3];
txb[0] = 0x3c; // ID of this message
txb[1] = getPBaudioDevice();
txb[2] = getCAPaudioDevice();
Udp.UdpBCsend(txb, GetMyBroadcastIP(), statics.UdpBCport_AppToModem);
Udp.searchtimeout++;
if (Udp.searchtimeout >= 3)
@@ -1161,6 +1243,8 @@ namespace oscardata
case 5: real_rate = 4800; break;
case 6: real_rate = 5525; break;
case 7: real_rate = 6000; break;
case 8: real_rate = 6615; break;
case 9: real_rate = 7200; break;
}
statics.setDatarate(real_rate);
@@ -1211,17 +1295,6 @@ namespace oscardata
}
/// <summary>
// TEST ONLY: tell modem to send a file
private void button1_Click(object sender, EventArgs e)
{
Byte[] txdata = new byte[statics.PayloadLen + 2];
txdata[0] = (Byte)statics.AutosendFile;
// and transmit it
Udp.UdpSend(txdata);
}
private void bt_openrxfile_Click(object sender, EventArgs e)
{
if (statics.ostype == 0)
@@ -1288,6 +1361,8 @@ namespace oscardata
cb_stampcall.Checked = (s == "1");
s = ReadString(sr);
cb_savegoodfiles.Checked = (s == "1");
cb_audioPB.Text = ReadString(sr);
cb_audioCAP.Text = ReadString(sr);
}
}
catch
@@ -1295,6 +1370,9 @@ namespace oscardata
tb_callsign.Text = "";
cb_speed.Text = "4000 QPSK BW: 2400 Hz (default QO-100)";
}
if (cb_audioPB.Text.Length <= 1) cb_audioPB.Text = "Default";
if (cb_audioCAP.Text.Length <= 1) cb_audioCAP.Text = "Default";
}
void save_Setup()
@@ -1307,6 +1385,8 @@ namespace oscardata
sw.WriteLine(cb_speed.Text);
sw.WriteLine(cb_stampcall.Checked?"1":"0");
sw.WriteLine(cb_savegoodfiles.Checked ? "1" : "0");
sw.WriteLine(cb_audioPB.Text);
sw.WriteLine(cb_audioCAP.Text);
}
}
catch { }
@@ -1326,5 +1406,25 @@ namespace oscardata
MessageBox.Show("Please wait abt. 1 minute before powering OFF the modem", "Shut Down Modem", MessageBoxButtons.OK);
}
}
/// <summary>
// TEST ONLY: tell modem to send a file
private void button1_Click(object sender, EventArgs e)
{
Byte[] txdata = new byte[statics.PayloadLen + 2];
txdata[0] = (Byte)statics.AutosendFile;
// and transmit it
Udp.UdpSend(txdata);
}
private void bt_resetmodem_Click(object sender, EventArgs e)
{
Byte[] txdata = new byte[statics.PayloadLen + 2];
txdata[0] = (Byte)statics.ResetModem;
// and transmit it
Udp.UdpSend(txdata);
}
}
}
Binary file not shown.
+4
View File
@@ -25,6 +25,7 @@ namespace oscardata
public static Byte AutosendFile = 17;
public static Byte AutosendFolder = 18;
public static Byte Modem_shutdown = 19;
public static Byte ResetModem = 20;
// frame sequence, modem needs that for i.e. sending a preamble
public static Byte FirstFrame = 0;
@@ -52,6 +53,9 @@ namespace oscardata
public static String RXimageStorage = "RXimages";
public static String OSversion = "";
public static int ostype = 0; // 0=Windows, 1=Linux
public static int GotAudioDevices = 0;
public static String[] AudioPBdevs;
public static String[] AudioCAPdevs;
public static void setDatarate(int rate)
{
+83 -16
View File
@@ -12,9 +12,11 @@
using System;
using System.Collections;
using System.Drawing;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Windows.Forms.VisualStyles;
namespace oscardata
{
@@ -91,6 +93,13 @@ namespace oscardata
{
statics.ModemIP = RemoteEndpoint.Address.ToString();
searchtimeout = 0;
// message b contains audio devices
String s = statics.ByteArrayToString(b);
String[] sa1 = s.Split(new char[] { '^' });
statics.AudioPBdevs = sa1[0].Split(new char[] { '~' });
statics.AudioCAPdevs = sa1[1].Split(new char[] { '~' });
if(statics.GotAudioDevices == 0)
statics.GotAudioDevices = 1;
}
// FFT data
@@ -108,10 +117,11 @@ namespace oscardata
lastb[0] = b[i];
// test if aligned
int re = 0, im = 0;
if (lastb[0] == 0 && lastb[1] == 0 && lastb[2] == 3 && lastb[3] == 0xe8)
{
// we are aligned to a re value
int re = lastb[4];
re = lastb[4];
re <<= 8;
re += lastb[5];
re <<= 8;
@@ -119,23 +129,18 @@ namespace oscardata
re <<= 8;
re += lastb[7];
int im = lastb[8];
im = lastb[8];
im <<= 8;
im += lastb[9];
im <<= 8;
im += lastb[10];
im <<= 8;
im += lastb[11];
qpskitem q = new qpskitem();
q.re = re;
q.im = im;
uq_iq.Add(q);
}
else if (lastb[0] == 0xe8 && lastb[1] == 3 && lastb[2] == 0 && lastb[3] == 0)
{
// we are aligned to a re value
int re = lastb[7];
re = lastb[7];
re <<= 8;
re += lastb[6];
re <<= 8;
@@ -143,19 +148,16 @@ namespace oscardata
re <<= 8;
re += lastb[4];
int im = lastb[11];
im = lastb[11];
im <<= 8;
im += lastb[10];
im <<= 8;
im += lastb[9];
im <<= 8;
im += lastb[8];
qpskitem q = new qpskitem();
q.re = re;
q.im = im;
uq_iq.Add(q);
}
drawBitmap(re, im);
}
}
}
@@ -164,6 +166,39 @@ namespace oscardata
}
}
static int panelw = 75, panelh = 75;
static int maxdrawanz = 250;
static int drawanz = 0;
static Bitmap bm;
static void drawBitmap(int re, int im)
{
if (re == 0 && im == 0) return;
if (++drawanz >= maxdrawanz && uq_iq.Count() <= 1)
{
drawanz = 0;
uq_iq.Add(bm);
bm = new Bitmap(75, 75);
}
using (Graphics gr = Graphics.FromImage(bm))
{
// re and im are in the range of +/- 2^24 (16777216)
// scale it to +/- 128
double fre = re;
double fim = im;
fre = fre * panelw / 2 / 16777216.0;
fim = fim * panelh / 2 / 16777216.0;
// scale it to the picture
int x = panelw / 2 + (int)fre;
int y = panelh / 2 + (int)fim;
int et = 1;
gr.FillEllipse(Brushes.Blue, x - et, y - et, et * 2, et * 2);
}
}
static AutoResetEvent autoEvent = new AutoResetEvent(false);
// Udp TX Loop runs in its own thread
@@ -265,6 +300,19 @@ namespace oscardata
return uq_iq.GetQPSKitem();
}
public static Bitmap UdpBitmap()
{
if (uq_iq.Count() == 0) return null;
return uq_iq.GetBitmap();
}
public static bool IQavail()
{
if (uq_iq.Count() == 0) return false;
return true;
}
}
// this class is a thread safe queue wich is used
@@ -289,13 +337,32 @@ namespace oscardata
}
}
public Byte [] Getarr()
public void Add(Bitmap bm)
{
lock (myQ.SyncRoot)
{
myQ.Enqueue(bm);
}
}
public Bitmap GetBitmap()
{
Bitmap b;
lock (myQ.SyncRoot)
{
b = (Bitmap)myQ.Dequeue();
}
return b;
}
public Byte[] Getarr()
{
Byte[] b;
lock (myQ.SyncRoot)
{
b = (Byte [])myQ.Dequeue();
b = (Byte[])myQ.Dequeue();
}
return b;
}
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff