Compare commits
	
		
			2 Commits
		
	
	
		
			75942bdb0c
			...
			504a64da93
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 504a64da93 | |||
| 7fb1fcce68 | 
							
								
								
									
										10
									
								
								btsetup.go
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								btsetup.go
									
									
									
									
									
								
							@@ -1,27 +1,27 @@
 | 
			
		||||
package infinitime
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"os/exec"
 | 
			
		||||
 | 
			
		||||
	bt "github.com/muka/go-bluetooth/api"
 | 
			
		||||
	"github.com/muka/go-bluetooth/bluez/profile/adapter"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var defaultAdapter *adapter.Adapter1
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
func Init() {
 | 
			
		||||
	// Get bluez default adapter
 | 
			
		||||
	da, err := bt.GetDefaultAdapter()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		panic(err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Power on command (workaround as go-bluetooth does not have a power on function)
 | 
			
		||||
	exec.Command("bluetoothctl", "power", "on").Start()
 | 
			
		||||
	da.SetPowered(true)
 | 
			
		||||
 | 
			
		||||
	defaultAdapter = da
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Exit() error {
 | 
			
		||||
	if defaultAdapter != nil {
 | 
			
		||||
		defaultAdapter.Close()
 | 
			
		||||
	}
 | 
			
		||||
	return bt.Exit()
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.mod
									
									
									
									
									
								
							@@ -2,4 +2,4 @@ module go.arsenm.dev/infinitime
 | 
			
		||||
 | 
			
		||||
go 1.16
 | 
			
		||||
 | 
			
		||||
require github.com/muka/go-bluetooth v0.0.0-20210812063148-b6c83362e27d
 | 
			
		||||
require github.com/muka/go-bluetooth v0.0.0-20211023182635-c49e7c952f19
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								go.sum
									
									
									
									
									
								
							@@ -10,8 +10,8 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJ
 | 
			
		||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
 | 
			
		||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
 | 
			
		||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
 | 
			
		||||
github.com/muka/go-bluetooth v0.0.0-20210812063148-b6c83362e27d h1:EG/xyWjHT19rkUpwsWSkyiCCmyqNwFovr9m10rhyOxU=
 | 
			
		||||
github.com/muka/go-bluetooth v0.0.0-20210812063148-b6c83362e27d/go.mod h1:dMCjicU6vRBk34dqOmIZm0aod6gUwZXOXzBROqGous0=
 | 
			
		||||
github.com/muka/go-bluetooth v0.0.0-20211023182635-c49e7c952f19 h1:xN9pngudDI32wVUMfwP8nCkXiib2ogLKQ7i2dPvTQ5U=
 | 
			
		||||
github.com/muka/go-bluetooth v0.0.0-20211023182635-c49e7c952f19/go.mod h1:dMCjicU6vRBk34dqOmIZm0aod6gUwZXOXzBROqGous0=
 | 
			
		||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
 | 
			
		||||
github.com/paypal/gatt v0.0.0-20151011220935-4ae819d591cf/go.mod h1:+AwQL2mK3Pd3S+TUwg0tYQjid0q1txyNUJuuSmz8Kdk=
 | 
			
		||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user