synchronized connectifnotconnected
This commit is contained in:
parent
a10a819a9d
commit
b818027b02
|
@ -68,6 +68,8 @@ public class DanaConnection {
|
||||||
PowerManager.WakeLock mWakeLock;
|
PowerManager.WakeLock mWakeLock;
|
||||||
private Treatment bolusingTreatment = null;
|
private Treatment bolusingTreatment = null;
|
||||||
|
|
||||||
|
private static Object connectionInProgress = new Object();
|
||||||
|
|
||||||
private DanaRFragment danaRFragment;
|
private DanaRFragment danaRFragment;
|
||||||
private DanaRPump danaRPump;
|
private DanaRPump danaRPump;
|
||||||
|
|
||||||
|
@ -159,6 +161,7 @@ public class DanaConnection {
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void connectIfNotConnected(String callerName) {
|
public synchronized void connectIfNotConnected(String callerName) {
|
||||||
|
synchronized (connectionInProgress) {
|
||||||
mWakeLock.acquire();
|
mWakeLock.acquire();
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
short connectionAttemptCount = 0;
|
short connectionAttemptCount = 0;
|
||||||
|
@ -191,6 +194,7 @@ public class DanaConnection {
|
||||||
}
|
}
|
||||||
mWakeLock.release();
|
mWakeLock.release();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private synchronized void connectBT() {
|
private synchronized void connectBT() {
|
||||||
if (mDevice == null) {
|
if (mDevice == null) {
|
||||||
|
|
Loading…
Reference in a new issue