BLE -peripheral:didDiscoverServices: never gets called
iOS 9.3.2 I'm developing an app that interfaces to a (unencrypted) BLE arduino, but I'm having difficulty getting CoreBluetooth to issue the -peripheral:didDiscoverServices: callback. Thus I can't proceed to do a -writeValue: without a send_characteristic for the peripheral. Here are the (condensed) steps I'm taking, all of which work, except the last. The methods are all within the same controller object, which is adherent to both CBCentralManagerDelegate and CBPeripheralDelegate protocols: @interface BLEViewController : UIViewController <CBCentralManagerDelegate,CBPeripheralDelegate> (1) Start scanning -(void)centralManagerDidUpdateState:(CBCentralManager *)central { if ([central state] == CBCentralManagerStatePoweredOn) { [centralManager scanForPeripheralsWithServices:arrayOfCBUUIDs options:nil]; } } // The above invokes the following: (2) Connect to the peripheral -(void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI { [centralManager stopScan]; [centralManager connectPeripheral:peripheral options:nil]; } // The above invokes the following: (3) Discover the peripheral's services -(void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral { [peripheral discoverServices:nil]; } // The above is *supposed to* invoke the following but never does: (4) Obtain the service.UUID -(void)peripheral:(CBPeripheral *)peripheral didDiscoverServices:(NSError *)error { NSLog(@"didDiscoverServices: %@", peripheral); // never invoked! } I've stepped through execution in the debugger, and all the objects are set and valid, including the centralManager.delegate. The BLE device works correctly with other apps, so I must have overlooked a step, but what? -Carl _______________________________________________ Do not post admin requests to the list. They will be ignored. Bluetooth-dev mailing list (Bluetooth-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/bluetooth-dev/site_archiver%40lists.... This email sent to site_archiver@lists.apple.com
participants (1)
-
Carl Hoefs