|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface NXTComm
Interface that all NXTComm implementation classes must implement for low-level communication
with the NXT.
| Field Summary | |
|---|---|
static int |
LCP
Lego Communications Protocol ( LCP) I/O mode. |
static int |
PACKET
PACKET I/O mode. |
static int |
RAW
RAW I/O mode. |
| Method Summary | |
|---|---|
int |
available()
Request the number of bytes available to read. |
java.io.InputStream |
getInputStream()
Return an InputStream for reading a stream of data from the NXT over this connection. |
java.io.OutputStream |
getOutputStream()
Return an OutputStream for writing a stream of data to the NXT over this connection. |
boolean |
open(NXTInfo nxt)
Connect to a NXT found by a search or created from name and address. |
boolean |
open(NXTInfo nxt,
int mode)
Connect to a NXT found by a search or created from name and address. |
byte[] |
read()
Read data from a NXT that has an open connection. |
NXTInfo[] |
search(java.lang.String name)
Search for NXTs over USB, Bluetooth or both |
void |
write(byte[] data)
Write data to a NXT that has an open connection. |
| Methods inherited from interface lejos.nxt.remote.NXTCommRequest |
|---|
close, sendRequest |
| Field Detail |
|---|
static final int LCP
LCP) I/O mode. The LCP is defined by The Lego Company to allow limited remote
command control of a NXT brick.
See the Lego Mindstorms Site. Look for the Bluetooth Developer Kit in Support |
Files | Advanced
static final int PACKET
PACKET I/O mode. This is default and is probably the best mode to use if you are talking to a
NXT using the leJOS classes. Headers are included for each packet of data sent and received.
static final int RAW
RAW I/O mode. This mode is just that and omits any headers. It is used normally for connections to non-NXT
devices such as cell phones, etc.
| Method Detail |
|---|
NXTInfo[] search(java.lang.String name)
throws NXTCommException
name - name of the NXT or null
NXTCommException
boolean open(NXTInfo nxt,
int mode)
throws NXTCommException
nxt - the NXTInfo object for the NXTmode - the mode for the connection: LCP, PACKET or
RAW
true if the open succeeded
NXTCommException
boolean open(NXTInfo nxt)
throws NXTCommException
nxt - the NXTInfo object for the NXT
true if the open succeeded
NXTCommException
byte[] read()
throws java.io.IOException
byte[] array
java.io.IOException
int available()
throws java.io.IOException
java.io.IOException
void write(byte[] data)
throws java.io.IOException
data - the data to be written. Used for stream connections.
java.io.IOExceptionjava.io.OutputStream getOutputStream()
OutputStream for writing a stream of data to the NXT over this connection.
OutputStream objectjava.io.InputStream getInputStream()
InputStream for reading a stream of data from the NXT over this connection.
InputStream object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||