eddystone

package module
v0.0.0-...-732e2ce Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2015 License: BSD-2-Clause Imports: 4 Imported by: 0

README

eddystone : Golang package for support Eddystone beacon

GoDoc Build Status

Eddystone is an open beacon format from Google.

This package covers Eddystone-UID, Eddystone-URL, Eddystone-TLM from Eddystone Protocol Specification.

$ go get github.com/suapapa/go_eddystone

Example

Checkout example/beacon.go for using this package with gatt to make a Eddystone beacon in Golang.

Author

Homin Lee <homin.lee@suapapa.net>

Copyright (c) 2015, Homin Lee. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Documentation

Overview

Package eddystone provides tools for making Eddystone frame

Index

Examples

Constants

View Source
const SvcUUID = 0xFEAA

Eddystone Service UUID

Variables

View Source
var ErrInvalidFrame = errors.New("invalid frame")

ErrInvalidFrame can be returned from Make*Frame()

View Source
var SvcUUIDBytes = []byte{0xAA, 0xFE}

Eddystone Service UUID in Little Endian format

Functions

This section is empty.

Types

type Frame

type Frame []byte

Frame represent Eddystone frame

func MakeFrame

func MakeFrame(r []byte) (Frame, error)

MakeFrame convert []byte to eddystone.Frame

Example
b, _ := hex.DecodeString("20000ce417800000000100000002")
f, _ := eddystone.MakeFrame(b)
fmt.Print(f)
Output:

Eddystone-TLM[batt:3300 temp:23.500000, advCnt:1 secCnt:2]

func MakeTLMFrame

func MakeTLMFrame(batt uint16, temp float32, advCnt, secCnt uint32) (Frame, error)

MakeTLMFrame makes Eddystone-TLM frame https://github.com/google/eddystone/tree/master/eddystone-tlm

Example
f, _ := eddystone.MakeTLMFrame(3300, 23.5, 1, 2)
fmt.Println(f)
fmt.Println([]byte(f))
Output:

Eddystone-TLM[batt:3300 temp:23.500000, advCnt:1 secCnt:2]
[32 0 12 228 23 128 0 0 0 1 0 0 0 2]

func MakeUIDFrame

func MakeUIDFrame(namespace, instance string, txPwr int) (Frame, error)

MakeUIDFrame makes Eddystone-UID frame https://github.com/google/eddystone/tree/master/eddystone-uid

Example
f, _ := eddystone.MakeUIDFrame("0102030405060708090a", "0b0c0d0e0f10", -30)
fmt.Println(f)
fmt.Println([]byte(f))
Output:

Eddystone-UID[Namespace:0x0102030405060708090a Instance:0x0b0c0d0e0f10 TxPwr:-30dBm]
[0 226 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 0 0]

func MakeURLFrame

func MakeURLFrame(url string, txPwr int) (Frame, error)

MakeURLFrame makes Eddystone-URL frame https://github.com/google/eddystone/tree/master/eddystone-url

Example
f, _ := eddystone.MakeURLFrame("http://github.com", -30)
fmt.Println(f)
fmt.Println([]byte(f))
Output:

Eddystone-URL[Url:http://github.com TxPwr:-30dBm]
[16 226 2 103 105 116 104 117 98 7]

func (Frame) String

func (f Frame) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL