public void enableCAT() { lock (this) { if (cat_enabled) { return; // nothing to do already enabled } cat_enabled = true; } int port_num = console.CATPort; if (port_num == 0) { return; } SIO = new SDRSerialSupportII.SDRSerialPort(port_num); SIO.setCommParms(console.CATBaudRate, (SDRSerialSupportII.SDRSerialPort.Parity)console.CATParity, (SDRSerialSupportII.SDRSerialPort.DataBits)console.CATDataBits, (SDRSerialSupportII.SDRSerialPort.StopBits)console.CATStopBits, (SDRSerialSupportII.SDRSerialPort.HandshakeBits)console.CATHandshake); Initialize(); SIOMonitorCount = 0; SIOMonitor.Start(); }
// private void SIOMonitor_Elapsed(object sender, System.Timers.ElapsedEventArgs e) // { // if(!console.MOX) // { // SIOMonitorCount++; // increments the counter when in receive // Debug.WriteLine("SIOMonitorCount: "+SIOMonitorCount.ToString()); // if(SIOMonitorCount < 12) // if the counter is less than 12 (60 seconds),reinitialize the serial port // { // Debug.WriteLine("The SIO Timer has elapsed"); // if(!SIO.PortIsOpen) // { // Debug.WriteLine("The port is closed"); // SIO.OpenPort = true; // StreamWriter sw = new StreamWriter("SIOTestLog.txt", true); // sw.WriteLine("The serial port was forced open"); // sw.WriteLine("Time: "+DateTime.Now.ToString()); // sw.Flush(); // sw.Close(); // SIOMonitor.Enabled = true; // SIOMonitorCount = 0; // Fpass = true; // disableCAT(); // enableCAT(); // } // //Initialize(); // } // else // consider the remote program on the serial port as being shut down // { // if(SIO.PortIsOpen) // { // port_status = "open"; // } // else // { // // port_status = "closed"; // } // // // SIOMonitorCount = 0; // disableCAT(); // enableCAT(); // // SIOMonitor.Stop(); // } // } // else // SIOMonitorCount = 0; // } public void enableCAT() { lock ( this ) { if ( cat_enabled ) return; // nothing to do already enabled cat_enabled = true; } int port_num = console.CATPort; SIO = new SDRSerialSupportII.SDRSerialPort(port_num); SIO.setCommParms(console.CATBaudRate, (SDRSerialSupportII.SDRSerialPort.Parity)console.CATParity, (SDRSerialSupportII.SDRSerialPort.DataBits)console.CATDataBits, (SDRSerialSupportII.SDRSerialPort.StopBits)console.CATStopBits); Initialize(); }