mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Stop BLE error from continuing and crashing the app
This commit is contained in:
parent
c8c6a5c0d2
commit
b8c7db1799
1 changed files with 10 additions and 4 deletions
|
|
@ -324,8 +324,12 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
|
|||
// MARK: Discover Characteristics Event
|
||||
func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {
|
||||
|
||||
|
||||
if let e = error {
|
||||
MeshLogger.log("🚫 BLE didDiscoverCharacteristicsFor error by \(peripheral.name ?? "Unknown") \(e)")
|
||||
MeshLogger.log("🚫 BLE Discover Characteristics error for \(peripheral.name ?? "Unknown") \(e) disconnecting device")
|
||||
// Try and stop crashes when this error occurs
|
||||
disconnectPeripheral()
|
||||
return
|
||||
}
|
||||
|
||||
guard let characteristics = service.characteristics else { return }
|
||||
|
|
@ -637,9 +641,11 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
|
|||
default:
|
||||
print("🚨 Unhandled Characteristic UUID: \(characteristic.uuid)")
|
||||
}
|
||||
|
||||
// Either Read the config complete value or from num notify value
|
||||
peripheral.readValue(for: FROMRADIO_characteristic)
|
||||
if FROMRADIO_characteristic != nil {
|
||||
|
||||
// Either Read the config complete value or from num notify value
|
||||
peripheral.readValue(for: FROMRADIO_characteristic)
|
||||
}
|
||||
}
|
||||
|
||||
public func sendMessage(message: String, toUserNum: Int64, isEmoji: Bool, replyID: Int64) -> Bool {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue