Skip to content

Latest commit

 

History

History
130 lines (92 loc) · 4.95 KB

docs.md

File metadata and controls

130 lines (92 loc) · 4.95 KB

NetcastClient

Client to interact with necast TVs host has to include a valid port number. By default LG TVs use 8080 so make sure to specify that eg. 192.168.1.3:8080

Following options are supported:

interface Options {
  timeout: 2000;
}

Kind: global class

new NetcastClient(host, options)

Creates a new NetcastClient instance

Param Type Description
host string

The host

options 2000

The options

netcastClient.wrap_command(command_type, command, session)

Wraps the given command into an XML block ready to send to the TV

Kind: instance method of NetcastClient

Param Type Default Description
command_type LG_HANDLE

LG_HANDLE

command Channel

either a LG_COMMAND or other payload, such as Channel

session string null

the current session id. if not specified, the command will be unauthenticated

netcastClient.send_to_tv(message_type, message, payload)

Sends the given message to the TV. message has to be in XML format Will return a javascript object with the result, or throw an exception

Kind: instance method of NetcastClient

Param Type Default Description
message_type string

Type of the message to send, eg 'data', 'command', 'auth'

message string null

Message to send in XML string format

payload object

Payload & (GET) parameters to send

netcastClient.display_pair_code()

Issues a command to the TV to display the pair code // access token

Kind: instance method of NetcastClient

netcastClient.get_session(access_token)

Retrieves (or creates) the current session used for interacting with the TV

Kind: instance method of NetcastClient

Param Type Default Description
access_token string null

Access token aka pair code

netcastClient.query_data(query)

Issues a query command to the TV to retrieve current information such as channel, volume, etc

Kind: instance method of NetcastClient

Param Type Description
query LG_QUERY

What to query. See LG_QUERY type

netcastClient.send_command(command, session)

Sends the given command to the TV To issue commands, you need a valid session id. To retrieve that, use get_session() paired with the access_token of the TV To get the access_token, use display_pair_code()

Kind: instance method of NetcastClient

Param Type Description
command LG_COMMAND

The command to send, see LG_COMMAND type

session string

Session id

netcastClient.change_channel(channel, session)

Changes channel to the given channel

Kind: instance method of NetcastClient

Param Type Description
channel Channel

The channel to switch to. Has to be in a specific format, see Channel type

session string

Session id

netcastClient.get_current_channel(session)

Retrieves the current channel information from the TV

Kind: instance method of NetcastClient

Param Type Description
session string

The session