throw exception when connection fails
This commit is contained in:
parent
7a72cf2f19
commit
9a009d2f96
|
@ -203,7 +203,6 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
||||||
start = true,
|
start = true,
|
||||||
name = "ConnectionThread",
|
name = "ConnectionThread",
|
||||||
) {
|
) {
|
||||||
// TODO quadruple check that we are not creating a party of Threads here
|
|
||||||
try {
|
try {
|
||||||
val stop = CountDownLatch(1)
|
val stop = CountDownLatch(1)
|
||||||
stopConnecting = stop
|
stopConnecting = stop
|
||||||
|
|
|
@ -127,6 +127,7 @@ class Connection(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun waitForConnection(connectionWaitCond: ConnectionWaitCondition): ConnectionState {
|
private fun waitForConnection(connectionWaitCond: ConnectionWaitCondition): ConnectionState {
|
||||||
|
aapsLogger.debug(LTag.PUMPBTCOMM, "waitForConnection connectionWaitCond=$connectionWaitCond")
|
||||||
try {
|
try {
|
||||||
connectionWaitCond.timeoutMs?.let {
|
connectionWaitCond.timeoutMs?.let {
|
||||||
bleCommCallbacks.waitForConnection(it)
|
bleCommCallbacks.waitForConnection(it)
|
||||||
|
@ -134,7 +135,7 @@ class Connection(
|
||||||
connectionWaitCond.stopConnection?.let {
|
connectionWaitCond.stopConnection?.let {
|
||||||
while (!bleCommCallbacks.waitForConnection(STOP_CONNECTING_CHECK_INTERVAL_MS)) {
|
while (!bleCommCallbacks.waitForConnection(STOP_CONNECTING_CHECK_INTERVAL_MS)) {
|
||||||
if (it.count == 0L) {
|
if (it.count == 0L) {
|
||||||
ConnectException("stopConnecting called")
|
throw ConnectException("stopConnecting called")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue