Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bleak android error #821

Closed
ps2229 opened this issue May 2, 2022 · 1 comment
Closed

bleak android error #821

ps2229 opened this issue May 2, 2022 · 1 comment

Comments

@ps2229
Copy link

ps2229 commented May 2, 2022

  • bleak version:0.14.2
  • Python version:3
  • Operating System:android
  • BlueZ version (bluetoothctl -v) in case of Linux:

Description

Trying to implement bleak start_notify function

What I Did

 async def begin_scan1(self):
    async def callback2(sender: int, data: bytearray):
        print(sender, data,'llllll')
    a = []
    scanned_devices = await bleak.BleakScanner.discover(1)

    if len(scanned_devices) == 0:
        print("NO DEVICES")
    scanned_devices.sort(key=lambda device: -device.rssi)
    for device in scanned_devices:
        device1 = f"{device.name}"
        print(device1)
        if device1 == "Bluno":
            try:
                async with bleak.BleakClient(device) as client:
                    print('rr')
                    paired = client.pair(protection_level=2)
                    print(f"Paired: {paired}")
                    COLOR_CHARACTERISTIC = "0000dfb1-0000-1000-8000-00805f9b34fb"
                    uu = '1'
                    write_value = bytearray([int(uu)])
                    await client.write_gatt_char(COLOR_CHARACTERISTIC, write_value) 
                    print('www')
                    await client.start_notify(COLOR_CHARACTERISTIC, callback2)
                    print('wwee')
                    await asyncio.sleep(10.0)
                    print('rrrq')
                    await client.stop_notify(COLOR_CHARACTERISTIC)
               
            except:

                asyncio.sleep(10)
                toast('error')
                self.main_pop.dismiss()
        else:
            toast('Device Not Found', duration=1)
            self.main_pop.dismiss()
    self.main_pop.dismiss()

Was getting error bleak.exc.bleakerror:descriptor None was not found.
Any clue why I am getting this issue or how to solve it.

@dlech
Copy link
Collaborator

dlech commented Jul 13, 2022

Duplicate of #828.

@dlech dlech closed this as completed Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants