Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Wait response flag inversion #177

@nezval

Description

@nezval
  • bleak version: 0.6.1
  • Python version:3.6.3
  • Operating System: macOS 10.15.4
    Was connected to "lego control plus"

Description

inside of BleakClientCoreBluetooth.write_gatt_char
line:

success = await cbapp.central_manager_delegate.connected_peripheral_delegate.writeCharacteristic_value_type_(
            characteristic.obj,
            value,
            CBCharacteristicWriteWithResponse if response else CBCharacteristicWriteWithoutResponse
        )

where
CBCharacteristicWriteWithResponse equal 0
CBCharacteristicWriteWithoutResponse equal 1

and inside of writeCharacteristic_value_type_

        if response:
            await event.wait()

So when write_gatt_char called with response=False inside of writeCharacteristic_value_type_ it will wait forever.

It looks like doing this conversion value right on the call of writeValue_forCharacteristic_type_ will fix it.

Metadata

Metadata

Assignees

Labels

Backend: Core BluetoothIssues and PRs relating to the Core Bluetooth backend

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions