/// <summary> /// Attempt to create a device using given credintials /// </summary> public void Login() { IEmotivDevice device = new EPOCEmotivDevice(UsernameInput.text, PasswordInput.text, ProfileInput.text); string msg = ""; bool suc = true; device.OnConnectAttempted += (b, m) => { msg = m; suc = b; }; device.Connect(); if (suc) { if (OnLoginedIn != null) { OnLoginedIn(device); } UserSettings.SetLogin(UsernameInput.text, PasswordInput.text, ProfileInput.text); Dismissed(); } else { ErrorMessage.text = msg; } }
/// <summary> /// Reader from random device and report states read from EmotivAnalyticReader /// </summary> static void Main(string[] args) { IEmotivDevice device = new EPOCEmotivDevice("emotiv123", "Emotivbci123", "KLD_Blink"); IConnectomeReader <IEmotivState> readerPlug = new BasicEmotivReader(device); int waitTimeSecond = 40; IConnectomeReader <IEmotivState> reader = new TimedEmotivReader(readerPlug, waitTimeSecond); int p = -1; reader.OnRead += (state) => { if (device.WirelessSignalStrength != p) { p = device.WirelessSignalStrength; //Debug.WriteLine(p); } }; reader.StartReading(); while (reader.IsReading) { //Debug.WriteLine(device.BatteryLevel); } Console.ReadLine(); Console.WriteLine("[END]"); }
/// <summary> /// Creates device /// </summary> /// <returns></returns> protected override IEmotivDevice CreateDevice() { if (DeviceInstance == null) { DeviceInstance = new EPOCEmotivDevice(Username, Password, Profile); DeviceInstance.OnConnectAttempted += DebugStatus; } return(DeviceInstance); }