We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After about 0 to 10 minutes of scanning it get stuck in the function discoverSomeServicesAndCharacteristicsAsync. Any suggestions?
const noble = require('@abandonware/noble/with-custom-binding')({extended: true}); noble.on('stateChange', async (state) => { console.log('stateChange received: '+state); if (state === 'poweredOn') { console.log('poweredOn received'); noble.startScanningAsync([],true); } }); noble.on('warning', async () => { console.log('warning'); }); noble.on('disconnect', async () => { console.log('disconnect'); }); noble.once('rssiUpdate', async () => { console.log('rssiUpdate'); }); noble.on('discover', async (peripheral) => { console.log('discovered: '+peripheral.address + ' rssi: '+peripheral.rssi); if (peripheral.address === 'xx:xx:xx:xx:xx:aa') { console.log('tag found') console.log("state: ", peripheral.state) printDetailsBattery(peripheral); } }); async function printDetailsBattery(peripheral) { if (peripheral.state !== 'disconnected') { return; } //noble.reset(); console.log("stopScanningAsync") await noble.stopScanningAsync() console.log("connectAsync") await peripheral.connectAsync(); // 180f = battery service // 2a19 = battery level console.log("discoverSomeServicesAndCharacteristicsAsync") const {characteristics} = await peripheral.discoverSomeServicesAndCharacteristicsAsync(['180f'], ['2a19']); console.log("readAsync") const batteryLevel = (await characteristics[0].readAsync())[0]; console.log(`battery level: ${peripheral.address}, ${batteryLevel}%`); console.log("disconnectAsync") await peripheral.disconnectAsync(); console.log("startScanningAsync") await noble.startScanningAsync([],true); }
discovered: xx:xx:xx:xx:xx:88 rssi: -85 discovered: xx:xx:xx:xx:xx:77 rssi: -90 discovered: xx:xx:xx:xx:xx:66 rssi: -72 discovered: xx:xx:xx:xx:xx:55 rssi: -72 discovered: xx:xx:xx:xx:xx:44 rssi: -62 discovered: xx:xx:xx:xx:xx:33 rssi: -97 discovered: xx:xx:xx:xx:xx:22 rssi: -76 discovered: xx:xx:xx:xx:xx:11 rssi: -98 discovered: xx:xx:xx:xx:xx:aa rssi: -59 tag found state: disconnected stopScanningAsync discovered: xx:xx:xx:xx:xx:ab rssi: -93 connectAsync discoverSomeServicesAndCharacteristicsAsync
The text was updated successfully, but these errors were encountered:
I had a similar issue but it wasn't finding my characteristic at all and worked around it by enumerating all of them and filtering after
const characteristics = await services[0].discoverCharacteristicsAsync(); const tempCharacteristic = characteristics.find(c => c.uuid === TEMP_CHARACTERISTIC_UUID);
Sorry, something went wrong.
No branches or pull requests
Problem
After about 0 to 10 minutes of scanning it get stuck in the function discoverSomeServicesAndCharacteristicsAsync. Any suggestions?
Scanning code
Last output before getting stuck
The text was updated successfully, but these errors were encountered: