adafruit / Adafruit_Blinka_bleio

`_bleio` for Blinka based on `bleak`
58 stars 19 forks source link

Async waiting for reply even if Characteristic.WRITE_NO_RESPONSE specified #29

Closed licryle closed 3 years ago

licryle commented 3 years ago

TLDR: I suspect there's an OR that should be an AND in _bleio.characteristic at line 195.

Hi folks,

I'm using adafruit_ble to connect to an off-the-shelf BLE lamp that implements a custom protocol.

To do so, I've implemented a quick custom Service using StreamIn/Out characteristics. In them, I specify Characteristic.WRITE_NO_RESPONSE. You can see the source code here.

However, at run time, the writing hangs waiting for a reply from the lamp. I tracked it down to _bleio.characteristic at line 195.

However, the line states: response=self.properties | Characteristic.WRITE

According to the documentation, response should be a bool where true means a reply is expected.. I may be mistaken, but OR seems to point as an "always true", while a AND would mean "only await a reply when config is specifically WRITE", hence I wonder if that should be a "&".

tannewt commented 3 years ago

@dhalbert Have any context on this? My brain has purged BLE info.

dhalbert commented 3 years ago

I will take a look!