Open GoogleCodeExporter opened 9 years ago
Additional XBee connection information. I create the connection with this code:
RxTxSerialComm serial = new RxTxSerialComm();
// void com.rapplogic.xbee.RxTxSerialComm.openSerialPort(String port, String
appName, int timeout, int baudRate, int dataBits, int stopBits, int parity, int
flowControl)
serial.openSerialPort("COM3", "XBee", 1000, 111111, SerialPort.DATABITS_8,
SerialPort.STOPBITS_1, SerialPort.PARITY_NONE,SerialPort.FLOWCONTROL_RTSCTS_IN
| SerialPort.FLOWCONTROL_RTSCTS_OUT);
xbee.initProviderConnection(serial);
Patch: I see now that IntArrayInputStream.java does not need the "throws
IOException" declaration.
Original comment by exuvo@exuvo.se
on 4 Dec 2011 at 3:43
I got the same error on reading the remote address and on second thought it is
much simpler and to add the following code to
com.rapplogic.xbee.util.InputStreamWrapper.java instead of the attached path:
public int read() throws IOException {
+ if(in.available() == 0){
+ long start = System.currentTimeMillis();
+ while(in.available() == 0){
+ Thread.yield();
+ if(System.currentTimeMillis() - start > 100){
+ throw new IOException("Timeout while reading from InputStream");
+ }
+ }
+ }
return in.read();
}
Why can't I edit the original post? Could clean up a few things.
Original comment by exuvo@exuvo.se
on 4 Dec 2011 at 4:08
That's great, thank you.
I have implemented you changes - it works fine now.
Attached you can find jar file with this patch. (JDK 1.6)
Original comment by kiryl.ro...@gmail.com
on 27 Oct 2012 at 11:41
Attachments:
Good to know that there is still some activity on xbee-api. But a 10 month
delay is slighly too slow.
Original comment by exuvo@exuvo.se
on 29 Oct 2012 at 9:54
More activity! Thanks for this!
Original comment by ZackGr...@gmail.com
on 12 Sep 2013 at 8:57
I'm unable to reproduce this. Are you using the RXTX that comes with the
library? What os, java version? -1 indicates the stream is closed and should
always block on read
Original comment by andrew.rapp@gmail.com
on 2 Feb 2014 at 4:28
Since I last wrote here I have moved away from RXTX to nrjavaserial to fix java
crashing (completely, no exceptions thrown) when a connected USB serial port
disappears. I'm not sure if the problem in this issue still persists with
nrjavaserial as I still have my patch applied.
Regarding versions I was using it says in the original message:
xbee-api-0.9.zip
WARNING: RXTX Version mismatch
Jar version = RXTX-2.2pre1
native lib Version = RXTX-2.2pre2
Original comment by exuvo@exuvo.se
on 3 Feb 2014 at 2:12
Checked my recent logs and I get around 10 "[WARN] [15:32:50]
rapplogic.xbee.RxTxSerialComm.serialEvent We were notified of new data but
available() is returning 0" each minute. This is using nrjavaserial-3.8.8.jar
as replacement for RXTX and xbee-api 0.9 with above mentioned patch (maybe
something else as well, cant remember).
Occasionally I see the bug mentioned:
[ERROR] [15:35:21] xbee.api.PacketParser.parsePacket Failed due to exception.
Returning ErrorResponse. bytes read:
0x00,0x3d,0x90,0x00,0x7d,0x33,0xa2,0x00,0x40,0x86,0x1e,0x0e,0x00,0x00,0x01,0x41,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
java.io.IOException: Timeout while reading from InputStream
at com.rapplogic.xbee.util.InputStreamWrapper.read(InputStreamWrapper.java:20)
at com.rapplogic.xbee.api.PacketParser.readFromStream(PacketParser.java:217)
at com.rapplogic.xbee.api.PacketParser.read(PacketParser.java:235)
at com.rapplogic.xbee.api.PacketParser.read(PacketParser.java:206)
at com.rapplogic.xbee.api.PacketParser.readRemainingBytes(PacketParser.java:303)
at com.rapplogic.xbee.api.zigbee.ZNetRxResponse.parse(ZNetRxResponse.java:56)
at com.rapplogic.xbee.api.PacketParser.parsePacket(PacketParser.java:164)
at com.rapplogic.xbee.api.InputStreamThread.run(InputStreamThread.java:151)
at java.lang.Thread.run(Unknown Source)
Original comment by exuvo@exuvo.se
on 3 Feb 2014 at 2:41
Where is the edit button? OS Windows 7 64bit, using a sparkfun usb to xbee
https://www.sparkfun.com/products/8687 and a xbee pro S2B.
Original comment by exuvo@exuvo.se
on 3 Feb 2014 at 2:45
I have Java 7 Update 45 (32-bit), 25 (64-bit) and JDK 7 Update 25 (64-bit)
installed. Eclipse should be using the 64-bit version but I'm not certain.
Original comment by exuvo@exuvo.se
on 3 Feb 2014 at 2:51
I don't have windows hardware readily available anymore (since osx mavericks
whacked my vmware), so can't test it. Can you try 32-bit java version if that's
not what you're using. Also do you have access to linux or macosx to see if you
can reproduce?
Original comment by andrew.rapp@gmail.com
on 3 Feb 2014 at 2:58
I'll try to reproduce on Win7 64bit with 32bit java and linux 64bit when I get
the time.
Original comment by exuvo@exuvo.se
on 5 Feb 2014 at 5:24
Original issue reported on code.google.com by
exuvo@exuvo.se
on 4 Dec 2011 at 3:33Attachments: