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.
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.