Cleanup.
This commit is contained in:
parent
cccf6f175c
commit
598d7f8de0
2 changed files with 1 additions and 16 deletions
|
@ -339,7 +339,7 @@ public class RuffyScripter implements RuffyCommands {
|
||||||
/**
|
/**
|
||||||
* On connection lose the pump raises an error immediately (when setting a TBR or giving a bolus) -
|
* On connection lose the pump raises an error immediately (when setting a TBR or giving a bolus) -
|
||||||
* there's no timeout before that happens. But: a reconnect is still possible which can then
|
* there's no timeout before that happens. But: a reconnect is still possible which can then
|
||||||
* confirm the alarm and, return to the main menu and restart the command safely.
|
* confirm the alarm and.
|
||||||
*
|
*
|
||||||
* @return whether the reconnect and return to main menu was successful
|
* @return whether the reconnect and return to main menu was successful
|
||||||
*/
|
*/
|
||||||
|
@ -419,22 +419,11 @@ public class RuffyScripter implements RuffyCommands {
|
||||||
log.debug("Waiting for first menu update to be sent");
|
log.debug("Waiting for first menu update to be sent");
|
||||||
long timeoutExpired = System.currentTimeMillis() + 90 * 1000;
|
long timeoutExpired = System.currentTimeMillis() + 90 * 1000;
|
||||||
long initialUpdateTime = menuLastUpdated;
|
long initialUpdateTime = menuLastUpdated;
|
||||||
long again = System.currentTimeMillis() + 30 * 1000;
|
|
||||||
while (initialUpdateTime == menuLastUpdated) {
|
while (initialUpdateTime == menuLastUpdated) {
|
||||||
if (System.currentTimeMillis() > timeoutExpired) {
|
if (System.currentTimeMillis() > timeoutExpired) {
|
||||||
throw new CommandException("Timeout connecting to pump");
|
throw new CommandException("Timeout connecting to pump");
|
||||||
}
|
}
|
||||||
SystemClock.sleep(50);
|
SystemClock.sleep(50);
|
||||||
if (again < System.currentTimeMillis()) {
|
|
||||||
// TODO test
|
|
||||||
log.debug("Connecting taking long, forcing disconnect first");
|
|
||||||
ruffyService.doRTDisconnect();
|
|
||||||
SystemClock.sleep(2000);
|
|
||||||
log.debug("Connecting again");
|
|
||||||
ruffyService.doRTConnect();
|
|
||||||
SystemClock.sleep(1000);
|
|
||||||
again = System.currentTimeMillis() + 30 * 1000;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (CommandException e) {
|
} catch (CommandException e) {
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
@ -95,10 +95,6 @@ public class BTConnection {
|
||||||
|
|
||||||
public void connect(PumpData pumpData, int retries)
|
public void connect(PumpData pumpData, int retries)
|
||||||
{
|
{
|
||||||
// if (pumpData == null) {
|
|
||||||
// Log.e("JOE", "pumpdata null 1");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
this.pumpData = pumpData;
|
this.pumpData = pumpData;
|
||||||
connect(pumpData.getPumpMac(),retries);
|
connect(pumpData.getPumpMac(),retries);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue