SharpBCI
A multi-threaded brain control interface (BCI) library in C#
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Pages
SharpBCI.SharpBCI Class Reference

This is the "main" class which you should create. More...

Public Member Functions

delegate void SharpBCIRawHandler (EEGEvent evt)
 A delegate which receives raw events based on what was registered. More...
 
delegate void SharpBCITrainedHandler (TrainedEvent evt)
 A delegate which recieved events based on a unique id returned by SharpBCI.StartTrain() More...
 
 SharpBCI (SharpBCIConfig config)
 
void StartTraining (int id)
 Start training SharpBCI on the EEG data from now on Should be paired w/ a StopTraining(id) call. More...
 
void StopTraining (int id)
 Stop training SharpBCI on the current trainingID. More...
 
void ClearTrainingData ()
 
IEnumerable< int > GetTrainedIds ()
 
void AddTrainedHandler (int id, SharpBCITrainedHandler handler)
 Add a training handler which is notified when "id" is detected Important: does not check if "id" has actually been trained upon. More...
 
void RemoveTrainedHandler (int id, SharpBCITrainedHandler handler)
 Remove a previously added training handler Important: does not check if "id" has actually been trained upon. More...
 
void AddRawHandler (EEGDataType type, SharpBCIRawHandler handler)
 Add a handler for raw (i.e, anything in EEGDataType) events Adding a handler does not guarantee events will actually be recieved, this is dependent on the configuration of the pipeline. More...
 
void RemoveRawHandler (EEGDataType type, SharpBCIRawHandler handler)
 Remove a handler for raw(i.e, anything in EEGDataType) events. More...
 
void MarkTime (DateTime time, string comment)
 Add an annotation to the current CSV file SharpBCI is logging to. More...
 
void LogRawData (EEGDataType dataType)
 Records the raw data for the current session to a newly created file. More...
 
void LogRawData (EEGDataType dataType, String fileName)
 Records the raw data for the current session to the filename/filepath specified. More...
 
void Close ()
 Called when all the SharpBCI threads should shutdown. More...
 

Public Attributes

const string RESERVED_PREFIX = "SharpBCI"
 None of your scope keys should start with this prefix. More...
 
const string SCOPE_ADAPTER_KEY = RESERVED_PREFIX + "Adapter"
 Keyword for the EEGDeviceAdapter configured. More...
 
const string SCOPE_SHARP_BCI_KEY = RESERVED_PREFIX + "Instance"
 Keyword for the SharpBCI instance. More...
 
const string SCOPE_CHANNELS_KEY = RESERVED_PREFIX + "Channels"
 Keyword for the number of EEG channels as reported by SharpBCIAdapter. More...
 
const string SCOPE_SAMPLE_RATE_KEY = RESERVED_PREFIX + "SampleRate"
 Keyword for the sample rate of EEGDataType.EEG as reported by SharpBCIAdapter. More...
 
readonly int channels
 How many channels the EEGDeviceAdapter has. More...
 
readonly double sampleRate
 Nominal sample rate of EEGDeviceAdapter, used for FFT and to understand EEGEvents. More...
 

Properties

double[] connectionStatus [get]
 Is the device connected to a human Based on the Muse EEG status updates: More...
 

Detailed Description

This is the "main" class which you should create.

All SharpBCI operates are coordinated by an instance of this class. The overhead for creating this class is rather large, so it should only be created once per usage.

Constructor & Destructor Documentation

SharpBCI.SharpBCI.SharpBCI ( SharpBCIConfig  config)
Parameters
configa valid config object, generally built with SharpBCIBuilder
See Also
SharpBCIConfig
SharpBCIBuilder

Member Function Documentation

void SharpBCI.SharpBCI.AddRawHandler ( EEGDataType  type,
SharpBCIRawHandler  handler 
)

Add a handler for raw (i.e, anything in EEGDataType) events Adding a handler does not guarantee events will actually be recieved, this is dependent on the configuration of the pipeline.

Exceptions
ArgumentExceptionif handler is null
void SharpBCI.SharpBCI.AddTrainedHandler ( int  id,
SharpBCITrainedHandler  handler 
)

Add a training handler which is notified when "id" is detected Important: does not check if "id" has actually been trained upon.

Exceptions
ArgumentExceptionwhen id less than or equal to zero
void SharpBCI.SharpBCI.ClearTrainingData ( )
void SharpBCI.SharpBCI.Close ( )

Called when all the SharpBCI threads should shutdown.

You may or may not continue to receive events after calling this You should unregister events before calling this to avoid memory leaks

IEnumerable<int> SharpBCI.SharpBCI.GetTrainedIds ( )
void SharpBCI.SharpBCI.LogRawData ( EEGDataType  dataType)

Records the raw data for the current session to a newly created file.

void SharpBCI.SharpBCI.LogRawData ( EEGDataType  dataType,
String  fileName 
)

Records the raw data for the current session to the filename/filepath specified.

Exceptions
ArgumentExceptionif dataType is null
void SharpBCI.SharpBCI.MarkTime ( DateTime  time,
string  comment 
)

Add an annotation to the current CSV file SharpBCI is logging to.

Parameters
timetime of the annotation
commentan optional comment to add to row in the csv file
void SharpBCI.SharpBCI.RemoveRawHandler ( EEGDataType  type,
SharpBCIRawHandler  handler 
)

Remove a handler for raw(i.e, anything in EEGDataType) events.

Exceptions
ArgumentExceptionif handler is null
void SharpBCI.SharpBCI.RemoveTrainedHandler ( int  id,
SharpBCITrainedHandler  handler 
)

Remove a previously added training handler Important: does not check if "id" has actually been trained upon.

Exceptions
ArgumentExceptionwhen id less than or equal to zero or if training handler was not previously added
delegate void SharpBCI.SharpBCI.SharpBCIRawHandler ( EEGEvent  evt)

A delegate which receives raw events based on what was registered.

See Also
EEGEvent
delegate void SharpBCI.SharpBCI.SharpBCITrainedHandler ( TrainedEvent  evt)

A delegate which recieved events based on a unique id returned by SharpBCI.StartTrain()

See Also
SharpBCI.StartTrain()
TrainedEvent
void SharpBCI.SharpBCI.StartTraining ( int  id)

Start training SharpBCI on the EEG data from now on Should be paired w/ a StopTraining(id) call.

Parameters
id- a unique non-negative non-zero integer which identifies this trained event
void SharpBCI.SharpBCI.StopTraining ( int  id)

Stop training SharpBCI on the current trainingID.

Parameters
id- a unique non-negative non-zero integer which identifies this trained event

Member Data Documentation

readonly int SharpBCI.SharpBCI.channels

How many channels the EEGDeviceAdapter has.

const string SharpBCI.SharpBCI.RESERVED_PREFIX = "SharpBCI"

None of your scope keys should start with this prefix.

readonly double SharpBCI.SharpBCI.sampleRate

Nominal sample rate of EEGDeviceAdapter, used for FFT and to understand EEGEvents.

const string SharpBCI.SharpBCI.SCOPE_ADAPTER_KEY = RESERVED_PREFIX + "Adapter"

Keyword for the EEGDeviceAdapter configured.

const string SharpBCI.SharpBCI.SCOPE_CHANNELS_KEY = RESERVED_PREFIX + "Channels"

Keyword for the number of EEG channels as reported by SharpBCIAdapter.

const string SharpBCI.SharpBCI.SCOPE_SAMPLE_RATE_KEY = RESERVED_PREFIX + "SampleRate"

Keyword for the sample rate of EEGDataType.EEG as reported by SharpBCIAdapter.

const string SharpBCI.SharpBCI.SCOPE_SHARP_BCI_KEY = RESERVED_PREFIX + "Instance"

Keyword for the SharpBCI instance.

Property Documentation

double [] SharpBCI.SharpBCI.connectionStatus
get

Is the device connected to a human Based on the Muse EEG status updates:

Returns
4 = no connection, 2 = ok connection, 1 = good connection, 3 = unused, complain to Muse about that

The documentation for this class was generated from the following file: