예제 #1
0
 private void StreamDataReceived(object sender, StreamDataEventArgs e)
 {
     if (e.StreamName == "sys")
     {
         List <string> data      = e.Data.ToObject <List <string> >();
         JArray        dataEvent = e.Data;
         string        detection = dataEvent[0].ToString();
         string        eventType = dataEvent[1].ToString();
         if (detection == "mentalCommand")
         {
             if (eventType == "MC_Started")
             {
                 Console.WriteLine("Start training...");
             }
             else if (eventType == "MC_Succeeded")
             {
                 OnTrainingSucceeded(this, true);
             }
             else if (eventType == "MC_Completed" ||
                      eventType == "MC_Rejected" ||
                      eventType == "MC_DataErased" ||
                      eventType == "MC_Reset")
             {
                 _ctxClient.SetupProfile(_cortexToken, _profileName, "save", _headsetId);
             }
         }
         else if (detection == "facialExpression")
         {
             if (eventType == "FE_Started")
             {
                 Console.WriteLine("Start training...");
             }
             else if (eventType == "FE_Succeeded")
             {
                 OnTrainingSucceeded(this, true);
             }
             else if (eventType == "FE_Completed" ||
                      eventType == "FE_Rejected" ||
                      eventType == "FE_DataErased" ||
                      eventType == "FE_Reset")
             {
                 _ctxClient.SetupProfile(_cortexToken, _profileName, "save", _headsetId);
             }
         }
     }
 }
예제 #2
0
        private void StreamDataReceived(object sender, StreamDataEventArgs e)
        {
            // Console.WriteLine(e.StreamName + " data received.");
            ArrayList data = e.Data.ToObject <ArrayList>();

            // insert timestamp to datastream
            data.Insert(0, e.Time);
            if (e.StreamName == "eeg")
            {
                OnEEGDataReceived(this, data);
            }
            else if (e.StreamName == "mot")
            {
                OnMotionDataReceived(this, data);
            }
            else if (e.StreamName == "met")
            {
                OnPerfDataReceived(this, data);
            }
            else if (e.StreamName == "pow")
            {
                OnBandPowerDataReceived(this, data);
            }
        }