control

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2018 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInsufficientNetworkDetails = errors.New("Insufficient network information was supplied to use this function")

ErrInsufficientNetworkDetails is returned if an attempt is made to turn on a tv without providing a mac address and subnet mask

View Source
var ErrNotConnected = errors.New("Client is not connected to TV")

ErrNotConnected is returned if an request is attempted to a TV which is not connected to the client

Functions

This section is empty.

Types

type App

type App struct {
	Name string
	ID   string
	// contains filtered or unexported fields
}

App represents an app on the TV

func (*App) Launch

func (app *App) Launch() (string, error)

Launch launches the app on the TV. It returns the ID of the new session

type Channel

type Channel struct {
	ChannelName   string
	ChannelNumber int
	IsScrambled   bool
	IsHdtv        bool
	// contains filtered or unexported fields
}

Channel represents a tv channel

func (*Channel) Watch

func (ch *Channel) Watch() error

Watch switches the TV to this channel

type ChannelProgramList

type ChannelProgramList struct {
	Channel  Channel
	Programs []Program
}

ChannelProgramList is the list of programs broadcast on a particular channel

type Input

type Input struct {
	Label string
	ID    string
	// contains filtered or unexported fields
}

Input represents an external input to the TV

func (*Input) Switch

func (i *Input) Switch() error

Switch switches the TV to this input

type LgTv

type LgTv struct {
	ClientKey   string
	IsConnected bool
	// contains filtered or unexported fields
}

LgTv represents the TV being controlled

func NewTV

func NewTV(ip, macAddress, subnet string) (*LgTv, error)

NewTV returns a new LgTv object with the specified IP address

func (*LgTv) ChannelDown

func (tv *LgTv) ChannelDown() error

ChannelDown changes the current channel down by 1

func (*LgTv) ChannelUp

func (tv *LgTv) ChannelUp() error

ChannelUp changes the current channel up by 1

func (*LgTv) Connect

func (tv *LgTv) Connect(clientKey string, timeout int) (string, error)

Connect connects to the tv using the provided client key. If an empty client key is provided, a new one will be provisioned

func (*LgTv) Disconnect

func (tv *LgTv) Disconnect() error

Disconnect disconnects from the TV

func (*LgTv) FastForward

func (tv *LgTv) FastForward() error

FastForward fast forwards the current media

func (*LgTv) GetChannelProgramList

func (tv *LgTv) GetChannelProgramList() (ChannelProgramList, error)

GetChannelProgramList gets the list of programs broadcast on the current channel

func (*LgTv) GetCurrentChannel

func (tv *LgTv) GetCurrentChannel() (Channel, error)

GetCurrentChannel returns the channel the TV is currently set to

func (*LgTv) GetMute

func (tv *LgTv) GetMute() (bool, error)

GetMute gets the mute status of the TV

func (*LgTv) GetVolume

func (tv *LgTv) GetVolume() (int, error)

GetVolume returns the current volume of the TV

func (*LgTv) LaunchApp

func (tv *LgTv) LaunchApp(appID string) (string, error)

LaunchApp launches the app with the provided ID. If successfully launched, it returns the ID of the new session

func (*LgTv) ListChannels

func (tv *LgTv) ListChannels() ([]Channel, error)

ListChannels returns a slice of available TV channels

func (*LgTv) ListExternalInputs

func (tv *LgTv) ListExternalInputs() ([]Input, error)

ListExternalInputs lists the external input devices for the TV

func (*LgTv) ListInstalledApps

func (tv *LgTv) ListInstalledApps() ([]App, error)

ListInstalledApps lists the apps currently installed on the TV

func (*LgTv) Pause

func (tv *LgTv) Pause() error

Pause pauses the current media

func (*LgTv) Play

func (tv *LgTv) Play() error

Play plays the current media

func (*LgTv) Rewind

func (tv *LgTv) Rewind() error

Rewind rewinds the current media

func (*LgTv) SetChannel

func (tv *LgTv) SetChannel(channelNumber int) error

SetChannel sets the current viewed channel to the specified number

func (*LgTv) SetMute

func (tv *LgTv) SetMute(isMute bool) error

SetMute sets the mute status of the TV

func (*LgTv) SetVolume

func (tv *LgTv) SetVolume(value int) error

SetVolume sets the volume to the specified value

func (*LgTv) Stop

func (tv *LgTv) Stop() error

Stop stops the current media

func (*LgTv) SwitchInput

func (tv *LgTv) SwitchInput(inputID string) error

SwitchInput switches the input of the TV to the one with the specified input ID

func (*LgTv) TurnOff

func (tv *LgTv) TurnOff() error

TurnOff turns the tv off

func (*LgTv) TurnOn added in v1.1.1

func (tv *LgTv) TurnOn() error

TurnOn turns the tv on. Note that it uses Wake-On-Lan to wake the TV, so this only works if the TV is plugged in via ethernet

func (*LgTv) VolumeDown

func (tv *LgTv) VolumeDown() error

VolumeDown decreases the volume by 1

func (*LgTv) VolumeUp

func (tv *LgTv) VolumeUp() error

VolumeUp increases the volume by 1

type Program

type Program struct {
	Name      string
	Genre     string
	StartTime time.Time
	EndTime   time.Time
	Duration  time.Duration
}

Program is a particular program broadcast on tv

Jump to

Keyboard shortcuts

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