hmi.faceanimation.util
Class XfaceInterface
java.lang.Object
java.lang.Thread
hmi.faceanimation.util.XfaceInterface
- All Implemented Interfaces:
- Runnable
public class XfaceInterface
- extends Thread
Provides an interface to Xface via TCP/IP. Xface accepts FAP uploads that
usually contain more frames at once. In this interface, we upload one
frame at a time. This works, but Xface stops working when these uploads
come too fast after each other. We therefore create a seperate thread so
the sleep does not get in the way of the GUI or whatever uses this
interface.
We use a small state machine to keep track of our state and stops us
from connecting when connected, sending when in error, etc.
- Author:
- R.C. Paul
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, 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, start, stop, stop, suspend, toString, yield |
configuration
private MPEG4Configuration configuration
values
private Integer[] values
logger
private org.slf4j.Logger logger
state
private XfaceInterface.State state
socket
private Socket socket
out
private PrintWriter out
in
private InputStream in
taskId
private int taskId
ownerId
private int ownerId
stopThread
private boolean stopThread
XfaceInterface
public XfaceInterface()
connect
public void connect()
disconnect
public void disconnect()
isStandby
public boolean isStandby()
setConfiguration
public void setConfiguration(MPEG4Configuration configuration)
Sets values via a MPEG4Configuration object. This usually
contains values from 0.0-1.0 for unidirectional FAPs or
-1.0-1.0 for bidirectional FAPs.
- Parameters:
configuration - - See Also:
setRawValues
setRawValues
public void setRawValues(Integer[] values)
Sets raw values. These are directly used in the FAP
uploads.
- Parameters:
values - - See Also:
setConfiguration
sendConfiguration
private void sendConfiguration()
displayConfiguration
private void displayConfiguration()
sendTask
private void sendTask(int taskId,
String task,
String xml)
setState
private void setState(XfaceInterface.State state)
timedPrint
private void timedPrint(String message)
sleep
public static void sleep(long time)
run
public void run()
- Specified by:
run in interface Runnable- Overrides:
run in class Thread
communicationNeeded
private boolean communicationNeeded()
communicate
private void communicate()