Documentation ¶
Index ¶
- type BaseDevice
- type LightBatchChannel
- type LightDevice
- func (d *LightDevice) EnableBrightnessChannel() error
- func (d *LightDevice) EnableColorChannel(supportedModes ...string) error
- func (d *LightDevice) EnableIdentifyChannel() error
- func (d *LightDevice) EnableOnOffChannel() error
- func (d *LightDevice) EnableTransitionChannel() error
- func (d *LightDevice) GetDeviceInfo() *model.Device
- func (d *LightDevice) GetDriver() chlab.Driver
- func (d *LightDevice) Identify() error
- func (d *LightDevice) Log() *logger.Logger
- func (d *LightDevice) SetBatch(state *LightDeviceState) error
- func (d *LightDevice) SetBrightness(state float64) error
- func (d *LightDevice) SetColor(state *channels.ColorState) error
- func (d *LightDevice) SetEventHandler(sendEvent func(event string, payload interface{}) error)
- func (d *LightDevice) SetLightState(state *LightDeviceState) error
- func (d *LightDevice) SetOnOff(state bool) error
- func (d *LightDevice) SetTransition(state int) error
- func (d *LightDevice) ToggleOnOff() error
- type LightDeviceState
- type MediaPlayerDevice
- func (d *MediaPlayerDevice) EnableControlChannel(supportedEvents []string) error
- func (d *MediaPlayerDevice) EnableMediaChannel() error
- func (d *MediaPlayerDevice) EnableOnOffChannel(supportedEvents ...string) error
- func (d *MediaPlayerDevice) EnableVolumeChannel(supportsMute bool) error
- func (d *MediaPlayerDevice) GetDeviceInfo() *model.Device
- func (d *MediaPlayerDevice) GetDriver() chlab.Driver
- func (d *MediaPlayerDevice) Log() *logger.Logger
- func (d *MediaPlayerDevice) Next() error
- func (d *MediaPlayerDevice) Pause() error
- func (d *MediaPlayerDevice) Play() error
- func (d *MediaPlayerDevice) PlayURL(url string, queue bool) error
- func (d *MediaPlayerDevice) Previous() error
- func (d *MediaPlayerDevice) SetEventHandler(sendEvent func(event string, payload interface{}) error)
- func (d *MediaPlayerDevice) SetMuted(muted bool) error
- func (d *MediaPlayerDevice) SetOnOff(state bool) error
- func (d *MediaPlayerDevice) SetVolume(volume *channels.VolumeState) error
- func (d *MediaPlayerDevice) Stop() error
- func (d *MediaPlayerDevice) ToggleMuted() error
- func (d *MediaPlayerDevice) ToggleOnOff() error
- func (d *MediaPlayerDevice) TogglePlay() error
- func (d *MediaPlayerDevice) UpdateControlState(state channels.MediaControlEvent) error
- func (d *MediaPlayerDevice) UpdateMusicMediaState(item *channels.MusicTrackMediaItem, position *int) error
- func (d *MediaPlayerDevice) UpdateOnOffState(state bool) error
- func (d *MediaPlayerDevice) UpdateVolumeState(state *channels.VolumeState) error
- func (d *MediaPlayerDevice) VolumeDown() error
- func (d *MediaPlayerDevice) VolumeUp() error
- type SwitchDevice
- func (d *SwitchDevice) GetDeviceInfo() *model.Device
- func (d *SwitchDevice) GetDriver() chlab.Driver
- func (d *SwitchDevice) Log() *logger.Logger
- func (d *SwitchDevice) SetEventHandler(sendEvent func(event string, payload interface{}) error)
- func (d *SwitchDevice) SetOnOff(state bool) error
- func (d *SwitchDevice) ToggleOnOff() error
- func (d *SwitchDevice) UpdateSwitchState(state bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseDevice ¶
type BaseDevice struct { Driver chlab.Driver Info *model.Device Conn *chlab.Connection Log_ *logger.Logger SendEvent func(event string, payload interface{}) error }
func (*BaseDevice) GetDeviceInfo ¶
func (d *BaseDevice) GetDeviceInfo() *model.Device
func (*BaseDevice) GetDriver ¶
func (d *BaseDevice) GetDriver() chlab.Driver
func (*BaseDevice) Log ¶
func (d *BaseDevice) Log() *logger.Logger
func (*BaseDevice) SetEventHandler ¶
func (d *BaseDevice) SetEventHandler(sendEvent func(event string, payload interface{}) error)
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 // SetLightState is required, 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 // contains filtered or unexported fields }
func CreateLightDevice ¶
func CreateLightDevice(driver chlab.Driver, info *model.Device, conn *chlab.Connection) (*LightDevice, error)
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 (*LightDevice) Identify ¶
func (d *LightDevice) Identify() error
func (*LightDevice) SetBatch ¶
func (d *LightDevice) SetBatch(state *LightDeviceState) error
func (*LightDevice) SetBrightness ¶
func (d *LightDevice) SetBrightness(state float64) error
func (*LightDevice) SetColor ¶
func (d *LightDevice) SetColor(state *channels.ColorState) error
func (*LightDevice) SetEventHandler ¶
func (*LightDevice) SetLightState ¶
func (d *LightDevice) SetLightState(state *LightDeviceState) 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
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 // contains filtered or unexported fields }
func CreateMediaPlayerDevice ¶
func CreateMediaPlayerDevice(driver chlab.Driver, info *model.Device, conn *chlab.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 (*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 (*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 chlab.Driver, info *model.Device, conn *chlab.Connection) (*SwitchDevice, error)
func (*SwitchDevice) GetDeviceInfo ¶
func (*SwitchDevice) SetEventHandler ¶
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
Click to show internal directories.
Click to hide internal directories.