void engine_UserAdded_Event(object sender, EmoEngineEventArgs e) { //Thread t = Thread.CurrentThread; //Debug.Log(t.Name + t.ThreadState); // t.Suspend(); //t.Yield();// Suspend(); Debug.Log("Dongle Plugged!!!!!!!"); userID = (int)e.userId; try { int errorCode = EdkDll.EE_DataAcquisitionEnable((uint)userID, true); //engine.DataAcquisitionEnable((uint)userID, true); EmoEngine.errorHandler((Int32)errorCode); Debug.Log("errorCode = " + errorCode); //enable the data aquisition for this user //[DllImport("edk.dll", EntryPoint = "EE_DataAcquisitionEnable")] // static extern Int32 Unmanaged_EE_DataAcquisitionEnable(UInt32 userId, Boolean enable); } catch (Exception exp) { Debug.Log("error"); Debug.Log(exp); } try { bool result; int err2 = EdkDll.EE_DataAcquisitionIsEnabled((uint)userID, out result); Debug.Log(err2); EmoEngine.errorHandler((Int32)err2); } catch (Exception exp) { Debug.Log("error"); Debug.Log(exp); } EmoState emoState = new EmoState(); EdkDll.EE_EEG_ContactQuality_t[] qualities = emoState.GetContactQualityFromAllChannels(); int i; for (i = 0; i < qualities.Length; i++) { Debug.Log(qualities[i]); } // EE_DataAcquisitionIsEnabled(uint userId, out bool pEnableOut); //engine.DataAcquisitionEnable((uint)userID, true); uint sampleRate = engine.DataGetSamplingRate((uint)userID); Debug.Log(sampleRate); //ask for up to 1s of buffered data engine.EE_DataSetBufferSizeInSec(1); int num = (int)engine.EngineGetNumUser(); Debug.Log("user number = " + num); }