scratchfoundation / scratch-link

Device interoperability layer for Windows and MacOS
BSD 3-Clause "New" or "Revised" License
102 stars 83 forks source link

BLE: the `withResponse` parameter should override write behavior #150

Closed cwillisf closed 4 years ago

cwillisf commented 4 years ago

Expected Behavior

Scratch Link should respect the withoutResponse parameter from a write message if present, even if the "write without response" capability flag is not present on the characteristic. Some peripherals may allow this even without the flag, and it should be the extension's responsibility to ensure compatibility with a particular peripheral.

@terado0618 reports that this change should improve performance significantly for some peripherals on Windows.

Actual Behavior

Scratch Link only respects the withoutResponse parameter of a write message if the characteristic's properties include the "write without response" flag. Otherwise, Scratch Link writes using the "with response" message regardless of the withoutResponse parameter.

Notes

We'll need to make sure not to reintroduce #111