troystribling / BlueCap

iOS Bluetooth LE framework
MIT License
714 stars 114 forks source link

Connect Peripheral Powered Off, 30 seconds later powered On #81

Closed kaizenkaizen closed 5 years ago

kaizenkaizen commented 6 years ago

How would I handle the case: an already connected peripheral is powered off, 30 seconds later it is powered on again, and I want to reconnect to this peripheral?

troystribling commented 6 years ago

After the disconnect try to reconnect with infinite timeout and wait.

kaizenkaizen commented 6 years ago

Thanks! Is there a code snippet of this, that you could provide or link to? It would be greatly appreciated.

troystribling commented 6 years ago

https://github.com/troystribling/BlueCap/blob/master/Documentation/CentralManager.md#central_peripheral_connection. The default timeout is infinite. Her is an example https://github.com/troystribling/BlueCap/blob/master/Examples/CentralManager/CentralManager/ViewController.swift#L106-L207