Package lejos.remote.nxt
Class NXTConnection
- java.lang.Object
-
- lejos.remote.nxt.NXTConnection
-
- All Implemented Interfaces:
Connection,InputConnection,OutputConnection,StreamConnection
- Direct Known Subclasses:
BTConnection,SocketConnection
public abstract class NXTConnection extends java.lang.Object implements StreamConnection
-
-
Constructor Summary
Constructors Constructor Description NXTConnection()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidclose()java.io.DataInputStreamopenDataInputStream()Open and return a data input stream for a connection.java.io.DataOutputStreamopenDataOutputStream()Open and return a data output stream for a connection.java.io.InputStreamopenInputStream()Open and return an input stream for a connection.java.io.OutputStreamopenOutputStream()Open and return an output stream for a connection.abstract intread(byte[] buf, int length)abstract intread(byte[] buf, int length, boolean b)abstract intwrite(byte[] buffer, int numBytes)
-
-
-
Field Detail
-
LCP
public static final int LCP
Lego Communications Protocol (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- See Also:
- Constant Field Values
-
PACKET
public static final int PACKET
PACKETI/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.- See Also:
- Constant Field Values
-
RAW
public static final int RAW
RAWI/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.- See Also:
- Constant Field Values
-
-
Method Detail
-
openDataInputStream
public java.io.DataInputStream openDataInputStream()
Description copied from interface:InputConnectionOpen and return a data input stream for a connection.- Specified by:
openDataInputStreamin interfaceInputConnection- Returns:
- the data input stream
-
openInputStream
public java.io.InputStream openInputStream()
Description copied from interface:InputConnectionOpen and return an input stream for a connection.- Specified by:
openInputStreamin interfaceInputConnection- Returns:
- the input stream
-
close
public abstract void close() throws java.io.IOException- Specified by:
closein interfaceConnection- Throws:
java.io.IOException
-
openDataOutputStream
public java.io.DataOutputStream openDataOutputStream()
Description copied from interface:OutputConnectionOpen and return a data output stream for a connection.- Specified by:
openDataOutputStreamin interfaceOutputConnection- Returns:
- the data output stream
-
openOutputStream
public java.io.OutputStream openOutputStream()
Description copied from interface:OutputConnectionOpen and return an output stream for a connection.- Specified by:
openOutputStreamin interfaceOutputConnection- Returns:
- the output stream
-
read
public abstract int read(byte[] buf, int length)
-
write
public abstract int write(byte[] buffer, int numBytes)
-
read
public abstract int read(byte[] buf, int length, boolean b)
-
-