Example #1
0
        static void engine_EmoEngineEmoStateUpdated(object sender, EmoStateUpdatedEventArgs e)
        {
            EmoState es = e.emoState;

            Single timeFromStart = es.GetTimeFromStart();

            Int32 headsetOn = es.GetHeadsetOn();
            Int32 numCqChan = es.GetNumContactQualityChannels();

            EdkDll.EE_EEG_ContactQuality_t[] cq = es.GetContactQualityFromAllChannels();
            for (Int32 i = 0; i < numCqChan; ++i)
            {
                if (cq[i] != es.GetContactQuality(i))
                {
                    throw new Exception();
                }
            }
            EdkDll.EE_SignalStrength_t signalStrength = es.GetWirelessSignalStatus();
            Int32 chargeLevel    = 0;
            Int32 maxChargeLevel = 0;

            es.GetBatteryChargeLevel(out chargeLevel, out maxChargeLevel);

            engineLog.Write(
                "{0},{1},{2},{3},{4},",
                timeFromStart,
                headsetOn, signalStrength, chargeLevel, maxChargeLevel);

            for (int i = 0; i < cq.Length; ++i)
            {
                engineLog.Write("{0},", cq[i]);
            }
            engineLog.WriteLine("");
            engineLog.Flush();
        }
Example #2
0
    static void engine_EmoEngineEmoStateUpdated(object sender, EmoStateUpdatedEventArgs e)
    {
        EmoState es        = e.emoState;
        Int32    numCqChan = es.GetNumContactQualityChannels();

        EdkDll.EE_EEG_ContactQuality_t[] cq = es.GetContactQualityFromAllChannels();
        nChan = numCqChan;
        int temp = 0;

        for (Int32 i = 0; i < numCqChan; ++i)
        {
            if (cq[i] != es.GetContactQuality(i))
            {
                throw new Exception();
            }

            switch (cq[i])
            {
            case EdkDll.EE_EEG_ContactQuality_t.EEG_CQ_NO_SIGNAL:
                Cq[i] = 0;
                break;

            case EdkDll.EE_EEG_ContactQuality_t.EEG_CQ_VERY_BAD:
                Cq[i] = 1;
                break;

            case EdkDll.EE_EEG_ContactQuality_t.EEG_CQ_POOR:
                Cq[i] = 2;
                break;

            case EdkDll.EE_EEG_ContactQuality_t.EEG_CQ_FAIR:
                Cq[i] = 3;
                break;

            case EdkDll.EE_EEG_ContactQuality_t.EEG_CQ_GOOD:
                temp++;
                Cq[i] = 4;
                break;
            }

            //---------------------
        }
        numOfGoodContacts = temp;
        //EdkDll.EE_SignalStrength_t signalStrength = es.GetWirelessSignalStatus();
        Int32 chargeLevel    = 0;
        Int32 maxChargeLevel = 0;

        es.GetBatteryChargeLevel(out chargeLevel, out maxChargeLevel);

        EdkDll.EE_SignalStrength_t signalStrength = es.GetWirelessSignalStatus();
        if (signalStrength == EdkDll.EE_SignalStrength_t.NO_SIGNAL)
        {
            for (Int32 i = 0; i < numCqChan; ++i)
            {
                Cq[i] = 0;
            }
        }
    }
Example #3
0
    private static void engine_EmoEngineEmoStateUpdated(object sender, EmoStateUpdatedEventArgs e)
    {
        EmoState emoState = e.emoState;
        int      numContactQualityChannels = emoState.GetNumContactQualityChannels();

        EdkDll.EE_EEG_ContactQuality_t[] contactQualityFromAllChannels = emoState.GetContactQualityFromAllChannels();
        EmoEngineInst.nChan = numContactQualityChannels;
        EdkDll.EE_SignalStrength_t wirelessSignalStatus = emoState.GetWirelessSignalStatus();
        int num = 0;

        if (wirelessSignalStatus != EdkDll.EE_SignalStrength_t.NO_SIGNAL)
        {
            for (int i = 0; i < numContactQualityChannels; i++)
            {
                if (contactQualityFromAllChannels[i] != emoState.GetContactQuality(i))
                {
                    throw new Exception();
                }
                switch (contactQualityFromAllChannels[i])
                {
                case EdkDll.EE_EEG_ContactQuality_t.EEG_CQ_NO_SIGNAL:
                    EmoEngineInst.Cq[i] = 0;
                    break;

                case EdkDll.EE_EEG_ContactQuality_t.EEG_CQ_VERY_BAD:
                    EmoEngineInst.Cq[i] = 1;
                    break;

                case EdkDll.EE_EEG_ContactQuality_t.EEG_CQ_POOR:
                    EmoEngineInst.Cq[i] = 2;
                    break;

                case EdkDll.EE_EEG_ContactQuality_t.EEG_CQ_FAIR:
                    EmoEngineInst.Cq[i] = 3;
                    break;

                case EdkDll.EE_EEG_ContactQuality_t.EEG_CQ_GOOD:
                    num++;
                    EmoEngineInst.Cq[i] = 4;
                    break;
                }
            }
        }
        else
        {
            for (int j = 0; j < numContactQualityChannels; j++)
            {
                EmoEngineInst.Cq[j] = 0;
            }
        }
        EmoEngineInst.numOfGoodContacts = num;
        int num2 = 0;
        int num3 = 0;

        EmoEngineInst.signalStrength = emoState.GetWirelessSignalStatus();
        emoState.GetBatteryChargeLevel(out num2, out num3);
    }
Example #4
0
        void engine_EmoStateUpdated(object sender, EmoStateUpdatedEventArgs e)
        {
            EmoState es = e.emoState;
            //Console.WriteLine("User has lower face expression : " + es.ExpressivGetLowerFaceAction().ToString()+ " of strength " + es.ExpressivGetLowerFaceActionPower().ToString() );
            Int32 numCqChan = es.GetNumContactQualityChannels();

            EdkDll.EE_EEG_ContactQuality_t[] cq = es.GetContactQualityFromAllChannels();

            for (Int32 i = 0; i < numCqChan; ++i)
            {
                if (cq[i] != es.GetContactQuality(i))
                {
                    throw new Exception();
                }
            }
            #region declare Contact Quality to store in datastructure
            ContactQuality contact = new ContactQuality()
            {
                CMS  = (double)cq[0],
                DRL  = (double)cq[1],
                AF4  = (double)cq[16],
                F8   = (double)cq[15],
                F4   = (double)cq[14],
                FC6  = (double)cq[13],
                T8   = (double)cq[12],
                P8   = (double)cq[11],
                O2   = (double)cq[10],
                O1   = (double)cq[9],
                P7   = (double)cq[8],
                T7   = (double)cq[7],
                FC5  = (double)cq[6],
                F3   = (double)cq[5],
                F7   = (double)cq[4],
                AF3  = (double)cq[3],
                date = DateTime.Now
            };
            #endregion
            scForm.updateContactQuality(contact);
            scForm.textChange();
            CQCollector.Add(contact);
        }
Example #5
0
        void engine_EmoStateUpdated(object sender, EmoStateUpdatedEventArgs e)
        {
            EmoState es = e.emoState;
            //   Console.WriteLine("User has lower face expression : " + es.ExpressivGetLowerFaceAction().ToString()+ " of strength " + es.ExpressivGetLowerFaceActionPower().ToString() );
            Int32 numCqChan = es.GetNumContactQualityChannels();

            EdkDll.EE_EEG_ContactQuality_t[] cq = es.GetContactQualityFromAllChannels();

            for (Int32 i = 0; i < numCqChan; ++i)
            {
                if (cq[i] != es.GetContactQuality(i))
                {
                    throw new Exception();
                }
            }
            for (int i = 0; i < cq.Length; ++i)
            {
                //     Console.WriteLine("{0},", cq[i]);
//              engineLog.Write("{0},", cq[i]);
            }
        }