- 求助:ios10系统,蓝牙广播advertisData转化成字符串后是相同的?
在ios9系统上完成正常,升级之后,advertisData转化成字符串 是相同的了(附截图) 代码如下: else if (app.deviceInnfo.platform == 'ios') { //真机 peripheral = res.devices[0]; var advertisData = peripheral.advertisData; var data = wx.base64ToArrayBuffer(advertisData); var str = buf2hex(data); peripheral.mac_add = getMacAddress(str.toUpperCase()); peripheral.advertisDataStr = str; array.push(res.devices[0]); console.log(peripheral); } function buf2hex(buffer) { return Array.prototype.map.call(new Uint8Array(buffer), x => ('00' + x.toString(16)).slice(-2)).join(''); } [图片]
2017-08-01 - 关于蓝牙监听寻找到新设备读取(advertiseData)的问题
wx.onBluetoothDeviceFound(CALLBACK)在返回的device 对象里面有个advertiseData属性,类型是ArrayBuffer,可是我在真机上得到的是string,这是怎么一回事呢,求解,感谢
2017-06-28