We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am running on Raspberry Pi 4 Model B to connect with BLE devices.
When I run adapter.Connect, it always returns error "le-connection-abort-by-local."
BlueZ version = 5.66
package main import ( "fmt" "strings" "time" "tinygo.org/x/bluetooth" ) func main() { adapter := bluetooth.DefaultAdapter if err := adapter.Enable(); err != nil { panic(err) } scanCh := make(chan bluetooth.ScanResult, 1) err := adapter.Scan(func(adapter *bluetooth.Adapter, device bluetooth.ScanResult) { println("found device:", device.Address.String(), device.RSSI, device.LocalName()) if strings.Contains(device.LocalName(), "PD") { scanCh <- device adapter.StopScan() } }) device := <- scanCh close(scanCh) adapter.SetConnectHandler(func(device bluetooth.Address, connected bool) { fmt.Printf("Connected to %s with %v\n", device.String(), connected) }) time.Sleep(time.Second * 1) _, err = adapter.Connect(device.Address, bluetooth.ConnectionParams{ ConnectionTimeout: bluetooth.NewDuration(time.Second * 100), }) if err != nil { fmt.Printf("Failed to Connect %s\n", err.Error()) } else { fmt.Printf("Connected to %s\n", device.Address) } }
The text was updated successfully, but these errors were encountered:
Have you tried connecting manually through bluetoothctl? Does it work there?
bluetoothctl
Sorry, something went wrong.
No branches or pull requests
I am running on Raspberry Pi 4 Model B to connect with BLE devices.
When I run adapter.Connect, it always returns error "le-connection-abort-by-local."
BlueZ version = 5.66
The text was updated successfully, but these errors were encountered: