Documentation ¶
Overview ¶
The effect package defines data structures and functions to export the functionality of devices, giving functions a textual name, description and providing an interface to configure their parameters
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColorLampEffectFactory ¶
type Config ¶
type Config interface{}
Config is a type used to configure the parameters of a function supported by a lamp this could be a color to be set or define the speed of an animation
func DelayConfigFactory ¶
func DelayConfigFactory() Config
DelayConfigFactory is used to create a preconfigured DelayConfig that configures a delay of 30ms appropriate for smooth but slow animations
func EmptyConfigFactory ¶
func EmptyConfigFactory() Config
EmptyConfigFactory creates an EmptyEffectConfig
type DelayConfig ¶
type DelayConfig struct {
Delay string
}
DelayConfig sets the Delay between steps of an animation
type DeviceEffectFactory ¶
type DimLampEffectFactory ¶
type EffectFunc ¶
EffectFunc turns any function taking a config into an Effect
func (EffectFunc) Apply ¶
func (f EffectFunc) Apply(config Config) error
Apply let's EffectFunc implement the Effect interface
type EmptyConfig ¶
type EmptyConfig struct{}
EmptyConfig is used to configure effects that don't have any parameters
type MatrixLampEffectFactory ¶
type MatrixLampEffectFactory func(s devices.MatrixLamp) Effect
type Registration ¶
Registration holds both metadata about a registered effect and also stores the ConfigFactory that may be used to generate default configurations for this effect. Usually all fields in the generated config can be customized
func (*Registration) Compatible ¶
func (e *Registration) Compatible(lamp devices.Device) bool
Compatible checks whether a particular Registration is compatible with the given device
type Registry ¶
Registry is the type used to handle registration of effects registered effects can then automatically be paired with compatible devices
var DefaultRegistry *Registry
DefaultRegistry is the default package History and for many applications no other Registry needs to be created
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry creates a new Registry, usually using the DefaultRegistry should be preferred
func (*Registry) CompatibleEffects ¶
CompatibleEffects returns a slice of all compatible effects for the given device
func (*Registry) Config ¶
Config creates a default config for the effect registered under the given name or nil if no such effect exists
func (*Registry) Effect ¶
Effect finds an effect in the registry by name and checks its compatibility with the given device. If the effect doesn't exist or is incompatible with the given device this function returns nil
func (*Registry) Info ¶
Info returns the information on the effect registered under the given name or nil if no such effect exists
func (*Registry) Register ¶
func (r *Registry) Register(reg *Registration) error
Register registers an effect and populates the current, though usually inactive, effect config with the default generated by the registered ConfigFactory
type StripeLampEffectFactory ¶
type StripeLampEffectFactory func(s devices.StripeLamp) Effect