com.neurosky.thinkgear
Class TGDevice

java.lang.Object
  extended by com.neurosky.thinkgear.TGDevice

public class TGDevice
extends java.lang.Object

Class to connect and receive data from a ThinkGear device.

Author:
Tin Nguyen

Field Summary
static int MSG_ATTENTION
           
static int MSG_BLINK
           
static int MSG_EEG_POWER
           
static int MSG_HEART_RATE
           
static int MSG_LOW_BATTERY
           
static int MSG_MEDITATION
           
static int MSG_POOR_SIGNAL
           
static int MSG_RAW_COUNT
           
static int MSG_RAW_DATA
           
static int MSG_RAW_MULTI
           
static int MSG_STATE_CHANGE
           
static int MSG_THINKCAP_RAW
           
static int STATE_CONNECTED
           
static int STATE_CONNECTING
           
static int STATE_DISCONNECTED
           
static int STATE_IDLE
           
static int STATE_NOT_FOUND
           
static int STATE_NOT_PAIRED
           
 
Constructor Summary
TGDevice(BluetoothAdapter btAdapter, Handler handler)
          Initializes a new TGDevice.
 
Method Summary
 void close()
          Closes the connection the the Bluetooth device.
 void connect(BluetoothDevice btDevice)
          Connects to the specified Bluetooth device with raw EEG disabled.
 void connect(BluetoothDevice btDevice, boolean rawEnabled)
          Connects to the specified Bluetooth device with configurable raw output.
 int getState()
          Gets the state of the TGDevice
 int getVersion()
          Returns the version number of the TGDevice driver
 void start()
          Starts the data stream.
 void stop()
          Stops the data stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_IDLE

public static final int STATE_IDLE
See Also:
Constant Field Values

STATE_CONNECTING

public static final int STATE_CONNECTING
See Also:
Constant Field Values

STATE_CONNECTED

public static final int STATE_CONNECTED
See Also:
Constant Field Values

STATE_DISCONNECTED

public static final int STATE_DISCONNECTED
See Also:
Constant Field Values

STATE_NOT_FOUND

public static final int STATE_NOT_FOUND
See Also:
Constant Field Values

STATE_NOT_PAIRED

public static final int STATE_NOT_PAIRED
See Also:
Constant Field Values

MSG_STATE_CHANGE

public static final int MSG_STATE_CHANGE
See Also:
Constant Field Values

MSG_POOR_SIGNAL

public static final int MSG_POOR_SIGNAL
See Also:
Constant Field Values

MSG_HEART_RATE

public static final int MSG_HEART_RATE
See Also:
Constant Field Values

MSG_ATTENTION

public static final int MSG_ATTENTION
See Also:
Constant Field Values

MSG_MEDITATION

public static final int MSG_MEDITATION
See Also:
Constant Field Values

MSG_BLINK

public static final int MSG_BLINK
See Also:
Constant Field Values

MSG_RAW_DATA

public static final int MSG_RAW_DATA
See Also:
Constant Field Values

MSG_EEG_POWER

public static final int MSG_EEG_POWER
See Also:
Constant Field Values

MSG_RAW_MULTI

public static final int MSG_RAW_MULTI
See Also:
Constant Field Values

MSG_THINKCAP_RAW

public static final int MSG_THINKCAP_RAW
See Also:
Constant Field Values

MSG_RAW_COUNT

public static final int MSG_RAW_COUNT
See Also:
Constant Field Values

MSG_LOW_BATTERY

public static final int MSG_LOW_BATTERY
See Also:
Constant Field Values
Constructor Detail

TGDevice

public TGDevice(BluetoothAdapter btAdapter,
                Handler handler)
Initializes a new TGDevice.

Parameters:
btAdapter - BluetoothAdapter of the device.
handler - Handler to accept messages from TGDevice
Method Detail

getVersion

public int getVersion()
Returns the version number of the TGDevice driver

Returns:
int Version number

connect

public void connect(BluetoothDevice btDevice)
Connects to the specified Bluetooth device with raw EEG disabled.

Parameters:
btDevice - Desired BluetoothDevice

connect

public void connect(BluetoothDevice btDevice,
                    boolean rawEnabled)
Connects to the specified Bluetooth device with configurable raw output.

Parameters:
btDevice - Desired BluetoothDevice
rawEnabled - Enable or disable raw EEG output.

close

public void close()
Closes the connection the the Bluetooth device.


start

public void start()
Starts the data stream.


stop

public void stop()
Stops the data stream.


getState

public int getState()
Gets the state of the TGDevice

Returns:
the state of the device as defined in the constants