CC2541获取连接设备蓝牙MAC地址,得到的MAC地址是虚拟MAC地址还连接设备实际的蓝牙MAC地址?
CC2541 BLE能得到连接设备实际蓝牙MAC地址嘛?
YiKai Chen:
這要看你连接的蓝牙设备,如果连接的蓝牙设备回應是虚拟MAC地址,當然就是虚拟的,但是據我所知大部分都是回應实际的蓝牙MAC地址
shilei dou:
回复 YiKai Chen:
我们产品中CC2541是与苹果手机和安卓手机连接,我测试发现得到的都是虚拟MAC地址。为什么手机不回应实际的MAC地址
Viki Shi:
连接的设备是手机吗?连上以后获取的应该是手机蓝牙的实际mac地址,但是有些手机会使用随机地址,看具体品牌或型号
Viki Shi:
回复 shilei dou:
手机会使用随机地址,根据这个地址可以解析出实际地址
Alvin Chen:
回复 shilei dou:
可能是系统安全考虑吧,绝大多数的手机的蓝牙地址的都是虚拟的,如果你是芯片或者CC2541或者CC26xx,可以设置为
地址模式为ADDRMODE_PUBLIC
{ADDRMODE_PUBLIC= 0x00,//!< Always Use Public AddressADDRMODE_RANDOM= 0x01,//!< Always Use Random Static Address/// Always Use Resolvable Private Address with Public Identity AddressADDRMODE_RP_WITH_PUBLIC_ID = 0x02,/// Always Use Resolvable Private Address with Random Identity AddressADDRMODE_RP_WITH_RANDOM_ID = 0x03,
shilei dou:
回复 Alvin Chen:
这个设置后可以得到手机实际MAC地址?
shilei dou:
回复 YiKai Chen:
https://blog.csdn.net/feilusia/article/details/70238789
这个API可以得到实际MAC嘛
YiKai Chen:
回复 shilei dou:
這個還是會跟手機回應你的有關係,你得要自己測試才行
Viki Shi:
回复 shilei dou:
In addition to the described services, BLE supports a mechanism called privacy feature, which allows a device to use private addresses and frequently change them. The privacy feature mitigates the threat by which an adversary can track a BLE device. The private addresses are generated by encrypting the public address of the device, which can be resolved by a trusted device that has been provided with the corresponding encryption key.