bjoernQ / bleps

A toy-level BLE peripheral stack
MIT License
55 stars 18 forks source link

Make reads and writes fallible. #15

Closed jneem closed 1 year ago

jneem commented 1 year ago

The AttData trait is modified so that the methods return Results. The trait is still implemented for infallible callbacks, so although this is a breaking change for anyone that explicitly uses AttData, most usages of the gatt! macro should not break.

This does change the behavior of zero-byte reads. I'm not sure if it was intentional, but previously if AttData::read returned zero bytes, we'd return a "not found" error. This PR changes the behavior to return success in this case.