Code: Select all
# -*- coding: utf-8 -*-
import multiprocessing
import asyncio
from bleak import BleakScanner
#This is the cause of the error.
from pygrabber.dshow_graph import FilterGraph
async def bluetooth_receiver_start():
print("bluetooth_receiver_start")
try:
devices = await BleakScanner.discover()
print("scnanned devices:")
for device in devices:
print(f" - {device.name} ({device.address})")
except Exception as e:
print(f"device search error: {e}")
return
def bluetooth_process():
print("bluetooth_process started")
asyncio.run(bluetooth_receiver_start())
print("bluetooth_process finished")
if __name__ == '__main__':
process_bluetooth = multiprocessing.Process(target=bluetooth_process)
process_bluetooth.start()
try:
devices = FilterGraph().get_input_devices()
for device_index, device_name in enumerate(devices):
print(device_name)
except:
pass