Search code examples
iosuuidcore-bluetoothbluetooth-peripheral

What can be used as a unique identifier for a set of bluetooth modules from a specific manufacturer?


I hope my type of question does not violate question type rules!

I'm coding a Bluetooth iOS app to control a peripheral (Bluetooth speaker) and I'd like the app to only identify a set of unique Bluetooth modules (brand).

Since I first want to identify if the speaker is part of the brand, I cannot rely on picking up certain types of services since any other speaker could also have them. Neither can I rely on the identifier name, since it's very superficial and prone to change.

The closest I've come to is the first 16-code of the UUID 32 hexadecimal digits, organization unique identifier (OUI). For example in the image below, is it good practice to use D42A8779-F905-BA72-80AA of the D42A8779-F905-BA72-80AA-3186A18D4453 as a brand peripheral identifier?

enter image description here

If not, what could I possibly rely on?


Solution

  • The identifier of CBPeripheral is unique to the iOS device that scanned it. It's not sent by the bluetooth peripheral itself https://developer.apple.com/documentation/corebluetooth/cbpeer/1620687-identifier

    Surely if you're looking to do something other than just audio, one of the service UUIDs will be unique to that device?

    You might also be able to identify by looking in the advertisement data, specifically the manufacturer data: https://developer.apple.com/documentation/corebluetooth/cbadvertisementdatamanufacturerdatakey

    This is part of the CBCentralManagerDelegate didDiscover callback https://developer.apple.com/documentation/corebluetooth/cbcentralmanagerdelegate/1518937-centralmanager