public class SamsungRemote
extends java.lang.Object
Constructor and Description |
---|
SamsungRemote(java.net.InetAddress host)
Opens a socket connection to the television.
|
SamsungRemote(java.net.InetAddress host,
boolean debug)
Opens a socket connection to the television and keeps a simple log when
debug is true.
|
SamsungRemote(java.lang.String host)
Deprecated.
|
SamsungRemote(java.lang.String host,
boolean debug)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
TVReply |
authenticate(java.lang.String name)
Authenticates with the television using host IP address for the ip and id
parameters.
|
TVReply |
authenticate(java.lang.String id,
java.lang.String name)
Authenticates with the television using host IP address for the ip
parameter.
|
TVReply |
authenticate(java.lang.String ip,
java.lang.String id,
java.lang.String name)
Authenticates with the television.
|
void |
checkConnection()
Checks the connection by sending an empty key code, does not return
anything but instead throws an exception when a problem arose (for
instance the TV turned off).
|
void |
close()
Closes the socket connection.
|
java.lang.String[] |
getLog()
Returns a simple log with for instance TV response payloads as string
array, will only be filled when this class is constructed with debug true
(otherwise the array will be empty).
|
void |
keycode(Keycode keycode)
Sends a key code to TV, blocks shortly waiting for TV response to check
delivery.
|
void |
keycode(java.lang.String keycode)
Sends a key code to TV, blocks shortly waiting for TV response to check
delivery.
|
void |
keycodeAsync(Keycode keycode)
Sends a key code to TV in a non-blocking manner, thus it does not check
the delivery (use checkConnection() to poll the TV status).
|
void |
keycodeAsync(java.lang.String keycode)
Sends a key code to TV in a non-blocking manner, thus it does not check
the delivery (use checkConnection() to poll the TV status).
|
public SamsungRemote(java.net.InetAddress host) throws java.io.IOException
host
- the host address.java.io.IOException
- if an I/O error occurs when creating the socket.public SamsungRemote(java.net.InetAddress host, boolean debug) throws java.io.IOException
host
- the host address.debug
- whether or not to keep a log.java.io.IOException
- if an I/O error occurs when creating the socket.public SamsungRemote(java.lang.String host) throws java.io.IOException
host
- the host name.java.io.IOException
- if an I/O error occurs when creating the socket.public SamsungRemote(java.lang.String host, boolean debug) throws java.io.IOException
host
- the host name.debug
- whether or not to keep a log.java.io.IOException
- if an I/O error occurs when creating the socket.public TVReply authenticate(java.lang.String name) throws java.io.IOException
name
- the name for this controller, which is displayed on the
television.java.io.IOException
- if an I/O error occurs.authenticate
public TVReply authenticate(java.lang.String id, java.lang.String name) throws java.io.IOException
id
- a parameter for the television.name
- the name for this controller, which is displayed on the
television.java.io.IOException
- if an I/O error occurs.authenticate
public TVReply authenticate(java.lang.String ip, java.lang.String id, java.lang.String name) throws java.io.IOException
ip
- a parameter for the television.id
- a parameter for the television.name
- the name for this controller, which is displayed on the
television.java.io.IOException
- if an I/O error occurs.public void keycode(Keycode keycode) throws java.io.IOException
keycode
- the key code to send.java.io.IOException
- if an I/O error occurs.public void keycode(java.lang.String keycode) throws java.io.IOException
keycode
- the key code to send.java.io.IOException
- if an I/O error occurs.public void keycodeAsync(Keycode keycode) throws java.io.IOException
keycode
- the key code to send.java.io.IOException
- if an I/O error occurs.public void keycodeAsync(java.lang.String keycode) throws java.io.IOException
keycode
- the key code to send.java.io.IOException
- if an I/O error occurs.public void checkConnection() throws java.io.IOException
java.io.IOException
- if an I/O error occurs.public java.lang.String[] getLog()
public void close()