Home:ALL Converter>CoreBluetooth: How can the peripheral manager know that the central received an indication?

CoreBluetooth: How can the peripheral manager know that the central received an indication?

Ask Time:2013-10-02T12:28:34         Author:user108

Json Formatter

The basic problem I'm trying to solve is as follows. I have two iOS devices, one configured as a central, and the other as a peripheral. I would like the peripheral to know if the central moves away or becomes inactive for some reason (say the device running the central is turned off).

Under normal conditions, I have it set up so that as the central moves close to the peripheral, the central can use beacon regions and ranging to inform the peripheral via a characteristic-write when it is in the immediate proximity (CLProximityImmediate), and then again when it is still in range, but far off (CLProximityFar). This works well.

However, to catch a corner condition when the central device goes from being CLProximityImmediate to some unknown state, I was planning to used periodic indications from the peripheral to which the central can respond. If there is no response to the indication, then the peripheral can assume that the central is no longer in immediate proximity. However, I am not able to find a callback or delegate method that informs the peripheral manager that the indication failed.

The method updateValue:forCharacteristic:onSubscribedCentrals: returns NO when the underlying transmit queue is full-- and NOT because the central did not respond, the way I've understood it.

Am I missing something obvious here? Is there a way for the peripheral manager to tell that the central did not receive an indication? Or is there a missing callback in CoreBluetooth for this case?

Thanks for your help!

Author:user108,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/19130006/corebluetooth-how-can-the-peripheral-manager-know-that-the-central-received-an
barbazoo :

There are two issues to let the peripheral know the location maneager lost contact with the CLBeacon:\n\n\nThe iBeacons are passive, advertise and transmit only devices. As in the Apple implementation there are no connection made to them from the Core Location framework. Therefore the peripheral newer knows anyone listened to their broadcast.\nThe CLBeacon will not expose the underlying BTLE peripheral as a CBPeripheral, so you would not be able to let the BTLE peripheral know your location monitor was in range. \n\n\nIssue #2 can be resolved a rather complicated way: \n\n\nStart scanning for CBPeripherals where the advertisementData contains the proximityUUID. \nMake connections to that CBPeripheral and get notified of a characteristic value change. \nChange a characteristic value on the peripheral frequently, so when the Central sees no more notifications after a timeout period it indicates the peripheral is out of range. \nIf you want to make it work for multiple iOS devices this gets way to complicated to switch between advertising and iBeacon and working as a GATT peripheral. \n",
2013-10-05T23:58:32
yy