File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -89,8 +89,23 @@ class BluezBindings extends EventEmitter {
8989 if ( this . _scanning ) {
9090 debug ( `[startScanning] Scan already ongoing...` ) ;
9191 } else {
92- debug ( `[startScanning] Start Scanning...` ) ;
9392 try {
93+ const powered = (
94+ await this . hciProps . Get ( 'org.bluez.Adapter1' , 'Powered' )
95+ ) . value ;
96+ if ( ! powered ) {
97+ debug ( `[startScanning] Turning the adapter on...` ) ;
98+ await this . hciProps . Set (
99+ 'org.bluez.Adapter1' ,
100+ 'Powered' ,
101+ new dbus . Variant ( 'b' , true )
102+ ) ;
103+ }
104+ debug ( `[startScanning] Setting discovery filter...` ) ;
105+ await this . hciAdapter . SetDiscoveryFilter ( {
106+ DuplicateData : new dbus . Variant ( 'b' , ! this . _scanFilterDuplicates ) ,
107+ } ) ;
108+ debug ( `[startScanning] Start Scanning...` ) ;
94109 await this . hciAdapter . StartDiscovery ( ) ;
95110 } catch ( err ) {
96111 debug (
You can’t perform that action at this time.
0 commit comments