SimpleBLE icon indicating copy to clipboard operation
SimpleBLE copied to clipboard

How to check if bluetooth is enabled

Open Yohannfra opened this issue 3 years ago • 1 comments

Hi,

On macos if I run

    auto adapter_list = SimpleBLE::Adapter::get_adapters();

with bluetooth enable or not I get the exact same result:

Default Adapter [00:00:00:00:00:00]

How can I detect if the bluetooth is enabled or not on the computer ?

Thank you

Yohannfra avatar Apr 28 '22 08:04 Yohannfra

This specific problem is a bit tricky, because the underlying API is soooo different for each operating system. There is an MR that has solved this problem for MacOS, but I haven't had time to look into equivalents for Windows and Linux.

The fact that you always get one adapter regardless of the BLE state is a horrible workaround I made, which I apologize for. I will dig deeper into this once I get v0.4.0, which is almost there besides from a very specific segfault that I just can't find.

kdewald avatar Apr 29 '22 04:04 kdewald

This has been fixed with the provided Adapter::bluetooth_enabled() function.

kdewald avatar Sep 15 '22 02:09 kdewald