|
||||||||
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.
Method Summary | |
---|---|
int |
available()
Request the number of bytes available to read. |
void |
close()
Closes the connection to the NXT. |
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 mname and address. |
byte[] |
read()
Read data from a NXT that has an open connection. |
NXTInfo[] |
search(java.lang.String name,
int protocol)
Search for NXTs over USB, Bluetooth or both |
byte[] |
sendRequest(byte[] message,
int replyLen)
Send an LCP message to the NXT and receive a reply |
void |
write(byte[] data)
Write data to a NXT that has an open connection. |
Method Detail |
---|
NXTInfo[] search(java.lang.String name, int protocol) throws NXTCommException
name
- name of the NXT or nullprotocol
- bitwise combination of NXTCommFactory.BLUETOOTH and NXTCommFactory.USB
NXTCommException
boolean open(NXTInfo nxt) throws NXTCommException
nxt
- the NXTInfo object for the NXT
NXTCommException
void close() throws java.io.IOException
java.io.IOException
byte[] sendRequest(byte[] message, int replyLen) throws java.io.IOException
message
- the LCP messagereplyLen
- the reply length expected
java.io.IOException
byte[] read() throws java.io.IOException
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.IOException
java.io.OutputStream getOutputStream()
java.io.InputStream getInputStream()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |