Фиксация изменений, теперь тесты работы аппаратуры

2.8.0.169
US1GHQ 2020-07-08 22:56:19 +03:00
parent 20095251f8
commit 0cf3644c77
7 changed files with 3267 additions and 79878 deletions

View File

@ -2263,10 +2263,12 @@ namespace PowerSDR
{
if(s.Length == parser.nSet)
{
if(console.setupForm.RttyOffsetEnabledA && (console.RX1DSPMode == DSPMode.DIGU || console.RX1DSPMode == DSPMode.DIGL))
if(console.setupForm.RttyOffsetEnabledA &&
(console.RX1DSPMode == DSPMode.DIGU || console.RX1DSPMode == DSPMode.DIGL))
{
int f = int.Parse(s);
if(console.RX1DSPMode == DSPMode.DIGU) f = f - Convert.ToInt32(console.setupForm.RttyOffsetHigh);
if(console.RX1DSPMode == DSPMode.DIGU)
f = f - Convert.ToInt32(console.setupForm.RttyOffsetHigh);
else if(console.RX1DSPMode == DSPMode.DIGL)
f = f + Convert.ToInt32(console.setupForm.RttyOffsetLow);
s = AddLeadingZeros(f);

View File

@ -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()));
}
}
}

View File

@ -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 */
cat3_enabled = false;
}
Debug.WriteLine("==============CAT PORT CLOSED");
if ( SIO3 != null )
{
SIO3.Destroy();
SIO3 = null;
}
Fpass = true; // reset init flag
return;
}
#endregion Constructor
#region Variables
//HiPerfTimer testTimer1 = new HiPerfTimer();
//HiPerfTimer testTimer2 = new HiPerfTimer();
public SDRSerialPort3 SIO3;
Console console;
ASCIIEncoding AE = new ASCIIEncoding();
private bool Fpass = true;
private bool cat3_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("SIO3Listener: " + s);
#endif
}
// Called when the console is activated for the first time.
private void Initialize()
{
if(Fpass)
{
SIO3.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 ( SIO3 != null )
{
SIO3.Destroy();
}
}
private void console_Activated(object sender, EventArgs e)
{
if ( console.CAT3Enabled )
{
// Initialize(); // wjt enable CAT calls Initialize
enableCAT3();
}
}
StringBuilder CommBuffer = new StringBuilder();//""; //holds incoming serial data from the port
private void SerialRX3EventHandler(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 = SIO3.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
}
//CAT4
public class SIO4ListenerII
{
#region Constructor
public SIO4ListenerII(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.CAT4Enabled ) // if CAT is on, fire it up
{
try
{
enableCAT4();
}
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.CAT4Enabled = false;
if ( console.setupForm != null )
{
console.setupForm.copyCAT4PropsToDialogVars(); // 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\nCAT4 control has been disabled.", "Error Initializing CAT control",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
public void enableCAT4()
{
lock ( this )
{
if ( cat4_enabled ) return; // nothing to do already enabled
cat4_enabled = true;
}
Debug.WriteLine("==============CAT PORT OPEN");
int port_num = console.CAT4Port;
SIO4 = new SDRSerialPort2(port_num);
SIO4.setCommParms(console.CAT4BaudRate,
console.CAT4Parity,
console.CAT4DataBits,
console.CAT4StopBits,
console.CAT4Handshake);
Initialize();
}
public bool UseForKeyPTT
{
set
{
if(SIO4 != null)
SIO4.UseForKeyPTT = value;
}
}
public bool UseForPaddles
{
set
{
if (SIO4 != null)
SIO4.UseForPaddles = value;
}
}
public bool PTTOnDTR
{
set
{
if (SIO4 != null)
SIO4.PTTOnDTR = value;
}
}
public bool PTTOnRTS
{
set
{
if (SIO4 != null)
SIO4.PTTOnRTS = value;
}
}
public bool KeyOnDTR
{
set
{
if (SIO4 != null)
SIO4.KeyOnDTR = value;
}
}
public bool KeyOnRTS
{
set
{
if (SIO4 != null)
SIO4.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 disableCAT4()
{
lock ( this )
{
if ( !cat4_enabled ) return; /* nothing to do already disabled */
cat4_enabled = false;
}
Debug.WriteLine("==============CAT PORT CLOSED");
if ( SIO4 != null )
{
SIO4.Destroy();
SIO4 = null;
}
Fpass = true; // reset init flag
return;
}
#endregion Constructor
#region Variables
//HiPerfTimer testTimer1 = new HiPerfTimer();
//HiPerfTimer testTimer2 = new HiPerfTimer();
public SDRSerialPort2 SIO4;
Console console;
ASCIIEncoding AE = new ASCIIEncoding();
private bool Fpass = true;
private bool cat4_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("SIO4Listener: " + s);
#endif
}
// Called when the console is activated for the first time.
private void Initialize()
{
if(Fpass)
{
SIO4.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 ( SIO4 != null )
{
SIO4.Destroy();
}
}
private void console_Activated(object sender, EventArgs e)
{
if ( console.CAT4Enabled )
{
// Initialize(); // wjt enable CAT calls Initialize
enableCAT4();
}
}
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 = SIO4.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
}
}

View File

@ -974,6 +974,9 @@ namespace PowerSDR
public DSP dsp;
private SIOListenerII siolisten = null;
private SIO2ListenerII sio2listen = null;
private SIO3ListenerII sio3listen = null;
private SIO4ListenerII sio4listen = null;
// private SIOListenerIII siolisten1 = null; // ke9ns add for ant rotor control
private Thread[] audio_process_thread; // threads to run DttSP functions
@ -9543,6 +9546,9 @@ namespace PowerSDR
//being sent via CAT
//EW 5/20/10 undid this change due to crashes when the secondary Keyer input was set to CAT
siolisten = new SIOListenerII(this);
sio2listen = new SIO2ListenerII(this);
sio3listen = new SIO3ListenerII(this);
sio4listen = new SIO4ListenerII(this);
siolisten1 = new SIOListenerIII(this); // ke9ns add for rotor control
@ -32632,6 +32638,24 @@ namespace PowerSDR
set { siolisten = value; }
}
public SIO2ListenerII Sio2listen
{
get { return sio2listen; }
set { sio2listen = value; }
}
public SIO3ListenerII Sio3listen
{
get { return sio3listen; }
set { sio3listen = value; }
}
public SIO4ListenerII Sio4listen
{
get { return sio4listen; }
set { sio4listen = value; }
}
// ke9ns add ant rotor control
public SIOListenerIII Siolisten1
{
@ -36129,8 +36153,271 @@ namespace PowerSDR
get { return cat_enabled; }
} // CATEnabled
//CAT2
private Parity cat2_parity;
public Parity CAT2Parity
{
set { cat2_parity = value; }
get { return cat2_parity; }
}
private StopBits cat2_stop_bits;
public StopBits CAT2StopBits
{
set { cat2_stop_bits = value; }
get { return cat2_stop_bits; }
}
private Handshake cat2_handshake;
public Handshake CAT2Handshake
{
set { cat2_handshake = value; }
get { return cat2_handshake; }
}
private int cat2_data_bits;
public int CAT2DataBits
{
set { cat2_data_bits = value; }
get { return cat2_data_bits; }
}
private int cat2_baud_rate;
public int CAT2BaudRate
{
set { cat2_baud_rate = value; }
get { return cat2_baud_rate; }
}
private bool cat2_enabled;
public bool CAT2Enabled
{
set
{
try
{
cat2_enabled = value;
if (sio2listen != null) // if we've got a listener tell them about state change
{
if (cat2_enabled)
{
sio2listen.enableCAT2();
}
else
{
sio2listen.disableCAT2();
}
}
}
catch (Exception)
{
if (cat2_port != 0)
{
MessageBox.Show("Error enabling CAT2 on COM" + cat2_port + ".\n" +
"Please check CAT2 settings and try again.",
"CAT2 Initialization Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
else
{
MessageBox.Show("Error enabling CAT2 comm port.\n" +
"Previously defined CAT2 comm port not enumerated.\n" +
"Please check CAT2 settings and try again.",
"CAT2 Initialization Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
if (setupForm != null) setupForm.CAT2Enabled = false;
}
} // set
get { return cat2_enabled; }
} // CAT2Enabled
//END
//CAT3
private Parity cat3_parity;
public Parity CAT3Parity
{
set { cat3_parity = value; }
get { return cat3_parity; }
}
private StopBits cat3_stop_bits;
public StopBits CAT3StopBits
{
set { cat3_stop_bits = value; }
get { return cat3_stop_bits; }
}
private Handshake cat3_handshake;
public Handshake CAT3Handshake
{
set { cat3_handshake = value; }
get { return cat3_handshake; }
}
private int cat3_data_bits;
public int CAT3DataBits
{
set { cat3_data_bits = value; }
get { return cat3_data_bits; }
}
private int cat3_baud_rate;
public int CAT3BaudRate
{
set { cat3_baud_rate = value; }
get { return cat3_baud_rate; }
}
private bool cat3_enabled;
public bool CAT3Enabled
{
set
{
try
{
cat3_enabled = value;
if (sio3listen != null) // if we've got a listener tell them about state change
{
if (cat3_enabled)
{
sio3listen.enableCAT3();
}
else
{
sio3listen.disableCAT3();
}
}
}
catch (Exception)
{
if (cat3_port != 0)
{
MessageBox.Show("Error enabling CAT3 on COM" + cat3_port + ".\n" +
"Please check CAT3 settings and try again.",
"CAT3 Initialization Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
else
{
MessageBox.Show("Error enabling CAT3 comm port.\n" +
"Previously defined CAT3 comm port not enumerated.\n" +
"Please check CAT3 settings and try again.",
"CAT3 Initialization Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
if (setupForm != null) setupForm.CAT3Enabled = false;
}
} // set
get { return cat3_enabled; }
} // CAT3Enabled
//END
//CAT4
private Parity cat4_parity;
public Parity CAT4Parity
{
set { cat4_parity = value; }
get { return cat4_parity; }
}
private StopBits cat4_stop_bits;
public StopBits CAT4StopBits
{
set { cat4_stop_bits = value; }
get { return cat4_stop_bits; }
}
private Handshake cat4_handshake;
public Handshake CAT4Handshake
{
set { cat4_handshake = value; }
get { return cat4_handshake; }
}
private int cat4_data_bits;
public int CAT4DataBits
{
set { cat4_data_bits = value; }
get { return cat4_data_bits; }
}
private int cat4_baud_rate;
public int CAT4BaudRate
{
set { cat4_baud_rate = value; }
get { return cat4_baud_rate; }
}
private bool cat4_enabled;
public bool CAT4Enabled
{
set
{
try
{
cat4_enabled = value;
if (sio4listen != null) // if we've got a listener tell them about state change
{
if (cat4_enabled)
{
sio4listen.enableCAT4();
}
else
{
sio4listen.disableCAT4();
}
}
}
catch (Exception)
{
if (cat4_port != 0)
{
MessageBox.Show("Error enabling CAT4 on COM" + cat4_port + ".\n" +
"Please check CAT4 settings and try again.",
"CAT4 Initialization Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
else
{
MessageBox.Show("Error enabling CAT4 comm port.\n" +
"Previously defined CAT4 comm port not enumerated.\n" +
"Please check CAT4 settings and try again.",
"CAT4 Initialization Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
if (setupForm != null) setupForm.CAT4Enabled = false;
}
} // set
get { return cat4_enabled; }
} // CAT4Enabled
//END
private int cat_rig_type;
public int CATRigType
{
@ -36145,6 +36432,29 @@ namespace PowerSDR
set { cat_port = value; }
}
//CAT2
private int cat2_port;
public int CAT2Port
{
get { return cat2_port; }
set { cat2_port = value; }
}
//CAT3
private int cat3_port;
public int CAT3Port
{
get { return cat3_port; }
set { cat3_port = value; }
}
//CAT4
private int cat4_port;
public int CAT4Port
{
get { return cat4_port; }
set { cat4_port = value; }
}
//========================================================================================
//========================================================================================
// ke9ns antennar rotor control via DDUtil VSP rotor port using Hygain protocol
@ -56682,6 +56992,9 @@ namespace PowerSDR
Audio.callback_return = 2;
CATEnabled = false;
CAT2Enabled = false;
CAT3Enabled = false;
CAT4Enabled = false;
ROTOREnabled = false; // ke9ns add
vfodial = false; // ke9ns add to terminal the dial routine

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