|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
org.stanwood.media.store.mp4.itunes.ITunesRemoteClient
public class ITunesRemoteClient
This is a client to the iTunes control server. It is used to send and receive messages. Details of the server can be found at "http://code.google.com/p/itunes-remote-control-server/".
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
static java.lang.String |
CMD_ADD_FILES
The ADDFILES command text |
static java.lang.String |
CMD_CLEAR_FILES
The CLEARFILES command text |
static java.lang.String |
CMD_FILE
The FILE command text |
static java.lang.String |
CMD_HELO
The HELO command text |
static java.lang.String |
CMD_LIST_DEAD_FILES
The LISTDEADFILES command text |
static java.lang.String |
CMD_LOGIN
The LOGIN command text |
static java.lang.String |
CMD_PASSWORD
The PASSWORD command text |
static java.lang.String |
CMD_QUIT
The QUIT command text |
static java.lang.String |
CMD_REFRESH_FILES
The REFRESHFILES command text |
static java.lang.String |
CMD_REMOVE_DEAD_FILES
The REMOVEDEADFILES command text |
static java.lang.String |
CMD_REMOVE_FILES
The REMOVEFILES command text |
static long |
DEFAULT_TIMEOUT
The default timeout for commands that don't take a long time in seconds |
static long |
NO_TIMEOUT
This can be used if no timeout is requried |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
ITunesRemoteClient()
The constructor |
Method Summary | |
---|---|
void |
connect(java.net.InetAddress hostname,
int port)
Used to connect to the server |
void |
disconnect()
Used to disconnect from the server |
void |
login(java.lang.String username,
java.lang.String password)
Used to login to the server |
void |
run()
|
void |
sendCommand(java.lang.String cmd,
int expectedCode,
long timeout)
Used to send a command to the server |
protected void |
waitForCode(java.lang.String cmd,
int expectedCode,
long timeout)
|
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final long DEFAULT_TIMEOUT
public static final long NO_TIMEOUT
public static final java.lang.String CMD_HELO
public static final java.lang.String CMD_QUIT
public static final java.lang.String CMD_LOGIN
public static final java.lang.String CMD_PASSWORD
public static final java.lang.String CMD_CLEAR_FILES
public static final java.lang.String CMD_ADD_FILES
public static final java.lang.String CMD_REMOVE_FILES
public static final java.lang.String CMD_REMOVE_DEAD_FILES
public static final java.lang.String CMD_LIST_DEAD_FILES
public static final java.lang.String CMD_REFRESH_FILES
public static final java.lang.String CMD_FILE
Constructor Detail |
---|
public ITunesRemoteClient()
Method Detail |
---|
public void connect(java.net.InetAddress hostname, int port) throws StoreException
hostname
- The hostname of the serverport
- The port number of the host
StoreException
- Thrown if their is a problempublic void login(java.lang.String username, java.lang.String password) throws StoreException
username
- The username of the user connecting to the serverpassword
- The password of the user connecting to the server
StoreException
- Thrown if their is a problempublic void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void sendCommand(java.lang.String cmd, int expectedCode, long timeout) throws StoreException
cmd
- The command to set to the serverexpectedCode
- The expected return code if their are no errorstimeout
- the timeout in seconds, or -1 for no timeout
StoreException
- Thrown if their is a problemprotected void waitForCode(java.lang.String cmd, int expectedCode, long timeout) throws StoreException
StoreException
public void disconnect()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |