Anirban Bhowmick
Anirban Bhowmick

Reputation: 61

know from the peripheral that whether it is disconnected from central

I am having a BLE device acting as peripheral and an iPhone4s as central.Both are connected via BluetoothLE connection.My question is that can i get to know from the peripheral end that it has been disconnected from the central.

Upvotes: 1

Views: 1704

Answers (2)

palhaland
palhaland

Reputation: 133

Depending on the implementation of your peripheral (HCI interface or proprietary) you would either get a Disconnection Complete Event (Bluetooth Core Spec 4.0 - Volume 2 Part E section 7.7.5) or the proprietary equivalent event.

Could you provide some more information about the peripheral you are using?

Upvotes: 1

henrik
henrik

Reputation: 1312

If the Peripheral disconnect you can catch the didDisconnect (on the iOS side) -(void) centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)

You can also ask iOS about "Known" devices (only those PAIRED, thus remembered/Cached in iOS6) Go through each one and check the peripheral.isConnected flag. Unfortunately iOS seems to also cache this for too long so some times you will see the isConnected flag even though connection has been lsot.

From Peripheral side you must keep track of didConnects / didDisconnects.

Upvotes: 0

Related Questions