prototooth/adapter_windows.go
deadprogram a55e2194c5 domain: use custom domain for all uses of winbt subpackage
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-09-09 16:04:40 +02:00

22 lines
559 B
Go

package bluetooth
import (
"github.com/go-ole/go-ole"
"tinygo.org/x/bluetooth/winbt"
)
type Adapter struct {
watcher *winbt.IBluetoothLEAdvertisementWatcher
}
// DefaultAdapter is the default adapter on the system.
//
// Make sure to call Enable() before using it to initialize the adapter.
var DefaultAdapter = &Adapter{}
// Enable configures the BLE stack. It must be called before any
// Bluetooth-related calls (unless otherwise indicated).
func (a *Adapter) Enable() error {
return ole.RoInitialize(1) // initialize with multithreading enabled
}