You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fmt.Printf("Subscribing to notifications on characteristic %s...\n", targetChar.UUID.String())
causes the following error:
./fvFlightBar.go:76:87: targetChar.UUID.String undefined (type func() bluetooth.UUID has no field or method String)
Both the docs and the code seem to think there's a String() method but the compiler begs to differ.
For more context, here's more of the code:
// 6. Discover the characteristic within that servicechars, err:=targetService.DiscoverCharacteristics([]bluetooth.UUID{charUUID})
iferr!=nil {
log.Fatalf("Failed to discover characteristics: %v", err)
}
iflen(chars) ==0 {
log.Fatalf("Characteristic %s not found", charUUID.String())
}
targetChar:=chars[0]
// 7. Subscribe to notifications on the found characteristicfmt.Printf("Subscribing to notifications on characteristic %s...\n", targetChar.UUID.String())
err=targetChar.EnableNotifications(func(value []byte) {
// Convert received bytes to a hexadecimal stringhexData:=hex.EncodeToString(value)
fmt.Printf("Notification data (hex): %s\n", hexData)
})
iferr!=nil {
log.Fatalf("Failed to subscribe to notifications: %v", err)
}
The text was updated successfully, but these errors were encountered:
@ssokol You need to call .UUID on DeviceCharacteristic; it does not have a UUID field, it has a method (type func() bluetooth.UUID has no field or method String).
Using version 0.10.0, the following line:
causes the following error:
Both the docs and the code seem to think there's a String() method but the compiler begs to differ.
For more context, here's more of the code:
The text was updated successfully, but these errors were encountered: