RL: fix indexoutofbounds
This commit is contained in:
parent
d39fc1ddf9
commit
401f2d4290
1 changed files with 11 additions and 9 deletions
|
@ -217,15 +217,17 @@ class RileyLinkBLE @Inject constructor(
|
||||||
// Tell Android that we want the notifications
|
// Tell Android that we want the notifications
|
||||||
bluetoothConnectionGatt?.setCharacteristicNotification(chara, true)
|
bluetoothConnectionGatt?.setCharacteristicNotification(chara, true)
|
||||||
val list = chara.descriptors
|
val list = chara.descriptors
|
||||||
if (gattDebugEnabled) for (i in list.indices) aapsLogger.debug(LTag.PUMPBTCOMM, "Found descriptor: " + list[i].toString())
|
if (list.size > 0) {
|
||||||
// Tell the remote device to send the notifications
|
if (gattDebugEnabled) for (i in list.indices) aapsLogger.debug(LTag.PUMPBTCOMM, "Found descriptor: " + list[i].toString())
|
||||||
mCurrentOperation = DescriptorWriteOperation(aapsLogger, bluetoothConnectionGatt, list[0], BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE)
|
// Tell the remote device to send the notifications
|
||||||
mCurrentOperation?.execute(this)
|
mCurrentOperation = DescriptorWriteOperation(aapsLogger, bluetoothConnectionGatt, list[0], BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE)
|
||||||
when {
|
mCurrentOperation?.execute(this)
|
||||||
mCurrentOperation?.timedOut == true -> retValue.resultCode = BLECommOperationResult.RESULT_TIMEOUT
|
when {
|
||||||
mCurrentOperation?.interrupted == true -> retValue.resultCode = BLECommOperationResult.RESULT_INTERRUPTED
|
mCurrentOperation?.timedOut == true -> retValue.resultCode = BLECommOperationResult.RESULT_TIMEOUT
|
||||||
else -> retValue.resultCode = BLECommOperationResult.RESULT_SUCCESS
|
mCurrentOperation?.interrupted == true -> retValue.resultCode = BLECommOperationResult.RESULT_INTERRUPTED
|
||||||
}
|
else -> retValue.resultCode = BLECommOperationResult.RESULT_SUCCESS
|
||||||
|
}
|
||||||
|
} else return retValue.apply { resultCode = BLECommOperationResult.RESULT_NONE }
|
||||||
}
|
}
|
||||||
mCurrentOperation = null
|
mCurrentOperation = null
|
||||||
gattOperationSema.release()
|
gattOperationSema.release()
|
||||||
|
|
Loading…
Reference in a new issue