Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CoreBluetooth: What is the lifetime of unique UUIDs

Following off of this question:
Corebluetooth, How to get a unique UUID?

After connecting to a peripheral, I can retrieve its CFUUIDRef, which is unique, and can use it to reconnect via retrievePeripherals. However, I have found that I can not use it to reconnect after closing the application.

Is the unique UUID generated after a connection only valid for the lifetime of the application or are we supposed to be able to save it for later use? I am trying to have my application remember one particular peripheral, but besides peripheral.UUID, I don't know of any other unique identifiers.

like image 883
loadedion Avatar asked Jul 10 '13 16:07

loadedion


1 Answers

Long story short, YES you can use the UUID to reconnect to the same device even after you close the application (in exactly the way you say).

I assume however, that you are not actually pairing with peripheral. That's a big problem right there. You need to actually establish the pairing request and get the peripheral to show up in the bluetooth table. The UUID will then be solidified with the iOS device and will remain until you flush the Network Settings of the iOS device.

The other possibility is that your BLE device has a firmware problem, wherein after you disconnect, it forces itself into advertising mode or something. This will also mess with your ability to reconnect. Let me know if you have any questions!

like image 170
Tommy Devoy Avatar answered Nov 10 '22 13:11

Tommy Devoy