public class LCPResponder
extends java.lang.Thread
Modifier and Type | Field and Description |
---|---|
protected NXTConnection |
conn |
protected NXTCommConnector |
connector |
protected boolean |
running |
Constructor and Description |
---|
LCPResponder(NXTCommConnector connector)
Create a Responder using the provided connector
The connector is used to create the listening connection used to accept
remote commands.
|
Modifier and Type | Method and Description |
---|---|
protected int |
command(byte[] inMsg,
int len,
byte[] reply)
Process the actual command
Default action is to call the LCP object to emulate the command
|
protected void |
disconnect()
Method called to disconnect the responder connect.
|
boolean |
isConnected()
Checks whether there is an active connection
|
protected void |
postCommand(byte[] inMsg,
int inLen,
byte[] replyMsg,
int replyLen) |
protected int |
preCommand(byte[] inMsg,
int len)
Method called with a newly read command, before it is processed.
|
void |
run() |
void |
shutdown()
Terminate the responder.
|
protected void |
waitConnect()
Method called when the responder is waiting for a new connection.
|
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
protected NXTCommConnector connector
protected NXTConnection conn
protected boolean running
public LCPResponder(NXTCommConnector connector)
connector
- protected void waitConnect()
protected void disconnect()
protected int preCommand(byte[] inMsg, int len)
inMsg
- Newly read commandlen
- length of the commandprotected int command(byte[] inMsg, int len, byte[] reply)
inMsg
- The command byteslen
- length of the commandreply
- bytes to send back in response to the commandprotected void postCommand(byte[] inMsg, int inLen, byte[] replyMsg, int replyLen)
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void shutdown()
public boolean isConnected()