为什么BLEPeripheralServer. startAdvertising()无法发送成功?
我使用下面的代码进行广播的发送,尝试过发送data也尝试过发送sendData,都无法发送成功,接收广播的地方接收不到,是否是我传递serverUuids的方式错误了?是否有发送广播的示例代码可以给我看一下,谢谢!
wx.openBluetoothAdapter({
success: function(res) {
wx.showToast({
title: '打开蓝牙成功',
});
wx.createBLEPeripheralServer({
success: function ({ server }){
const data = ['1111', '1111', '1111', '1111', '1111', '1111', 'A9FF', '54CB', '6F6E', '0BEA', '5173', 'ADEA', '29C6'];
const sendData = data.map(str => `0000${str}-0000-1000-8000-00805F9B34FB`);
wx.showToast({
title: '创建服务对象成功',
});
console.log('dsafasdfadsL:',server);
console.log('dsafasdfadsL:', server.startAdvertising);
server.startAdvertising({
advertiseRequest: {
connectable: false,
serviceUuids: data,
}
});
}
});
},
})