package main import ( "flag" "fmt" "protomolecule/src/dust" "protomolecule/src/scanStuff" projVars "protomolecule/src/vars" "github.com/fatih/color" "tinygo.org/x/bluetooth" ) func main() { values := flag.Args() scanStuff.Scanners() color.Red("Searching for: ") for _, word := range values { fmt.Print(word) } /* err := adapter.Enable() if err != nil { println("BLE stack unstable, could not enable", err.Error()) return } */ //var foundDevice bluetooth.ScanResult //turn the stuff on dust.Must("BLE stack", projVars.ScanAdapter.Enable()) println("Scanning") err := projVars.ScanAdapter.Scan(func(adapter *bluetooth.Adapter, result bluetooth.ScanResult) { if result.Address.String() == *projVars.Target { color.Cyan("found device:", result.Address.String(), result.RSSI, result.LocalName()) } /* if err != nil { println("could not enable the stack", err.Error()) return } */ }) dust.Must("scanns n stuff", err) /* connectToStuff := func(addr bluetooth.Addresser, device *bluetooth.Device) { d, _ := adapter.Connect(addr, bluetooth.ConnectionParams{}, err == *device == d) color.Red("Trying a connection", addr) } */ }