示例#1
0
        public uint GetVitalAlgorithm(EdkDll.EE_EmotivSuite_t suite)
        {
            uint pVitalAlgorithmBitVectorOut = 0;

            EmoEngine.errorHandler(EdkDll.EE_OptimizationGetVitalAlgorithm(this.hOptimizationParam, suite, out pVitalAlgorithmBitVectorOut));
            return(pVitalAlgorithmBitVectorOut);
        }
        public EEG_Logger()
        {
            // 创建engine 
            engine = EmoEngine.Instance;
            engine.UserAdded += 
                new EmoEngine.UserAddedEventHandler(engine_UserAdded_Event);
            engine.EmoStateUpdated += 
                new EmoEngine.EmoStateUpdatedEventHandler(engine_EmoStateUpdated);
            engine.EmoEngineEmoStateUpdated += 
                new EmoEngine.EmoEngineEmoStateUpdatedEventHandler(engine_EmoEngineEmoStateUpdated);
            engine.CognitivEmoStateUpdated +=
                new EmoEngine.CognitivEmoStateUpdatedEventHandler(engine_CognitivEmoStateUpdated);
            engine.CognitivTrainingStarted +=
               new EmoEngine.CognitivTrainingStartedEventEventHandler(engine_CognitivTrainingStarted);
            engine.CognitivTrainingSucceeded +=
                new EmoEngine.CognitivTrainingSucceededEventHandler(engine_CognitivTrainingSucceeded);
            engine.CognitivTrainingCompleted +=
                new EmoEngine.CognitivTrainingCompletedEventHandler(engine_CognitivTrainingCompleted);
            engine.CognitivTrainingRejected +=
                new EmoEngine.CognitivTrainingRejectedEventHandler(engine_CognitivTrainingRejected);
            // engine.EmoEngineConnected += new EmoEngine.EmoEngineConnectedEventHandler(engine_Connected_Event);
            //engine.EmoEngineDisconnected += new EmoEngine.EmoEngineDisconnectedEventHandler(engine_DisConnected_Event);
            // 连接耳机            
            engine.Connect();

            // 创建输出文件的列头名称
            WriteHeader();
        }
示例#3
0
        static void Main(string[] args)
        {
            Console.WriteLine("===========================================================================");
            Console.WriteLine("Example to show how to log Motion Data from EmoDriver/EmoComposer.");
            Console.WriteLine("===========================================================================");

            MotionDataLogger p = new MotionDataLogger();

            // create the engine
            engine = EmoEngine.Instance;
            engine.UserAdded += new EmoEngine.UserAddedEventHandler(engine_UserAdded_Event);

            // connect to Emoengine.            
            engine.Connect();

            string header = "COUNTER, GYROX, GYROY, GYROZ, ACCX, " +
                "ACCY, ACCZ, MAGX, MAGY, MAGZ, TIMESTAMP";

            file.WriteLine(header);

            while (true)
            {
                if (Console.KeyAvailable)
                    break;

                // Handle any waiting events
                engine.ProcessEvents();

                p.Run();
                Thread.Sleep(10);
            }

            file.Close();
            engine.Disconnect();
        }
示例#4
0
        public MindReader(IEventStore store, StreamName streamName,  EmoEngine engine)
        {
            this.engine = engine;
            this.store = store;
            this.streamName = streamName;

            RegisterHandlers();
        }
示例#5
0
        public byte[] GetBytes()
        {
            uint pProfileSizeOut = 0;

            EmoEngine.errorHandler(EdkDll.EE_GetUserProfileSize(this.hProfile, out pProfileSizeOut));
            byte[] destBuffer = new byte[pProfileSizeOut];
            EmoEngine.errorHandler(EdkDll.EE_GetUserProfileBytes(this.hProfile, destBuffer, pProfileSizeOut));
            return(destBuffer);
        }
示例#6
0
        void mainLoop()
        {
            engine = EmoEngine.Instance;
            engine.EmoStateUpdated += new EmoEngine.EmoStateUpdatedEventHandler(engine_EmoStateUpdated);
            engine.Connect();

            while (true)
            {
                engine.ProcessEvents(1000);
            }
        }
示例#7
0
        int userID = -1; // userID is used to uniquely identify a user's headset

        #endregion Fields

        #region Constructors

        MotionDataLogger()
        {
            // create the engine
            engine = EmoEngine.Instance;
            engine.UserAdded += new EmoEngine.UserAddedEventHandler(engine_UserAdded_Event);

            // connect to Emoengine.
            engine.Connect();

            // create a header for our output file
            WriteHeader();
        }
示例#8
0
        public EmotivDevice()
        {
            // create the engine
            _engine = EmoEngine.Instance;
            _engine.UserAdded += new EmoEngine.UserAddedEventHandler(engine_UserAdded_Event);

            _engine.EmoEngineConnected += (s, e) =>
            {
                Debug.WriteLine("emotiv connected");
            };

            _engine.EmoEngineDisconnected += (s, e) =>
            {
                Debug.WriteLine("emotiv disconnected");
            };

            // emotiv state has changed
            _engine.EmoStateUpdated += (s, e) =>
            {
                               

                var smileExtent = e.emoState.ExpressivGetLowerFaceActionPower();
                var frownExtent = e.emoState.ExpressivGetUpperFaceActionPower();
                if (smileExtent > frownExtent)
                {
                    if (smileExtent >= TARGET_SMILE_VALUE)
                    {
                        Magnitude = smileExtent;
                        Emotion = EmotivEmotion.HAPPY;
                    }
                    else if (frownExtent >= TARGET_FROWN_VALUE)
                    {
                        Magnitude = frownExtent;
                        Emotion = EmotivEmotion.ANGRY;

                    }
                    else
                    {
                        Magnitude = 0;
                        Emotion = EmotivEmotion.NEUTRAL;
                    }
                }
                else if (smileExtent <= frownExtent)
                {
                    if (frownExtent >= TARGET_FROWN_VALUE)
                    {
                        Magnitude = frownExtent;
                        Emotion = EmotivEmotion.ANGRY;

                    }
                    else if (smileExtent >= TARGET_SMILE_VALUE)
                    {
                        Magnitude = smileExtent;
                        Emotion = EmotivEmotion.HAPPY;
                    }
                    
                    else
                    {
                        Magnitude = 0;
                        Emotion = EmotivEmotion.NEUTRAL;
                    }
                }
                //var smileExtent = e.emoState.ExpressivGetLowerFaceActionPower();
                //var frownExtent = e.emoState.ExpressivGetUpperFaceActionPower();
                //if (smileExtent >= TARGET_SMILE_VALUE)
                //{
                //        Magnitude = smileExtent;
                //        Emotion = EmotivEmotion.HAPPY;
                //}
                //else if (frownExtent >= TARGET_FROWN_VALUE)
                //{
                //        Magnitude = frownExtent;
                //        Emotion = EmotivEmotion.ANGRY;

                //}
                //else
                //{
                //        Magnitude = 0;
                //        Emotion = EmotivEmotion.NEUTRAL;
                //}
            };


        }
        /// <summary>
        /// 
        /// </summary>
        void emo()
        {
            engine = EmoEngine.Instance;
            EmoLabel.Content = "EmoStatus: EmoEngine Instance Created"; System.Diagnostics.Debug.WriteLine("EmoStatus: EmoEngine Instance Created");

            // connection and state
            engine.EmoEngineConnected +=new EmoEngine.EmoEngineConnectedEventHandler(engine_EmoEngineConnected);
            engine.InternalStateChanged +=new EmoEngine.InternalStateChangedEventHandler(engine_InternalStateChanged);
            engine.EmoEngineEmoStateUpdated +=new EmoEngine.EmoEngineEmoStateUpdatedEventHandler(engine_EmoEngineEmoStateUpdated);
            engine.UserAdded +=new EmoEngine.UserAddedEventHandler(engine_UserAdded);

            bConnectionType = true;
            #region connect Engine
            if (bConnectionType)
            {
                //When your trying to connect directly
                System.Diagnostics.Debug.WriteLine("Connect");
                EmoLabel.Content = "EmoStatus: Connect";
                engine.Connect();
            }
            else
            {
                // if you are using SDKlite or wish to connect your application to EmoComposer or Emotiv Control Panel.
                System.Diagnostics.Debug.WriteLine("remote connect");
                EmoLabel.Content = "EmoStatus: remote connect";
                engine.RemoteConnect("127.0.0.1",1726);
            }
            #endregion

            processEventsThread = new Thread(new ThreadStart(staticProcessEvents));
            processEventsThread.Name = "processEventsThread";
            processEventsThread.Start();
        }
		//Contructor
		public DeviceEmotivEpocNode() {
            try
            {
                mEngine = EmoEngine.Instance;

                //Register event handler
                mEngine.EmoEngineConnected += new EmoEngine.EmoEngineConnectedEventHandler(EmoEngineConnectedCB);
                mEngine.EmoEngineDisconnected += new EmoEngine.EmoEngineDisconnectedEventHandler(EmoEngineDisconnectedCB);
                mEngine.EmoEngineEmoStateUpdated += new EmoEngine.EmoEngineEmoStateUpdatedEventHandler(EmoEngineEmoStateUpdatedCB);
            }
            catch(EmoEngineException e)
            {
                FLogger.Log(LogType.Debug, e.ToString());
            }
		}
示例#11
0
 public void SetVitalAlgorithm(EdkDll.EE_EmotivSuite_t suite, uint vitalAlgorithmBitVector)
 {
     EmoEngine.errorHandler(EdkDll.EE_OptimizationSetVitalAlgorithm(this.hOptimizationParam, suite, vitalAlgorithmBitVector));
 }
示例#12
0
 public EEGCollector(FusionData fusionData)
 {
     eegEngine = EmoEngine.Instance;
     fd = fusionData;
 }