synchronized connectifnotconnected
This commit is contained in:
parent
a10a819a9d
commit
b818027b02
1 changed files with 32 additions and 28 deletions
|
@ -68,6 +68,8 @@ public class DanaConnection {
|
|||
PowerManager.WakeLock mWakeLock;
|
||||
private Treatment bolusingTreatment = null;
|
||||
|
||||
private static Object connectionInProgress = new Object();
|
||||
|
||||
private DanaRFragment danaRFragment;
|
||||
private DanaRPump danaRPump;
|
||||
|
||||
|
@ -77,7 +79,7 @@ public class DanaConnection {
|
|||
|
||||
private static final UUID SPP_UUID = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb");
|
||||
|
||||
// TODO: keepalive kills active connection
|
||||
// TODO: keepalive kills active connection
|
||||
public DanaConnection(Bus bus) {
|
||||
danaRFragment = (DanaRFragment) MainActivity.getSpecificPlugin(DanaRFragment.class);
|
||||
danaRFragment.setDanaConnection(this);
|
||||
|
@ -159,6 +161,7 @@ public class DanaConnection {
|
|||
}
|
||||
|
||||
public synchronized void connectIfNotConnected(String callerName) {
|
||||
synchronized (connectionInProgress) {
|
||||
mWakeLock.acquire();
|
||||
long startTime = System.currentTimeMillis();
|
||||
short connectionAttemptCount = 0;
|
||||
|
@ -191,6 +194,7 @@ public class DanaConnection {
|
|||
}
|
||||
mWakeLock.release();
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void connectBT() {
|
||||
if (mDevice == null) {
|
||||
|
|
Loading…
Reference in a new issue