1
#common sets up the conduit environment
4
import conduit.utils.Bluetooth as Bluetooth
6
#test the bluetooth searching singleton
7
def found_phone(address, name):
10
def found_pc(address, name):
13
a = Bluetooth.BluetoothSearcher()
14
b = Bluetooth.BluetoothSearcher()
16
ok("Bluetooth searcher is singleton", a != None and a == b)
18
a.watch_for_devices(found_phone)
19
b.watch_for_devices(found_phone)
20
ok("Registered found_phone function", len(a._cbs) == 1)
22
b.watch_for_devices(found_pc, class_check_func=Bluetooth.is_computer_class)
23
ok("Registered found_pc function", len(a._cbs) == 2)
26
ok("Bluetooth search thread started", a.isAlive())
31
ok("Cancelled scan (found %d devices)" % len(a.get_devices()), True)
33
ok("Cancelled scan", False)