API reference
Detailed documentation is available here:
Cannot resolve file macro, invalid file name or id..
Code walkthrough
The Emotiv Engine Client API provides an event-driven managed wrapper around the the Emotiv Engine in DotNetEmotivSDK.dll.
EmoEngineClient classThe
EmoEngineClient class interacts with Emotiv's EmoEngine class in two distinct ways.
- Polling for neuroheadset device state, which is reported in EmoState instances. A worker thread polls the ProcessEvents(Int32) method.
- Polling for realtime electrode data from the neuroheadset device, which is reported in dictionaries. A worker thread polls the GetData(UInt32) method.
Call the StartEmoEngine method to start the engine's ProcessEvents(Int32) worker thread.
Call the StartDataPolling method to start the engine's GetData(UInt32) worker thread.
Subscribe to the PropertyChanged event to be notified when an EmoEngineClient property changes value. To get realtime data, check the Buffer property in your PropertyChanged event handler. For example, this is how the NeuroDataControl handles the PropertyChanged event:
void emoEngineClient_PropertyChanged( object sender, PropertyChangedEventArgs e )
{
if( e.PropertyName == "Buffer" )
{
EmoEngineClient emoEngineClient = sender as EmoEngineClient;
lock( emoEngineClient.Buffer.ChannelData.SyncRoot )
{
foreach( KeyValuePair<EdkDll.EE_DataChannel_t, double[]> kvp in emoEngineClient.Buffer.ChannelData )
{
if( this._timeSeriesControlDictionary.ContainsKey( kvp.Key ) )
{
EdkDll.EE_DataChannel_t channel = kvp.Key;
double[] data = kvp.Value;
this._timeSeriesControlDictionary[channel].UpdateDisplay( data );
}
}
}
}
}
SampleBuffer classThe
SampleBuffer class collects samples of electrode data from the Emotiv neuroheadset's realtime data stream and saves them in a
SampleBufferDictionary.
The neuroheadset periodically sends data frames of electrode measurements and reference signals. The engine's DataGetSamplingRate(UInt32) property determines how fast data frames arrive. This value is typically 128Hz.
Each frame contains data for the channels specified in the EE_DataChannel_t enumeration. Currently, each data frame comprises 14 channels of electrode data and 11 channels of reference and other signals.
Use the ChannelData property to access data frames in the sample buffer. Synchronize access to the
SampleBufferDictionary class by using the lock statement and the SyncRoot property.
ChannelContext classThe
ChannelContext class provides a collection of properties for a data channel.
- AddToBuffer: Boolean indicating that the data channel is included in the SampleBuffer.
- RemoveDCBias: Boolean indicating that any DC bias in the data channel is removed.
- IsElectrodeChannel: Boolean indicating that the data channel holds electrode data.
- ComputeFFT: Boolean indicating that a Fast Fourier Transform (FFT) is computed for the data channel.
- ContactQuality: A EE_EEG_ContactQuality_t that indicates the signal quality of the data channel.
The EmoEngineClient class creates a default collection of channel contexts in the PopulateChannelContexts method.
EmotivState classThe
EmotivState class provides property wrappers around the EmoState methods. EmotivState wraps EmoState methods with CLR properties, which enables data binding in the visualization layer.
Realtime data from the neuroheadset maps to EmoEngineClientLibrary data channels in the InputChannelToDataChannelMap property.
EmoEngineControlLibrary namespace
TimeSeriesControlThe
TimeSeriesControl class is a lightweight WPF control that displays a buffer of double data.
NeuroDataControlThe
NeuroDataControl class displays realtime electrode data from the Emotiv neuroheadset.