Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ const (
// ApplicationManagerForegroundAppCommand returns information about the forgeground app.
ApplicationManagerForegroundAppCommand Command = "ssap://com.webos.applicationManager/getForegroundAppInfo"

// ApplicationManagerListAppsCommand returns information about the forgeground app.
ApplicationManagerListAppsCommand Command = "ssap://com.webos.applicationManager/listApps"

// AudioGetVolumeCommand returns information about the TV's configured audio output volume.
AudioGetVolumeCommand Command = "ssap://audio/getVolume"

Expand Down Expand Up @@ -111,6 +114,20 @@ func (tv *TV) CurrentApp() (*App, error) {
return a, err
}

// CurrentApp returns information about the current app.
func (tv *TV) ListApps() ([]*App, error) {
msg, err := tv.Command(ApplicationManagerListAppsCommand, nil)
if err != nil {
return nil, err
}

resp := struct {
Apps []*App `json:"apps"`
}{}
err = mapstructure.Decode(msg.Payload, &resp)
return resp.Apps, err
}

// GetVolume returns information about the audio output volume.
func (tv *TV) GetVolume() (*Volume, error) {
msg, err := tv.Command(AudioGetVolumeCommand, nil)
Expand Down Expand Up @@ -320,6 +337,18 @@ func (tv *TV) KeyOk() (Message, error) {
return tv.Command(KeyEnterCommand, nil)
}

func (tv *TV) KeyEnter() error {
if tv.input == nil {
var err error
tv.input, err = tv.createInput()
if err != nil {
return err
}
}
tv.input.SendButton("ENTER")
return nil
}

func (tv *TV) KeyBack() error {
if tv.input == nil {
var err error
Expand Down
7 changes: 7 additions & 0 deletions pairing.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func pairPrompt() Payload {
"serial": "2f930e2d2cfe083771f68e4fe7bb07",
},
"permissions": []string{
"LAUNCH",
"TEST_SECURE",
"CONTROL_INPUT_TEXT",
"CONTROL_MOUSE_AND_KEYBOARD",
Expand All @@ -55,6 +56,12 @@ func pairPrompt() Payload {
"SEARCH",
"WRITE_SETTINGS",
"WRITE_NOTIFICATION_ALERT",
"CONTROL_AUDIO",
"CONTROL_DISPLAY",
"CONTROL_INPUT_JOYSTICK",
"CONTROL_INPUT_MEDIA_RECORDING",
"CONTROL_INPUT_MEDIA_PLAYBACK",
"CONTROL_INPUT_TV",
"CONTROL_POWER",
"READ_CURRENT_CHANNEL",
"READ_RUNNING_APPS",
Expand Down