Documentation ¶
Index ¶
- Variables
- func IsFrameType(b byte) (out bool)
- func IsTlmPacket(b []byte) bool
- func IsUidPacket(b []byte) bool
- func IsUrlPacket(b []byte) bool
- func IsUrlPrefix(b byte) bool
- func IsUrlSuffix(i byte) bool
- type Frame
- type FrameFactory
- type FrameType
- type TlmFrame
- type TlmFrameFac
- type UidFrame
- type UidFrameFac
- type UrlFrame
- type UrlFrameFac
- type UrlPrefix
- type UrlSuffix
Constants ¶
This section is empty.
Variables ¶
View Source
var ( FrameTypeUid = FrameType{0x00, "UUID"} FrameTypeUrl = FrameType{0x10, "URL"} FrameTypeTlm = FrameType{0x20, "TLM"} )
View Source
var ( UrlPrefixHttpFull = UrlPrefix{0x00, "http://www."} UrlPrefixHttpsFull = UrlPrefix{0x01, "https://www."} UrlPrefixHttpShort = UrlPrefix{0x02, "http://"} UrlPrefixHttpsShort = UrlPrefix{0x03, "https://"} )
View Source
var ( UrlSuffixComSlash = UrlSuffix{0x00, ".com/"} UrlSuffixOrgSlash = UrlSuffix{0x01, ".org/"} UrlSuffixEduSlash = UrlSuffix{0x02, ".edu/"} UrlSuffixNetSlash = UrlSuffix{0x03, ".net/"} UrlSuffixInfoSlash = UrlSuffix{0x04, ".info/"} UrlSuffixBizSlash = UrlSuffix{0x05, ".biz/"} UrlSuffixGovSlash = UrlSuffix{0x06, ".gov/"} UrlSuffixCom = UrlSuffix{0x07, ".com"} UrlSuffixOrg = UrlSuffix{0x08, ".org"} UrlSuffixEdu = UrlSuffix{0x09, ".edu"} UrlSuffixNet = UrlSuffix{0x0A, ".net"} UrlSuffixInfo = UrlSuffix{0x0B, ".info"} UrlSuffixBiz = UrlSuffix{0x0C, ".biz"} UrlSuffixGov = UrlSuffix{0x0D, ".gov"} )
Functions ¶
func IsFrameType ¶
func IsTlmPacket ¶
func IsUidPacket ¶
func IsUrlPacket ¶
func IsUrlPrefix ¶
func IsUrlSuffix ¶
Types ¶
type Frame ¶
type Frame interface { fmt.Stringer json.Marshaler // Returns the type of the current frame. Type() FrameType // ToBytes returns this frame represented as a slice of // bytes compatible with the Eddystone TLM specification. ToBytes() []byte // FromBytes parses the given byte array and writes the // parsed values to the internal store for this Frame FromBytes(b []byte) error }
Frame is the base type for all Eddystone frame data, on for development use, see TlmFrame, UrlFrame, or UidFrame.
type FrameFactory ¶
type FrameFactory interface { // NewTlmFrame produces a new instance of the TlmFrame // interface populated with the parsed value of the given // byte slice NewTlmFrame(b []byte) (TlmFrame, error) // NewUidFrame produces a new instance of the UidFrame // interface populated with the parsed value of the given // byte slice NewUidFrame(b []byte) (UidFrame, error) // NewUrlFrame produces a new instance of the UrlFrame // interface populated with the parsed value of the given // byte slice NewUrlFrame(b []byte) (UrlFrame, error) // TlmFrameFactory overrides the default factory method // for creating new TlmFrame instances with the given // factory function. // // After calling TlmFrameFactory, calls to NewTlmFrame() // will only use the latest factory function TlmFrameFactory(fac TlmFrameFac) FrameFactory // UidFrameFactory overrides the default factory method // for creating new UidFrame instances with the given // factory function. // // After calling UidFrameFactory, calls to NewUidFrame() // will only use the latest factory function UidFrameFactory(fac UidFrameFac) FrameFactory // UrlFrameFactory overrides the default factory method // for creating new UrlFrame instances with the given // factory function. // // After calling UrlFrameFactory, calls to NewUrlFrame() // will only use the latest factory function UrlFrameFactory(fac UrlFrameFac) FrameFactory }
FrameFactory provides factory methods for producing instances of the various Eddystone TLM frame types.
func NewFrameFactory ¶
func NewFrameFactory() FrameFactory
type TlmFrame ¶
type TlmFrame interface { Frame TlmVersion() byte // BatteryVoltage returns the current battery charge in // millivolts (mV). // // Not all beacons support battery voltage measurements. // Use SupportsBatteryVoltage() to confirm that the // current beacon does before using this value. BatteryVoltage() uint16 // BeaconTemperatureInC returns the current temperature of // the beacon in Celsius. // // Not all beacons support temperature measurements. Use // SupportsTemperature() to confirm that the current // beacon does before using this value. BeaconTemperatureInC() float32 // BeaconTemperatureInC returns the current temperature of // the beacon in Fahrenheit. // // Not all beacons support temperature measurements. Use // SupportsTemperature() to confirm that the current // beacon does before using this value. BeaconTemperatureInF() float32 // AdvertisementCount returns the number of advertisement // packets sent by the beacon since last reboot. AdvertisementCount() uint32 // ActiveTime returns the uptime, or time since last // reboot for the broadcasting beacon. // // Value returned has a precision of 1/10 of a second. ActiveTime() float32 // SupportsBatteryVoltage returns whether or not the // beacon that sent this frame sends battery voltage data. SupportsBatteryVoltage() bool // SupportsTemperature returns whether or not the beacon // that sent this frame sends temperature data. SupportsTemperature() bool }
TlmFrame provides access to parsed Eddystone Telemetry data.
type TlmFrameFac ¶
type TlmFrameFac = func() TlmFrame
TlmFrameFac produces a new base configuration instance of the TlmFrame interface
type UidFrame ¶
type UidFrame interface { Frame // TxPower returns the advertised TX power measured in dBm TxPower() int8 // RangingData returns the advertised TX power measured in // dBm // // RangingData is an alias of TxPower based on the naming // scheme from the Eddystone specification. RangingData() int8 // NamespaceBytes returns the raw byte value of the UID // namespace for the source device. NamespaceBytes() [10]byte // NamespaceString returns the stringified hex value of // the UID namespace for the source device. NamespaceString() string // NamespaceInt returns the parsed big int value of the // UID namespace for the source device. NamespaceInt() *big.Int // InstanceBytes returns the raw byte value of the UID // instance identifier for the source device. InstanceBytes() [6]byte // InstanceString returns the stringified hex value of the // UID instance identifier for the source device. InstanceString() string // InstanceInt returns the parsed uint64 value of the UID // instance identifier for the source device. InstanceInt() uint64 // Returns the full identifier value for the source device // as a UUID. Uuid() uuid.UUID }
type UidFrameFac ¶
type UidFrameFac = func() UidFrame
UidFrameFac produces a new base configuration instance of the UidFrame interface
type UrlFrameFac ¶
type UrlFrameFac = func() UrlFrame
UrlFrameFac produces a new base configuration instance of the UrlFrame interface
Click to show internal directories.
Click to hide internal directories.