Ask for adapter ID in Init()

This commit is contained in:
Elara Musayelyan 2022-05-02 20:14:46 -07:00
parent 9f0ee67c0f
commit 5e7a110cdc

View file

@ -11,7 +11,7 @@ import (
var defaultAdapter *adapter.Adapter1
var itdAgent *Agent
func Init() {
func Init(adapterID string) {
conn, err := dbus.SystemBus()
if err != nil {
panic(err)
@ -23,8 +23,12 @@ func Init() {
panic(err)
}
if adapterID == "" {
adapterID = bt.GetDefaultAdapterID()
}
// Get bluez default adapter
da, err := bt.GetDefaultAdapter()
da, err := bt.GetAdapter(adapterID)
if err != nil {
panic(err)
}