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
When running with "-race" data races are detected.
To replicate just run this example code with "-race" flag:
package main import ( "context" "flag" "fmt" "log" "time" "github.com/go-ble/ble" "github.com/go-ble/ble/examples/lib/dev" "github.com/pkg/errors" ) var ( device = flag.String("device", "default", "implementation of ble") du = flag.Duration("du", 5*time.Second, "scanning duration") dup = flag.Bool("dup", true, "allow duplicate reported") ) func main() { flag.Parse() d, err := dev.NewDevice(*device) if err != nil { log.Fatalf("can't new device : %s", err) } ble.SetDefaultDevice(d) // Scan for specified durantion, or until interrupted by user. fmt.Printf("Scanning for %s...\n", *du) ctx := ble.WithSigHandler(context.WithTimeout(context.Background(), *du)) chkErr(ble.Scan(ctx, *dup, advHandler, nil)) } func advHandler(a ble.Advertisement) { if a.Connectable() { fmt.Printf("[%s] C %3d:", a.Addr(), a.RSSI()) } else { fmt.Printf("[%s] N %3d:", a.Addr(), a.RSSI()) } comma := "" if len(a.LocalName()) > 0 { fmt.Printf(" Name: %s", a.LocalName()) comma = "," } if len(a.Services()) > 0 { fmt.Printf("%s Svcs: %v", comma, a.Services()) comma = "," } if len(a.ManufacturerData()) > 0 { fmt.Printf("%s MD: %X", comma, a.ManufacturerData()) } fmt.Printf("\n") } func chkErr(err error) { switch errors.Cause(err) { case nil: case context.DeadlineExceeded: fmt.Printf("done\n") case context.Canceled: fmt.Printf("canceled\n") default: log.Fatalf(err.Error()) } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When running with "-race" data races are detected.
To replicate just run this example code with "-race" flag:
The text was updated successfully, but these errors were encountered: