fix ConnectionWatchdog 20 secs timeout on no text msgs
This commit is contained in:
parent
378e646319
commit
2af8924714
|
@ -170,7 +170,8 @@ public class BinaryProtocol {
|
||||||
LinkManager.COMMUNICATION_EXECUTOR.submit(new Runnable() {
|
LinkManager.COMMUNICATION_EXECUTOR.submit(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
requestOutputChannels();
|
if (requestOutputChannels())
|
||||||
|
ConnectionWatchdog.onDataArrived();
|
||||||
String text = requestPendingMessages();
|
String text = requestPendingMessages();
|
||||||
if (text != null)
|
if (text != null)
|
||||||
listener.onDataArrived((text + "\r\n").getBytes());
|
listener.onDataArrived((text + "\r\n").getBytes());
|
||||||
|
@ -494,12 +495,12 @@ public class BinaryProtocol {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void requestOutputChannels() {
|
public boolean requestOutputChannels() {
|
||||||
if (isClosed)
|
if (isClosed)
|
||||||
return;
|
return false;
|
||||||
byte[] response = executeCommand(new byte[]{COMMAND_OUTPUTS}, "output channels", false);
|
byte[] response = executeCommand(new byte[]{COMMAND_OUTPUTS}, "output channels", false);
|
||||||
if (response == null || response.length != (Fields.TS_OUTPUT_SIZE + 1) || response[0] != RESPONSE_OK)
|
if (response == null || response.length != (Fields.TS_OUTPUT_SIZE + 1) || response[0] != RESPONSE_OK)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
currentOutputs = response;
|
currentOutputs = response;
|
||||||
|
|
||||||
|
@ -515,5 +516,6 @@ public class BinaryProtocol {
|
||||||
SensorCentral.getInstance().setValue(value, sensor);
|
SensorCentral.getInstance().setValue(value, sensor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue