channels

package
v0.0.0-...-cb7d559 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotificationPriorityMax     = "max"
	NotificationPriorityHigh    = "high"
	NotificationPriorityDefault = "default"
	NotificationPriorityLow     = "low"
	NotificationPriorityMin     = "min"
)
View Source
const (
	NotificationCategoryAlert      = "alert"
	NotificationCategoryQuery      = "query"
	NotificationCategorySuggestion = "suggestion"
)

Variables

View Source
var (
	MODE_OFF  = "off"
	MODE_COOL = "cool"
	MODE_FAN  = "fan"
	MODE_DRY  = "dry"
	MODE_HEAT = "heat"
	ALL_MODES = []string{MODE_OFF, MODE_COOL, MODE_FAN, MODE_DRY, MODE_HEAT}
)

Functions

This section is empty.

Types

type ACStatActuator

type ACStatActuator interface {
	SetACState(acState *ACState) error
}

type ACStatChannel

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

func NewACStatChannel

func NewACStatChannel(actuator ACStatActuator) *ACStatChannel

func (*ACStatChannel) GetProtocol

func (c *ACStatChannel) GetProtocol() string

func (*ACStatChannel) SendState

func (c *ACStatChannel) SendState(acState *ACState) error

func (*ACStatChannel) Set

func (c *ACStatChannel) Set(acState *ACState) error

func (*ACStatChannel) SetEventHandler

func (c *ACStatChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type ACState

type ACState struct {
	Mode           *string  `json:"mode,omitempty"`
	SupportedModes []string `json:"supported-modes,omitempty"`
}

func NewACState

func NewACState() *ACState

type BaseChannel

type BaseChannel struct {
	Protocol  string
	SendEvent func(event string, payload ...interface{}) error
}

func (*BaseChannel) GetProtocol

func (c *BaseChannel) GetProtocol() string

func (*BaseChannel) SetEventHandler

func (c *BaseChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type BatteryChannel

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

func NewBatteryChannel

func NewBatteryChannel(device BatteryDevice) *BatteryChannel

func (*BatteryChannel) GetProtocol

func (c *BatteryChannel) GetProtocol() string

func (*BatteryChannel) SendState

func (c *BatteryChannel) SendState(state float64) error

func (*BatteryChannel) SendWarning

func (c *BatteryChannel) SendWarning() error

func (*BatteryChannel) SetEventHandler

func (c *BatteryChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type BatteryDevice

type BatteryDevice interface {
}

type BrightnessChannel

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

func NewBrightnessChannel

func NewBrightnessChannel(device BrightnessDevice) *BrightnessChannel

func (*BrightnessChannel) GetProtocol

func (c *BrightnessChannel) GetProtocol() string

func (*BrightnessChannel) SendState

func (c *BrightnessChannel) SendState(state float64) error

func (*BrightnessChannel) Set

func (c *BrightnessChannel) Set(state float64) error

func (*BrightnessChannel) SetEventHandler

func (c *BrightnessChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type BrightnessDevice

type BrightnessDevice interface {
	SetBrightness(state float64) error
}

type ColorChannel

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

func NewColorChannel

func NewColorChannel(device ColorDevice) *ColorChannel

func (*ColorChannel) GetProtocol

func (c *ColorChannel) GetProtocol() string

func (*ColorChannel) SendState

func (c *ColorChannel) SendState(state *ColorState) error

func (*ColorChannel) Set

func (c *ColorChannel) Set(state *ColorState) error

func (*ColorChannel) SetEventHandler

func (c *ColorChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type ColorDevice

type ColorDevice interface {
	SetColor(state *ColorState) error
}

type ColorState

type ColorState struct {
	Mode        string   `json:"mode,omitempty"`
	Hue         *float64 `json:"hue,omitempty"`
	Saturation  *float64 `json:"saturation,omitempty"`
	Temperature *float64 `json:"temperature,omitempty"`
	X           *float64 `json:"x,omitempty"`
	Y           *float64 `json:"y,omitempty"`
}

type DemandChannel

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

func NewDemandChannel

func NewDemandChannel() *DemandChannel

func (*DemandChannel) GetProtocol

func (c *DemandChannel) GetProtocol() string

func (*DemandChannel) SendState

func (c *DemandChannel) SendState(demandState *DemandState) error

func (*DemandChannel) SetEventHandler

func (c *DemandChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type DemandControl

type DemandControl struct {
	Enabled  *bool       `json:"enabled,omitempty"`
	Goal     *float64    `json:"goal,omitempty"`
	Strategy interface{} `json:"strategy,omitempty"`
}

type DemandStatActuator

type DemandStatActuator interface {
	SetDemandControl(demandControl *DemandControl) error
}

type DemandStatChannel

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

func NewDemandStatChannel

func NewDemandStatChannel(actuator DemandStatActuator) *DemandStatChannel

func (*DemandStatChannel) GetProtocol

func (c *DemandStatChannel) GetProtocol() string

func (*DemandStatChannel) SendState

func (c *DemandStatChannel) SendState(demandControl *DemandControl) error

func (*DemandStatChannel) Set

func (c *DemandStatChannel) Set(demandControl *DemandControl) error

func (*DemandStatChannel) SetEventHandler

func (c *DemandStatChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type DemandState

type DemandState struct {
	Rated        *float64 `json:"rated,omitempty"`        // rated maximum power, in Watts
	ObservedMax  *float64 `json:"observedMax,omitempty"`  // the observed max current power for this device
	Current      *float64 `json:"current,omitempty"`      // average power for current period
	Peak         *float64 `json:"peak,omitempty"`         // peak instantaneous power in averaging period
	Goal         *float64 `json:"goal,omitempty"`         // goal power for averaging period
	Controlled   *float64 `json:"controlled,omitempty"`   // average controlled power
	Uncontrolled *float64 `json:"uncontrolled,omitempty"` // average uncontrolled power
	Period       *int     `json:"period,omitempty"`       // averaging period, in seconds
	OnTicks      *int     `json:"onTicks,omitempty"`      // the number of seconds since last switch on
	OffTicks     *int     `json:"offTicks,omitempty"`     // the number of seconds since last switch off
}

type EnergyChannel

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

func NewEnergyChannel

func NewEnergyChannel(device EnergyDevice) *EnergyChannel

func (*EnergyChannel) GetProtocol

func (c *EnergyChannel) GetProtocol() string

func (*EnergyChannel) SendState

func (c *EnergyChannel) SendState(state float64) error

func (*EnergyChannel) SetEventHandler

func (c *EnergyChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type EnergyDevice

type EnergyDevice interface {
}

type FanStatActuator

type FanStatActuator interface {
	SetFanState(fanState *FanState) error
}

type FanStatChannel

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

func NewFanStatChannel

func NewFanStatChannel(actuator FanStatActuator) *FanStatChannel

func (*FanStatChannel) GetProtocol

func (c *FanStatChannel) GetProtocol() string

func (*FanStatChannel) SendState

func (c *FanStatChannel) SendState(fanState *FanState) error

func (*FanStatChannel) Set

func (c *FanStatChannel) Set(fanState *FanState) error

func (*FanStatChannel) SetEventHandler

func (c *FanStatChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type FanState

type FanState struct {
	Speed     *float64 `json:"speed,omitempty"`     // the speed of the fan as a percentage of maximum
	Direction *string  `json:"direction,omitempty"` // the direction of the fan: "forward" or "reverse"
}

type GenericMediaItem

type GenericMediaItem struct {
	MediaItem
	Subtitle *string `json:"subtitle,omitempty"`
}

type GenericMediaState

type GenericMediaState struct {
	Media *GenericMediaItem `json:"media,omitempty"`
}

type HumidiStatActuator

type HumidiStatActuator interface {
	SetHumiditySetPoint(float64) error
}

type HumidiStatChannel

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

func NewHumidiStatChannel

func NewHumidiStatChannel(actuator HumidiStatActuator) *HumidiStatChannel

func (*HumidiStatChannel) GetProtocol

func (c *HumidiStatChannel) GetProtocol() string

func (*HumidiStatChannel) SendState

func (c *HumidiStatChannel) SendState(setPoint float64) error

func (*HumidiStatChannel) Set

func (c *HumidiStatChannel) Set(setPoint *float64) error

func (*HumidiStatChannel) SetEventHandler

func (c *HumidiStatChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type HumidityChannel

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

func NewHumidityChannel

func NewHumidityChannel(device HumidityDevice) *HumidityChannel

func (*HumidityChannel) GetProtocol

func (c *HumidityChannel) GetProtocol() string

func (*HumidityChannel) SendState

func (c *HumidityChannel) SendState(state float64) error

func (*HumidityChannel) SetEventHandler

func (c *HumidityChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type HumidityDevice

type HumidityDevice interface {
}

type IdentifyChannel

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

func NewIdentifyChannel

func NewIdentifyChannel(device IdentifyDevice) *IdentifyChannel

func (*IdentifyChannel) GetProtocol

func (c *IdentifyChannel) GetProtocol() string

func (*IdentifyChannel) Identify

func (c *IdentifyChannel) Identify() error

func (*IdentifyChannel) SetEventHandler

func (c *IdentifyChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type IdentifyDevice

type IdentifyDevice interface {
	Identify() error
}

type IlluminanceChannel

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

func NewIlluminanceChannel

func NewIlluminanceChannel() *IlluminanceChannel

func (*IlluminanceChannel) GetProtocol

func (c *IlluminanceChannel) GetProtocol() string

func (*IlluminanceChannel) SendState

func (c *IlluminanceChannel) SendState(state float64) error

func (*IlluminanceChannel) SetEventHandler

func (c *IlluminanceChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type MediaChannel

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

A MediaChannel can be added to devices, exposing http://schema.ninjablocks.com/protocol/media

func NewMediaChannel

func NewMediaChannel(device MediaDevice) *MediaChannel

func (*MediaChannel) GetProtocol

func (c *MediaChannel) GetProtocol() string

func (*MediaChannel) PlayUrl

func (c *MediaChannel) PlayUrl(url *string) error

func (*MediaChannel) QueueUrl

func (c *MediaChannel) QueueUrl(url *string) error

func (*MediaChannel) SendGenericState

func (c *MediaChannel) SendGenericState(state *GenericMediaItem) error

func (*MediaChannel) SendMusicTrackState

func (c *MediaChannel) SendMusicTrackState(state *MusicTrackMediaItem, position *int) error

func (*MediaChannel) SetEventHandler

func (c *MediaChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type MediaContentType

type MediaContentType string

func (*MediaContentType) IsValid

func (m *MediaContentType) IsValid() bool

type MediaControlChannel

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

A MediaControlChannel can be added to devices, exposing http://schema.ninjablocks.com/protocol/media-control

func NewMediaControlChannel

func NewMediaControlChannel(device MediaControlDevice) *MediaControlChannel

func (*MediaControlChannel) GetProtocol

func (c *MediaControlChannel) GetProtocol() string

func (*MediaControlChannel) Next

func (c *MediaControlChannel) Next() error

func (*MediaControlChannel) Pause

func (c *MediaControlChannel) Pause() error

func (*MediaControlChannel) Play

func (c *MediaControlChannel) Play() error

func (*MediaControlChannel) Previous

func (c *MediaControlChannel) Previous() error

func (*MediaControlChannel) SendState

func (c *MediaControlChannel) SendState(event MediaControlEvent) error

func (*MediaControlChannel) SetEventHandler

func (c *MediaControlChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

func (*MediaControlChannel) Stop

func (c *MediaControlChannel) Stop() error

func (*MediaControlChannel) TogglePlay

func (c *MediaControlChannel) TogglePlay() error

type MediaControlDevice

type MediaControlDevice interface {
	Play() error
	Pause() error
	TogglePlay() error
	Stop() error
	Next() error
	Previous() error
}

type MediaControlEvent

type MediaControlEvent int
const (
	MediaControlEventPlaying MediaControlEvent = iota
	MediaControlEventPaused
	MediaControlEventStopped
	MediaControlEventBuffering
	MediaControlEventBusy
	MediaControlEventIdle
	MediaControlEventInactive
)

func (*MediaControlEvent) Name

func (e *MediaControlEvent) Name() string

type MediaDevice

type MediaDevice interface {
	PlayURL(url string, autoplay bool) error
}

type MediaItem

type MediaItem struct {
	ID          *string            `json:"id,omitempty"`
	ExternalIDs *map[string]string `json:"externalIds,omitempty"`
	ContentType *MediaContentType  `json:"contentType,omitempty"`
	Type        *string            `json:"type,omitempty"`
	Title       *string            `json:"title,omitempty"`
	Image       *MediaItemImage    `json:"image,omitempty"`
	Duration    *int               `json:"duration,omitempty"`
}

type MediaItemAlbum

type MediaItemAlbum struct {
	ID *string `json:"id,omitempty"`

	Name   string          `json:"name"`
	Image  *MediaItemImage `json:"image,omitempty"`
	Genres *[]string       `json:"genres,omitempty"`
	// contains filtered or unexported fields
}

type MediaItemArtist

type MediaItemArtist struct {
	ID *string `json:"id,omitempty"`

	Name  string          `json:"name"`
	Image *MediaItemImage `json:"image,omitempty"`
	// contains filtered or unexported fields
}

type MediaItemImage

type MediaItemImage struct {
	URL    string `json:"url"`
	Width  *int   `json:"width,omitempty"`
	Height *int   `json:"height,omitempty"`
}

type MoistureChannel

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

func NewMoistureChannel

func NewMoistureChannel(device MoistureDevice) *MoistureChannel

func (*MoistureChannel) GetProtocol

func (c *MoistureChannel) GetProtocol() string

func (*MoistureChannel) SendState

func (c *MoistureChannel) SendState(state float64) error

func (*MoistureChannel) SetEventHandler

func (c *MoistureChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type MoistureDevice

type MoistureDevice interface {
}

type MotionChannel

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

func NewMotionChannel

func NewMotionChannel() *MotionChannel

func (*MotionChannel) GetProtocol

func (c *MotionChannel) GetProtocol() string

func (*MotionChannel) SendMotion

func (c *MotionChannel) SendMotion() error

func (*MotionChannel) SetEventHandler

func (c *MotionChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type MusicTrackMediaItem

type MusicTrackMediaItem struct {
	ID          *string            `json:"id,omitempty"`
	ExternalIDs *map[string]string `json:"externalIds,omitempty"`
	ContentType *MediaContentType  `json:"contentType,omitempty"`
	Type        string             `json:"type"`
	Title       *string            `json:"title,omitempty"`
	Image       *MediaItemImage    `json:"image,omitempty"`
	Duration    *int               `json:"duration,omitempty"`
	Artists     *[]MediaItemArtist `json:"artists,omitempty"`
	Album       *MediaItemAlbum    `json:"album,omitempty"`
}

type MusicTrackMediaState

type MusicTrackMediaState struct {
	Media    *MusicTrackMediaItem `json:"media,omitempty"`
	Position *int                 `json:"position,omitempty"`
}

type Notification

type Notification struct {
	Title    string               `json:"title"`
	Subtitle string               `json:"subtitle"`
	Priority notificationPriority `json:"priority"`
	Category notificationCategory `json:"category"`
}

type OnOffChannel

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

An OnOffChannel can be added to devices, exposing http://schema.ninjablocks.com/protocol/on-off

func NewOnOffChannel

func NewOnOffChannel(device OnOffDevice) *OnOffChannel

func (*OnOffChannel) GetProtocol

func (c *OnOffChannel) GetProtocol() string

func (*OnOffChannel) SendState

func (c *OnOffChannel) SendState(on bool) error

func (*OnOffChannel) Set

func (c *OnOffChannel) Set(state *bool) error

func (*OnOffChannel) SetEventHandler

func (c *OnOffChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

func (*OnOffChannel) Toggle

func (c *OnOffChannel) Toggle() error

func (*OnOffChannel) TurnOff

func (c *OnOffChannel) TurnOff() error

func (*OnOffChannel) TurnOn

func (c *OnOffChannel) TurnOn() error

type OnOffDevice

type OnOffDevice interface {
	ToggleOnOff() error
	SetOnOff(state bool) error
}

type OpenLoopActuator

type OpenLoopActuator interface {
	SetOpenLoopState(openLoop *OpenLoopState) error
}

type OpenLoopChannel

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

func NewOpenLoopChannel

func NewOpenLoopChannel(actuator OpenLoopActuator) *OpenLoopChannel

func (*OpenLoopChannel) GetProtocol

func (c *OpenLoopChannel) GetProtocol() string

func (*OpenLoopChannel) SendState

func (c *OpenLoopChannel) SendState(openLoop *OpenLoopState) error

func (*OpenLoopChannel) Set

func (c *OpenLoopChannel) Set(openLoop *OpenLoopState) error

func (*OpenLoopChannel) SetEventHandler

func (c *OpenLoopChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type OpenLoopState

type OpenLoopState struct {
	Enabled         *bool `json:"enabled,omitempty"`
	ReapplyInterval *int  `json:"reapply-interval,omitempty"`
}

type PowerChannel

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

func NewPowerChannel

func NewPowerChannel(device PowerDevice) *PowerChannel

func (*PowerChannel) GetProtocol

func (c *PowerChannel) GetProtocol() string

func (*PowerChannel) SendState

func (c *PowerChannel) SendState(state float64) error

func (*PowerChannel) SetEventHandler

func (c *PowerChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type PowerDevice

type PowerDevice interface {
}

type PresenceChannel

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

func NewPresenceChannel

func NewPresenceChannel() *PresenceChannel

func (*PresenceChannel) GetProtocol

func (c *PresenceChannel) GetProtocol() string

func (*PresenceChannel) SendState

func (c *PresenceChannel) SendState(state bool) error

func (*PresenceChannel) SetEventHandler

func (c *PresenceChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type TemperatureChannel

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

func NewTemperatureChannel

func NewTemperatureChannel(device TemperatureDevice) *TemperatureChannel

func (*TemperatureChannel) GetProtocol

func (c *TemperatureChannel) GetProtocol() string

func (*TemperatureChannel) SendState

func (c *TemperatureChannel) SendState(state float64) error

func (*TemperatureChannel) SetEventHandler

func (c *TemperatureChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type TemperatureDevice

type TemperatureDevice interface {
}

type ThermoStatActuator

type ThermoStatActuator interface {
	SetTemperatureSetPoint(float64) error
}

type ThermoStatChannel

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

func NewThermoStatChannel

func NewThermoStatChannel(actuator ThermoStatActuator) *ThermoStatChannel

func (*ThermoStatChannel) GetProtocol

func (c *ThermoStatChannel) GetProtocol() string

func (*ThermoStatChannel) SendState

func (c *ThermoStatChannel) SendState(state float64) error

func (*ThermoStatChannel) Set

func (c *ThermoStatChannel) Set(state float64) error

func (*ThermoStatChannel) SetEventHandler

func (c *ThermoStatChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type ThreePhasePower

type ThreePhasePower struct {
	ActiveA       float64 `json:"activeA"`
	ActiveB       float64 `json:"activeB"`
	ActiveC       float64 `json:"activeC"`
	ActiveTotal   float64 `json:"activeTotal"`
	ReactiveA     float64 `json:"reactiveA"`
	ReactiveB     float64 `json:"reactiveB"`
	ReactiveC     float64 `json:"reactiveC"`
	ReactiveTotal float64 `json:"reactiveTotal"`
	ApparentA     float64 `json:"apparentA"`
	ApparentB     float64 `json:"apparentB"`
	ApparentC     float64 `json:"apparentC"`
	ApparentTotal float64 `json:"apparentTotal"`
	PfA           float64 `json:"pfA"`
	PfB           float64 `json:"pfB"`
	PfC           float64 `json:"pfC"`
	PfAverage     float64 `json:"pfAverage"`
}

type ThreePhasePowerChannel

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

func NewThreePhasePowerChannel

func NewThreePhasePowerChannel() *ThreePhasePowerChannel

func (*ThreePhasePowerChannel) GetProtocol

func (c *ThreePhasePowerChannel) GetProtocol() string

func (*ThreePhasePowerChannel) SendState

func (c *ThreePhasePowerChannel) SendState(state *ThreePhasePower) error

func (*ThreePhasePowerChannel) SetEventHandler

func (c *ThreePhasePowerChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type ThreePhaseVoltage

type ThreePhaseVoltage struct {
	VoltageAN    float64 `json:"voltageAN"`
	VoltageBN    float64 `json:"voltageBN"`
	VoltageCN    float64 `json:"voltageCN"`
	VoltageLNAvg float64 `json:"voltageLNAvg"`
	VoltageAB    float64 `json:"voltageAB"`
	VoltageBC    float64 `json:"voltageBC"`
	VoltageCA    float64 `json:"voltageCA"`
	VoltageLLAvg float64 `json:"voltageLLAvg"`
}

type ThreePhaseVoltageChannel

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

func NewThreePhaseVoltageChannel

func NewThreePhaseVoltageChannel() *ThreePhaseVoltageChannel

func (*ThreePhaseVoltageChannel) GetProtocol

func (c *ThreePhaseVoltageChannel) GetProtocol() string

func (*ThreePhaseVoltageChannel) SendState

func (c *ThreePhaseVoltageChannel) SendState(state *ThreePhaseVoltage) error

func (*ThreePhaseVoltageChannel) SetEventHandler

func (c *ThreePhaseVoltageChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type TransitionChannel

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

func NewTransitionChannel

func NewTransitionChannel(device TransitionDevice) *TransitionChannel

func (*TransitionChannel) GetProtocol

func (c *TransitionChannel) GetProtocol() string

func (*TransitionChannel) Set

func (c *TransitionChannel) Set(state *int) error

func (*TransitionChannel) SetEventHandler

func (c *TransitionChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

type TransitionDevice

type TransitionDevice interface {
	SetTransition(state int) error
}

type VolumeChannel

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

func NewVolumeChannel

func NewVolumeChannel(device VolumeDevice) *VolumeChannel

func (*VolumeChannel) GetProtocol

func (c *VolumeChannel) GetProtocol() string

func (*VolumeChannel) Mute

func (c *VolumeChannel) Mute() error

func (*VolumeChannel) SendState

func (c *VolumeChannel) SendState(state *VolumeState) error

func (*VolumeChannel) Set

func (c *VolumeChannel) Set(state *VolumeState) error

func (*VolumeChannel) SetEventHandler

func (c *VolumeChannel) SetEventHandler(handler func(event string, payload ...interface{}) error)

func (*VolumeChannel) ToggleMuted

func (c *VolumeChannel) ToggleMuted() error

func (*VolumeChannel) Unmute

func (c *VolumeChannel) Unmute() error

func (*VolumeChannel) VolumeDown

func (c *VolumeChannel) VolumeDown() error

func (*VolumeChannel) VolumeUp

func (c *VolumeChannel) VolumeUp() error

type VolumeDevice

type VolumeDevice interface {
	SetVolume(volumeState *VolumeState) error
	VolumeUp() error
	VolumeDown() error
	SetMuted(muted bool) error
	ToggleMuted() error
}

type VolumeState

type VolumeState struct {
	Level *float64 `json:"level,omitempty"`
	Muted *bool    `json:"muted,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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