protocol

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2017 License: MIT Imports: 7 Imported by: 9

Documentation

Overview

Package protocol implements the LIFX LAN protocol.

This package is not designed to used directly by end users, other than to specify a protocol version when creating a new Client from the golifx package.

The currently implemented protocol versions are:

V2

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type V2

type V2 struct {
	// IP determines UDP listen address for this protocol instance
	IP net.IP
	// Port determines UDP listen port for this protocol instance
	Port int
	// Reliable enables reliable comms, requests ACKs for all operations to
	// ensure they're delivered (recommended)
	Reliable bool

	common.SubscriptionProvider
	sync.RWMutex
	// contains filtered or unexported fields
}

V2 implements the LIFX LAN protocol version 2.

func (*V2) Close

func (p *V2) Close() error

Close closes the protocol driver, no further communication with the protocol is possible

func (*V2) Discover

func (p *V2) Discover() error

Discover initiates device discovery, this may be a noop in some future protocol versions. This is called immediately when the client connects to the protocol

func (*V2) GetDevice added in v0.5.0

func (p *V2) GetDevice(id uint64) (common.Device, error)

func (*V2) GetDevices added in v0.5.0

func (p *V2) GetDevices() ([]common.Device, error)

GetDevices returns a slice of all devices known to the protocol, or common.ErrNotFound if no devices are currently known.

func (*V2) GetGroup added in v0.5.0

func (p *V2) GetGroup(id string) (common.Group, error)

func (*V2) GetGroups added in v0.5.0

func (p *V2) GetGroups() ([]common.Group, error)

GetGroups returns a slice of all groups known to the client, or common.ErrNotFound if no groups are currently known.

func (*V2) GetLocation added in v0.5.0

func (p *V2) GetLocation(id string) (common.Location, error)

func (*V2) GetLocations added in v0.5.0

func (p *V2) GetLocations() ([]common.Location, error)

GetLocations returns a slice of all locations known to the protocol, or common.ErrNotFound if no locations are currently known.

func (*V2) SetColor

func (p *V2) SetColor(color common.Color, duration time.Duration) error

SetColor changes the color globally, on all lights, transitioning over the specified duration

func (*V2) SetPower

func (p *V2) SetPower(state bool) error

SetPower sets the power state globally, on all devices

func (*V2) SetPowerDuration added in v0.0.2

func (p *V2) SetPowerDuration(state bool, duration time.Duration) error

SetPowerDuration sets the power state globally, on all devices, transitioning over the specified duration

func (*V2) SetRetryInterval added in v0.5.0

func (p *V2) SetRetryInterval(retryInterval *time.Duration)

SetRetryInterval attaches a retry interval to the protocol

func (*V2) SetTimeout added in v0.5.0

func (p *V2) SetTimeout(timeout *time.Duration)

SetTimeout attaches a timeout to the protocol

Directories

Path Synopsis
v2
device
Package device implements a LIFX LAN protocol version 2 device.
Package device implements a LIFX LAN protocol version 2 device.
packet
Package packet implements a LIFX LAN protocol version 2 packet.
Package packet implements a LIFX LAN protocol version 2 packet.
shared
Package shared contains shared elements of the LIFX LAN protocol version 2.
Package shared contains shared elements of the LIFX LAN protocol version 2.

Jump to

Keyboard shortcuts

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