noble
noble copied to clipboard
Connecting to peripheral stops scanning
I am aware that some hardware may not support continuous scanning while connecting to a peripheral, but I'm not getting any of the errors that would indicate that. When I connect to a discovered peripheral, I get a 'scanStop' event right after.
What's worse is I'm unable to get scanning to work again after that.
This is running on a raspberrypi 3B+, running raspian buster.
Should I give up on continuing to scan while talking to a peripheral?
I had this same issue on a raspberry. Adding this fixed it for me.
noble.on('stateChange', (state: string) => {
if (state == 'poweredOn') {
noble.startScanning([], true);
}
});
noble.on('scanStop', () => {
noble.startScanning([], true);
});