danielgallagher0 / bluetooth-hci

Bluetooth HCI implementation for embedded Rust
Apache License 2.0
53 stars 8 forks source link

Consider handling `Controller::peek` internally #6

Open micolous opened 1 year ago

micolous commented 1 year ago

I'd like to connect Controller to something which implements Read and Write. The tedious part of this is Controller::peek(usize), because you need to implement a small "peekable" buffer which applies to read_into as well.

peek feels like an implementation detail which bluetooth-hci could handle itself, so then you only would need to implement read_into. It also means bluetooth-hci can make this buffer as large or as small as needed.

BlueNRG has a buffer implementation which doesn't appear specific to this device:

https://github.com/danielgallagher0/bluenrg/blob/e5cbecfe3d63bb24a346ff91221041bf9267ec0f/src/lib.rs#L375