try different connection timeouts
This commit is contained in:
parent
d4f7caf119
commit
9ca82441bb
2 changed files with 8 additions and 2 deletions
|
@ -125,7 +125,7 @@ class OmnipodDashBleManagerImpl @Inject constructor(
|
||||||
for (i in 1..MAX_NUMBER_OF_CONNECTION_ATTEMPTS) {
|
for (i in 1..MAX_NUMBER_OF_CONNECTION_ATTEMPTS) {
|
||||||
try {
|
try {
|
||||||
// wait i * CONNECTION_TIMEOUT
|
// wait i * CONNECTION_TIMEOUT
|
||||||
conn.connect(i)
|
conn.connect(4)
|
||||||
break
|
break
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
aapsLogger.warn(LTag.PUMPBTCOMM, "connect error=$e")
|
aapsLogger.warn(LTag.PUMPBTCOMM, "connect error=$e")
|
||||||
|
@ -240,7 +240,7 @@ class OmnipodDashBleManagerImpl @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val MAX_NUMBER_OF_CONNECTION_ATTEMPTS = 3
|
const val MAX_NUMBER_OF_CONNECTION_ATTEMPTS = 2
|
||||||
const val CONTROLLER_ID = 4242 // TODO read from preferences or somewhere else.
|
const val CONTROLLER_ID = 4242 // TODO read from preferences or somewhere else.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.session
|
||||||
|
|
||||||
|
interface ConnectionStateChangeHandler {
|
||||||
|
|
||||||
|
fun onConnectionStateChange(status: Int, newState: Int)
|
||||||
|
}
|
Loading…
Reference in a new issue