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 BT_STATE_CONNECTED
           
static int BT_STATE_CONNECTING
           
static int BT_STATE_IDLE
           
static int MESSAGE_BT_STATE_CHANGE
           
static int MESSAGE_ESENSE_DATA
           
static int MESSAGE_LOW_BATTERY
           
static int MESSAGE_RAW_COUNT
           
static int MESSAGE_RAW_DATA
           
 
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
 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

BT_STATE_IDLE

public static final int BT_STATE_IDLE
See Also:
Constant Field Values

BT_STATE_CONNECTING

public static final int BT_STATE_CONNECTING
See Also:
Constant Field Values

BT_STATE_CONNECTED

public static final int BT_STATE_CONNECTED
See Also:
Constant Field Values

MESSAGE_BT_STATE_CHANGE

public static final int MESSAGE_BT_STATE_CHANGE
See Also:
Constant Field Values

MESSAGE_RAW_DATA

public static final int MESSAGE_RAW_DATA
See Also:
Constant Field Values

MESSAGE_ESENSE_DATA

public static final int MESSAGE_ESENSE_DATA
See Also:
Constant Field Values

MESSAGE_RAW_COUNT

public static final int MESSAGE_RAW_COUNT
See Also:
Constant Field Values

MESSAGE_LOW_BATTERY

public static final int MESSAGE_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

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