Skip to content

Commit 43edf72

Browse files
committed
fix: set HCI default Advertising Interval to a more sensible default
Signed-off-by: deadprogram <[email protected]>
1 parent 1fd1367 commit 43edf72

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

gap_hci.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,13 @@ func (a *Advertisement) Configure(options AdvertisementOptions) error {
342342
}
343343

344344
a.serviceUUIDs = append([]UUID{}, options.ServiceUUIDs...)
345-
a.interval = uint16(options.Interval)
346-
if a.interval == 0 {
347-
a.interval = 0x0800 // default interval is 1.28 seconds
345+
if options.Interval == 0 {
346+
// Pick an advertisement interval recommended by Apple (section 35.5
347+
// Advertising Interval):
348+
// https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf
349+
options.Interval = NewDuration(152500 * time.Microsecond) // 152.5ms
348350
}
351+
a.interval = uint16(options.Interval)
349352
a.manufacturerData = append([]ManufacturerDataElement{}, options.ManufacturerData...)
350353
a.serviceData = append([]ServiceDataElement{}, options.ServiceData...)
351354

0 commit comments

Comments
 (0)