Ejemplo n.º 1
0
        static void SavingLoadingFunction(int mode)
        {
            int getNumberProfile = EmotivCloudClient.EC_GetAllProfileName(userCloudID);

            if (mode == 0)
            {
                int profileID = EmotivCloudClient.EC_GetProfileId(userCloudID, profileName);

                if (profileID >= 0)
                {
                    Console.WriteLine("Profile with " + profileName + " is existed");
                    Console.WriteLine("Updating....");
                    if (EmotivCloudClient.EC_UpdateUserProfile(userCloudID, 0, profileID) == EmotivCloudClient.EC_OK)
                    {
                        Console.WriteLine("Updating finished");
                    }
                    else
                    {
                        Console.WriteLine("Updating failed");
                    }
                }
                else
                {
                    Console.WriteLine("Saving...");

                    if (EmotivCloudClient.EC_SaveUserProfile(userCloudID, (int)0, profileName,
                                                             EmotivCloudClient.profileFileType.TRAINING) == EmotivCloudClient.EC_OK)
                    {
                        Console.WriteLine("Saving finished");
                    }
                    else
                    {
                        Console.WriteLine("Saving failed");
                    }
                }

                return;
            }
            if (mode == 1)
            {
                if (getNumberProfile > 0)
                {
                    Console.WriteLine("Loading...");

                    if (EmotivCloudClient.EC_LoadUserProfile(userCloudID, 0,
                                                             EmotivCloudClient.EC_GetProfileId(userCloudID, profileName), version) == EmotivCloudClient.EC_OK)
                    {
                        Console.WriteLine("Loading finished");
                    }
                    else
                    {
                        Console.WriteLine("Loading failed");
                    }
                }

                return;
            }
        }
Ejemplo n.º 2
0
 public void LoadProfile()
 {
     if (CloudConnected())
     {
         if (EmotivCloudClient.EC_LoadUserProfile(userCloudID, (int)engineUserID, EmotivCloudClient.EC_GetProfileId(userCloudID, profileName.text), (int)version))
         {
             message_box.text = "Load finished";
         }
         else
         {
             message_box.text = "Problem loading";
         }
     }
 }
Ejemplo n.º 3
0
        static void SavingLoadingFunction(int mode)
        {
            int getNumberProfile = EmotivCloudClient.EC_GetAllProfileName(userCloudID);

            if (mode == 0)
            {
                int profileID = EmotivCloudClient.EC_GetProfileId(userCloudID, profileName);

                if (profileID >= 0)
                {
                    Console.WriteLine("Profile with " + profileName + " is existed");
                    if (EmotivCloudClient.EC_UpdateUserProfile(userCloudID, engineUserID, profileID, profileName))
                    {
                        Console.WriteLine("Updating finished");
                    }
                    else
                    {
                        Console.WriteLine("Updating failed");
                    }
                }
                else if (EmotivCloudClient.EC_SaveUserProfile(userCloudID, (int)engineUserID, profileName, EmotivCloudClient.profileFileType.TRAINING))
                {
                    Console.WriteLine("Saving finished");
                }
                else
                {
                    Console.WriteLine("Saving failed");
                }

                Thread.Sleep(5000);
                return;
            }
            if (mode == 1)
            {
                if (getNumberProfile > 0)
                {
                    if (EmotivCloudClient.EC_LoadUserProfile(userCloudID, engineUserID, EmotivCloudClient.EC_ProfileIDAtIndex(userCloudID, 0), version))
                    {
                        Console.WriteLine("Loading finished");
                    }
                    else
                    {
                        Console.WriteLine("Loading failed");
                    }
                }

                Thread.Sleep(5000);
                return;
            }
        }
 public void LoadProfile()
 {
     if (CloudConnected())
     {
         int profileId = -1;
         EmotivCloudClient.EC_GetProfileId(userCloudID, profileName.text, ref profileId);
         if (EmotivCloudClient.EC_LoadUserProfile(userCloudID, (int)engineUserID, profileId, (int)version) == Emotiv.EdkDll.EDK_OK)
         {
             successOrNot.text = "Load finished successfully";
             isRegestered      = true;
         }
         else
         {
             successOrNot.text = "Problem loading";
         }
     }
 }
Ejemplo n.º 5
0
        static void ProfileLoading()
        {
            Console.WriteLine("Loading...");

            int profileID = -1;

            EmotivCloudClient.EC_GetProfileId(cloudUserID, profileName, ref profileID);

            if (EmotivCloudClient.EC_LoadUserProfile(cloudUserID, 0, profileID, version) == EdkDll.EDK_OK)
            {
                Console.WriteLine("Loading finished");
            }
            else
            {
                Console.WriteLine("Loading failed");
            }

            Thread.Sleep(5000);
            return;
        }
Ejemplo n.º 6
0
    public void LoadProfile()
    {
        if (CloudConnected())
        {
            int profileId = -1;
            EmotivCloudClient.EC_GetProfileId(userCloudID, profileName.text, ref profileId);

            if (EmotivCloudClient.EC_LoadUserProfile(
                    userCloudID, (int)engineUserID,
                    profileId,
                    (int)version) == EdkDll.EDK_OK)
            {
                message_box.text = "Load finished";
            }
            else
            {
                message_box.text = "Problem loading";
            }
        }
    }
Ejemplo n.º 7
0
 public void LoadProfile()
 {
     if (CloudConnected())
     {
         int profileId = -1;
         if (EmotivCloudClient.EC_LoadUserProfile(
                 userCloudID, (int)engineUserID,
                 EmotivCloudClient.EC_GetProfileId(userCloudID, profileName.text, ref profileId),
                 (int)version) == EdkDll.EDK_OK)
         {
             textOutputFunction("Status: Load finished");
             Debug.Log("Status: Load finished");
         }
         else
         {
             textOutputFunction("Status: Problem loading");
             Debug.Log("Status: Problem loading");
         }
     }
 }
Ejemplo n.º 8
0
    void LoadProfileWindow(int wid)
    {
        GUI.Label(new Rect(10, 20, 200, 30), "Select profile");
        vec2_Scoll = GUI.BeginScrollView(new Rect(10, 50, 200, 300), vec2_Scoll, new Rect(0, 0, 200, 300));
        int i = 0;

        foreach (PROFILE p in profiles)
        {
            if (GUI.Button(new Rect(0, 10 + i * 35, 200, 30), p.name))
            {
                EmotivCloudClient.EC_LoadUserProfile(userCloudId, EmoUserManagement.currentUser, p.id, -1);
                str_Profile   = p.name;
                isLoadProfile = false;
            }
            i++;
        }
        GUI.EndScrollView();
        if (GUI.Button(new Rect(10, 350, 200, 30), "Close"))
        {
            isLoadProfile = false;
        }
    }
Ejemplo n.º 9
0
        protected override bool ConnectionSetUp(out string errorMessage)
        {
            string userName    = this.username;
            string password    = this.password;
            string profileName = this.profileName;

            int state = 0;

            uint engineUserID;
            int  userCloudID;

            engineUserID = 0;
            userCloudID  = -1;

            if (EdkDll.IEE_EngineConnect("Emotiv Systems-5") != EdkDll.EDK_OK)
            {
                errorMessage = "Emotiv Engine start up failed.";
                return(false);
            }

            eEvent = EdkDll.IEE_EmoEngineEventCreate();
            eState = EdkDll.IEE_EmoStateCreate();

            UpdateBatteryLevel();
            UpdateWirelessSigmalStrength();

            if (EmotivCloudClient.EC_Connect() != EmotivCloudClient.EC_OK)
            {
                errorMessage = ("Cannot connect to Emotiv Cloud");
                return(false);
            }

            if (EmotivCloudClient.EC_Login(userName, password) != EmotivCloudClient.EC_OK)
            {
                errorMessage = ("Your login attempt has failed. The username or password may be incorrect");
                return(false);
            }

            //Debug.WriteLine("Logged in as " + userName);

            if (EmotivCloudClient.EC_GetUserDetail(ref userCloudID) != EmotivCloudClient.EC_OK)
            {
                errorMessage = "Unable to get user details";
                return(false);
            }

            state = EdkDll.IEE_EngineGetNextEvent(eEvent);

            if (state == EdkDll.EDK_OK)
            {
                var eventType = EdkDll.IEE_EmoEngineEventGetType(eEvent);
                EdkDll.IEE_EmoEngineEventGetUserId(eEvent, out engineUserID);

                // Log the EmoState if it has been updated
                if (eventType == EdkDll.IEE_Event_t.IEE_UserAdded)
                {
                    //Debug.WriteLine("User added");
                }
            }
            else if (state != EdkDll.EDK_NO_EVENT)
            {
                errorMessage = ("Internal error in Emotiv Engine!");
                return(false);
            }

            //Debug.WriteLine("userCloudID: " + userCloudID);
            //Debug.WriteLine("userEngineID: " + engineUserID);

            int version          = -1; // Lastest version
            int getNumberProfile = EmotivCloudClient.EC_GetAllProfileName(userCloudID);

            //Debug.WriteLine(getNumberProfile);

            if (getNumberProfile > 0)
            {
                int profileID = EmotivCloudClient.EC_GetProfileId(userCloudID, profileName);
                //Debug.WriteLine(profileID);
                if (EmotivCloudClient.EC_LoadUserProfile(userCloudID, (int)engineUserID, profileID, version) == EmotivCloudClient.EC_OK)
                {
                    // Debug.WriteLine("Loading finished" + EmotivCloudClient.EC_GetAllProfileName(userCloudID));
                }
                else
                {
                    errorMessage = ("Loading failed: either USB not connected or profile  \'" + profileName + "\' doesn't exist");
                    EmotivCloudClient.EC_Logout(userCloudID);
                    return(false);
                }
            }

            uint pTrainedActionsOut = 0;

            EdkDll.IEE_MentalCommandGetTrainedSignatureActions(engineUserID, out pTrainedActionsOut);
            //Debug.WriteLine("Current overall trained actions: " + pTrainedActionsOut);

            float skill = -1;

            EdkDll.IEE_MentalCommandGetOverallSkillRating(engineUserID, out skill);
            //Debug.WriteLine("Current overall skill rating: " + skill);

            errorMessage = "Profile " + profileName + " was loaded and device connected!";

            return(true);
        }