Unique identifier for a BLE peripheral device

So, I have a BLE peripheral device, and I need some identifier so that it can later be shared with another iPhone. Example I connect using iPhone 'A' to the peripheral. iPhone "A" stores the peripheral database identifier, and then I can easily take iPhone "B" and connect to the peripherals found by this identifier.

Now there is a UUID that changes for each iPhone-peripheral connection, but the MAC Address not available. What could you suggest?

+5
source share
2 answers

I have a similar problem and many streams like this say that you cannot get the MAC address from CoreBluetooth. I want to connect to a BLE peripheral device (I mean an open and connected peripheral device) and store some information in a database so that another iPhone can read the same database and use the information when it connects to the same BLE peripheral device . So far, I rely on the device name obtained as follows:

 -(void)addDiscoveredDevice:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI { NSString * name = [peripheral name]; } 

because NSString * uuid = [[peripheral identifier] UUIDString]; gives different results on different iOS devices.

Therefore, let’s say my first problem is to find out how much Apple Watch I have is close to my iPhone, the second problem is to find out if this Apple Watch (for example, John Apple Watch) fits my iPhone. Unfortunately, this method does not work because users (e.g. John) or companies can change the name of their peripheral devices.

Yes. I can rely on a combination of the name + service uuid + character uuid, but for the same reasons, if the name changes, it is useless. Has anyone found a solution?

0
source

Unless you are manufacturing peripherals yourself, you cannot uniquely identify peripherals on different iOS devices. That's exactly what Apple wants this to happen, because it means developers cannot track user locations or motion patterns based on device addresses. This will be a privacy issue.

If you yourself create the periphery, you can do whatever you want. For example: use the uuid user service, add uuid to the manufacturer’s data in the advertisement, specify unique ad names, etc. Etc. But if the main purpose of all this is to track the user, then I would suggest that Apple might refuse your submission.

0
source

Source: https://habr.com/ru/post/1239471/


All Articles