protocol

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2015 License: MIT Imports: 7 Imported by: 0

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 Protocol

type Protocol interface {
	// SetClient sets the client on the protocol for bi-directional
	// communication
	SetClient(client common.Client)
	// 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
	Discover() error
	// Close closes the protocol driver, no further communication with the
	// protocol is possible
	Close() error

	// SetPower sets the power state globally, on all devices
	SetPower(state bool) error
	// SetPowerDuration sets the power state globally, on all lights, over the
	// specified duration
	SetPowerDuration(state bool, duration time.Duration) error
	// SetColor changes the color globally, on all lights, over the specified
	// duration
	SetColor(color common.Color, duration time.Duration) error
}

Protocol defines the interface between the Client and a protocol implementation

type V2

type V2 struct {
	// Port determines UDP port for this protocol instance
	Port int

	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) SetClient

func (p *V2) SetClient(client common.Client)

SetClient sets the client on the protocol for bi-directional communication

func (*V2) SetColor

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

SetColor changes the color globally, on all lights, 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

SetPower sets the power state globally, on all devices

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