channels

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: 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

This section is empty.

Functions

This section is empty.

Types

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 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 GenericMediaItem

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

type GenericMediaState

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

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 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 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"`
}

Jump to

Keyboard shortcuts

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