In machines with multiple bluetooth adapters, the method defaultAdapter (Bluetooth.js) considers all adapters, regardless of their power status, and returns the first item of the list. This behavior is causing errors in client code when the first adapter (hci0) is offline.
To avoid breaking the current behavior of defaultAdapter, I created a new method, activeAdapters, which will return the list of usable (isPowered == true) adapters. Then the client is able to choose which adapter to use.
Coverage increased (+0.1%) to 95.963% when pulling 7cd09dea0e688523d9fe61f361d78ae86cf32011 on altaircunhajr:main into eb20e9c32d431df65ee5718c6c0e968b09524085 on chrvadala:main.
Context:
In machines with multiple bluetooth adapters, the method
defaultAdapter
(Bluetooth.js) considers all adapters, regardless of their power status, and returns the first item of the list. This behavior is causing errors in client code when the first adapter (hci0) is offline.To avoid breaking the current behavior of
defaultAdapter
, I created a new method,activeAdapters
, which will return the list of usable (isPowered
== true) adapters. Then the client is able to choose which adapter to use.