|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread lejos.nxt.comm.RConsole
public class RConsole
This class provides a simple way of sending output for viewing on a
PC. The output is transmitted via the nxt USB connection or via Bluetooth.
If open is not called or if the connection to the PC is timed out, then
the output is discarded. The class may also be used to provide a remote view
of the NXT LCD display, and to capture various debug events. The use of these
facilities requires corresponding capabilities within the remote viewer and
is negotiated at connection time.
Use of this class is normally initiated in two ways:
1. Explicit usage. The user program makes a call to one of the open methods
and than uses the RConsole.println method to display output.
2. Implicit usage. In this mode the -gr (--remotedebug) is specified to the
leJOS linker and this arranges to start the user program via this class.
This class then hooks any required debug events, waits for a remote viewer
to connect (via either Bluetooth or USB), and then routes the standard
system output and err print streams to the remote display.
Nested Class Summary | |
---|---|
static class |
RConsole.Monitor
The following internal class provides an implicit remote console and also hooks into the debug event system. |
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Method Summary | |
---|---|
static void |
close()
Close the remote console connection. |
static boolean |
exception(int classNo,
int methodNo,
int pc,
int[] stackTrace,
String msg)
Send an exception event to the remote console. |
static PrintStream |
getPrintStream()
Return a print stream connected to the remote console. |
static boolean |
isOpen()
Check to see if the remote console is available for use. |
static void |
open()
Wait forever for a remote viewer to connect. |
static void |
openAny(int timeout)
Wait for a remote viewer to connect using either USB or Bluetooth. |
static void |
openBluetooth(int timeout)
Wait for a remote viewer to connect via Bluetooth. |
static void |
openUSB(int timeout)
Wait for a remote viewer to connect via USB. |
static void |
print(String s)
Send output to the remote viewer. |
static void |
println(String s)
Send a line to the remote viewer. |
void |
run()
Main console I/O thread. |
Methods inherited from class java.lang.Thread |
---|
currentThread, getDefaultUncaughtExceptionHandler, getName, getPriority, getUncaughtExceptionHandler, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, start, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void openUSB(int timeout)
timeout
- how long to wait, 0 waits for ever.public static void openBluetooth(int timeout)
timeout
- how long to wait, 0 waits for ever.public static void openAny(int timeout)
timeout
- time to wait for the connection, 0 waits for ever.public static void open()
public static void print(String s)
s
- public static void println(String s)
s
- public static void close()
public static boolean isOpen()
public static PrintStream getPrintStream()
public void run()
run
in interface Runnable
run
in class Thread
public static boolean exception(int classNo, int methodNo, int pc, int[] stackTrace, String msg)
classNo
- The exception class.methodNo
- The method in which the exception occurred.pc
- The location of the exception.stackTrace
- An internal stack trace.msg
- A text message associated with the exception.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |