I'm using CoreBluetooth to communicate with nrf52 ble , i want to secure my app for a possible crash or bug like when you want to read from a Characteristic and this Characteristic not returning nothing , in this example noramly CoreBluetooth have a timer so after a while the communication with ble is disconnected , my question is : it's possible to cancel the request of read before the disconnection from Bluetooth. or is there an error of callback which allows me to control the situation before the disconnection of the app from bluetooth
my code :
BT.readValue(for: mainCharacteristic)
the result should appear here if the Characteristic return a value
func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
guard let data = characteristic.value else { return }
}