|
Emotiv EPOC plugin 1.0
|
00001 //################################################################################### 00002 //# Definition Of Class Epoc # 00003 //# Used To Handle an Emotiv EPOC headset # 00004 //# Author : # 00005 //# Aymeric SUTEAU # 00006 //# LISA - ANGERS # 00007 //################################################################################### 00008 00009 00010 // Emotiv Development Kit includes 00011 #include "..\edk\edk.h" 00012 #include "..\edk\edkErrorCode.h" 00013 #include "..\edk\EmoStateDLL.h" 00014 00015 // Other includes 00016 #include <stdio.h> 00017 #include <conio.h> 00018 #include <list> 00019 00020 // Thread includes 00021 #include "..\lib\ou_thread.h" 00022 00023 // Profile handler 00024 #include "Profile.h" 00025 00026 // Used namespaces 00027 using namespace openutils; 00028 00029 // Class definition 00030 class MyThread; 00031 class Epoc : public Thread 00032 { 00033 public: 00034 Epoc(); 00035 ~Epoc(); 00036 bool Connect(); 00037 bool Disconnect(); 00038 void ReadData(); 00039 00040 // Handle new events related to Headset setup and Expressiv / Affective / Cognitive suite 00041 void HandleHeadsetSetupEvent(EmoStateHandle); 00042 void HandleExpressivSuiteEvent(EmoStateHandle); 00043 void HandleAffectiveSuiteEvent(EmoStateHandle); 00044 void HandleCognitivSuiteEvent(EmoStateHandle); 00045 00046 // Handle new events related to Expressiv and Cognitiv training actions 00047 void HandleExpressivTrainingEvent(EmoEngineEventHandle); 00048 void HandleCognitivTrainingEvent(EmoEngineEventHandle); 00049 bool StartExpressivSuiteTraining(EE_ExpressivAlgo_t); 00050 bool StartCognitivSuiteTraining(EE_CognitivAction_t); 00051 bool EraseExpressivSuiteTraining(EE_ExpressivAlgo_t); 00052 bool EraseCognitivSuiteTraining(EE_CognitivAction_t); 00053 00054 // Getters and setters 00055 unsigned int GetUserID(); 00056 float GetSystemUpTime(); // Related to "Headset Setup" 00057 int GetDongleStatus(); 00058 int GetHeadsetStatus(); 00059 float GetWirelessSignal(); 00060 float GetBatteryPower(); 00061 float GetEngagementBoredom(); // Related to "Affectiv Suite" 00062 float GetFrustration(); 00063 float GetMeditation(); 00064 float GetInstantaneousExcitement(); 00065 float GetLongTermExcitement(); 00066 unsigned int GetEyeExpressionType(); // Related to "Expressiv Suite" 00067 unsigned int GetUpperFaceExpressionType(); 00068 unsigned int GetLowerFaceExpressionType(); 00069 float GetUpperFaceExpressionPower(); 00070 float GetLowerFaceExpressionPower(); 00071 unsigned int GetActionType(); // Related to "Cognitiv Suite" 00072 float GetActionPower(); 00073 00074 void SetUserID(unsigned int); 00075 void SetSystemUpTime(float); // Related to "Headset Setup" 00076 void SetDongleStatus(int); 00077 void SetHeadsetStatus(int); 00078 void SetWirelessSignal(float); 00079 void SetBatteryPower(); 00080 void SetEngagementBoredom(float); // Related to "Affectiv Suite" 00081 void SetFrustration(float); 00082 void SetMeditation(float); 00083 void SetInstantaneousExcitement(float); 00084 void SetLongTermExcitement(float); 00085 void SetEyeExpressionType(unsigned int); // Related to "Expressiv Suite" 00086 void SetUpperFaceExpressionType(unsigned int); 00087 void SetLowerFaceExpressionType(unsigned int); 00088 void SetUpperFaceExpressionPower(float); 00089 void SetLowerFaceExpressionPower(float); 00090 void SetActionType(unsigned int); // Related to "Cognitiv Suite" 00091 void SetActionPower(float); 00092 00093 // Handle user profiles 00094 void SetUserProfileFileName(char*); 00095 char* GetUserProfileFileName(); 00096 bool GetProfileLoadingDone(); 00097 bool GetProfileSavingDone(); 00098 void SetProfileLoadingDone(bool); 00099 void SetProfileSavingDone(bool); 00100 bool ProfileToByteArray(EmoEngineEventHandle, unsigned char**, unsigned int*); // Get profile byte stream 00101 bool LoadProfile(char*); // Load profile from file 00102 void SaveProfile(char*); // Save profile to file 00103 00104 // Handle headset gyro position 00105 bool UpdateGyroPosition(); 00106 float GetGyroX(); 00107 float GetGyroY(); 00108 void SetGyroX(float); 00109 void SetGyroY(float); 00110 00111 // Attributes 00112 int* iContactQuality; // Contact quality for the 16 pads of the headset (0 = NO SIGNAL to 4 = GOOD) 00113 float fEEGData[14]; // Raw EEG data 00114 00115 // Thread Handling 00116 void run(); 00117 bool bIsRunning; 00118 00119 private: 00120 EmoEngineEventHandle eEvent; 00121 EmoEngineEventHandle eProfile; 00122 EmoStateHandle eState; 00123 unsigned int uUserID; 00124 bool bStatus; 00125 00126 // Attributes related to "Headset Setup" 00127 float fSystemUpTime; 00128 int iDongleStatus; 00129 int iHeadsetStatus; 00130 float fWirelessSignal; 00131 float fBatteryPower; 00132 00133 // Attributes related to "Affectiv Suite" 00134 float fEngagementBoredom; 00135 float fFrustration; 00136 float fMeditation; 00137 float fInstantaneousExcitement; 00138 float fLongTermExcitement; 00139 00140 // Attributes related to "Expressiv Suite" 00141 unsigned int uEyeExpressionType; 00142 unsigned int uUpperFaceExpressionType; 00143 unsigned int uLowerFaceExpressionType; 00144 float fUpperFaceExpressionPower; 00145 float fLowerFaceExpressionPower; 00146 00147 // Attributes related to "Cognitiv Suite" 00148 unsigned int uActionType; 00149 float fActionPower; 00150 00151 // Gyro position 00152 float fXGyro; 00153 float fYGyro; 00154 00155 // User profiles 00156 char* cUserProfileFileName; // User profile filename 00157 bool bLoadProfileDone; // Status of user profile loading 00158 bool bSaveProfileDone; // Status of user profile saving 00159 00160 // Raw EEG data acquisition 00161 bool readyToCollect; 00162 };
1.7.3