File: app_advertise.go

package info (click to toggle)
golang-github-muka-go-bluetooth 5.60-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,688 kB
  • sloc: makefile: 92; sh: 2
file content (22 lines) | stat: -rw-r--r-- 514 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package service

import (
	"github.com/muka/go-bluetooth/api"
	"github.com/muka/go-bluetooth/bluez/profile/advertising"
)

func (app *App) GetAdvertisement() *advertising.LEAdvertisement1Properties {
	return app.advertisement
}

func (app *App) Advertise(timeout uint32) (func(), error) {

	adv := app.GetAdvertisement()

	for _, svc := range app.GetServices() {
		adv.ServiceUUIDs = append(adv.ServiceUUIDs, svc.UUID)
	}

	cancel, err := api.ExposeAdvertisement(app.adapterID, adv, timeout)
	return cancel, err
}