devices

package
v0.0.0-...-b90083f Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2015 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LightBatchChannel

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

func (*LightBatchChannel) GetProtocol

func (c *LightBatchChannel) GetProtocol() string

func (*LightBatchChannel) SetBatch

func (c *LightBatchChannel) SetBatch(state *LightDeviceState) error

func (*LightBatchChannel) SetEventHandler

func (c *LightBatchChannel) SetEventHandler(_ func(event string, payload ...interface{}) error)

type LightDevice

type LightDevice struct {
	sync.Mutex

	// ApplyLightState is required in your driver,
	// and should actually set the state on the physical light
	ApplyLightState func(state *LightDeviceState) error

	// The following three are optional, and are used instead of ApplyLightState
	// if only a single channel state is being set.
	ApplyOnOff      func(state bool) error
	ApplyBrightness func(state float64) error
	ApplyColor      func(state *channels.ColorState) error
	ApplyTransition func(state int) error
	ApplyIdentify   func() error

	// getter methods
	ApplyIsOn func() (bool, error)
	// contains filtered or unexported fields
}

func CreateLightDevice

func CreateLightDevice(driver ninja.Driver, info *model.Device, conn *ninja.Connection) (*LightDevice, error)

CreateLightDevice returns a LightDevice for a driver to use

func (*LightDevice) EnableBrightnessChannel

func (d *LightDevice) EnableBrightnessChannel() error

func (*LightDevice) EnableColorChannel

func (d *LightDevice) EnableColorChannel(supportedModes ...string) error

func (*LightDevice) EnableIdentifyChannel

func (d *LightDevice) EnableIdentifyChannel() error

func (*LightDevice) EnableOnOffChannel

func (d *LightDevice) EnableOnOffChannel() error

func (*LightDevice) EnableTransitionChannel

func (d *LightDevice) EnableTransitionChannel() error

func (*LightDevice) GetDeviceInfo

func (d *LightDevice) GetDeviceInfo() *model.Device

func (*LightDevice) GetDriver

func (d *LightDevice) GetDriver() ninja.Driver

func (*LightDevice) Identify

func (d *LightDevice) Identify() error

func (*LightDevice) IsOn

func (d *LightDevice) IsOn() (bool, error)

IsOn is for determining if the light is on or off

func (*LightDevice) Log

func (d *LightDevice) Log() *logger.Logger

func (*LightDevice) SetBatch

func (d *LightDevice) SetBatch(state *LightDeviceState) error

SetBatch runs when airwheel gesture is used

func (*LightDevice) SetBrightness

func (d *LightDevice) SetBrightness(state float64) error

func (*LightDevice) SetColor

func (d *LightDevice) SetColor(state *channels.ColorState) error

SetColor sets the color for a light All modes are converted to hue then corresponding color values are stored in the ColorState

func (*LightDevice) SetEventHandler

func (d *LightDevice) SetEventHandler(sendEvent func(event string, payload interface{}) error)

func (*LightDevice) SetOnOff

func (d *LightDevice) SetOnOff(state bool) error

func (*LightDevice) SetTransition

func (d *LightDevice) SetTransition(state int) error

func (*LightDevice) ToggleOnOff

func (d *LightDevice) ToggleOnOff() error

func (*LightDevice) UpdateLightState

func (d *LightDevice) UpdateLightState(state *LightDeviceState) error

UpdateLightState sends the new state(s) to the channel(s) to update the user interfaces LightDevice doesn't call this automatically, so you should call it as needed in your driver

type LightDeviceState

type LightDeviceState struct {
	OnOff      *bool                `json:"on-off,omitempty"`
	Color      *channels.ColorState `json:"color,omitempty"`
	Brightness *float64             `json:"brightness,omitempty"`
	Transition *int                 `json:"transition,omitempty"`
}

func (*LightDeviceState) Clone

func (c *LightDeviceState) Clone() *LightDeviceState

type MediaPlayerDevice

type MediaPlayerDevice struct {
	ApplyTogglePlay   func() error
	ApplyPlayPause    func(playing bool) error
	ApplyStop         func() error
	ApplyPlaylistJump func(delta int) error

	ApplyVolume      func(state *channels.VolumeState) error
	ApplyVolumeUp    func() error
	ApplyVolumeDown  func() error
	ApplyToggleMuted func() error

	ApplyPlayURL func(url string, queue bool) error

	ApplyOn          func() error
	ApplyOff         func() error
	ApplyToggleOnOff func() error

	// getter methods
	ApplyIsOn func() (bool, error)
	// contains filtered or unexported fields
}

func CreateMediaPlayerDevice

func CreateMediaPlayerDevice(driver ninja.Driver, info *model.Device, conn *ninja.Connection) (*MediaPlayerDevice, error)

func (*MediaPlayerDevice) EnableControlChannel

func (d *MediaPlayerDevice) EnableControlChannel(supportedEvents []string) error

func (*MediaPlayerDevice) EnableMediaChannel

func (d *MediaPlayerDevice) EnableMediaChannel() error

func (*MediaPlayerDevice) EnableOnOffChannel

func (d *MediaPlayerDevice) EnableOnOffChannel(supportedEvents ...string) error

func (*MediaPlayerDevice) EnableVolumeChannel

func (d *MediaPlayerDevice) EnableVolumeChannel(supportsMute bool) error

func (*MediaPlayerDevice) GetDeviceInfo

func (d *MediaPlayerDevice) GetDeviceInfo() *model.Device

func (*MediaPlayerDevice) GetDriver

func (d *MediaPlayerDevice) GetDriver() ninja.Driver

func (*MediaPlayerDevice) IsOn

func (d *MediaPlayerDevice) IsOn() (bool, error)

IsOn is for determining if the media player power is on or off

func (*MediaPlayerDevice) Log

func (d *MediaPlayerDevice) Log() *logger.Logger

func (*MediaPlayerDevice) Next

func (d *MediaPlayerDevice) Next() error

func (*MediaPlayerDevice) Pause

func (d *MediaPlayerDevice) Pause() error

func (*MediaPlayerDevice) Play

func (d *MediaPlayerDevice) Play() error

func (*MediaPlayerDevice) PlayURL

func (d *MediaPlayerDevice) PlayURL(url string, queue bool) error

func (*MediaPlayerDevice) Previous

func (d *MediaPlayerDevice) Previous() error

func (*MediaPlayerDevice) SetEventHandler

func (d *MediaPlayerDevice) SetEventHandler(sendEvent func(event string, payload interface{}) error)

func (*MediaPlayerDevice) SetExistingVolume

func (d *MediaPlayerDevice) SetExistingVolume(volume float64) error

func (*MediaPlayerDevice) SetMuted

func (d *MediaPlayerDevice) SetMuted(muted bool) error

func (*MediaPlayerDevice) SetOnOff

func (d *MediaPlayerDevice) SetOnOff(state bool) error

func (*MediaPlayerDevice) SetVolume

func (d *MediaPlayerDevice) SetVolume(volume *channels.VolumeState) error

func (*MediaPlayerDevice) Stop

func (d *MediaPlayerDevice) Stop() error

func (*MediaPlayerDevice) ToggleMuted

func (d *MediaPlayerDevice) ToggleMuted() error

func (*MediaPlayerDevice) ToggleOnOff

func (d *MediaPlayerDevice) ToggleOnOff() error

func (*MediaPlayerDevice) TogglePlay

func (d *MediaPlayerDevice) TogglePlay() error

func (*MediaPlayerDevice) UpdateControlState

func (d *MediaPlayerDevice) UpdateControlState(state channels.MediaControlEvent) error

func (*MediaPlayerDevice) UpdateMusicMediaState

func (d *MediaPlayerDevice) UpdateMusicMediaState(item *channels.MusicTrackMediaItem, position *int) error

func (*MediaPlayerDevice) UpdateOnOffState

func (d *MediaPlayerDevice) UpdateOnOffState(state bool) error

func (*MediaPlayerDevice) UpdateVolumeState

func (d *MediaPlayerDevice) UpdateVolumeState(state *channels.VolumeState) error

func (*MediaPlayerDevice) VolumeDown

func (d *MediaPlayerDevice) VolumeDown() error

func (*MediaPlayerDevice) VolumeUp

func (d *MediaPlayerDevice) VolumeUp() error

type SwitchDevice

type SwitchDevice struct {
	ApplyOnOff func(state bool) error
	// contains filtered or unexported fields
}

func CreateSwitchDevice

func CreateSwitchDevice(driver ninja.Driver, info *model.Device, conn *ninja.Connection) (*SwitchDevice, error)

func (*SwitchDevice) GetDeviceInfo

func (d *SwitchDevice) GetDeviceInfo() *model.Device

func (*SwitchDevice) GetDriver

func (d *SwitchDevice) GetDriver() ninja.Driver

func (*SwitchDevice) Log

func (d *SwitchDevice) Log() *logger.Logger

func (*SwitchDevice) SetEventHandler

func (d *SwitchDevice) SetEventHandler(sendEvent func(event string, payload interface{}) error)

func (*SwitchDevice) SetOnOff

func (d *SwitchDevice) SetOnOff(state bool) error

func (*SwitchDevice) ToggleOnOff

func (d *SwitchDevice) ToggleOnOff() error

func (*SwitchDevice) UpdateSwitchState

func (d *SwitchDevice) UpdateSwitchState(state bool) error

Jump to

Keyboard shortcuts

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