Skip to content

Instantly share code, notes, and snippets.

Last active Nov 28, 2020
What would you like to do?
golang ble ibeacon peripheral advertise macos darwin
package main
import (
func main() {
d, err := darwin.NewDevice()
if err != nil {
log.Printf("can't new device : %s", err)
// 6c617265-6870-6972-6570-2d6f6762632d
var a ble.UUID = []byte("-cbgo-peripheral")
var c uint16
ctx := ble.WithSigHandler(context.WithTimeout(context.Background(), 3000 * time.Millisecond))
for range time.Tick(3000 * time.Millisecond) {
fmt.Println("Tick count", c)
ble.AdvertiseIBeacon(ctx, a, 1, c, 0)
quit := make(chan os.Signal)
signal.Notify(quit, os.Interrupt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment