BhushanVU
BhushanVU

Reputation: 3455

CoreBluetooth Fire a method when other device is asking to pair?

I am new to Corebluetooth.framework, I want to fire a simple method when other device wants to connect to ios device.

Any guidance will be appreciated.

Upvotes: 1

Views: 122

Answers (1)

allprog
allprog

Reputation: 16790

You cannot intercept the connection event, nor the service discovery. The first time you even "hear" about a central being connected to your device (acting as the peripheral) is when the central is trying to read, write dynamic characteristics or subscribes for notifications.

If you have a scenario in mind where the central lets know the peripheral that it is there and the peripheral can start doing something with this info, then you need to implement this in a proprietary way using any of the read, write or subscribe events.

Additional note: you cannot force a central to disconnect from your peripheral. The only way to do this is the deallocation of the CBPeripheralManager. But even in that case, iOS will decide when to really close the connection.

Upvotes: 2

Related Questions