adeelahmedkhanabbasi / xbee-api

Automatically exported from code.google.com/p/xbee-api
GNU General Public License v3.0
0 stars 0 forks source link

Delay in asynchronous request when there is an unreachable request (NO_RESPONSE) #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. send multiple asynchronous request to two different xbees (one of them must 
not be accessible -> NO_RESPONSE)

What is the expected output? What do you see instead?
The messages to the reachable xbee should be sent immediately after the method 
call, but it has a delay of 2, 3 seconds because of the messages sent to the 
xbee out of range.

What version of the product are you using? On what operating system?
xbee-api-0.9
Ubuntu 11.04

Please provide any additional information below.
Here is a sample code for this issue:

XBee xbee = new XBee();
xbee.open("COM5", 9600);
String XBEE_OK_ADDR = "00 13 a2 00 40 61 19 11";
String XBEE_OUT_ADDR = "00 13 a2 00 40 61 19 00";
xbee.sendAsynchronous(new RemoteAtRequest(new XBeeAddress64(XBEE_OK_ADDR), 
"D4", new int[] {5}));
xbee.sendAsynchronous(new RemoteAtRequest(new XBeeAddress64(XBEE_OUT_ADDR), 
"D4", new int[] {5}));
xbee.sendAsynchronous(new RemoteAtRequest(new XBeeAddress64(XBEE_OK_ADDR), 
"D4", new int[] {4}));
xbee.sendAsynchronous(new RemoteAtRequest(new XBeeAddress64(XBEE_OUT_ADDR), 
"D4", new int[] {4}));
xbee.sendAsynchronous(new RemoteAtRequest(new XBeeAddress64(XBEE_OK_ADDR), 
"D4", new int[] {5}));
xbee.sendAsynchronous(new RemoteAtRequest(new XBeeAddress64(XBEE_OUT_ADDR), 
"D4", new int[] {5}));
xbee.sendAsynchronous(new RemoteAtRequest(new XBeeAddress64(XBEE_OK_ADDR), 
"D4", new int[] {4}));
xbee.sendAsynchronous(new RemoteAtRequest(new XBeeAddress64(XBEE_OUT_ADDR), 
"D4", new int[] {4}));

When this code runs only with the xbee in range, the IO 4 turns on/of 
immediately. But when there is a request to an xbee out of range, there is a 
delay of 2, 3 seconds to send the messages to the xbee in range. This delay 
appears to increase according to the number of NO_RESPONSE requests.

Original issue reported on code.google.com by rhesch...@gmail.com on 22 Aug 2011 at 8:46

GoogleCodeExporter commented 9 years ago
sendAsynchronous simply writes the packet to the output stream. If there is 
some blocking going on it has to do with RXTX and not something I can affect. I 
recommend you collect the response before sending another command to the radio, 
something like

sendAsync Radio1
sendAsync Radio2

wait for responses
if Radio 1, sendAsync Radio1
if Radio 2, sendAsync Radio2
etc

Original comment by andrew.rapp@gmail.com on 2 Feb 2014 at 4:19