Quantcast
Channel: Emotiv
Viewing all articles
Browse latest Browse all 898

Get EEG Data Continuously

$
0
0

Hi,

I have a little problem that I don’t understand.

I want get the EEG Data in continuously.

But with my code I get the data only one time and after nothing append. Why ? Can you help me ?
I give you my code. (I use the Research SDK)

        
        public void ReceiveMessage()
        {
            Connection();

            // On ajoute la méthode à declencher pour l'evenement EmoStateUpdated
            Engine.EmoStateUpdated += BuildOriginalMessage;

            // Permet de fermer le programme lorsque le thread du Reader est terminé
            while (true)
            {
                if (Engine != null)
                {
                    try
                    {
                        // Regarde si l'état du casque se met à jour pendant 250ms
                        Engine.ProcessEvents(250);

                        // Pause de 250 ms (limitation de l'utilisation du processeur)
                        Thread.Sleep(250);
                    }
                    catch (EmoEngineException e)
                    {
                        if (e.ErrorCode == 1024)
                            Logger.WriteLog("Can work only with the real Device", LogLevelL4N.WARN);
                        else
                            Logger.WriteLog("Exception : " + e.Message, LogLevelL4N.WARN);
                    }
                }
                else
                {
                    break;
                }
            }

            if (Engine != null)
                Engine.Disconnect();
        }

        private void BuildOriginalMessage(object sender, EmoStateUpdatedEventArgs e)
        {
            Logger.WriteLog("1");    // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< I Arrive here only one time, why ? The event EmoStateUpdated happends only one time ? 
        }

Thanks for your help


Viewing all articles
Browse latest Browse all 898

Trending Articles