how to get public Bluetooth Device Address using c

2019-05-29 21:22发布

问题:

We have one bluetooth devices.Bluetooth devices have one public bluetooth device address(BDA).In android they get bluetooth like (30:03:5B:00:15:12).I can get only device name and device UUID like this

-(void) centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI { 
NSLog(@"Discovered peripheral %@ (%@) (%@)",peripheral.name,peripheral.identifier.UUIDString); //PHARMACELL CAREOUSEL (0BEF07EA-7680-4223-2D5E-6CE159333F7E)

}

Please any one guide to us how to get BDA value

回答1:

The simple answer is clearly: NO. It is not possible (practically) to get the BDA from the seeds that generated a particular UUID. Provided that in fact the algorithm that generated your UUID did used the MAC Address of your device to generate it, and I guess you cannot guarantee that it is the case for the UUID generator you use, unless you have access to the UUID Generator code or algorithm.

As apple while generating UUID might use the MAC address of the device, other components like timestamps, hashing, UDID (iOS Devices) and also some other factors so its looks impossible to get it back from UDID also.



回答2:

Android 6 has REMOVED ability to read own Device WIFI and BT MAC address, they will be hardcoded to 02:00:00:00:00:00. This is "to protect user data" or more correctly "privacy". Too many big mall's have abused harvesting these addresses for getting user behavioral information.



回答3:

On iOS it is not possible to get the MAC address of the device, it's abstracted by the CBPeripheral class and is identified internally in os by the identifier property. One way to get the MAC address, that's actually most popular, is to include the MAC address in the scan response. You could ask this feature from your BLE device manufacturer. Also the MAC address could be read from one of the GATT characteristics. Ask your BLE manufacturer for more details.