Skip to content

Commit

Permalink
fix: set HCI default Advertising Interval to a more sensible default
Browse files Browse the repository at this point in the history
Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Jan 9, 2025
1 parent 48aec1a commit ec67475
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions gap_hci.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)

Expand Down

0 comments on commit ec67475

Please sign in to comment.