Browse Source

2.8.0.163

2.8.0.179
Alex Paraskeva 1 year ago
parent
commit
78bd465e0d
  1. 16
      DXLOC.txt
  2. 1418063
      EN.dat
  3. 2
      FCCDATA.dat
  4. 9035
      SWL.csv
  5. 12
      SWL2.csv
  6. 6
      Source/Console/AssemblyInfo.cs
  7. 46
      Source/Console/CAT/CATCommands.cs
  8. 948
      Source/Console/CAT/SDRSerialPortII.cs
  9. 895
      Source/Console/CAT/SIOListenerII.cs
  10. 21
      Source/Console/DJConsoleUI/DJConsole.cs
  11. 66
      Source/Console/DiversityForm.cs
  12. 3
      Source/Console/DiversityForm.resx
  13. 2
      Source/Console/FWC/FLEX3000TestForm.cs
  14. 6
      Source/Console/FWC/FLEX3000TestForm.resx
  15. 35
      Source/Console/FWC/FLEX5000LLHWForm.cs
  16. 16
      Source/Console/FWC/FLEX5000LLHWForm.resx
  17. 613
      Source/Console/FWC/FLEX5000ProdTestForm.cs
  18. 14
      Source/Console/FWC/FLEX5000ProdTestForm.resx
  19. 22
      Source/Console/FWC/PreSelForm.Designer.cs
  20. 18
      Source/Console/FWC/PreSelForm.cs
  21. 6
      Source/Console/FWC/PreSelForm.resx
  22. 7
      Source/Console/FWC/fwcAntForm.cs
  23. 488
      Source/Console/FWC/fwcmixform.cs
  24. 100
      Source/Console/FWC/fwcmixform.resx
  25. 3
      Source/Console/GDF/GDFPage.cs
  26. 7
      Source/Console/Http.cs
  27. 16
      Source/Console/Invoke/textboxts.cs
  28. 50
      Source/Console/LegacyForm.Designer.cs
  29. 268
      Source/Console/Memory/MemoryForm.Designer.cs
  30. 49
      Source/Console/Memory/MemoryForm.cs
  31. 22
      Source/Console/Memory/MemoryForm.resx
  32. 8
      Source/Console/Memory/MemoryRecord.cs
  33. 32
      Source/Console/PowerSDR.csproj
  34. 2
      Source/Console/Properties/Resources.Designer.cs
  35. BIN
      Source/Console/Resources/VFOblueB.png
  36. BIN
      Source/Console/Resources/VFOred.png
  37. BIN
      Source/Console/Resources/black2.png
  38. BIN
      Source/Console/Resources/newvfo.png
  39. BIN
      Source/Console/Resources/red2.png
  40. BIN
      Source/Console/Resources/white2.png
  41. BIN
      Source/Console/Resources/yell2.png
  42. 14
      Source/Console/app.config
  43. 228
      Source/Console/audio.cs
  44. 6492
      Source/Console/console.cs
  45. 1671
      Source/Console/console.resx
  46. 65002
      Source/Console/console_small.cs
  47. 14868
      Source/Console/console_small.resx
  48. 2735
      Source/Console/display.cs
  49. 5
      Source/Console/dsp.cs
  50. 8
      Source/Console/dttsp.cs
  51. 31
      Source/Console/eqform.cs
  52. 4
      Source/Console/hid/FLEX1500DebugForm.cs
  53. 53
      Source/Console/hid/FLEX1500DebugForm.designer.cs
  54. 13
      Source/Console/hid/FLEX1500DebugForm.resx
  55. 180
      Source/Console/hid/hidAntForm.cs
  56. BIN
      Source/Console/images/splash8.png
  57. 2
      Source/Console/master.cs
  58. 74
      Source/Console/omnirig.cs
  59. 3
      Source/Console/packages.config
  60. 8
      Source/Console/parallel.cs
  61. 750
      Source/Console/scan.cs
  62. 4152
      Source/Console/setup.cs
  63. 167
      Source/Console/setup.resx
  64. 2244
      Source/Console/splash.resx
  65. 1116
      Source/Console/spot.cs
  66. 47
      Source/Console/spot.resx
  67. 2
      Source/Console/titlebar.cs
  68. 25
      Source/Console/ucbform.cs
  69. 25
      Source/Console/ucbform.resx
  70. 116
      Source/Console/wave.cs
  71. 2
      Source/Console/wizard.cs
  72. 49
      Source/Console/xvtr.cs
  73. 23
      Source/Console/xvtr.resx
  74. 7
      Source/DttSP/DttSP.vcxproj
  75. 36
      Source/DttSP/am_demod.c
  76. 607
      Source/DttSP/fftw3.h
  77. 23
      Source/DttSP/fm_demod.c
  78. 46
      Source/DttSP/noiseblanker.c
  79. 2
      Source/DttSP/noiseblanker.h
  80. 24
      Source/DttSP/sdr.c
  81. 2
      Source/DttSP/sdrexport.h
  82. 41
      Source/DttSP/update.c
  83. 3
      Source/PowerMate/PowerMate.vcxproj
  84. 2
      Source/PowerMate/PowerMate.vcxproj.filters
  85. 830
      Source/PowerSDR ke9ns Installer 2.8.0_2017.aip
  86. 10
      Source/PowerSDR.sln
  87. BIN
      bin/Debug/ADODB.dll
  88. BIN
      bin/Debug/AutoItX3.Assembly.dll
  89. 1073
      bin/Debug/AutoItX3.Assembly.xml
  90. BIN
      bin/Debug/AutoItX3.dll
  91. BIN
      bin/Debug/AutoItX3_x64.dll
  92. 4946
      bin/Debug/CATStructs.xml
  93. BIN
      bin/Debug/ControlzEx.dll
  94. BIN
      bin/Debug/ControlzEx.pdb
  95. BIN
      bin/Debug/DttSP.dll
  96. BIN
      bin/Debug/MahApps.Metro.dll
  97. BIN
      bin/Debug/MahApps.Metro.pdb
  98. 5549
      bin/Debug/MahApps.Metro.xml
  99. BIN
      bin/Debug/NAudio.Lame.dll
  100. BIN
      bin/Debug/NAudio.dll

16
DXLOC.txt

@ -206,6 +206,7 @@
"071","HD8","Galapagos Is.","SA","2.00S","92.00W","10","12","A","11-15-45","HC8,HD8","",""
"072","HI","Dominican Republic","NA","18.30N","70.00W","8","11","A","11-15-45","HI","",""
"074","YS","El Salvador","NA","14.00N","89.00W","7","11","A","11-15-45","YS,HU","",""
"074","HU","El Salvador","NA","14.00N","89.00W","7","11","A","11-15-45","YS,HU","",""
"075","4L","Georgia","AS","41.30N","45.00E","21","29","A","11-15-45","4L > 03-01-93,UF < 03-01-93,RF,R6F,4J5F,U6F,EK6F,EM6F,EN6F,EO6F,ER6F < 06-30-93,EX6F,EY6F,EZ6F,RK6F,EX8F,4J5F,UK6F,UK6O,UK6Q,UK6V","",""
"075","UF","Georgia","AS","41.30N","45.00E","21","29","A","11-15-45","4L > 03-01-93,UF < 03-01-93,RF,R6F,4J5F,U6F,EK6F,EM6F,EN6F,EO6F,ER6F < 06-30-93,EX6F,EY6F,EZ6F,RK6F,EX8F,4J5F,UK6F,UK6O,UK6Q,UK6V","",""
"075","R6F","Georgia","AS","41.30N","45.00E","21","29","A","11-15-45","4L > 03-01-93,UF < 03-01-93,RF,R6F,4J5F,U6F,EK6F,EM6F,EN6F,EO6F,ER6F < 06-30-93,EX6F,EY6F,EZ6F,RK6F,EX8F,4J5F,UK6F,UK6O,UK6Q,UK6V","",""
@ -223,6 +224,7 @@
"079","FG","Guadeloupe","NA","17.00N","62.00W","8","11","A","11-15-45","FG","",""
"079","TO2","Guadeloupe","NA","17.00N","62.00W","8","11","A","11-15-45","FG","",""
"079","TO3","Guadeloupe","NA","17.00N","62.00W","8","11","A","11-15-45","FG","",""
"079","TO7","Guadeloupe","NA","17.00N","62.00W","8","11","A","11-15-45","FG","",""
"080","HR","Honduras","NA","14.00N","87.00W","7","11","A","11-15-45","HR,HQ","",""
"080","HQ","Honduras","NA","14.00N","87.00W","7","11","A","11-15-45","HR,HQ","",""
"081","DL/D","Germany ","EU","51.41N","11.83E","14","28","D","07-17-73","DA,DB,DC,DD,DE,DF,DG,DH,DI,DJ,DK,DL,DM","",""
@ -489,6 +491,7 @@
"179","ER","Moldavia","EU","47.00N","29.00E","16","29","A","11-15-45","UO,RO,U5O,R5O,EK5O,EM5O,EN5O,EO5O,ER5O,EX5O,EY5O,EZ5O,RK5O,EU5O,UK5O,ER > 07-01-93","",""
"180","SV/A","Mount Athos","EU","40.12N","24.18E","20","28","A","11-15-45","SY1MA,SV1JG/A,SV2ASP/A,SV0GV/3,SY,SV/A","",""
"181","C8","Mozambique","AF","15.00S","41.00E","37","53","A","11-15-45","C8,C9 > 09-17-63","",""
"181","C9","Mozambique","AF","15.00S","41.00E","37","53","A","11-15-45","C8,C9 > 09-17-63","",""
"182","KP1","Navassa I.","NA","18.00N","75.00W","8","11","A","11-15-45","KP1,NP1,WP1","",""
"183","PK5","Borneo Netherlands","OC","6.00S","107.00E","28","54","D","05-01-63","PK5","",""
"184","JZ0","N. Guinea Netherlands","OC","4.52S","140.73E","28","51","D","04-30-63","JZ0","",""
@ -505,6 +508,8 @@
"193","KR6","Okinawa Ryukyu Is.","AS","26.5N","127.99E","25","45","D","05-16-72","KR6,KR8,JR6,KA6","",""
"194","7J1","Okino Tori-shima","AS","27.30N","141.00E","27","45","D","12-01-80","7J1","",""
"196","ZC6","Palestine","AS","32.00N","35.00E","20","39","D","07-01-68","ZC6,4X1","",""
"196","E44","Palestine","AS","32.00N","35.00E","20","39","D","07-01-68","ZC6,4X1","",""
"196","4X1","Palestine","AS","32.00N","35.00E","20","39","D","07-01-68","ZC6,4X1","",""
"197","KH5","Palmyra & Jarvis Is.","OC","6.00N","162.00W","31","61","A","11-15-45","KH5,WH5,AH5,NH5.KH5J,WH5J,AH5J,NH5J","",""
"198","P2/P","Papua Territory","OC","5.12S","145.36E","28","51","D","09-16-75","P2,VK9/P","",""
"199","3Y/P","Peter I I.","AN","68.50S","90.45W","12","72","A","11-15-45","3Y1EE,3Y0PI,3Y/P","",""
@ -528,6 +533,8 @@
"212","LZ","Bulgaria","EU","43.14N","25.83E","20","28","A","11-15-45","LZ","",""
"213","FJ","Saint Martin","NA","18.00N","63.00W","8","11","A","11-15-45","FS,FJ","",""
"213","FS","Saint Martin","NA","18.00N","63.00W","8","11","A","11-15-45","FS,FJ","",""
"213","TO0","Saint Martin","NA","18.00N","63.00W","8","11","A","11-15-45","FS,FJ","",""
"213","TO9","Saint Martin","NA","18.00N","63.00W","8","11","A","11-15-45","FS,FJ","",""
"214","TK","Corsica","EU","42.00N","9.00E","15","28","A","11-15-45","TK","",""
"215","5B","Cyprus","AS","34.94N","32.97E","20","39","A","11-15-45","5B,H2,C4,P3","",""
"215","H2","Cyprus","AS","34.94N","32.97E","20","39","A","11-15-45","5B,H2,C4,P3","",""
@ -1114,6 +1121,15 @@
"023","2","Blenheim Reef","AF","5.70S","72.00E","39","41","D","06-30-75","1/BR,2","",""
"227","F","France","EU","48.48N","2.18E","14","27","A","11-15-45","F,TO,TV,HW,TX,TH,HX,HY,TW,TM,TP,TQ","",""
"227","TM","France","EU","48.48N","2.18E","14","27","A","11-15-45","F,TO,TV,HW,TX,TH,HX,HY,TW,TM,TP,TQ","",""
"227","TO","France","EU","48.48N","2.18E","14","27","A","11-15-45","F,TO,TV,HW,TX,TH,HX,HY,TW,TM,TP,TQ","",""
"227","TV","France","EU","48.48N","2.18E","14","27","A","11-15-45","F,TO,TV,HW,TX,TH,HX,HY,TW,TM,TP,TQ","",""
"227","TH,"France","EU","48.48N","2.18E","14","27","A","11-15-45","F,TO,TV,HW,TX,TH,HX,HY,TW,TM,TP,TQ","",""
"227","HW","France","EU","48.48N","2.18E","14","27","A","11-15-45","F,TO,TV,HW,TX,TH,HX,HY,TW,TM,TP,TQ","",""
"227","TX","France","EU","48.48N","2.18E","14","27","A","11-15-45","F,TO,TV,HW,TX,TH,HX,HY,TW,TM,TP,TQ","",""
"227","HX","France","EU","48.48N","2.18E","14","27","A","11-15-45","F,TO,TV,HW,TX,TH,HX,HY,TW,TM,TP,TQ","",""
"227","TW","France","EU","48.48N","2.18E","14","27","A","11-15-45","F,TO,TV,HW,TX,TH,HX,HY,TW,TM,TP,TQ","",""
"227","TP","France","EU","48.48N","2.18E","14","27","A","11-15-45","F,TO,TV,HW,TX,TH,HX,HY,TW,TM,TP,TQ","",""
"227","TQ","France","EU","48.48N","2.18E","14","27","A","11-15-45","F,TO,TV,HW,TX,TH,HX,HY,TW,TM,TP,TQ","",""
"093","3","Geyser Reef","AF","12.00S","46.50E","39","53","D","02-28-78","1/GR,3","",""
"111","VK0","Heard I.","AF","53.00S","73.24E","39","68","A","11-15-45","VK0HI,VK0IR","",""
"050","X","Mexico","NA","19.40N","99.42W","6","10","A","11-15-45","XE,XF,4A,4B,4C,6D,6E,6F,6G,6H,6I,6J,XB,XA,XC,XD,XG,XH,XI","",""

1418063
EN.dat
File diff suppressed because it is too large
View File

2
FCCDATA.dat
File diff suppressed because it is too large
View File

9035
SWL.csv
File diff suppressed because it is too large
View File

12
SWL2.csv

@ -233,13 +233,11 @@ kHz:75;Time(UTC):93;Days:59;ITU:49;Station:201;Lng:49;Target:62;Remarks:135;P:35
4687;0000-2400;;USA;HFDL-Barrow;;AK;;1;;
5095;0000-2400;;CAN;Stanag 75l CAN;;CAN;;1;;
5200;0000-2400;;USA;DRM-USCG;;USA;;1;;
5330.5;0000-2400;;EU;ALE-EU;Afica;Mideast;;EU;;1;;
5330.5;0000-2400;;USA;ALE-USA;;USA;;1;;
5346.5;0000-2400;;USA;ALE-USA;;USA;;1;;
5346.5;0000-2400;;EU;ALE-EU;Afica;Mideast;;EU;;1;;
5357;0000-2400;;Wld;ALE-World;;Wld;;1;;
5371.5;0000-2400;;Wld;ALE-World;;Wld;;1;;
5403.5;0000-2400;;Wld;ALE-World;;Wld;;1;;
5330.5;0000-2400;;USA;60mCh1-USA;;USA;;1;;
5346.5;0000-2400;;USA;60mCh2-USA;;USA;;1;;
5357.0;0000-2400;;USA;60mCh3-USA;;USA;;1;;
5371.5;0000-2400;;USA;60mCh4-USA;;Wld;;1;;
5403.5;0000-2400;;USA;60mCh5-USA;;Wld;;1;;
5451;0000-2400;;GUM;HFDL-Agana;;GUM;;1;;
5508;0000-2400;;USA;HFDL-San Francisco;;CA;;1;;
5514;0000-2400;;USA;HFDL-Molokai;;HWA;;1;;

6
Source/Console/AssemblyInfo.cs

@ -40,7 +40,7 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("FlexRadio Systems")]
[assembly: AssemblyProduct("PowerSDR")]
[assembly: AssemblyCopyright("© 2003-2019 FlexRadio Systems. All rights reserved.")]
[assembly: AssemblyCopyright("© 2003-2020 FlexRadio Systems. All rights reserved.")]
[assembly: AssemblyTrademark("FlexRadio Systems")]
[assembly: AssemblyCulture("")]
@ -55,7 +55,7 @@ using System.Runtime.CompilerServices;
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("2.8.0.131")]
[assembly: AssemblyVersion("2.8.0.163")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
@ -85,5 +85,5 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
[assembly: AssemblyFileVersion("2.8.0.131")]
[assembly: AssemblyFileVersion("2.8.0.163")]

46
Source/Console/CAT/CATCommands.cs

@ -2257,8 +2257,9 @@ namespace PowerSDR
return parser.Error1;
}
//Sets or reads VFO A frequency
public string ZZFA(string s)
//Sets or reads VFO A frequency
public string ZZFA(string s)
{
if(s.Length == parser.nSet)
{
@ -2272,12 +2273,12 @@ namespace PowerSDR
f = f + Convert.ToInt32(console.setupForm.RttyOffsetLow);
s = AddLeadingZeros(f);
s = s.Insert(5, separator);
}
}
else
s = s.Insert(5, separator);
console.VFOAFreq = double.Parse(s);
return "";
return "";
}
else if(s.Length == parser.nGet)
{
@ -2638,6 +2639,8 @@ namespace PowerSDR
byte addr = byte.Parse(s.Substring(0,2),NumberStyles.HexNumber);
byte val = byte.Parse(s.Substring(2,2),NumberStyles.HexNumber);
FWC.FlexWire_WriteValue(addr, val);
return "";
}
@ -2659,6 +2662,7 @@ namespace PowerSDR
byte val1 = byte.Parse(s.Substring(2,2), NumberStyles.HexNumber);
byte val2 = byte.Parse(s.Substring(4,2), NumberStyles.HexNumber);
FWC.FlexWire_Write2Value(addr, val1, val2);
return "";
@ -3664,15 +3668,39 @@ namespace PowerSDR
{
if(s.Length == parser.nSet)
{
if(s == "0")
console.MON = false;
else if(s == "1")
console.MON = true;
console.chkMON.CheckedChanged -= console.chkMON_CheckedChanged; // ke9ns mod turn eventoff
if (s == "0") // ke9ns mod: .146
{
//console.MON = false;
console.chkMON.Checked = false;
console.chkMON.Text = "MON";
Audio.MON_PRE = 0; // turn off MON_PRE
}
else if (s == "1") // ke9ns mod: .146 set MON to MONpr (this is standard MON mode, expect now you can use this with AM/FM modes)
{
// console.MON = true;
console.chkMON.Checked = true;
console.chkMON.Text = "MONpr";
Audio.MON_PRE = 1; // turn ON MON_PRE
}
else if (s == "2") // ke9ns add: .146 set MON to MONps (flex 3000/5000 only)
{
// console.MON = true;
console.chkMON.Checked = true;
console.chkMON.Text = "MONps";
Audio.MON_PRE = 0; // turn ON MON_PRE
}
console.chkMON.CheckedChanged += console.chkMON_CheckedChanged; //ke9ns mod turn eventoff
Audio.MON = console.chkMON.Checked; // ke9ns tell audio routine MON is on or OFF
return "";
}
else if(s.Length == parser.nGet)
{
bool retval = console.MON;
bool retval = console.MON; // ke9ns: get console.chkMON status
if(retval)
return "1";
else

948
Source/Console/CAT/SDRSerialPortII.cs

@ -346,7 +346,953 @@ namespace PowerSDR
}
}
//CAT2
public class SDRSerialPort2
{
public static event SerialRXEventHandler serial_rx_event;
private SerialPort commPort;
public SerialPort BasePort
{
get { return commPort; }
}
private bool isOpen = false;
private bool bitBangOnly = false;
//Added 2/14/2008 BT
public bool IsOpen
{
get { return commPort.IsOpen; }
}
public void Open()
{
commPort.Open();
}
public void Close()
{
commPort.Close();
}
public static Parity StringToParity(string s)
{
if (s == "none") return Parity.None;
if (s == "odd") return Parity.Odd;
if (s == "even") return Parity.Even;
if (s == "space") return Parity.Space;
if (s == "mark") return Parity.Mark;
return Parity.None; // error -- default to none
}
public static StopBits StringToStopBits(string s)
{
if (s == "0") return StopBits.None;
if (s == "1") return StopBits.One;
if (s == "1.5") return StopBits.OnePointFive;
if (s == "2") return StopBits.Two;
return StopBits.One; // error -- default
}
public SDRSerialPort2(int portidx)
{
commPort = new SerialPort();
commPort.Encoding = System.Text.Encoding.ASCII;
commPort.RtsEnable = true; // hack for soft rock ptt
commPort.DtrEnable = true; // set dtr off
//commPort.ErrorReceived += new SerialErrorReceivedEventHandler(this.SerialErrorReceived);
commPort.DataReceived += new SerialDataReceivedEventHandler(this.SerialReceivedData);
commPort.PinChanged += new SerialPinChangedEventHandler(this.SerialPinChanged);
commPort.PortName = "COM" + portidx.ToString();
commPort.Parity = Parity.None;
commPort.StopBits = StopBits.One;
commPort.Handshake = Handshake.None;
commPort.DataBits = 8;
commPort.BaudRate = 9600;
commPort.ReadTimeout = 5000;
commPort.WriteTimeout = 500;
commPort.ReceivedBytesThreshold = 1;
}
// set the comm parms ... can only be done if port is not open -- silently fails if port is open (fixme -- add some error checking)
//
public void setCommParms(int baudrate, Parity p, int databits, StopBits stop, Handshake handshake)
{
if ( commPort.IsOpen ) return; // bail out if it's already open
commPort.BaudRate = baudrate;
commPort.Parity = p;
commPort.StopBits = stop;
commPort.DataBits = databits;
// commPort.Handshake = handshake;
}
public uint put(string s)
{
if ( bitBangOnly ) return 0; // fixme -- throw exception?
commPort.Write(s);
return (uint)s.Length; // wjt fixme -- hack -- we don't know if we actually wrote things
}
// ke9ns add
public string put1(string s)
{
string answer="---";
if (bitBangOnly) return answer; // fixme -- throw exception?
commPort.Write("AI1;");
try
{
byte[] test = new byte[10];
// var tes1 = commPort.Read(test, 0, 4);
// test[0] = commPort.ReadByte();
// answer = test.ToString();
// Debug.WriteLine("BEAM: " + test[0] + " , " + test[1] + " , " + test[2] + " , " + test[3]);
// answer = commPort.ReadExisting();
Debug.WriteLine("BEAM: " + answer);
// answer = System.Text.Encoding.Default.GetString(test);
}
catch (Exception e)
{
// Debug.WriteLine("BEAM: " + e);
answer = "===";
}
return answer; // wjt fixme -- hack -- we don't know if we actually wrote things
} // put1
public int Create()
{
return Create(false);
}
// create port
public int Create(bool bit_bang_only)
{
bitBangOnly = bit_bang_only;
if ( isOpen ){ return -1; }
commPort.Open();
isOpen = commPort.IsOpen;
if ( isOpen )
return 0; // all is well
else
return -1; //error
}
public void Destroy()
{
try
{
commPort.Close();
}
catch(Exception)
{
}
isOpen = false;
}
public bool isCTS()
{
if ( !isOpen ) return false; // fixme error check
return commPort.CtsHolding;
}
public bool isDSR()
{
if ( !isOpen ) return false; // fixme error check
return commPort.DsrHolding;
}
public bool isRI()
{
if ( !isOpen ) return false; // fixme error check
return false;
}
public bool isRLSD()
{
if ( !isOpen ) return false; // fixme error check
return commPort.CDHolding;
}
public void setDTR(bool v)
{
if ( !isOpen ) return;
commPort.DtrEnable = v;
}
void SerialErrorReceived(object source, SerialErrorReceivedEventArgs e)
{
}
private bool use_for_keyptt = false;
public bool UseForKeyPTT
{
get { return use_for_keyptt; }
set { use_for_keyptt = value; }
}
private bool use_for_paddles = false;
public bool UseForPaddles
{
get { return use_for_paddles; }
set { use_for_paddles = value; }
}
private bool ptt_on_dtr = false;
public bool PTTOnDTR
{
get { return ptt_on_dtr; }
set { ptt_on_dtr = value; }
}
private bool ptt_on_rts = false;
public bool PTTOnRTS
{
get { return ptt_on_rts; }
set { ptt_on_rts = value; }
}
private bool key_on_dtr = false;
public bool KeyOnDTR
{
get { return key_on_dtr; }
set { key_on_dtr = value; }
}
private bool key_on_rts = false;
public bool KeyOnRTS
{
get { return key_on_rts; }
set { key_on_rts = value; }
}
private static bool reverse_paddles = false;
public static bool ReversePaddles
{
get { return reverse_paddles; }
set { reverse_paddles = value; }
}
void SerialPinChanged(object source, SerialPinChangedEventArgs e)
{
if (!use_for_keyptt && !use_for_paddles) return;
if (use_for_keyptt)
{
switch (e.EventType)
{
case SerialPinChange.DsrChanged:
bool b = commPort.DsrHolding;
if (ptt_on_dtr)
{
CWPTTItem item = new CWPTTItem(b, CWSensorItem.GetCurrentTime());
CWKeyer.PTTEnqueue(item);
}
if (key_on_dtr)
{
CWSensorItem item = new CWSensorItem(CWSensorItem.InputType.StraightKey, b);
CWKeyer.SensorEnqueue(item);
}
break;
case SerialPinChange.CtsChanged:
b = commPort.CtsHolding;
if (ptt_on_rts)
{
CWPTTItem item = new CWPTTItem(b, CWSensorItem.GetCurrentTime());
CWKeyer.PTTEnqueue(item);
}
if (key_on_rts)
{
CWSensorItem item = new CWSensorItem(CWSensorItem.InputType.StraightKey, b);
CWKeyer.SensorEnqueue(item);
}
break;
}
}
else if (use_for_paddles)
{
switch (e.EventType)
{
case SerialPinChange.DsrChanged:
CWSensorItem.InputType type = CWSensorItem.InputType.Dot;
if (reverse_paddles) type = CWSensorItem.InputType.Dash;
CWSensorItem item = new CWSensorItem(type, commPort.DsrHolding);
CWKeyer.SensorEnqueue(item);
break;
case SerialPinChange.CtsChanged:
type = CWSensorItem.InputType.Dash;
if (reverse_paddles) type = CWSensorItem.InputType.Dot;
item = new CWSensorItem(type, commPort.CtsHolding);
CWKeyer.SensorEnqueue(item);
break;
}
}
}
void SerialReceivedData(object source, SerialDataReceivedEventArgs e)
{
serial_rx_event(this, new SerialRXEvent(commPort.ReadExisting()));
}
}
//CAT3
public class SDRSerialPort3
{
public static event SerialRXEventHandler serial_rx_event;
private SerialPort commPort;
public SerialPort BasePort
{
get { return commPort; }
}
private bool isOpen = false;
private bool bitBangOnly = false;
//Added 2/14/2008 BT
public bool IsOpen
{
get { return commPort.IsOpen; }
}
public void Open()
{
commPort.Open();
}
public void Close()
{
commPort.Close();
}
public static Parity StringToParity(string s)
{
if (s == "none") return Parity.None;
if (s == "odd") return Parity.Odd;
if (s == "even") return Parity.Even;
if (s == "space") return Parity.Space;
if (s == "mark") return Parity.Mark;
return Parity.None; // error -- default to none
}
public static StopBits StringToStopBits(string s)
{
if (s == "0") return StopBits.None;
if (s == "1") return StopBits.One;
if (s == "1.5") return StopBits.OnePointFive;
if (s == "2") return StopBits.Two;
return StopBits.One; // error -- default
}
public SDRSerialPort3(int portidx)
{
commPort = new SerialPort();
commPort.Encoding = System.Text.Encoding.ASCII;
commPort.RtsEnable = true; // hack for soft rock ptt
commPort.DtrEnable = true; // set dtr off
//commPort.ErrorReceived += new SerialErrorReceivedEventHandler(this.SerialErrorReceived);
commPort.DataReceived += new SerialDataReceivedEventHandler(this.SerialReceivedData);
commPort.PinChanged += new SerialPinChangedEventHandler(this.SerialPinChanged);
commPort.PortName = "COM" + portidx.ToString();
commPort.Parity = Parity.None;
commPort.StopBits = StopBits.One;
commPort.Handshake = Handshake.None;
commPort.DataBits = 8;
commPort.BaudRate = 9600;
commPort.ReadTimeout = 5000;
commPort.WriteTimeout = 500;
commPort.ReceivedBytesThreshold = 1;
}
// set the comm parms ... can only be done if port is not open -- silently fails if port is open (fixme -- add some error checking)
//
public void setCommParms(int baudrate, Parity p, int databits, StopBits stop, Handshake handshake)
{
if ( commPort.IsOpen ) return; // bail out if it's already open
commPort.BaudRate = baudrate;
commPort.Parity = p;
commPort.StopBits = stop;
commPort.DataBits = databits;
// commPort.Handshake = handshake;
}
public uint put(string s)
{
if ( bitBangOnly ) return 0; // fixme -- throw exception?
commPort.Write(s);
return (uint)s.Length; // wjt fixme -- hack -- we don't know if we actually wrote things
}
// ke9ns add
public string put1(string s)
{
string answer="---";
if (bitBangOnly) return answer; // fixme -- throw exception?
commPort.Write("AI1;");
try
{
byte[] test = new byte[10];
// var tes1 = commPort.Read(test, 0, 4);
// test[0] = commPort.ReadByte();
// answer = test.ToString();
// Debug.WriteLine("BEAM: " + test[0] + " , " + test[1] + " , " + test[2] + " , " + test[3]);
// answer = commPort.ReadExisting();
Debug.WriteLine("BEAM: " + answer);
// answer = System.Text.Encoding.Default.GetString(test);
}
catch (Exception e)
{
// Debug.WriteLine("BEAM: " + e);
answer = "===";
}
return answer; // wjt fixme -- hack -- we don't know if we actually wrote things
} // put1
public int Create()
{
return Create(false);
}
// create port
public int Create(bool bit_bang_only)
{
bitBangOnly = bit_bang_only;
if ( isOpen ){ return -1; }
commPort.Open();
isOpen = commPort.IsOpen;
if ( isOpen )
return 0; // all is well
else
return -1; //error
}
public void Destroy()
{
try
{
commPort.Close();
}
catch(Exception)
{
}
isOpen = false;
}
public bool isCTS()
{
if ( !isOpen ) return false; // fixme error check
return commPort.CtsHolding;
}
public bool isDSR()
{
if ( !isOpen ) return false; // fixme error check
return commPort.DsrHolding;
}
public bool isRI()
{
if ( !isOpen ) return false; // fixme error check
return false;
}
public bool isRLSD()
{
if ( !isOpen ) return false; // fixme error check
return commPort.CDHolding;
}
public void setDTR(bool v)
{
if ( !isOpen ) return;
commPort.DtrEnable = v;
}
void SerialErrorReceived(object source, SerialErrorReceivedEventArgs e)
{
}
private bool use_for_keyptt = false;
public bool UseForKeyPTT
{
get { return use_for_keyptt; }
set { use_for_keyptt = value; }
}
private bool use_for_paddles = false;
public bool UseForPaddles
{
get { return use_for_paddles; }
set { use_for_paddles = value; }
}
private bool ptt_on_dtr = false;
public bool PTTOnDTR
{
get { return ptt_on_dtr; }
set { ptt_on_dtr = value; }
}
private bool ptt_on_rts = false;
public bool PTTOnRTS
{
get { return ptt_on_rts; }
set { ptt_on_rts = value; }
}
private bool key_on_dtr = false;
public bool KeyOnDTR
{
get { return key_on_dtr; }
set { key_on_dtr = value; }
}
private bool key_on_rts = false;
public bool KeyOnRTS
{
get { return key_on_rts; }
set { key_on_rts = value; }
}
private static bool reverse_paddles = false;
public static bool ReversePaddles
{
get { return reverse_paddles; }
set { reverse_paddles = value; }
}
void SerialPinChanged(object source, SerialPinChangedEventArgs e)
{
if (!use_for_keyptt && !use_for_paddles) return;
if (use_for_keyptt)
{
switch (e.EventType)
{
case SerialPinChange.DsrChanged:
bool b = commPort.DsrHolding;
if (ptt_on_dtr)
{
CWPTTItem item = new CWPTTItem(b, CWSensorItem.GetCurrentTime());
CWKeyer.PTTEnqueue(item);
}
if (key_on_dtr)
{
CWSensorItem item = new CWSensorItem(CWSensorItem.InputType.StraightKey, b);
CWKeyer.SensorEnqueue(item);
}
break;
case SerialPinChange.CtsChanged:
b = commPort.CtsHolding;
if (ptt_on_rts)
{
CWPTTItem item = new CWPTTItem(b, CWSensorItem.GetCurrentTime());
CWKeyer.PTTEnqueue(item);
}
if (key_on_rts)
{
CWSensorItem item = new CWSensorItem(CWSensorItem.InputType.StraightKey, b);
CWKeyer.SensorEnqueue(item);
}
break;
}
}
else if (use_for_paddles)
{
switch (e.EventType)
{
case SerialPinChange.DsrChanged:
CWSensorItem.InputType type = CWSensorItem.InputType.Dot;
if (reverse_paddles) type = CWSensorItem.InputType.Dash;
CWSensorItem item = new CWSensorItem(type, commPort.DsrHolding);
CWKeyer.SensorEnqueue(item);
break;
case SerialPinChange.CtsChanged:
type = CWSensorItem.InputType.Dash;
if (reverse_paddles) type = CWSensorItem.InputType.Dot;
item = new CWSensorItem(type, commPort.CtsHolding);
CWKeyer.SensorEnqueue(item);
break;
}
}
}
void SerialReceivedData(object source, SerialDataReceivedEventArgs e)
{
serial_rx_event(this, new SerialRXEvent(commPort.ReadExisting()));
}
}
//CAT4
public class SDRSerialPort4
{
public static event SerialRXEventHandler serial_rx_event;
private SerialPort commPort;
public SerialPort BasePort
{
get { return commPort; }
}
private bool isOpen = false;
private bool bitBangOnly = false;
//Added 2/14/2008 BT
public bool IsOpen
{
get { return commPort.IsOpen; }
}
public void Open()
{
commPort.Open();
}
public void Close()
{
commPort.Close();
}
public static Parity StringToParity(string s)
{
if (s == "none") return Parity.None;
if (s == "odd") return Parity.Odd;
if (s == "even") return Parity.Even;
if (s == "space") return Parity.Space;
if (s == "mark") return Parity.Mark;
return Parity.None; // error -- default to none
}
public static StopBits StringToStopBits(string s)
{
if (s == "0") return StopBits.None;
if (s == "1") return StopBits.One;
if (s == "1.5") return StopBits.OnePointFive;
if (s == "2") return StopBits.Two;
return StopBits.One; // error -- default
}
public SDRSerialPort4(int portidx)
{
commPort = new SerialPort();
commPort.Encoding = System.Text.Encoding.ASCII;
commPort.RtsEnable = true; // hack for soft rock ptt
commPort.DtrEnable = true; // set dtr off
//commPort.ErrorReceived += new SerialErrorReceivedEventHandler(this.SerialErrorReceived);
commPort.DataReceived += new SerialDataReceivedEventHandler(this.SerialReceivedData);
commPort.PinChanged += new SerialPinChangedEventHandler(this.SerialPinChanged);
commPort.PortName = "COM" + portidx.ToString();
commPort.Parity = Parity.None;
commPort.StopBits = StopBits.One;
commPort.Handshake = Handshake.None;
commPort.DataBits = 8;
commPort.BaudRate = 9600;
commPort.ReadTimeout = 5000;
commPort.WriteTimeout = 500;
commPort.ReceivedBytesThreshold = 1;
}
// set the comm parms ... can only be done if port is not open -- silently fails if port is open (fixme -- add some error checking)
//
public void setCommParms(int baudrate, Parity p, int databits, StopBits stop, Handshake handshake)
{
if ( commPort.IsOpen ) return; // bail out if it's already open
commPort.BaudRate = baudrate;
commPort.Parity = p;
commPort.StopBits = stop;
commPort.DataBits = databits;
// commPort.Handshake = handshake;
}
public uint put(string s)
{
if ( bitBangOnly ) return 0; // fixme -- throw exception?
commPort.Write(s);
}
return (uint)s.Length; // wjt fixme -- hack -- we don't know if we actually wrote things
}
// ke9ns add
public string put1(string s)
{
string answer="---";
if (bitBangOnly) return answer; // fixme -- throw exception?
commPort.Write("AI1;");
try
{
byte[] test = new byte[10];
// var tes1 = commPort.Read(test, 0, 4);
// test[0] = commPort.ReadByte();
// answer = test.ToString();
// Debug.WriteLine("BEAM: " + test[0] + " , " + test[1] + " , " + test[2] + " , " + test[3]);
// answer = commPort.ReadExisting();
Debug.WriteLine("BEAM: " + answer);
// answer = System.Text.Encoding.Default.GetString(test);
}
catch (Exception e)
{
// Debug.WriteLine("BEAM: " + e);
answer = "===";
}
return answer; // wjt fixme -- hack -- we don't know if we actually wrote things
} // put1
public int Create()
{
return Create(false);
}
// create port
public int Create(bool bit_bang_only)
{
bitBangOnly = bit_bang_only;
if ( isOpen ){ return -1; }
commPort.Open();
isOpen = commPort.IsOpen;
if ( isOpen )
return 0; // all is well
else
return -1; //error
}
public void Destroy()
{
try
{
commPort.Close();
}
catch(Exception)
{
}
isOpen = false;
}
public bool isCTS()
{
if ( !isOpen ) return false; // fixme error check
return commPort.CtsHolding;
}
public bool isDSR()
{
if ( !isOpen ) return false; // fixme error check
return commPort.DsrHolding;
}
public bool isRI()
{
if ( !isOpen ) return false; // fixme error check
return false;
}
public bool isRLSD()
{
if ( !isOpen ) return false; // fixme error check
return commPort.CDHolding;
}
public void setDTR(bool v)
{
if ( !isOpen ) return;
commPort.DtrEnable = v;
}
void SerialErrorReceived(object source, SerialErrorReceivedEventArgs e)
{
}
private bool use_for_keyptt = false;
public bool UseForKeyPTT
{
get { return use_for_keyptt; }
set { use_for_keyptt = value; }
}
private bool use_for_paddles = false;
public bool UseForPaddles
{
get { return use_for_paddles; }
set { use_for_paddles = value; }
}
private bool ptt_on_dtr = false;
public bool PTTOnDTR
{
get { return ptt_on_dtr; }
set { ptt_on_dtr = value; }
}
private bool ptt_on_rts = false;
public bool PTTOnRTS
{
get { return ptt_on_rts; }
set { ptt_on_rts = value; }
}
private bool key_on_dtr = false;
public bool KeyOnDTR
{
get { return key_on_dtr; }
set { key_on_dtr = value; }
}
private bool key_on_rts = false;
public bool KeyOnRTS
{
get { return key_on_rts; }
set { key_on_rts = value; }
}
private static bool reverse_paddles = false;
public static bool ReversePaddles
{
get { return reverse_paddles; }
set { reverse_paddles = value; }
}
void SerialPinChanged(object source, SerialPinChangedEventArgs e)
{
if (!use_for_keyptt && !use_for_paddles) return;
if (use_for_keyptt)
{
switch (e.EventType)
{
case SerialPinChange.DsrChanged:
bool b = commPort.DsrHolding;
if (ptt_on_dtr)
{
CWPTTItem item = new CWPTTItem(b, CWSensorItem.GetCurrentTime());
CWKeyer.PTTEnqueue(item);
}
if (key_on_dtr)
{
CWSensorItem item = new CWSensorItem(CWSensorItem.InputType.StraightKey, b);
CWKeyer.SensorEnqueue(item);
}
break;
case SerialPinChange.CtsChanged:
b = commPort.CtsHolding;
if (ptt_on_rts)
{
CWPTTItem item = new CWPTTItem(b, CWSensorItem.GetCurrentTime());
CWKeyer.PTTEnqueue(item);
}
if (key_on_rts)
{
CWSensorItem item = new CWSensorItem(CWSensorItem.InputType.StraightKey, b);
CWKeyer.SensorEnqueue(item);
}
break;
}
}
else if (use_for_paddles)
{
switch (e.EventType)
{
case SerialPinChange.DsrChanged:
CWSensorItem.InputType type = CWSensorItem.InputType.Dot;
if (reverse_paddles) type = CWSensorItem.InputType.Dash;
CWSensorItem item = new CWSensorItem(type, commPort.DsrHolding);
CWKeyer.SensorEnqueue(item);
break;
case SerialPinChange.CtsChanged:
type = CWSensorItem.InputType.Dash;
if (reverse_paddles) type = CWSensorItem.InputType.Dot;
item = new CWSensorItem(type, commPort.CtsHolding);
CWKeyer.SensorEnqueue(item);
break;
}
}
}
void SerialReceivedData(object source, SerialDataReceivedEventArgs e)
{
serial_rx_event(this, new SerialRXEvent(commPort.ReadExisting()));
}
}
}

895
Source/Console/CAT/SIOListenerII.cs

@ -388,6 +388,901 @@ namespace PowerSDR
}
#endregion Events
}
//CAT2
public class SIO2ListenerII
{
#region Constructor
public SIO2ListenerII(Console c)
{
console = c;
console.Activated += new EventHandler(console_Activated);
console.Closing += new System.ComponentModel.CancelEventHandler(console_Closing);
parser = new CATParser(console);
//event handler for Serial RX Events
SDRSerialPort2.serial_rx_event += new SerialRXEventHandler(SerialRX2EventHandler);
if ( console.CAT2Enabled ) // if CAT is on, fire it up
{
try
{
enableCAT2();
}
catch ( Exception ex )
{
// fixme??? how cool is to to pop a msg box from an exception handler in a constructor ??
// seems ugly to me (wjt)
console.CAT2Enabled = false;
if ( console.setupForm != null )
{
console.setupForm.copyCAT2PropsToDialogVars(); // need to make sure the props on the setup page get reset
}
MessageBox.Show("Could not initialize CAT control. Exception was:\n\n " + ex.Message +
"\n\nCAT2 control has been disabled.", "Error Initializing CAT control",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
public void enableCAT2()
{
lock ( this )
{
if ( cat2_enabled ) return; // nothing to do already enabled
cat2_enabled = true;
}
Debug.WriteLine("==============CAT PORT OPEN");
int port_num = console.CAT2Port;
SIO2 = new SDRSerialPort2(port_num);
SIO2.setCommParms(console.CAT2BaudRate,
console.CAT2Parity,
console.CAT2DataBits,
console.CAT2StopBits,
console.CAT2Handshake);
Initialize();
}
public bool UseForKeyPTT
{
set
{
if(SIO2 != null)
SIO2.UseForKeyPTT = value;
}
}
public bool UseForPaddles
{
set
{
if (SIO2 != null)
SIO2.UseForPaddles = value;
}
}
public bool PTTOnDTR
{
set
{
if (SIO2 != null)
SIO2.PTTOnDTR = value;
}
}
public bool PTTOnRTS
{
set
{
if (SIO2 != null)
SIO2.PTTOnRTS = value;
}
}
public bool KeyOnDTR
{
set
{
if (SIO2 != null)
SIO2.KeyOnDTR = value;
}
}
public bool KeyOnRTS
{
set
{
if (SIO2 != null)
SIO2.KeyOnRTS = value;
}
}
// typically called when the end user has disabled CAT control through a UI element ... this
// closes the serial port and neutralized the listeners we have in place
public void disableCAT2()
{
lock ( this )
{
if ( !cat2_enabled ) return; /* nothing to do already disabled */
cat2_enabled = false;
}
Debug.WriteLine("==============CAT PORT CLOSED");
if ( SIO2 != null )
{
SIO2.Destroy();
SIO2 = null;
}
Fpass = true; // reset init flag
return;
}
#endregion Constructor
#region Variables
//HiPerfTimer testTimer1 = new HiPerfTimer();
//HiPerfTimer testTimer2 = new HiPerfTimer();
public SDRSerialPort2 SIO2;
Console console;
ASCIIEncoding AE = new ASCIIEncoding();
private bool Fpass = true;
private bool cat2_enabled = false; // is cat currently enabled by user?
// private System.Timers.Timer SIOMonitor;
CATParser parser;
// private int SIOMonitorCount = 0;
#endregion variables
#region Methods
private static void dbgWriteLine(string s)
{
#if(!DBG_PRINT)
Console.dbgWriteLine("SIO2Listener: " + s);
#endif
}
// Called when the console is activated for the first time.
private void Initialize()
{
if(Fpass)
{
SIO2.Create();
Fpass = false;
}
}
#if UseParser
private char[] ParseLeftover = null;
// segment incoming string into CAT commands ... handle leftovers from when we read a parial
//
private void ParseString(byte[] rxdata, uint count)
{
if ( count == 0 ) return; // nothing to do
int cmd_char_count = 0;
int left_over_char_count = ( ParseLeftover == null ? 0 : ParseLeftover.Length );
char[] cmd_chars = new char[count + left_over_char_count];
if ( ParseLeftover != null ) // seed with leftovers from last read
{
for ( int j = 0; j < left_over_char_count; j++ ) // wjt fixme ... use C# equiv of System.arraycopy
{
cmd_chars[cmd_char_count] = ParseLeftover[j];
++cmd_char_count;
}
ParseLeftover = null;
}
for ( int j = 0; j < count; j++ ) // while we have chars to play with
{
cmd_chars[cmd_char_count] = (char)rxdata[j];
++cmd_char_count;
if ( rxdata[j] == ';' ) // end of cmd -- parse it and execute it
{
string cmdword = new String(cmd_chars, 0, cmd_char_count);
dbgWriteLine("cmdword: >" + cmdword + "<");
// BT 06/08
string answer = parser.Get(cmdword);
byte[] out_string = AE.GetBytes(answer);
uint result = SIO.put(out_string, (uint) out_string.Length);
cmd_char_count = 0; // reset word counter
}
}
// when we get here have processed all of the incoming buffer, if there's anyting
// in cmd_chars we need to save it as we've not pulled a full command so we stuff
// it in leftover for the next time we come through
if ( cmd_char_count != 0 )
{
ParseLeftover = new char[cmd_char_count];
for ( int j = 0; j < cmd_char_count; j++ ) // wjt fixme ... C# equiv of Sytsem.arraycopy
{
ParseLeftover[j] = cmd_chars[j];
}
}
#if DBG_PRINT
if ( ParseLeftover != null)
{
dbgWriteLine("Leftover >" + new String(ParseLeftover) + "<");
}
#endif
return;
}
#endif
#endregion Methods
#region Events
private void console_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if ( SIO2 != null )
{
SIO2.Destroy();
}
}
private void console_Activated(object sender, EventArgs e)
{
if ( console.CAT2Enabled )
{
// Initialize(); // wjt enable CAT calls Initialize
enableCAT2();
}
}
StringBuilder CommBuffer = new StringBuilder();//""; //holds incoming serial data from the port
private void SerialRX2EventHandler(object source, SerialRXEvent e)
{
// SIOMonitor.Interval = 5000; // set the timer for 5 seconds
// SIOMonitor.Enabled = true; // start or restart the timer
//double T0 = 0.00;
//double T1 = 0.00;
//int bufferLen = 0;
CommBuffer.Append(e.buffer); // put the data in the string
if(parser != null) // is the parser instantiated
{
//bufferLen = CommBuffer.Length;
try
{
Regex rex = new Regex(".*?;"); //accept any string ending in ;
string answer;
uint result;
for(Match m = rex.Match(CommBuffer.ToString()); m.Success; m = m.NextMatch()) //loop thru the buffer and find matches
{
//testTimer1.Start();
answer = parser.Get(m.Value); //send the match to the parser
//testTimer1.Stop();
//T0 = testTimer1.DurationMsec;
//testTimer2.Start();
if(answer.Length > 0)
result = SIO2.put(answer); //send the answer to the serial port
//testTimer2.Stop();
//T1 = testTimer2.DurationMsec;
CommBuffer = CommBuffer.Replace(m.Value, "", 0, m.Length); //remove the match from the buffer
//Debug.WriteLine("Parser decode time for "+m.Value.ToString()+": "+T0.ToString()+ "ms");
//Debug.WriteLine("SIO send answer time: " + T1.ToString() + "ms");
//Debug.WriteLine("CommBuffer Length: " + bufferLen.ToString());
//if (bufferLen > 100)
//Debug.WriteLine("Buffer contents: "+CommBuffer.ToString());
}
}
catch(Exception)
{
//Add ex name to exception above to enable
//Debug.WriteLine("RX Event: "+ex.Message);
//Debug.WriteLine("RX Event: "+ex.StackTrace);
}
}
}
#endregion Events
}
//CAT3
public class SIO3ListenerII
{
#region Constructor
public SIO3ListenerII(Console c)
{
console = c;
console.Activated += new EventHandler(console_Activated);
console.Closing += new System.ComponentModel.CancelEventHandler(console_Closing);
parser = new CATParser(console);
//event handler for Serial RX Events
SDRSerialPort3.serial_rx_event += new SerialRXEventHandler(SerialRX3EventHandler);
if ( console.CAT3Enabled ) // if CAT is on, fire it up
{
try
{
enableCAT3();
}
catch ( Exception ex )
{
// fixme??? how cool is to to pop a msg box from an exception handler in a constructor ??
// seems ugly to me (wjt)
console.CAT3Enabled = false;
if ( console.setupForm != null )
{
console.setupForm.copyCAT3PropsToDialogVars(); // need to make sure the props on the setup page get reset
}
MessageBox.Show("Could not initialize CAT control. Exception was:\n\n " + ex.Message +
"\n\nCAT3 control has been disabled.", "Error Initializing CAT control",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
public void enableCAT3()
{
lock ( this )
{
if ( cat3_enabled ) return; // nothing to do already enabled
cat3_enabled = true;
}
Debug.WriteLine("==============CAT PORT OPEN");
int port_num = console.CAT3Port;
SIO3 = new SDRSerialPort3(port_num);
SIO3.setCommParms(console.CAT3BaudRate,
console.CAT3Parity,
console.CAT3DataBits,
console.CAT3StopBits,
console.CAT3Handshake);
Initialize();
}
public bool UseForKeyPTT
{
set
{
if(SIO3 != null)
SIO3.UseForKeyPTT = value;
}
}
public bool UseForPaddles
{
set
{
if (SIO3 != null)
SIO3.UseForPaddles = value;
}
}
public bool PTTOnDTR
{
set
{
if (SIO3 != null)
SIO3.PTTOnDTR = value;
}
}
public bool PTTOnRTS
{
set
{
if (SIO3 != null)
SIO3.PTTOnRTS = value;
}
}
public bool KeyOnDTR
{
set
{
if (SIO3 != null)
SIO3.KeyOnDTR = value;
}
}
public bool KeyOnRTS
{
set
{
if (SIO3 != null)
SIO3.KeyOnRTS = value;
}
}
// typically called when the end user has disabled CAT control through a UI element ... this
// closes the serial port and neutralized the listeners we have in place
public void disableCAT3()
{
lock ( this )
{
if ( !cat3_enabled ) return; /* nothing to do already disabled */