beacon

package
v0.0.0-...-ac156b6 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BeaconTypeEddystone = "eddystone"
	BeaconTypeIBeacon   = "ibeacon"
)
View Source
const (
	EddystoneFrameUID EddystoneFrame = "uid"
	EddystoneFrameURL                = "url"
	EddystoneFrameTLM                = "tlm"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Beacon

type Beacon struct {
	Name string

	Type   BeaconType
	Device *device.Device1
	// contains filtered or unexported fields
}

func CreateEddystoneTLM

func CreateEddystoneTLM(batt uint16, temp float32, advCnt, secCnt uint32) (*Beacon, error)

CreateEddystoneTLM create an eddystone beacon frame with tlm

func CreateEddystoneUID

func CreateEddystoneUID(namespace, instance string, txPwr int) (*Beacon, error)

CreateEddystoneUID create an eddystone beacon frame with uid

func CreateEddystoneURL

func CreateEddystoneURL(url string, txPower int) (*Beacon, error)

CreateEddystoneURL create an eddystone beacon frame with url

func CreateIBeacon

func CreateIBeacon(uuid string, major uint16, minor uint16, measuredPower uint16) (*Beacon, error)

CreateIBeacon Create a beacon in the IBeacon format

func NewBeacon

func NewBeacon(dev *device.Device1) (Beacon, error)

func (*Beacon) Expose

func (b *Beacon) Expose(adapterID string, timeout uint16) (func(), error)

Expose the beacon

func (*Beacon) GetEddystone

func (b *Beacon) GetEddystone() BeaconEddystone

GetEddystone return eddystone beacon information

func (*Beacon) GetFrames

func (b *Beacon) GetFrames() []byte

GetFrames return the bytes content

func (*Beacon) GetIBeacon

func (b *Beacon) GetIBeacon() BeaconIBeacon

GetIBeacon return if the type of beacon is ibeacon

func (*Beacon) IsEddystone

func (b *Beacon) IsEddystone() bool

IsEddystone return if the type of beacon is eddystone

func (*Beacon) IsIBeacon

func (b *Beacon) IsIBeacon() bool

IsIBeacon return if the type of beacon is ibeacon

func (*Beacon) Parse

func (b *Beacon) Parse() bool

Load beacon inforamtion if available

func (*Beacon) ParseEddystone

func (b *Beacon) ParseEddystone(frames []byte) BeaconEddystone

func (*Beacon) ParseIBeacon

func (b *Beacon) ParseIBeacon(frames []uint8) BeaconIBeacon

From Apple specifications Byte(s) Name Value Notes 0 Flags[0] 0x02 See Bluetooth 4.0 Core Specification , Volume 3, Appendix C, 18.1. 1 Flags[1] 0x01 See Bluetooth 4.0 Core Specification , Volume 3, Appendix C, 18.1. 2 Flags[2] 0x06 See Bluetooth 4.0 Core Specification , Volume 3, Appendix C, 18.1. 3 Length 0x1A See Bluetooth 4.0 Core Specification 4 Type 0xFF See Bluetooth 4.0 Core Specification 5 Company ID[0] 0x4C Must not be used for any purposes not specified by Apple. 6 Company ID[1] 0x00 Must not be used for any purposes not specified by Apple. ---- Bluez data starts here ---- 7 Beacon Type[0] 0x02 Must be set to 0x02 for all Proximity Beacons 8 Beacon Type[1] 0x15 Must be set to 0x15 for all Proximity Beacons 9-24 Proximity UUID 0xnn..nn See CLBeaconRegion class in iOS Developer Library. Must not be set to all 0s. 25-26 Major 0xnnnn See CLBeaconRegion class in iOS Developer Library. 0x0000 = unset. 27-28 Minor 0xnnnn See CLBeaconRegion class in iOS Developer Library. 0x0000 = unset. 29 Measured Power 0xnn See Measured Power (page 7)

func (*Beacon) WatchDeviceChanges

func (b *Beacon) WatchDeviceChanges(ctx context.Context) (chan bool, error)

WatchDeviceChanges watch for properties changes

type BeaconEddystone

type BeaconEddystone struct {
	Frame             EddystoneFrame
	CalibratedTxPower int
	// eddystone-uid
	UID         string
	InstanceUID string

	URL string

	// eddystone-tlm plain
	TLMVersion          int
	TLMBatteryVoltage   uint16
	TLMTemperature      float32
	TLMAdvertisingPDU   uint32
	TLMLastRebootedTime uint32
}

type BeaconIBeacon

type BeaconIBeacon struct {
	Type          string
	ProximityUUID string
	Major         uint16
	Minor         uint16
	MeasuredPower uint16
}

type BeaconType

type BeaconType string

type EddystoneFrame

type EddystoneFrame string

Jump to

Keyboard shortcuts

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