public abstract class NXTConnection extends java.lang.Object implements StreamConnection
Modifier and Type | Field and Description |
---|---|
static int |
LCP
Lego Communications Protocol (
LCP ) I/O mode. |
static int |
PACKET
PACKET I/O mode. |
static int |
RAW
RAW I/O mode. |
Constructor and Description |
---|
NXTConnection() |
Modifier and Type | Method and Description |
---|---|
abstract void |
close() |
java.io.DataInputStream |
openDataInputStream()
Open and return a data input stream for a connection.
|
java.io.DataOutputStream |
openDataOutputStream()
Open and return a data output stream for a connection.
|
java.io.InputStream |
openInputStream()
Open and return an input stream for a connection.
|
java.io.OutputStream |
openOutputStream()
Open and return an output stream for a connection.
|
abstract int |
read(byte[] buf,
int length) |
abstract int |
read(byte[] buf,
int length,
boolean b) |
abstract int |
write(byte[] buffer,
int numBytes) |
public 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 | Advancedpublic 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.public 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.public java.io.DataInputStream openDataInputStream()
InputConnection
openDataInputStream
in interface InputConnection
public java.io.InputStream openInputStream()
InputConnection
openInputStream
in interface InputConnection
public abstract void close() throws java.io.IOException
close
in interface Connection
java.io.IOException
public java.io.DataOutputStream openDataOutputStream()
OutputConnection
openDataOutputStream
in interface OutputConnection
public java.io.OutputStream openOutputStream()
OutputConnection
openOutputStream
in interface OutputConnection
public abstract int read(byte[] buf, int length)
public abstract int write(byte[] buffer, int numBytes)
public abstract int read(byte[] buf, int length, boolean b)