|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.NeuroSky.ThinkGear.IO.Connection
public abstract class Connection
This class defines an implementation of the ThinkGear driver. Both ThinkGear.Driver and ThinkGear.DummyDriver extend from this class, allowing a programmer to (possibly programmatically) swap between debug non-live code and live code by changing which driver type gets instantiated.
Constructor Summary | |
---|---|
Connection()
|
Method Summary | |
---|---|
abstract boolean |
closeConnection()
Closes the connection to the ThinkGear headset. |
abstract void |
flush()
Flushes data in the output buffer directly to the headset. |
abstract boolean |
isConnected()
Check whether the driver is connected to a ThinkGear headset. |
abstract boolean |
openConnection(java.lang.String deviceID)
Open a connection to the ThinkGear headset using a unique device identifier. |
abstract boolean |
openConnection(java.lang.String deviceID,
int channel)
Open a connection to the ThinkGear headset using a unique device identifier and a channel number. |
abstract int |
read(byte[] byteArray)
Reads data from the headset into a byte array reference passed in as a parameter. |
abstract void |
write(byte[] values,
int off,
int len)
Writes a value to the headset. |
abstract 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 Connection()
Method Detail |
---|
public abstract boolean openConnection(java.lang.String deviceID) throws java.io.IOException
deviceID
- a 12-digit hexadecimal value representing the unique device identifier
true
if the connection attempt was successful,
false
otherwise
java.io.IOException
public abstract boolean openConnection(java.lang.String deviceID, int channel) throws java.io.IOException
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 abstract boolean closeConnection() throws java.io.IOException
true
if the connection was successfully closed,
false
otherwise
java.io.IOException
public abstract int read(byte[] byteArray) throws java.io.IOException
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 abstract void write(int value) throws java.io.IOException
values
- the value to be written to the headset
java.io.IOException
public abstract void write(byte[] values, int off, int len) throws java.io.IOException
values
- the value to be written to the headset
java.io.IOException
public abstract void flush() throws java.io.IOException
write(int)
to perform an immediate write.
java.io.IOException
public abstract boolean isConnected()
true
if the headset is connect,
false
otherwise.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |