mirror of
https://github.com/fasteddy516/SimplySerial.git
synced 2024-11-24 10:04:35 +00:00
Improved detection and notification of com port disconnects.
This commit is contained in:
parent
ae75570442
commit
ecef3d18a0
@ -308,6 +308,10 @@ namespace SimplySerial
|
|||||||
lastFlush = DateTime.Now;
|
lastFlush = DateTime.Now;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if the serial port is unexpectedly closed, throw an exception
|
||||||
|
if (!serialPort.IsOpen)
|
||||||
|
throw new IOException();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -324,7 +328,6 @@ namespace SimplySerial
|
|||||||
//nothing to do here, other than prevent execution from stopping if dispose() throws an exception
|
//nothing to do here, other than prevent execution from stopping if dispose() throws an exception
|
||||||
}
|
}
|
||||||
Thread.Sleep(2000); // sort-of arbitrary delay - should be long enough to read the "interrupted" message
|
Thread.Sleep(2000); // sort-of arbitrary delay - should be long enough to read the "interrupted" message
|
||||||
Console.Clear();
|
|
||||||
if (autoConnect == AutoConnect.ANY)
|
if (autoConnect == AutoConnect.ANY)
|
||||||
{
|
{
|
||||||
port.name = String.Empty;
|
port.name = String.Empty;
|
||||||
@ -332,7 +335,6 @@ namespace SimplySerial
|
|||||||
}
|
}
|
||||||
else if (autoConnect == AutoConnect.ONE)
|
else if (autoConnect == AutoConnect.ONE)
|
||||||
{
|
{
|
||||||
Console.Clear();
|
|
||||||
Output("<<< Attempting to re-connect to " + port.name + ". Use CTRL-X to cancel >>>");
|
Output("<<< Attempting to re-connect to " + port.name + ". Use CTRL-X to cancel >>>");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user