devices

package
v0.0.0-...-9e2e3ce Latest Latest
Warning

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

Go to latest
Published: May 20, 2017 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package lampbase provides interface definitions for different types of devices which can be controlled by a lampserver

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock interface {
	TimeUpdate(time time.Time) error
}

Clock describes a device which receives time updates, usually to display the current time

type ColorLamp

type ColorLamp interface {
	// A ColorLamp can be dimmed by setting a darker color with the same hue so
	// it must also fullfill the DimLamp interface
	DimLamp
	// Color sets the ColorLamp's static color
	Color(color color.Color) error
	// ColorFade starts a fading effect that fades between dark and the specified
	// color
	ColorFade(delay time.Duration, col color.Color) error
	// Sunrise starts an effect imitating the colors of a sunrise, ideal for
	// waking up
	Sunrise(delay time.Duration) error
	// ColorWheel starts an effect looping through all available hues
	ColorWheel(delay time.Duration) error
}

ColorLamp describes a lamp device which supports single RGB color lighting. A ColorLamp supports several types of effects that can be achieved using colored light

type Device

type Device interface {
	// Power powers a device on (on == true) or off (on == false)
	Power(on bool) error
}

Device describes any type of device that can be powered on or off

type DimLamp

type DimLamp interface {
	// A DimLamp can also be powered on or off and therefore also supports the
	// Device interface
	Device
	// Brightness sets the static Brightness of the device
	Brightness(brightness uint8) error
	// Fade starts a fading effect with the specified delay and maximum
	// brightness
	Fade(delay time.Duration, maxBrightness uint8) error
	// Stroboscope starts a stroboscope like effect aka fast switching between
	// full and zero brightness
	Stroboscope(delay time.Duration) error
	// BrightnessScaling sets a scaling factor for all other effects so that they
	// may be used dimmed
	BrightnessScaling(brightness uint8) error
}

DimLamp describes a lamp device which can be dimmed. A DimLamp supports several types of effects that can be achieved using dimming

type MatrixLamp

type MatrixLamp interface {
	// MatrixLamps may act as StripeLamps
	StripeLamp
	// Heart shows a static or animated heart on the device
	Heart() error
}

MatrixLamp describes a lamp device with pixels/LEDs ordered as a square

type ReliableUDPTransport

type ReliableUDPTransport struct {
	// contains filtered or unexported fields
}

ReliableUDPTransport implements a UDP based message oriented lowlevel (currently one-way) protocoll by implementing resend of unackowledged messages.

func DialReliableUDPTransport

func DialReliableUDPTransport(laddr, raddr *net.UDPAddr) (l *ReliableUDPTransport, err error)

DialReliableUDPTransport allows dialing remote UDPAddr

func (*ReliableUDPTransport) Close

func (l *ReliableUDPTransport) Close() error

Close implements the Closer interface

func (*ReliableUDPTransport) Write

func (l *ReliableUDPTransport) Write(b []byte) (written int, lastError error)

Write implements the Writer interface

type StripeLamp

type StripeLamp interface {
	// A StripeLamp may set the same color for all its LEDs and may thus act as a ColorLamp
	ColorLamp
	// Fire starts a fire like effect
	Fire(delay time.Duration, cooling uint8, spark uint8) error
	// Rainbow starts a rainbow like effect which spreads colors accross its LEDs
	Rainbow(delay time.Duration) error
	// RandomPixelBrightness starts an effect utilizing randomly bright but white
	// LEDs
	RandomPixelBrightness(delay time.Duration) error
	// RandomPixelWhiteFade starts an effect that fades a random selection of
	// LEDs using white light
	RandomPixelWhiteFade(delay time.Duration) error
	// RandomPixelColor starts an effect that sets a random color for each LED
	// every delay
	RandomPixelColor(delay time.Duration) error
}

StripeLamp describes a device built from LED strips with individually controllable LEDs

type UdpColorLamp

type UdpColorLamp struct {
	UdpDimLamp
}

func NewUdpColorLamp

func NewUdpColorLamp() *UdpColorLamp

func (*UdpColorLamp) Color

func (l *UdpColorLamp) Color(col color.Color) error

func (*UdpColorLamp) ColorFade

func (l *UdpColorLamp) ColorFade(delay time.Duration, col color.Color) error

func (*UdpColorLamp) ColorWheel

func (l *UdpColorLamp) ColorWheel(delay time.Duration) error

func (*UdpColorLamp) Sunrise

func (l *UdpColorLamp) Sunrise(delay time.Duration) error

type UdpDimLamp

type UdpDimLamp struct {
	UdpPowerDevice
}

func NewUdpDimLamp

func NewUdpDimLamp() *UdpDimLamp

func (*UdpDimLamp) Brightness

func (l *UdpDimLamp) Brightness(b uint8) error

func (*UdpDimLamp) BrightnessScaling

func (l *UdpDimLamp) BrightnessScaling(b uint8) error

func (*UdpDimLamp) Fade

func (l *UdpDimLamp) Fade(delay time.Duration, maxBrightness uint8) error

func (*UdpDimLamp) Stroboscope

func (l *UdpDimLamp) Stroboscope(delay time.Duration) error

type UdpMatrixLamp

type UdpMatrixLamp struct {
	UdpStripeLamp
}

func NewUdpMatrixLamp

func NewUdpMatrixLamp() *UdpMatrixLamp

func (*UdpMatrixLamp) Clock

func (l *UdpMatrixLamp) Clock() error

func (*UdpMatrixLamp) Heart

func (l *UdpMatrixLamp) Heart() error

type UdpPowerDevice

type UdpPowerDevice struct {
	// contains filtered or unexported fields
}

func NewUdpPowerDevice

func NewUdpPowerDevice() *UdpPowerDevice

func (*UdpPowerDevice) Close

func (l *UdpPowerDevice) Close() error

func (*UdpPowerDevice) Dial

func (l *UdpPowerDevice) Dial(laddr, raddr *net.UDPAddr, lampNum uint8) (err error)

func (*UdpPowerDevice) Power

func (l *UdpPowerDevice) Power(on bool) error

type UdpStripeLamp

type UdpStripeLamp struct {
	UdpColorLamp
}

func NewUdpStripeLamp

func NewUdpStripeLamp() *UdpStripeLamp

func (*UdpStripeLamp) Fire

func (l *UdpStripeLamp) Fire(delay time.Duration, cooling uint8, spark uint8) error

func (*UdpStripeLamp) Rainbow

func (l *UdpStripeLamp) Rainbow(delay time.Duration) error

func (*UdpStripeLamp) RandomPixelBrightness

func (l *UdpStripeLamp) RandomPixelBrightness(delay time.Duration) error

func (*UdpStripeLamp) RandomPixelColor

func (l *UdpStripeLamp) RandomPixelColor(delay time.Duration) error

func (*UdpStripeLamp) RandomPixelWhiteFade

func (l *UdpStripeLamp) RandomPixelWhiteFade(delay time.Duration) error

type UdpWordClock

type UdpWordClock struct {
	UdpMatrixLamp
	// contains filtered or unexported fields
}

func NewUdpWordClock

func NewUdpWordClock(timeUpdateInterval time.Duration) *UdpWordClock

func (*UdpWordClock) ClockColor

func (l *UdpWordClock) ClockColor(col color.Color) error

func (*UdpWordClock) Dial

func (l *UdpWordClock) Dial(laddr, raddr *net.UDPAddr, lampNum uint8) error

func (*UdpWordClock) TimeUpdate

func (l *UdpWordClock) TimeUpdate(t time.Time) error

type WordClock

type WordClock interface {
	// WordClocks are built from a matrix so they support all matrix functions
	MatrixLamp
	// WordClocks are also clocks receiving TimeUpdate's
	Clock
	// Clock puts the WordClock into time display mode
	Clock() error
	// ClockColor sets the color used to display the time
	ClockColor(color color.Color) error
}

WordClock describes a special clock device built from a matrix of pixels/LEDs

Jump to

Keyboard shortcuts

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