scratchfoundation / scratch-link

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

BLE: delay on first read/write of a characteristic #151

Closed cwillisf closed 4 years ago

cwillisf commented 4 years ago

Expected Behavior

The time it takes to read or write a characteristic should depend only on state exposed to the client, such as whether or not the peripheral is connected. In particular, it should not depend on any hidden internal state within Scratch Link.

Actual Behavior

The first message to read or write a characteristic takes some extra time while information about that characteristic is read and cached within Scratch Link. Instead we should consider preemptively caching that information as soon as the peripheral connects, which would effectively hide the delay.

This enhancement was suggested by @terado0618 and should improve initial read and write speed for most or all BLE peripherals.