Add clear_peripherals method to adapter#382
Add clear_peripherals method to adapter#382danielstuart14 wants to merge 1 commit intodeviceplug:devfrom
Conversation
| async fn add_peripheral(&self, address: &PeripheralId) -> Result<Self::Peripheral>; | ||
|
|
||
| /// Clear the list of [`Peripheral`]s that have been discovered so far. | ||
| async fn clear_peripherals(&self) -> Result<()>; |
There was a problem hiding this comment.
As far as I can see there's no need for this to be async.
There was a problem hiding this comment.
I think it is best to keep it async, so that if a new platform (or even a linux solution later) needs it to be async we don't have to break the API. What do you think?
| } | ||
|
|
||
| async fn clear_peripherals(&self) -> Result<()> { | ||
| Err(Error::NotSupported( |
There was a problem hiding this comment.
I'm worried that this will result in people writing programs that crash on Linux as they only tested it on other platforms. What do you think about this just being a silent no-op on Linux? Not being able to clear the peripheral list shouldn't be a big issue in most cases I can think of.
There was a problem hiding this comment.
That sounds good, I'll change it. It may be possible to clear the bluez list, but the bluez-async lib doesn't seem to currently support it.
qdot
left a comment
There was a problem hiding this comment.
Making this as changes requested since there was some talk of updates but they haven't happened yet.
|
Any updates on this? Any help needed? We are currently using https://github.com/MnlPhlp/tauri-plugin-blec package which uses btleplug and we really need this feature to clear peripherals. if any testing or help needed, I am here! |
Add clear_peripherals method to adapter, so that the peripheral list can be cleared after being used.
Without this, the list would keep growing until the whole adapter object is dropped.
The method returns a result so that later if a platform/functionality needs to be fallible the API won't need to be changed.
AFAIK, Linux doesn't support this as the peripheral list comes from bluez directly.
Solves #206