Reputation: 8327
We upgraded our embedded firmware's Silicon Labs IDE Simp Studio from v4 to v5 (which has substantial BLE enhancements).
PROBLEM...
Now our iphone Swift app, using corebluetooth, has connection trouble to our embedded.
DEBUGGING WE HAVE TRIED......
After installation of prior firmware, iOS app connects and operates without problem.
Tried alternate embedded device: same problem.
OUR iOS BLE ............
internal func centralManagerDidUpdateState(_ central: CBCentralManager)
{
switch central.state {
case .poweredOn:
start_peripheral_scan()
case .poweredOff:
start_comm_recovery( false )
return
case .resetting:
return
case .unauthorized:
if #available(iOS 13.0, *) {
switch central.authorization {
case .denied:
case .restricted:
default:
}
} else {
}
return
case .unknown:
return
case .unsupported:
return
@unknown default:
return
}
// NEXT: didDiscover
}
func start_peripheral_scan()
{
if centralManager == nil { handle_fault("start_peripheral_scan: centralManager == nil") }
centralManager.scanForPeripherals(withServices: nil, /////////////////// S T A R T S C A N N I N G //////////////////////
options: [CBCentralManagerScanOptionAllowDuplicatesKey: true])
}
func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral,
advertisementData: [String: Any], rssi RSSI: NSNumber)
{
. . . // verifies peripheral.name is desired device.
if is_my_device
{
centralManager.connect(peripheral, options: nil)
// Attempts connection. But this occurs only once after uploading firmware to our embedded device.
// If our app
}
}
Upvotes: -5
Views: 81
Reputation: 8327
No, there wasn't. Problem was app failed to await Core Bluetooth POWER ON event before starting BLE scan.
Upvotes: 0