|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.NeuroSky.ThinkGear.IO.Connection
com.NeuroSky.ThinkGear.IO.HeadsetConnection
public class HeadsetConnection
This class implements a live ThinkGear driver. Refer to the documentation for the
abstract Connection
class for method details.
Constructor Summary | |
---|---|
HeadsetConnection()
|
Method Summary | |
---|---|
boolean |
closeConnection()
Closes the connection to the ThinkGear headset. |
void |
flush()
Flushes data in the output buffer directly to the headset. |
boolean |
isConnected()
Check whether the driver is connected to a ThinkGear headset. |
boolean |
openConnection(java.lang.String deviceID)
Open a connection to the ThinkGear headset using a unique device identifier. |
boolean |
openConnection(java.lang.String deviceID,
int channel)
Open a connection to the ThinkGear headset using a unique device identifier and a channel number. |
int |
read(byte[] byteArray)
Reads data from the headset into a byte array reference passed in as a parameter. |
void |
write(byte[] values,
int off,
int len)
Writes a value to the headset. |
void |
write(int value)
Writes a value to the headset. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HeadsetConnection()
Method Detail |
---|
public boolean isConnected()
Connection
isConnected
in class Connection
true
if the headset is connect,
false
otherwise.public boolean openConnection(java.lang.String deviceID, int channel) throws java.io.IOException
Connection
openConnection
in class Connection
deviceID
- a 12-digit hexadecimal value representing the unique device identifierchannel
- an integer representing the desired channel to connect on
true
if the connection attempt was successful,
false
otherwise
java.io.IOException
public boolean openConnection(java.lang.String deviceID) throws java.io.IOException
Connection
openConnection
in class Connection
deviceID
- a 12-digit hexadecimal value representing the unique device identifier
true
if the connection attempt was successful,
false
otherwise
java.io.IOException
public int read(byte[] byteArray) throws java.io.IOException
Connection
read
in class Connection
byteArray
- the byte array that is to be written to
-1
if there is no more data because
the end of the stream has been reached.
java.io.IOException
public void write(int value) throws java.io.IOException
Connection
write
in class Connection
java.io.IOException
public void write(byte[] values, int off, int len) throws java.io.IOException
Connection
write
in class Connection
values
- the value to be written to the headset
java.io.IOException
public void flush() throws java.io.IOException
Connection
Connection.write(int)
to perform an immediate write.
flush
in class Connection
java.io.IOException
public boolean closeConnection() throws java.io.IOException
Connection
closeConnection
in class Connection
true
if the connection was successfully closed,
false
otherwise
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |