#NEWLINE# def scan_devices( duration = 10 ) : #NEWLINE# #INDENT# ' This causes the bluetooth system to scan for any broadcasting devices. Once found, the devices get added to a\n\tdbus backed database specific for bluetooth for retrieval later.\n\n\tArgs:\n\t\tduration (int): the amount of time that the scan should run for in seconds.\n\t' #NEWLINE# DBusGMainLoop ( set_as_default = True ) #NEWLINE# bus = dbus . SystemBus ( ) #NEWLINE# adapter = find_adapter ( ) #NEWLINE# adapter . StartDiscovery ( ) #NEWLINE# mainloop = GObject . MainLoop ( ) #NEWLINE# GObject . timeout_add ( ( duration * 1000 ) , quit , mainloop ) #NEWLINE# mainloop . run ( )