noble icon indicating copy to clipboard operation
noble copied to clipboard

Connecting to peripheral stops scanning

Open jmbldwn opened this issue 4 years ago • 1 comments

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?

jmbldwn avatar Mar 07 '21 22:03 jmbldwn

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);
});

mendess avatar Apr 05 '21 17:04 mendess