Search code examples
iosbluetoothcore-bluetoothbluegiga

CoreBluetooth peripheral identifier changes


I am using CoreBluetooth to connect to a number of identical bluetooth scales that I've developed using BlueGiga BLE113 modules. My app keeps a local copy of each scale's CBPeripheral.Identifier.UUIDString along with some related data about that physical scale so I can tell them apart. E.g. "Scale A" and "Scale B"

My trouble is that every so often the device's UUIDString changes. I can develop for days against a device, then one day the UUID is different. The scale hasn't been reset, the app hasn't been restarted and bluetooth hasn't been cycled on the phone.

I need a way to identify each bluetooth peripheral (scale) reliably and I'd rather not have to hard code identifiers into each device during production.

Is there a better method of identifying peripherals for the long-term?


Solution

  • Unfortunately, I dont think you get around iOS's changing of peripheral UUIDs.

    Depending on the control you have to change the BLE services/characteristics on the scales, you could advertise an additional service which contains a characteristic where you put a custom identifier in.

    On iOS you could scan for that service and read the characteristics value to identify the scale. This way, you would not be dependent on the UUID the OS assigns to your peripherals.

    Hope this helps!