Exemplo n.º 1
0
        void affectiveStateUpdate(object sender, EmoStateUpdatedEventArgs e)
        {
            EmoState es = e.emoState;

            // float lastUpdate = time;
            //float esTimeStamp = es.GetTimeFromStart();
            //string systemTimeStamp = DateTime.Now.ToString("hh.mm.ss.ffffff");

            // "Timestamp,EmoState_Timestamp,BoredomScore,ExcitementShortScore,FrustrationScore," +
            // " MediationScore,ValenceScore,ExcitementLongShort,"


            if (e.userId == userID)
            {
                AffectiveOSC.AffectiveState affectiveState = new AffectiveOSC.AffectiveState();
                affectiveState.emotivTimeStamp    = es.GetTimeFromStart();
                affectiveState.boredom            = es.AffectivGetEngagementBoredomScore();
                affectiveState.excitement         = es.AffectivGetExcitementShortTermScore();
                affectiveState.frustration        = es.AffectivGetFrustrationScore();
                affectiveState.mediation          = es.AffectivGetMeditationScore();
                affectiveState.valence            = es.AffectivGetValenceScore();
                affectiveState.excitementLongTerm = es.AffectivGetExcitementLongTermScore();
                affectiveOSC.sendAffectiveStateData(affectiveState, false);

                Console.WriteLine("Received Affective State Update");
            }
        }
Exemplo n.º 2
0
        static void affectiveStateUpdate(object sender, EmoStateUpdatedEventArgs e)
        {
            EmoState es              = e.emoState;
            float    lastUpdate      = time;
            float    esTimeStamp     = es.GetTimeFromStart();
            string   systemTimeStamp = DateTime.Now.ToString("hh.mm.ss.ffffff");
            // Write the data to a file
            TextWriter file = new StreamWriter(filename, true);

            // "Timestamp,EmoState_Timestamp,BoredomScore,ExcitementShortScore,FrustrationScore," +
            // " MediationScore,ValenceScore,ExcitementLongShort,"


            if (e.userId == userID)
            {
                file.Write(systemTimeStamp + ";");
                file.Write(Convert.ToString(esTimeStamp) + ";");
                file.Write(es.AffectivGetEngagementBoredomScore() + ";");
                file.Write(es.AffectivGetExcitementShortTermScore() + ";");
                file.Write(es.AffectivGetFrustrationScore() + ";");
                file.Write(es.AffectivGetMeditationScore() + ";");
                file.Write(es.AffectivGetValenceScore() + ";");
                file.Write(es.AffectivGetExcitementLongTermScore() + ";");
                file.WriteLine("");



                Console.WriteLine("Receiveing affective update .....");
            }
            file.Close();
        }