MCPcopy Create free account
hub / github.com/ActiveState/code / BluetoothScan

Function BluetoothScan

recipes/Python/576627_BlueMon/recipe-576627.py:48–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46 f=os.popen(zcmd)#------------send the command to terminal.
47
48def BluetoothScan():#-----------------------Performs the actual scan for Bluetooth Devices
49 f = os.popen("hcitool scan")#-----------Sends the command to the terminal
50 for i in f.readlines():#-----------------Step through the list of information returned from the above command.
51 if (i.find(":") != -1):#-------------search for the ":" symbol.
52 DevAdd =i[1:18]#-----------------If it's found then strip out the device bluetooth address
53 DevLab=i[19:-1]#------------------and then strip out the device name
54 x=DevLab#------------------------a copy of the Device label/name
55 scan.append(x)#-------------------add the device to the array
56
57while 1:#------------------------------------------start to loop forever
58 BluetoothScan()#--------------------------------Perform the scan for devices

Callers 1

recipe-576627.pyFile · 0.85

Calls 3

readlinesMethod · 0.45
findMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected