4

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?

Michael
  • 600
  • 6
  • 15
  • Unless you pair with them, they will changes. – Larme Apr 19 '16 at 08:23
  • 1
    Possible duplicate of [CoreBluetooth: What is the lifetime of unique UUIDs](http://stackoverflow.com/questions/17575949/corebluetooth-what-is-the-lifetime-of-unique-uuids) – Larme Apr 19 '16 at 09:54

1 Answers1

5

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!

p2pkit
  • 1,159
  • 8
  • 11
  • Thanks @p2pkit, I was afraid this may be the case. I do have control to change the services and I will add a characteristic with my own identifier and make it unique in production. – Michael Apr 20 '16 at 05:32