public void SaveProfile() { if (CloudConnected()) { int profileId = -1; EmotivCloudClient.EC_GetProfileId(userCloudID, profileName.text, ref profileId); if (profileId >= 0) { if (EmotivCloudClient.EC_UpdateUserProfile(userCloudID, (int)engineUserID, profileId) == EdkDll.EDK_OK) { message_box.text = "Profile updated"; } else { message_box.text = "Error saving profile, aborting"; } } else { if (EmotivCloudClient.EC_SaveUserProfile( userCloudID, engineUserID, profileName.text, EmotivCloudClient.profileFileType.TRAINING) == EdkDll.EDK_OK) { message_box.text = "Profiled saved successfully"; } else { message_box.text = "Error saving profile, aborting"; } } } }
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; } }
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"; } } }
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"; } } }
void UploadProfileWindow(int wId) { GUI.Label(new Rect(10, 20, 200, 30), "Create new profile"); newProfileName = GUI.TextField(new Rect(10, 40, 180, 30), newProfileName); if (GUI.Button(new Rect(10, 80, 90, 30), "Cancel")) { isUploadProfile = false; } if (GUI.Button(new Rect(120, 80, 80, 30), "Upload")) { int pid = EmotivCloudClient.EC_GetProfileId(userCloudId, newProfileName); if (pid >= 0) { EmotivCloudClient.EC_UpdateUserProfile(userCloudId, EmoUserManagement.currentUser, pid); //close upload window isUploadProfile = false; } else { EmotivCloudClient.EC_SaveUserProfile(userCloudId, EmoUserManagement.currentUser, newProfileName, EmotivCloudClient.profileFileType.TRAINING); int id = EmotivCloudClient.EC_GetProfileId(userCloudId, newProfileName); PROFILE t = new PROFILE(); t.id = id; t.name = newProfileName; profiles.Add(t); //close upload window isUploadProfile = false; } } GUI.Label(new Rect(10, 110, 200, 30), "or select from your profiles"); vec2_Scoll = GUI.BeginScrollView(new Rect(10, 130, 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)) { newProfileName = p.name; } _i++; } GUI.EndScrollView(); }
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; }
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"; } } }
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"); } } }
static void ProfileSaving() { int profileID = -1; EmotivCloudClient.EC_GetProfileId(cloudUserID, profileName, ref profileID); if (profileID >= 0) { Console.WriteLine("Updating..."); Console.WriteLine("Profile with " + profileName + " is existed"); if (EmotivCloudClient.EC_UpdateUserProfile(cloudUserID, engineUserID, profileID) == EdkDll.EDK_OK) { Console.WriteLine("Updating finished"); } else { Console.WriteLine("Updating failed"); } } else { Console.WriteLine("Saving..."); if (EmotivCloudClient.EC_SaveUserProfile(cloudUserID, 0, profileName, EmotivCloudClient.profileFileType.TRAINING) == EdkDll.EDK_OK) { Console.WriteLine("Saving finished"); } else { Console.WriteLine("Saving failed"); } } Thread.Sleep(5000); return; }
public void SaveProfile() { if (CloudConnected()) { int profileId = -1; profileId = EmotivCloudClient.EC_GetProfileId(userCloudID, profileName.text, ref profileId); if (profileId >= 0) { if (EmotivCloudClient.EC_UpdateUserProfile(userCloudID, (int)engineUserID, profileId) == EdkDll.EDK_OK) { textOutputFunction("Status: Profile updated"); Debug.Log("Status: Profile updated"); } else { textOutputFunction("Status: Error saving profile, aborting"); Debug.Log("Status: Error saving profile, aborting"); } } else { if (EmotivCloudClient.EC_SaveUserProfile( userCloudID, engineUserID, profileName.text, EmotivCloudClient.profileFileType.TRAINING) == EdkDll.EDK_OK) { textOutputFunction("Status: Profiled saved successfully"); Debug.Log("Status: Profiled saved successfully"); } else { textOutputFunction("Status: Error saving profile, aborting"); Debug.Log("Status: Error saving profile, aborting"); } } } }
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); }