蓝牙搜索设备信息:
Printer_A44E: {"deviceId": "BB49E9D3-D7A5-0035-79FD-D9EAED3CB8F8", "RSSI": -66, "connectable": true, "advertisData": "<ArrayBuffer: byteLength=8>", "advertisServiceUUIDs": ["E7810A71-73AE-499D-8C15-FAA9AEF0C3F2"], "localName": "Printer_A44E", "name": "Printer_A44E"}
Printer_5773_BLE: {"deviceId": "80941346-7501-DAC7-959E-C6FD6E25D642", "advertisServiceUUIDs": ["000018F0-0000-1000-8000-00805F9B34FB", "E7810A71-73AE-499D-8C15-FAA9AEF0C3F2"], "localName": "Printer_5773_BLE", "name": "Printer_5773_BLE", "connectable": true, "RSSI": -81}
描述:
1.之前用deviceId作为标识,但在ios平台deviceId偶尔会变动
2.考虑过用advertisData,解析出来是mac地址(物理地址),ios和Android平台获取mac一致,但通过多个设备测试,Print_5537_BLE 打印机没有advertisData字段,或者说空字符。通过advertisServiceUUIDs值可以看出,5537打印机是多数组,其他都是单数组,猜想应该是这个导致不能解析
3.最后考虑用advertisServiceUUIDs,不分平台,获取数值都是一样的
4.问题来了,相同设备advertisServiceUUIDs是一样的
那么最后
同一账号不同设备(包含安卓和苹果),我想储存一个标识,用于下次连接,那么请问该以什么标识为储存依据?