Set of helpers to use the Emotiv Epoc SDK - C/C++
This project aims to provide a simple-yet-prowerfull system-wide library ( on Linux for now ) for use with the Emotiv Epoc headset. It includes code for accessing both the raw EEG data & the data after EDK processing.
The project currently holds the necessary code for both the processed data & the raw EEG one. It 's still in beta, and the code will be "cleaned up" in the next few weeks ( ... ).
Later improvements includes the ability to pass functions to the 'epocutils::handleEvents()' function, making it possible to handle both the eEvents & what to do with the raw EEG data in two separate external functions ( that can be defined in a "amin.cpp" file or elswhere practical for the programmer ).
Keep informed ;D
// main.cpp
#include "epocutils.hpp" // include the 'epocutils' helpers
// ( ... )
int main(int agrc, char *argv[])
{
// init code for the program ( SDL stuff, ... )
EmoEngineEventHandle eEvent = epocutils::createEventHandle();
EmoStateHandle eState = epocutils::createStateHandle();
unsigned int userID = 0;
int epoc_state = 0;
bool connected = false;
epocutils::EpocHeadset_t myEpocHeadset;
epocutils::initializeEpocHeadsetStruct(userID, myEpocHeadset);
// ( ... )
int epoc_conn_retval = epocutils::connect(connected);
if ( epoc_conn_retval != 0 )
{
std::cout << "Failed to connect to the Epoc headset." << std::endl;
}
else
{
std::cout << "Connected to the Epoc headset." << std::endl;
}
// ( ... )
while (1) // dummy infinite loop
{
epocutils::handleEvents(connected, epoc_state, eEvent, eState, userID, myEpocHeadset);
if ( cartman.newDataToRead )
{
// ( ... )
myEpocHeadset.newDataToRead = false;
}
}
epocutils::disconnect(connected, eState, eEvent);
return 0;
}
$ // example of compiling & linking against the Emotiv library
$ g++ -Wall -o epoc_test.out main.cpp epocutils.hpp epocutils.cpp edk.h edkErrorCode.h EmoStateDLL.h -ledk -ledk_utils_linux
The edk.h, edk_utils_.h, EmoStateDLL.h, & edkErrorCode.h header files The library corresponding to your platform ( .so on Linux | .dylib on Mac )
StephaneAG ( @StephaneAG )
Feel free to contact me for any help, suggestion, or related stuff.