forked from Elara6331/infinitime
28 lines
418 B
Go
28 lines
418 B
Go
package infinitime
|
|
|
|
import (
|
|
bt "github.com/muka/go-bluetooth/api"
|
|
"github.com/muka/go-bluetooth/bluez/profile/adapter"
|
|
)
|
|
|
|
var defaultAdapter *adapter.Adapter1
|
|
|
|
func Init() {
|
|
// Get bluez default adapter
|
|
da, err := bt.GetDefaultAdapter()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
da.SetPowered(true)
|
|
|
|
defaultAdapter = da
|
|
}
|
|
|
|
func Exit() error {
|
|
if defaultAdapter != nil {
|
|
defaultAdapter.Close()
|
|
}
|
|
return bt.Exit()
|
|
}
|