Android 5 个静态蓝牙 MAC BLE 广告地址
Android 5 static bluetooth MAC address for BLE advertising
Android 5 引入了 BLE MAC 地址轮换以增加隐私。每次调用 BluetoothLeAdvertiser.startAdvertising() 时,MAC-地址都会改变。
是否可以禁用地址轮换,并在 BluetoothLeAdvertiser 的整个生命周期内只使用相同的 MAC 地址?
MAC地址是物理地址,不会改变。在 BLE 术语中,它是 Public 设备地址或 BD_ADDR for BR/EDR。我没试过,但每次用 readAddress() 读取它应该 return 相同的值。
Android 的 BLE 框架所做的是在广播时不使用该地址。它通过使用可能每隔几分钟左右更改一次的私有可解析地址来实现隐私,但仍然允许绑定设备使用绑定时交换的 IRK 来识别它。
出于明显的隐私原因,Android 的 BLE 框架不允许您将控制器设置为在广播时使用 public 地址。所以你不能禁用 "address rotating".
您可以禁用 BLE 隐私功能以避免 MAC 地址旋转,
并更改bluedroid源代码如下:
http://androidxref.com/5.1.1_r6/xref/external/bluetooth/bluedroid/include/bt_target.h#1326
* Toggles support for general LE privacy features such as remote address
* resolution, local address rotation etc.
*/
#ifndef BLE_PRIVACY_SPT
-#define BLE_PRIVACY_SPT TRUE
+#define BLE_PRIVACY_SPT FLASE
#endif
Android 5 引入了 BLE MAC 地址轮换以增加隐私。每次调用 BluetoothLeAdvertiser.startAdvertising() 时,MAC-地址都会改变。
是否可以禁用地址轮换,并在 BluetoothLeAdvertiser 的整个生命周期内只使用相同的 MAC 地址?
MAC地址是物理地址,不会改变。在 BLE 术语中,它是 Public 设备地址或 BD_ADDR for BR/EDR。我没试过,但每次用 readAddress() 读取它应该 return 相同的值。
Android 的 BLE 框架所做的是在广播时不使用该地址。它通过使用可能每隔几分钟左右更改一次的私有可解析地址来实现隐私,但仍然允许绑定设备使用绑定时交换的 IRK 来识别它。
出于明显的隐私原因,Android 的 BLE 框架不允许您将控制器设置为在广播时使用 public 地址。所以你不能禁用 "address rotating".
您可以禁用 BLE 隐私功能以避免 MAC 地址旋转, 并更改bluedroid源代码如下:
http://androidxref.com/5.1.1_r6/xref/external/bluetooth/bluedroid/include/bt_target.h#1326
* Toggles support for general LE privacy features such as remote address * resolution, local address rotation etc. */ #ifndef BLE_PRIVACY_SPT -#define BLE_PRIVACY_SPT TRUE +#define BLE_PRIVACY_SPT FLASE #endif