Skip to content

Commit ce8e05c

Browse files
author
dbaba
committed
Turn on the adapter gain after it's turned off
1 parent 072b3cb commit ce8e05c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/noble/lib/bluez/bindings.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,17 @@ class BluezBindings extends EventEmitter {
682682
debug(`Powered=>${changedProps.Powered.value}`);
683683
if (!changedProps.Powered.value) {
684684
this.emit('stateChange', 'poweredOff');
685+
setTimeout(async () => {
686+
debug(`Trying to turn on the adapter...`);
687+
const powerOn = new dbus.Variant('b', true);
688+
try {
689+
await this.hciProps.Set(interfaceName, 'Powered', powerOn);
690+
} catch (err) {
691+
debug(
692+
`Error while turning on the adapter. err.message:${err.message}, type:${err.type}`
693+
);
694+
}
695+
}, 5 * 1000);
685696
}
686697
}
687698
// Skip to show other props

0 commit comments

Comments
 (0)