Merge pull request #2588 from kfeuz/Issue2364

Implements the active() method for Serial and Server (Issue #2364).
This commit is contained in:
Ben Fry
2014-11-14 15:01:17 -07:00
2 changed files with 16 additions and 0 deletions

View File

@@ -177,6 +177,13 @@ public class Server implements Runnable {
return -1;
}
/**
* Return true if this server is still active and hasn't run
* into any trouble.
*/
public boolean active() {
return (thread != null);
}
static public String ip() {
try {

View File

@@ -135,6 +135,15 @@ public class Serial implements SerialPortEventListener {
}
/**
* Return true if this port is still active and hasn't run
* into any trouble.
*/
public boolean active() {
return (port.isOpened());
}
public void pre() {
if (serialAvailableMethod != null && invokeSerialAvailable) {
invokeSerialAvailable = false;