1
0
Fork 0

Don't re-enable the adapter

This commit is contained in:
Daniele Tricoli 2023-02-28 22:07:12 +01:00
parent 61a7a3c925
commit 55fd646bb1
1 changed files with 1 additions and 6 deletions

View File

@ -56,14 +56,9 @@ func ScanUntilTimeout(t float32) []bluetooth.ScanResult {
// TODO: right now it's unbounded, ad a max timeout.
func FindDeviceByAddress(adapter *bluetooth.Adapter, address string) bluetooth.ScanResult {
err := adapter.Enable()
if err != nil {
log.Error(err)
}
ch := make(chan bluetooth.ScanResult, 1)
err = adapter.Scan(func(adapter *bluetooth.Adapter, result bluetooth.ScanResult) {
err := adapter.Scan(func(adapter *bluetooth.Adapter, result bluetooth.ScanResult) {
if result.Address.String() == address {
_ = adapter.StopScan()
ch <- result