2020-05-30 21:55:20 +03:00
|
|
|
package bluetooth
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/go-ole/go-ole"
|
2020-05-31 17:45:26 +03:00
|
|
|
"github.com/tinygo-org/bluetooth/winbt"
|
2020-05-30 21:55:20 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
type Adapter struct {
|
|
|
|
watcher *winbt.IBluetoothLEAdvertisementWatcher
|
|
|
|
}
|
|
|
|
|
2020-06-01 14:26:45 +03:00
|
|
|
// DefaultAdapter is the default adapter on the system.
|
|
|
|
//
|
|
|
|
// Make sure to call Enable() before using it to initialize the adapter.
|
2020-06-03 02:13:46 +03:00
|
|
|
var DefaultAdapter = &Adapter{}
|
2020-05-30 21:55:20 +03:00
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|