|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlejos.pc.comm.NXTCommLibnxt
public class NXTCommLibnxt
Implementation of NXTComm over USB using libnxt. Should not be used directly - use NXTCommFactory to create an appropriate NXTComm object for your system and the protocol you are using.
Constructor Summary | |
---|---|
NXTCommLibnxt()
|
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. |
void |
jlibnxt_close(long nxt)
|
long |
jlibnxt_find(int idx)
|
java.lang.String |
jlibnxt_name(long nxt)
|
int |
jlibnxt_open(long nxt)
|
byte[] |
jlibnxt_read_data(long nxt,
int len)
|
void |
jlibnxt_send_data(long nxt,
byte[] message)
|
java.lang.String |
jlibnxt_serial(long nxt)
|
boolean |
open(NXTInfo nxtInfo)
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[] data,
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NXTCommLibnxt()
Method Detail |
---|
public long jlibnxt_find(int idx)
public int jlibnxt_open(long nxt)
public void jlibnxt_close(long nxt)
public void jlibnxt_send_data(long nxt, byte[] message) throws java.io.IOException
java.io.IOException
public byte[] jlibnxt_read_data(long nxt, int len) throws java.io.IOException
java.io.IOException
public java.lang.String jlibnxt_serial(long nxt)
public java.lang.String jlibnxt_name(long nxt)
public NXTInfo[] search(java.lang.String name, int protocol)
NXTComm
search
in interface NXTComm
name
- name of the NXT or nullprotocol
- bitwise combination of NXTCommFactory.BLUETOOTH and NXTCommFactory.USB
public boolean open(NXTInfo nxtInfo)
NXTComm
open
in interface NXTComm
nxtInfo
- the NXTInfo object for the NXT
public void close() throws java.io.IOException
NXTComm
close
in interface NXTComm
java.io.IOException
public byte[] sendRequest(byte[] data, int replyLen) throws java.io.IOException
NXTComm
sendRequest
in interface NXTComm
data
- the LCP messagereplyLen
- the reply length expected
java.io.IOException
public byte[] read() throws java.io.IOException
NXTComm
read
in interface NXTComm
java.io.IOException
public int available() throws java.io.IOException
NXTComm
available
in interface NXTComm
java.io.IOException
public void write(byte[] data) throws java.io.IOException
NXTComm
write
in interface NXTComm
data
- the data to be written.
Used for stream connections.
java.io.IOException
public java.io.OutputStream getOutputStream()
NXTComm
getOutputStream
in interface NXTComm
public java.io.InputStream getInputStream()
NXTComm
getInputStream
in interface NXTComm
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |