muka / go-bluetooth

Golang bluetooth client based on bluez DBus interfaces
Apache License 2.0
652 stars 125 forks source link

bluez 5.63 requires advertisements set Min and Max intervals. #152

Closed james-lawrence closed 2 years ago

james-lawrence commented 2 years ago

bluez 5.63 emits the following error followed by a seg fault if the advertisement doesn't have a min interval specified.

Mar 06 13:36:16 bluetoothd[144262]: src/advertising.c:parse_advertisement() Error parsing MinInterval property

hack patch I added to fix it locally not a great solution but API doesn't seem to expose a way to actually configure the advertisement.

git diff ../vendor/github.com/muka/go-bluetooth/api/service/app.go
diff --git a/vendor/github.com/muka/go-bluetooth/api/service/app.go b/vendor/github.com/muka/go-bluetooth/api/service/app.go
index 0012727..20d679d 100644
--- a/vendor/github.com/muka/go-bluetooth/api/service/app.go
+++ b/vendor/github.com/muka/go-bluetooth/api/service/app.go
@@ -58,7 +58,9 @@ func NewApp(options AppOptions) (*App, error) {
        )

        app.advertisement = &advertising.LEAdvertisement1Properties{
-               Type: advertising.AdvertisementTypePeripheral,
+               Type:        advertising.AdvertisementTypePeripheral,
+               MinInterval: 1000,
+               MaxInterval: 1000,
        }

        if app.Options.AgentCaps == "" {