|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectlejos.pc.comm.NXTCommBluez
public class NXTCommBluez
Implementation of NXTComm using the the jbluez library on Linux or Unix systems. Should not be used directly - use NXTCommFactory to create an appropriate NXTComm object for your system and the protocol you are using.
| Field Summary |
|---|
| Fields inherited from interface lejos.pc.comm.NXTComm |
|---|
LCP, PACKET, RAW |
| Constructor Summary | |
|---|---|
NXTCommBluez()
|
|
| Method Summary | |
|---|---|
int |
available()
Request the number of bytes available to read. |
void |
close()
Close the connection |
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 |
initialize(lejos.internal.jni.JNILoader jnil)
Return false, if the |
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 |
byte[] |
sendRequest(byte[] request,
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 NXTCommBluez()
| Method Detail |
|---|
public NXTInfo[] search(java.lang.String name)
NXTComm
search in interface NXTCommname - name of the NXT or null
public void close()
throws java.io.IOException
NXTCommRequest
close in interface NXTCommRequestjava.io.IOException
public boolean open(NXTInfo nxt,
int mode)
throws NXTCommException
NXTComm
open in interface NXTCommnxt - the NXTInfo object for the NXTmode - the mode for the connection: NXTComm.LCP, NXTComm.PACKET or
NXTComm.RAW
true if the open succeeded
NXTCommException
public boolean open(NXTInfo nxt)
throws NXTCommException
NXTComm
open in interface NXTCommnxt - the NXTInfo object for the NXT
true if the open succeeded
NXTCommException
public byte[] sendRequest(byte[] request,
int replyLen)
throws java.io.IOException
NXTCommRequest
sendRequest in interface NXTCommRequestrequest - the LCP messagereplyLen - the reply length expected
java.io.IOException
public byte[] read()
throws java.io.IOException
NXTComm
read in interface NXTCommbyte[] array
java.io.IOException
public int available()
throws java.io.IOException
NXTComm
available in interface NXTCommjava.io.IOException
public void write(byte[] data)
throws java.io.IOException
NXTComm
write in interface NXTCommdata - the data to be written. Used for stream connections.
java.io.IOExceptionpublic java.io.OutputStream getOutputStream()
NXTCommOutputStream for writing a stream of data to the NXT over this connection.
getOutputStream in interface NXTCommOutputStream objectpublic java.io.InputStream getInputStream()
NXTCommInputStream for reading a stream of data from the NXT over this connection.
getInputStream in interface NXTCommInputStream object
public boolean initialize(lejos.internal.jni.JNILoader jnil)
throws lejos.internal.jni.JNIException
lejos.internal.jni.JNIClass
initialize in interface lejos.internal.jni.JNIClassjnil - instance of JNILoader
lejos.internal.jni.JNIException - if something went wrong loading the JNI library
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||