|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectlejos.pc.comm.NXTCommLoggable
lejos.pc.comm.NXTConnector
public class NXTConnector
Connects to a NXT using Bluetooth or USB (or either) and supplies input and output data streams.
| Field Summary |
|---|
| Fields inherited from class lejos.pc.comm.NXTCommLoggable |
|---|
fLogListeners |
| Constructor Summary | |
|---|---|
NXTConnector()
|
|
| Method Summary | |
|---|---|
void |
close()
Close the connection |
boolean |
connectTo()
Connect to any NXT over any protocol in NXTComm.PACKET mode |
boolean |
connectTo(int mode)
Connect to any NXT over any protocol specifying mode |
boolean |
connectTo(NXTInfo nxtInfo,
int mode)
Connect to a NXT using a NXTInfo instance |
boolean |
connectTo(java.lang.String deviceURL)
Connect to a device by URL in NXTComm.PACKET mode |
boolean |
connectTo(java.lang.String deviceURL,
int mode)
Connect to a device by URL |
boolean |
connectTo(java.lang.String nxt,
java.lang.String addr,
int protocols)
Connect to a specified NXT in packet mode |
boolean |
connectTo(java.lang.String nxt,
java.lang.String addr,
int protocols,
int mode)
Connect to a NXT |
java.io.InputStream |
getInputStream()
|
NXTComm |
getNXTComm()
|
NXTInfo |
getNXTInfo()
|
java.io.OutputStream |
getOutputStream()
|
NXTInfo[] |
search(java.lang.String nxt,
java.lang.String addr,
int protocols)
Search for one or more NXTs and return an array of NXTInfo instances for those found. |
void |
setDebug(boolean debug)
Set debugging on or off |
| Methods inherited from class lejos.pc.comm.NXTCommLoggable |
|---|
addLogListener, log, log, removeLogListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NXTConnector()
| Method Detail |
|---|
public boolean connectTo()
NXTComm.PACKET mode
true if the connection succeededNXTComm.PACKETpublic boolean connectTo(int mode)
mode - the NXTComm mode (NXTComm.PACKET, NXTComm.LCP, or
NXTComm.RAW)
true if the connection succeeded
public boolean connectTo(java.lang.String nxt,
java.lang.String addr,
int protocols)
nxt - the name of the NXT to connect to or null for anyaddr - the address of the NXT to connect to or nullprotocols - the protocols to use: NXTCommFactory.ALL_PROTOCOLS,
NXTCommFactory.BLUETOOTH, or NXTCommFactory.USB
true if the connection succeeded
public NXTInfo[] search(java.lang.String nxt,
java.lang.String addr,
int protocols)
NXTInfo instances for those found.
nxt - the name of the NXT to connect to or null for anyaddr - the address of the NXT to connect to or nullprotocols - the protocols to use: NXTCommFactory.ALL_PROTOCOLS,
NXTCommFactory.BLUETOOTH, or NXTCommFactory.USB
NXTInfo instances for found NXTs
public boolean connectTo(java.lang.String nxt,
java.lang.String addr,
int protocols,
int mode)
nxt - the name of the NXT to connect to or null for anyaddr - the address of the NXT to connect to or nullprotocols - the protocols to use: NXTCommFactory.ALL_PROTOCOLS,
NXTCommFactory.BLUETOOTH, or NXTCommFactory.USBmode - the NXTComm mode (NXTComm.PACKET, NXTComm.LCP, or
NXTComm.RAW)
true if the connection succeeded
public boolean connectTo(NXTInfo nxtInfo,
int mode)
NXTInfo instance
nxtInfo - mode -
true if the connection succeeded
public boolean connectTo(java.lang.String deviceURL,
int mode)
deviceURL - i.e. btspp://[name], usb://[name]mode - the mode (NXTComm.PACKET, NXTComm.LCP, or
NXTComm.RAW)
true if the connection succeededpublic boolean connectTo(java.lang.String deviceURL)
NXTComm.PACKET mode
deviceURL - i.e. btspp://[name], usb://[name]
true if the connection succeededNXTComm.PACKETpublic java.io.InputStream getInputStream()
InputStream for this connection;public java.io.OutputStream getOutputStream()
OutputStream for this connection;public NXTInfo getNXTInfo()
NXTInfo for this connectionpublic NXTComm getNXTComm()
NXTComm for this connection
public void close()
throws java.io.IOException
java.io.IOExceptionpublic void setDebug(boolean debug)
debug - true for on, false for off
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||