usb send message open check inside class itself
@@ -193,10 +193,12 @@ public class UsbConnection {
}
public void send(String msg) {
+ if (isOpen() && !isBusy()) {
busy = true;
serialDevice.write(msg.getBytes(UTF_8));
busy = false;
}
+ }
public boolean isOpen() {
return connection != null;
