|
|||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | ||||||||
See:
Description
| Interface Summary | |
|---|---|
| IRawSampleGenerator | Generates the raw EEG samples for a specific channel or channels. |
| IRawSampleListener | Listener interface for receiving raw EEG samples. |
| Class Summary | |
|---|---|
| EEGAcquisitionController | Controller that starts/stops reading EEG data, and provides access to the
IRawSampleGenerator. |
| RawSample | Contains the raw EEG data sample(s) for a specific channel or set of channels. |
Provides access to the raw EEG data acquired by the ModEEG device. To access this
data, an application instructs the EEGAcquisitionController to begin
reading data by calling its startReading method. Classes wanting to
receive EEG data should register as listeners with the IRawSampleGenerator's
addSampleListener method, and implement the IRawSampleListener
interface.
public class SampleApp
{
private EEGAcquisitionController eegAcquisitionController;
public SampleApp()
{
eegAcquisitionController = EEGAcquisitionController.getInstance();
IRawSampleGenerator sampleGenerator = eegAcquisitionController.getChannelSampleGenerator();
// Listens to both channels 1 and 2
SampleListener twoChannelListener = new SampleListener("Channel One and Two");
sampleGenerator.addSampleListener(twoChannelListener, new int[]{1, 2});
// Listens to only channel 1
SampleListener oneChannelListener = new SampleListener("Channel One");
sampleGenerator.addSampleListener(oneChannelListener, new int[]{1});
}
public void start() throws IOException
{
eegAcquisitionController.startReading();
}
public void stop()
{
eegAcquisitionController.stopReading();
}
public static void main(String[] args) throws IOException
{
SampleApp app = new SampleApp();
app.start();
}
class SampleListener implements IRawSampleListener
{
String name;
SampleListener(String name)
{
this.name = name;
}
public void receiveSample(RawSample rawSample)
{
System.out.println(name);
int packetNumber = rawSample.getPacketNumber();
System.out.println(" Packet number:" + packetNumber);
for (int i = 0, length = rawSample.getChannelNumbers().length; i < length; i++)
{
int channelNumber = rawSample.getChannelNumbers()[i];
int sample = rawSample.getSamples()[i];
System.out.println(" Channel #" + channelNumber + " = " + sample);
}
}
}
}
|
|||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | ||||||||