hmm, I can't edit the posts on this forum.. so I'll just have to post updates here: this is going to get messy.
don't call uartIn_.wait(2000); it will give you an error.
if you want timeouts.. edit this IOIOLib\ioio.lib.impl\QueueInputStream.java function like so:
i.e 2000ms timeout on the uart.read()
@Override
synchronized public int read(byte[] b, int off, int len) throws IOException {
if (len == 0) {
return 0;
}
try {
//while (state_ == State.OPEN && queue_.isEmpty()) {
if (state_ == State.OPEN && queue_.isEmpty()) { //dont wait forever.. just 2000ms
wait(2000);
}
if (state_ == State.KILLED) {
throw new IOException("Stream has been closed");
}
if (state_ == State.CLOSED && queue_.isEmpty()) {
return -1;
}
if (len > queue_.size()) {
len = queue_.size();
}
for (int i = 0; i < len; ++i) {
b[off++] = queue_.remove();
}
return len;
} catch (InterruptedException e) {
throw new IOException("Interrupted");
}
}