static void Main(string[] args) { Console.WriteLine("==========================================================================="); Console.WriteLine("Example to saving and loading profile from Emotiv Cloud."); Console.WriteLine("==========================================================================="); Console.WriteLine("Press 'F1' to saving profile to Emotiv Cloud."); Console.WriteLine("Press 'F2' to loading profile from Emotiv Cloud."); SavingAndLoadingProfileCloud p = new SavingAndLoadingProfileCloud(); // create the engine EmoEngine engine = EmoEngine.Instance; engine.UserAdded += new EmoEngine.UserAddedEventHandler(engine_UserAdded_Event); engine.Connect(); ConsoleKeyInfo cki = new ConsoleKeyInfo(); if (EmotivCloudClient.EC_Connect() != EmotivCloudClient.EC_OK) { Console.WriteLine("Cannot connect to Emotiv Cloud."); Thread.Sleep(2000); return; } if (EmotivCloudClient.EC_Login(userName, password) != EmotivCloudClient.EC_OK) { Console.WriteLine("Your login attempt has failed. The username or password may be incorrect"); Thread.Sleep(2000); return; } Console.WriteLine("Logged in as " + userName); if (EmotivCloudClient.EC_GetUserDetail(ref userCloudID) != EmotivCloudClient.EC_OK) { return; } while (true) { engine.ProcessEvents(10); if (!Console.KeyAvailable) { continue; } cki = Console.ReadKey(true); if (cki.Key == ConsoleKey.F1) { if (engineUserID < 0) { Console.WriteLine("No headset is connected."); continue; } SavingLoadingFunction(0); break; } if (cki.Key == ConsoleKey.F2) { if (engineUserID < 0) { Console.WriteLine("No headset is connected."); continue; } SavingLoadingFunction(1); break; } } engine.Disconnect(); }
static void Main(string[] args) { Console.WriteLine("==========================================================================="); Console.WriteLine("Example to saving and loading profile from Emotiv Cloud."); Console.WriteLine("==========================================================================="); Console.WriteLine("Press 'F1' to saving profile to Emotiv Cloud."); Console.WriteLine("Press 'F2' to loading profile from Emotiv Cloud."); SavingAndLoadingProfileCloud p = new SavingAndLoadingProfileCloud(); // create the engine EmoEngine engine = EmoEngine.Instance; engine.UserAdded += new EmoEngine.UserAddedEventHandler(engine_UserAdded_Event); engine.Connect(); ConsoleKeyInfo cki = new ConsoleKeyInfo(); if (EmotivCloudClient.EC_Connect() != EdkDll.EDK_OK) { Console.WriteLine("Cannot connect to Emotiv Cloud."); Thread.Sleep(2000); return; } if (EmotivCloudClient.EC_Login(userName, password) != EdkDll.EDK_OK) { Console.WriteLine("Your login attempt has failed. The username or password may be incorrect"); Thread.Sleep(2000); return; } Console.WriteLine("Logged in as " + userName); if (EmotivCloudClient.EC_GetUserDetail(ref cloudUserID) != EdkDll.EDK_OK) { return; } // Loading information of all profiles from Cloud to buffer. // and return number of profile in the list. int getNumberProfile = EmotivCloudClient.EC_GetAllProfileName(cloudUserID); while (true) { engine.ProcessEvents(10); if (!Console.KeyAvailable) { continue; } cki = Console.ReadKey(true); if (cki.Key == ConsoleKey.F1) { if (engineUserID < 0) { Console.WriteLine("No headset is connected."); continue; } // If your profile is new profile. You need call this function // before want to train Mental Command detections. ProfileSaving(); break; } if (cki.Key == ConsoleKey.F2) { if (engineUserID < 0) { Console.WriteLine("No headset is connected."); continue; } if (getNumberProfile > 0) { ProfileLoading(); break; } } } engine.Disconnect(); }
static void Main(string[] args) { Console.WriteLine("==========================================================================="); Console.WriteLine("Example to saving and loading profile from Emotiv Cloud."); Console.WriteLine("==========================================================================="); Console.WriteLine("Press 'F1' to saving profile to Emotiv Cloud."); Console.WriteLine("Press 'F2' to loading profile from Emotiv Cloud."); SavingAndLoadingProfileCloud p = new SavingAndLoadingProfileCloud(); // create the engine EmoEngine engine = EmoEngine.Instance; engine.UserAdded += new EmoEngine.UserAddedEventHandler(engine_UserAdded_Event); engine.Connect(); ConsoleKeyInfo cki = new ConsoleKeyInfo(); if(!EmotivCloudClient.EC_Connect()) { Console.WriteLine("Cannot connect to Emotiv Cloud."); Thread.Sleep(2000); return; } if(!EmotivCloudClient.EC_Login(userName, password)) { Console.WriteLine("Your login attempt has failed. The username or password may be incorrect"); Thread.Sleep(2000); return; } Console.WriteLine("Logged in as " + userName); if (!EmotivCloudClient.EC_GetUserDetail(ref userCloudID)) return; while (true) { engine.ProcessEvents(10); if (!Console.KeyAvailable) continue; cki = Console.ReadKey(true); if (cki.Key == ConsoleKey.F1) { if (engineUserID < 0) { Console.WriteLine("No headset is connected."); continue; } SavingLoadingFunction(0); break; } if (cki.Key == ConsoleKey.F2) { if (engineUserID < 0) { Console.WriteLine("No headset is connected."); continue; } SavingLoadingFunction(1); break; } } engine.Disconnect(); }