|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlejos.pc.comm.NXTCommBluecove
public class NXTCommBluecove
Implementation of NXTComm using the Bluecove libraries on Microsoft Windows. 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 javax.bluetooth.DiscoveryListener |
---|
INQUIRY_COMPLETED, INQUIRY_ERROR, INQUIRY_TERMINATED, SERVICE_SEARCH_COMPLETED, SERVICE_SEARCH_DEVICE_NOT_REACHABLE, SERVICE_SEARCH_ERROR, SERVICE_SEARCH_NO_RECORDS, SERVICE_SEARCH_TERMINATED |
Constructor Summary | |
---|---|
NXTCommBluecove()
|
Method Summary | |
---|---|
int |
available()
Request the number of bytes available to read. |
void |
close()
Closes the connection to the NXT. |
void |
deviceDiscovered(javax.bluetooth.RemoteDevice btDevice,
javax.bluetooth.DeviceClass cod)
|
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 |
inquiryCompleted(int discType)
|
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)
Sends a request to the NXT brick. |
void |
servicesDiscovered(int transID,
javax.bluetooth.ServiceRecord[] servRecord)
|
void |
serviceSearchCompleted(int transID,
int respCode)
|
java.lang.String |
stripColons(java.lang.String s)
|
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 NXTCommBluecove()
Method Detail |
---|
public NXTInfo[] search(java.lang.String name, int protocol) throws NXTCommException
NXTComm
search
in interface NXTComm
name
- name of the NXT or nullprotocol
- bitwise combination of NXTCommFactory.BLUETOOTH and NXTCommFactory.USB
NXTCommException
public boolean open(NXTInfo nxt) throws NXTCommException
NXTComm
open
in interface NXTComm
nxt
- the NXTInfo object for the NXT
NXTCommException
public void close() throws java.io.IOException
NXTComm
close
in interface NXTComm
java.io.IOException
public byte[] sendRequest(byte[] message, int replyLen) throws java.io.IOException
sendRequest
in interface NXTComm
message
- Data to send.replyLen
- 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 void deviceDiscovered(javax.bluetooth.RemoteDevice btDevice, javax.bluetooth.DeviceClass cod)
deviceDiscovered
in interface javax.bluetooth.DiscoveryListener
public void inquiryCompleted(int discType)
inquiryCompleted
in interface javax.bluetooth.DiscoveryListener
public void servicesDiscovered(int transID, javax.bluetooth.ServiceRecord[] servRecord)
servicesDiscovered
in interface javax.bluetooth.DiscoveryListener
public void serviceSearchCompleted(int transID, int respCode)
serviceSearchCompleted
in interface javax.bluetooth.DiscoveryListener
public java.io.OutputStream getOutputStream()
NXTComm
getOutputStream
in interface NXTComm
public java.io.InputStream getInputStream()
NXTComm
getInputStream
in interface NXTComm
public java.lang.String stripColons(java.lang.String s)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |