问题描述
我是新手
我通过NRF连接获得服务的UUID,但是我一直在等待它
this.device=null;
this.server=null;
function connect() {
return navigator.bluetooth.requestDevice({filters:[{services:[ '0000ffb0-0000-1000-8000-00805f9b34fb' ]}]})
.then(device => {
this.device = device;
return device.gatt.connect();
})
.then(server => {
this.server = server;
return Promise.all([
//Keep waiting
server.getPrimaryService('0000ffb0-0000-1000-8000-00805f9b34fb').then(service => {
this.service = service;
console.log(service);
return Promise.all([
//this._cacheCharacteristic(service,''),])
})
]);
})
}
解决方法
我测试了一个小时 ''' server.getPrimaryService(0x1800); ''' 只有一次 剩下的时间在等待