File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,7 @@ def devices(self):
121121 """
122122 Returns all known Bluetooth devices.
123123 """
124+ self .update_devices ()
124125 return self ._devices .values ()
125126
126127 def start_discovery (self , service_uuids = []):
@@ -208,6 +209,24 @@ def remove_device(self, mac_address):
208209 # TODO: Implement
209210 pass
210211
212+ def remove_all_devices (self , skip_alias = None ):
213+ self .update_devices ()
214+
215+ keys_to_be_deleted = []
216+ for key , device in self ._devices .items ():
217+ if skip_alias and device .alias () == skip_alias :
218+ continue
219+ mac_address = device .mac_address .replace (':' , '_' ).upper ()
220+ path = '/org/bluez/%s/dev_%s' % (self .adapter_name , mac_address )
221+ self ._adapter .RemoveDevice (path )
222+ keys_to_be_deleted .append (key )
223+
224+ for key in keys_to_be_deleted :
225+ del self ._devices [key ]
226+
227+ self .update_devices ()
228+
229+
211230
212231class Device :
213232 def __init__ (self , mac_address , manager , managed = True ):
You can’t perform that action at this time.
0 commit comments