hbldh / bleak

A cross platform Bluetooth Low Energy Client for Python using asyncio
MIT License
1.56k stars 275 forks source link

andorid start_notify no Descriptor #1527

Closed tsiens closed 2 months ago

tsiens commented 2 months ago

828

tsiens commented 2 months ago

What happened?Format and Lint?I don't understand

dlech commented 2 months ago

Format and Lint?I don't understand

We use black to automatically format the code. So the CI failure is because black wasn't run on the changes.

Also, I don't think this is the right way to fix the issue. It seems like the if statements are just silently ignoring the bug.

Can you explain more about what you are trying to fix and why this fixes it?

tsiens commented 2 months ago

Format and Lint?I don't understand

We use black to automatically format the code. So the CI failure is because black wasn't run on the changes.

Also, I don't think this is the right way to fix the issue. It seems like the if statements are just silently ignoring the bug.

Can you explain more about what you are trying to fix and why this fixes it?

I am developing an APK that uses a ble device, 1、In function “start_notify“,characteristic can be a string like the function 'stop_notify' 2、I don't know why my ble notification_descriptor is empty,self.write_gatt_descriptor will report an error,i think it's necessary to be compatible with empty notification_descriptor

dlech commented 2 months ago

In function “start_notify“,characteristic can be a string like the function 'stop_notify'

This should already be handled in the start_notify() in bleak/__init__.py. Is it not working?

I don't know why

I would like to understand what is actually going on before considering merging these change. E.g. does the same Python script work on other OSes but not on Android. Can we get logs showing what descriptors are actually reported by the device. Are we sure this isn't a defective device like those described in https://github.com/hbldh/bleak/issues/972?

tsiens commented 2 months ago

In function “start_notify“,characteristic can be a string like the function 'stop_notify'

This should already be handled in the start_notify() in bleak/__init__.py. Is it not working?

I don't know why

I would like to understand what is actually going on before considering merging these change. E.g. does the same Python script work on other OSes but not on Android. Can we get logs showing what descriptors are actually reported by the device. Are we sure this isn't a defective device like those described in #972?

my code is working properly on Windows, in bleak/p4android/client.py start_nofity,The original code required input BleakGATTCharacteristic object,This is unreasonable,Because the program will input a string char uuid just like stop_nofity,So the char_specifier should be modified to char_specifier: Union[BleakGATTCharacteristic, int, str, uuid.UUID].

and bleak/init.py start_nofity also char_specifier: Union[BleakGATTCharacteristic, int, str, uuid.UUID]

tsiens commented 2 months ago

In function “start_notify“,characteristic can be a string like the function 'stop_notify'

This should already be handled in the start_notify() in bleak/__init__.py. Is it not working?

I don't know why

I would like to understand what is actually going on before considering merging these change. E.g. does the same Python script work on other OSes but not on Android. Can we get logs showing what descriptors are actually reported by the device. Are we sure this isn't a defective device like those described in #972?

He doesn't work. I entered a string uuid into the start_nofity and reported an error. After I modified the p4a/client.py, it was successful