Beispiel #1
0
 public bool CognitivEqual(EmoState state)
 {
     return(EdkDll.ES_CognitivEqual(this.GetHandle(), state.GetHandle()));
 }
Beispiel #2
0
 /// <summary>
 /// Check whether two states are with identical Cognitiv state
 /// </summary>
 /// <param name="state">EmoState</param>
 /// <returns>true: Equal, false: Different</returns>
 public Boolean MentalCommandEqual(EmoState state)
 {
     return EdkDll.IS_MentalCommandEqual(GetHandle(), state.GetHandle());
 }
Beispiel #3
0
 public bool AffectivEqual(EmoState state)
 {
     return(EdkDll.ES_AffectivEqual(this.GetHandle(), state.GetHandle()));
 }
Beispiel #4
0
 /// <summary>
 /// Check whether two states are with identical Expressiv state, i.e. are both state representing the same facial expression
 /// </summary>
 /// <param name="state">EmoState</param>
 /// <returns>true: Equal, false: Different</returns>
 public Boolean FacialExpressionEqual(EmoState state)
 {
     return(EdkDll.IS_FacialExpressionEqual(GetHandle(), state.GetHandle()));
 }
Beispiel #5
0
 /// <summary>
 /// Check whether two states are with identical Cognitiv state
 /// </summary>
 /// <param name="state">EmoState</param>
 /// <returns>true: Equal, false: Different</returns>
 public Boolean CognitivEqual(EmoState state)
 {
     return EdkDll.ES_CognitivEqual(GetHandle(), state.GetHandle());
 }
Beispiel #6
0
 public bool ExpressivEqual(EmoState state)
 {
     return(EdkDll.ES_ExpressivEqual(this.GetHandle(), state.GetHandle()));
 }
Beispiel #7
0
 /// <summary>
 /// Check whether two EmoStateHandles are identical
 /// </summary>
 /// <param name="a">EmoState</param>
 /// <param name="b">EmoState</param>
 /// <returns></returns>
 public Boolean Equals(EmoState a, EmoState b)
 {
     return(EdkDll.IS_Equal(a.GetHandle(), b.GetHandle()));
 }
Beispiel #8
0
 /// <summary>
 /// Check whether two states are with identical Cognitiv state
 /// </summary>
 /// <param name="state">EmoState</param>
 /// <returns>true: Equal, false: Different</returns>
 public Boolean CognitivEqual(EmoState state)
 {
     return(EdkDll.ES_CognitivEqual(GetHandle(), state.GetHandle()));
 }
Beispiel #9
0
 /// <summary>
 /// Check whether two states are with identical 'emotiv' state
 /// </summary>
 /// <param name="state">EmoState</param>
 /// <returns>true: Equal, false: Different</returns>
 public Boolean PerformanceMetricEqual(EmoState state)
 {
     return(PerformanceMetric.IS_PerformanceMetricEqual(GetHandle(), state.GetHandle()));
 }
Beispiel #10
0
 /// <summary>
 /// Check whether two states are with identical 'emotiv' state
 /// </summary>
 /// <param name="state">EmoState</param>
 /// <returns>true: Equal, false: Different</returns>
 public Boolean AffectivEqual(EmoState state)
 {
     return(EdkDll.ES_AffectivEqual(GetHandle(), state.GetHandle()));
 }
Beispiel #11
0
 /// <summary>
 /// Check whether two states are with identical Expressiv state, i.e. are both state representing the same facial expression
 /// </summary>
 /// <param name="state">EmoState</param>
 /// <returns>true: Equal, false: Different</returns>
 public Boolean ExpressivEqual(EmoState state)
 {
     return(EdkDll.ES_ExpressivEqual(GetHandle(), state.GetHandle()));
 }
Beispiel #12
0
        /// <summary>
        /// Processes EmoEngine events until there is no more events or maximum processing time has elapsed
        /// </summary>
        /// <param name="maxTimeMilliseconds">maximum processing time in milliseconds</param>
        public void ProcessEvents(Int32 maxTimeMilliseconds)
        {
            Stopwatch st = new Stopwatch();

            st.Start();
            while (EdkDll.EE_EngineGetNextEvent(hEvent) == EdkDll.EDK_OK)
            {
                if (maxTimeMilliseconds != 0)
                {
                    if (st.ElapsedMilliseconds >= maxTimeMilliseconds)
                        break;
                }
                UInt32 userId = 0;
                EdkDll.EE_EmoEngineEventGetUserId(hEvent, out userId);
                EmoEngineEventArgs args = new EmoEngineEventArgs(userId);
                EdkDll.EE_Event_t eventType = EdkDll.EE_EmoEngineEventGetType(hEvent);
                switch (eventType)
                {
                    case EdkDll.EE_Event_t.EE_UserAdded:
                        OnUserAdded(args);
                        break;
                    case EdkDll.EE_Event_t.EE_UserRemoved:
                        OnUserRemoved(args);
                        break;
                    case EdkDll.EE_Event_t.EE_EmoStateUpdated:
                        EmoState curEmoState = new EmoState();
                        errorHandler(EdkDll.EE_EmoEngineEventGetEmoState(hEvent, curEmoState.GetHandle()));
                        EmoStateUpdatedEventArgs emoStateUpdatedEventArgs = new EmoStateUpdatedEventArgs(userId, curEmoState);
                        OnEmoStateUpdated(emoStateUpdatedEventArgs);
                        if (!curEmoState.EmoEngineEqual(lastEmoState[userId]))
                        {
                            emoStateUpdatedEventArgs = new EmoStateUpdatedEventArgs(userId, new EmoState(curEmoState));
                            OnEmoEngineEmoStateUpdated(emoStateUpdatedEventArgs);
                        }
                        if (!curEmoState.AffectivEqual(lastEmoState[userId]))
                        {
                            emoStateUpdatedEventArgs = new EmoStateUpdatedEventArgs(userId, new EmoState(curEmoState));
                            OnAffectivEmoStateUpdated(emoStateUpdatedEventArgs);
                        }
                        if (!curEmoState.CognitivEqual(lastEmoState[userId]))
                        {
                            emoStateUpdatedEventArgs = new EmoStateUpdatedEventArgs(userId, new EmoState(curEmoState));
                            OnCognitivEmoStateUpdated(emoStateUpdatedEventArgs);
                        }
                        if (!curEmoState.ExpressivEqual(lastEmoState[userId]))
                        {
                            emoStateUpdatedEventArgs = new EmoStateUpdatedEventArgs(userId, new EmoState(curEmoState));
                            OnExpressivEmoStateUpdated(emoStateUpdatedEventArgs);
                        }
                        lastEmoState[userId] = (EmoState)curEmoState.Clone();
                        break;
                    case EdkDll.EE_Event_t.EE_CognitivEvent:
                        EdkDll.EE_CognitivEvent_t cogType = EdkDll.EE_CognitivEventGetType(hEvent);
                        switch(cogType){
                            case EdkDll.EE_CognitivEvent_t.EE_CognitivTrainingStarted:
                                OnCognitivTrainingStarted(args);
                                break;
                            case EdkDll.EE_CognitivEvent_t.EE_CognitivTrainingSucceeded:
                                OnCognitivTrainingSucceeded(args);
                                break;
                            case EdkDll.EE_CognitivEvent_t.EE_CognitivTrainingFailed:
                                OnCognitivTrainingFailed(args);
                                break;
                            case EdkDll.EE_CognitivEvent_t.EE_CognitivTrainingCompleted:
                                OnCognitivTrainingCompleted(args);
                                break;
                            case EdkDll.EE_CognitivEvent_t.EE_CognitivTrainingDataErased:
                                OnCognitivTrainingDataErased(args);
                                break;
                            case EdkDll.EE_CognitivEvent_t.EE_CognitivTrainingRejected:
                                OnCognitivTrainingRejected(args);
                                break;
                            case EdkDll.EE_CognitivEvent_t.EE_CognitivTrainingReset:
                                OnCognitivTrainingReset(args);
                                break;
                            case EdkDll.EE_CognitivEvent_t.EE_CognitivAutoSamplingNeutralCompleted:
                                OnCognitivAutoSamplingNeutralCompleted(args);
                                break;
                            case EdkDll.EE_CognitivEvent_t.EE_CognitivSignatureUpdated:
                                OnCognitivSignatureUpdated(args);
                                break;
                            default:
                                break;
                        }
                        break;
                    case EdkDll.EE_Event_t.EE_ExpressivEvent:
                        EdkDll.EE_ExpressivEvent_t expEvent = EdkDll.EE_ExpressivEventGetType(hEvent);
                        switch (expEvent)
                        {
                            case EdkDll.EE_ExpressivEvent_t.EE_ExpressivTrainingStarted:
                                OnExpressivTrainingStarted(args);
                                break;
                            case EdkDll.EE_ExpressivEvent_t.EE_ExpressivTrainingSucceeded:
                                OnExpressivTrainingSucceeded(args);
                                break;
                            case EdkDll.EE_ExpressivEvent_t.EE_ExpressivTrainingFailed:
                                OnExpressivTrainingFailed(args);
                                break;
                            case EdkDll.EE_ExpressivEvent_t.EE_ExpressivTrainingCompleted:
                                OnExpressivTrainingCompleted(args);
                                break;
                            case EdkDll.EE_ExpressivEvent_t.EE_ExpressivTrainingDataErased:
                                OnExpressivTrainingDataErased(args);
                                break;
                            case EdkDll.EE_ExpressivEvent_t.EE_ExpressivTrainingRejected:
                                OnExpressivTrainingRejected(args);
                                break;
                            case EdkDll.EE_ExpressivEvent_t.EE_ExpressivTrainingReset:
                                OnExpressivTrainingReset(args);
                                break;
                            default:
                                break;
                        }
                        break;
                    case EdkDll.EE_Event_t.EE_InternalStateChanged:
                        OnInternalStateChanged(args);
                        break;
                    default:
                        break;
                }
            }
        }
Beispiel #13
0
 /// <summary>
 /// Check whether two states are with identical 'emotiv' state
 /// </summary>
 /// <param name="state">EmoState</param>
 /// <returns>true: Equal, false: Different</returns>
 public Boolean AffectivEqual(EmoState state)
 {
     return EdkDll.ES_AffectivEqual(GetHandle(), state.GetHandle());
 }
Beispiel #14
0
 /// <summary>
 /// Check whether two states are with identical Expressiv state, i.e. are both state representing the same facial expression
 /// </summary>
 /// <param name="state">EmoState</param>
 /// <returns>true: Equal, false: Different</returns>
 public Boolean ExpressivEqual(EmoState state)
 {
     return EdkDll.ES_ExpressivEqual(GetHandle(), state.GetHandle());
 }
Beispiel #15
0
 public bool EmoEngineEqual(EmoState state)
 {
     return(EdkDll.ES_EmoEngineEqual(this.GetHandle(), state.GetHandle()));
 }
Beispiel #16
0
                /// <summary>
        /// Check whether two states are with identical EmoEngine state.
        /// </summary>
        /// <remarks>
        /// This function is comparing the time since EmoEngine start,
		/// the wireless signal strength and the signal quality of different channels
        /// </remarks>
        /// <param name="state">EmoState</param>
        /// <returns>true: Equal, false: Different</returns>
        public Boolean EmoEngineEqual(EmoState state)
        {
            return EdkDll.IS_EmoEngineEqual(GetHandle(), state.GetHandle());
        }
Beispiel #17
0
 public bool Equals(EmoState a, EmoState b)
 {
     return(EdkDll.ES_Equal(a.GetHandle(), b.GetHandle()));
 }
Beispiel #18
0
 /// <summary>
 /// Check whether two EmoStateHandles are identical
 /// </summary>
 /// <param name="a">EmoState</param>
 /// <param name="b">EmoState</param>
 /// <returns></returns>
 public Boolean Equals (EmoState a, EmoState b)
 {
     return EdkDll.IS_Equal(a.GetHandle(), b.GetHandle());
 }
Beispiel #19
0
 /// <summary>
 /// Check whether two states are with identical EmoEngine state.
 /// </summary>
 /// <remarks>
 /// This function is comparing the time since EmoEngine start,
 /// the wireless signal strength and the signal quality of different channels
 /// </remarks>
 /// <param name="state">EmoState</param>
 /// <returns>true: Equal, false: Different</returns>
 public Boolean EmoEngineEqual(EmoState state)
 {
     return(EdkDll.IS_EmoEngineEqual(GetHandle(), state.GetHandle()));
 }
Beispiel #20
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="es">EmoState to be copied</param>
 public EmoState(EmoState es)
 {
     this.hEmoState = EdkDll.IS_Create();
     EdkDll.IS_Copy(this.hEmoState, es.GetHandle());
 }
Beispiel #21
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="es">EmoState to be copied</param>
 public EmoState(EmoState es)
 {
     this.hEmoState = EdkDll.IS_Create();
     EdkDll.IS_Copy(this.hEmoState, es.GetHandle());
 }
Beispiel #22
0
 /// <summary>
 /// Check whether two states are with identical Expressiv state, i.e. are both state representing the same facial expression
 /// </summary>
 /// <param name="state">EmoState</param>
 /// <returns>true: Equal, false: Different</returns>
 public Boolean FacialExpressionEqual(EmoState state)
 {
     return EdkDll.IS_FacialExpressionEqual(GetHandle(), state.GetHandle());
 }
Beispiel #23
0
 /// <summary>
 /// Check whether two states are with identical Cognitiv state
 /// </summary>
 /// <param name="state">EmoState</param>
 /// <returns>true: Equal, false: Different</returns>
 public Boolean MentalCommandEqual(EmoState state)
 {
     return(EdkDll.IS_MentalCommandEqual(GetHandle(), state.GetHandle()));
 }
Beispiel #24
0
        public void ProcessEvents(int maxTimeMilliseconds)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            while (EdkDll.EE_EngineGetNextEvent(this.hEvent) == 0)
            {
                if ((maxTimeMilliseconds != 0) && (stopwatch.ElapsedMilliseconds >= maxTimeMilliseconds))
                {
                    return;
                }
                uint pUserIdOut = 0;
                EdkDll.EE_EmoEngineEventGetUserId(this.hEvent, out pUserIdOut);
                EmoEngineEventArgs e = new EmoEngineEventArgs(pUserIdOut);
                switch (EdkDll.EE_EmoEngineEventGetType(this.hEvent))
                {
                case EdkDll.EE_Event_t.EE_CognitivEvent:
                {
                    switch (EdkDll.EE_CognitivEventGetType(this.hEvent))
                    {
                    case EdkDll.EE_CognitivEvent_t.EE_CognitivTrainingStarted:
                    {
                        this.OnCognitivTrainingStarted(e);
                        continue;
                    }

                    case EdkDll.EE_CognitivEvent_t.EE_CognitivTrainingSucceeded:
                    {
                        this.OnCognitivTrainingSucceeded(e);
                        continue;
                    }

                    case EdkDll.EE_CognitivEvent_t.EE_CognitivTrainingFailed:
                    {
                        this.OnCognitivTrainingFailed(e);
                        continue;
                    }

                    case EdkDll.EE_CognitivEvent_t.EE_CognitivTrainingCompleted:
                    {
                        this.OnCognitivTrainingCompleted(e);
                        continue;
                    }

                    case EdkDll.EE_CognitivEvent_t.EE_CognitivTrainingDataErased:
                    {
                        this.OnCognitivTrainingDataErased(e);
                        continue;
                    }

                    case EdkDll.EE_CognitivEvent_t.EE_CognitivTrainingRejected:
                    {
                        this.OnCognitivTrainingRejected(e);
                        continue;
                    }

                    case EdkDll.EE_CognitivEvent_t.EE_CognitivTrainingReset:
                    {
                        this.OnCognitivTrainingReset(e);
                        continue;
                    }

                    case EdkDll.EE_CognitivEvent_t.EE_CognitivAutoSamplingNeutralCompleted:
                    {
                        this.OnCognitivAutoSamplingNeutralCompleted(e);
                        continue;
                    }

                    case EdkDll.EE_CognitivEvent_t.EE_CognitivSignatureUpdated:
                    {
                        this.OnCognitivSignatureUpdated(e);
                        continue;
                    }
                    }
                    continue;
                }

                case EdkDll.EE_Event_t.EE_ExpressivEvent:
                {
                    switch (EdkDll.EE_ExpressivEventGetType(this.hEvent))
                    {
                    case EdkDll.EE_ExpressivEvent_t.EE_ExpressivTrainingStarted:
                    {
                        this.OnExpressivTrainingStarted(e);
                        continue;
                    }

                    case EdkDll.EE_ExpressivEvent_t.EE_ExpressivTrainingSucceeded:
                    {
                        this.OnExpressivTrainingSucceeded(e);
                        continue;
                    }

                    case EdkDll.EE_ExpressivEvent_t.EE_ExpressivTrainingFailed:
                    {
                        this.OnExpressivTrainingFailed(e);
                        continue;
                    }

                    case EdkDll.EE_ExpressivEvent_t.EE_ExpressivTrainingCompleted:
                    {
                        this.OnExpressivTrainingCompleted(e);
                        continue;
                    }

                    case EdkDll.EE_ExpressivEvent_t.EE_ExpressivTrainingDataErased:
                    {
                        this.OnExpressivTrainingDataErased(e);
                        continue;
                    }

                    case EdkDll.EE_ExpressivEvent_t.EE_ExpressivTrainingRejected:
                    {
                        this.OnExpressivTrainingRejected(e);
                        continue;
                    }

                    case EdkDll.EE_ExpressivEvent_t.EE_ExpressivTrainingReset:
                    {
                        this.OnExpressivTrainingReset(e);
                        continue;
                    }
                    }
                    continue;
                }

                case EdkDll.EE_Event_t.EE_InternalStateChanged:
                    break;

                case EdkDll.EE_Event_t.EE_UserAdded:
                {
                    this.OnUserAdded(e);
                    continue;
                }

                case EdkDll.EE_Event_t.EE_UserRemoved:
                {
                    this.OnUserRemoved(e);
                    continue;
                }

                case EdkDll.EE_Event_t.EE_EmoStateUpdated:
                {
                    EmoState emoState = new EmoState();
                    errorHandler(EdkDll.EE_EmoEngineEventGetEmoState(this.hEvent, emoState.GetHandle()));
                    EmoStateUpdatedEventArgs args2 = new EmoStateUpdatedEventArgs(pUserIdOut, emoState);
                    this.OnEmoStateUpdated(args2);
                    if (!emoState.EmoEngineEqual(this.lastEmoState[pUserIdOut]))
                    {
                        args2 = new EmoStateUpdatedEventArgs(pUserIdOut, new EmoState(emoState));
                        this.OnEmoEngineEmoStateUpdated(args2);
                    }
                    if (!emoState.AffectivEqual(this.lastEmoState[pUserIdOut]))
                    {
                        args2 = new EmoStateUpdatedEventArgs(pUserIdOut, new EmoState(emoState));
                        this.OnAffectivEmoStateUpdated(args2);
                    }
                    if (!emoState.CognitivEqual(this.lastEmoState[pUserIdOut]))
                    {
                        args2 = new EmoStateUpdatedEventArgs(pUserIdOut, new EmoState(emoState));
                        this.OnCognitivEmoStateUpdated(args2);
                    }
                    if (!emoState.ExpressivEqual(this.lastEmoState[pUserIdOut]))
                    {
                        args2 = new EmoStateUpdatedEventArgs(pUserIdOut, new EmoState(emoState));
                        this.OnExpressivEmoStateUpdated(args2);
                    }
                    this.lastEmoState[pUserIdOut] = (EmoState)emoState.Clone();
                    continue;
                }

                default:
                {
                    continue;
                }
                }
                this.OnInternalStateChanged(e);
            }
        }