From ec67475bd5183e19ce440f7699e93722f1bf4768 Mon Sep 17 00:00:00 2001 From: deadprogram Date: Wed, 8 Jan 2025 19:35:05 +0100 Subject: [PATCH] fix: set HCI default Advertising Interval to a more sensible default Signed-off-by: deadprogram --- gap_hci.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gap_hci.go b/gap_hci.go index 3fec39a..651d21b 100644 --- a/gap_hci.go +++ b/gap_hci.go @@ -342,10 +342,13 @@ func (a *Advertisement) Configure(options AdvertisementOptions) error { } a.serviceUUIDs = append([]UUID{}, options.ServiceUUIDs...) - a.interval = uint16(options.Interval) - if a.interval == 0 { - a.interval = 0x0800 // default interval is 1.28 seconds + if options.Interval == 0 { + // Pick an advertisement interval recommended by Apple (section 35.5 + // Advertising Interval): + // https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf + options.Interval = NewDuration(152500 * time.Microsecond) // 152.5ms } + a.interval = uint16(options.Interval) a.manufacturerData = append([]ManufacturerDataElement{}, options.ManufacturerData...) a.serviceData = append([]ServiceDataElement{}, options.ServiceData...)