private void Myo_Disconnected(object sender, MyoEventArgs e) { OnMyoDisconnected(e); UnhookMyoEvents(e.Myo); _myos.Remove(e.Myo.Handle); e.Myo.Dispose(); }
private void Myo_Locked(object sender, MyoEventArgs e) { if (MyoUnlocked != null) { MyoUnlocked.Invoke(this, e); } }
/// <summary> /// Raises the <see cref="E:MyoDisconnected" /> event. /// </summary> /// <param name="e">The <see cref="MyoEventArgs"/> instance containing the event data.</param> protected virtual void OnMyoDisconnected(MyoEventArgs e) { var handler = MyoDisconnected; if (handler != null) { handler.Invoke(this, e); } }
/// <summary> /// Raises the <see cref="E:MyoDisconnected" /> event. /// </summary> /// <param name="e">The <see cref="MyoEventArgs"/> instance containing the event data.</param> protected virtual void OnMyoDisconnected(MyoEventArgs e) { Contract.Requires <ArgumentNullException>(e != null, "e"); var handler = MyoDisconnected; if (handler != null) { handler.Invoke(this, e); } }
/// <summary> /// Called when the Myo has unlocked. /// </summary> /// <param name="timestamp">The timestamp of the event.</param> protected virtual void OnUnLock(DateTime timestamp) { this.IsUnlocked = true; var handler = Unlocked; if (handler != null) { var args = new MyoEventArgs(this, timestamp); handler(this, args); } }
/// <summary> /// Called when the Myo can no longer recognize which arm it is on. /// </summary> /// <param name="timestamp">The timestamp of the event.</param> protected virtual void OnArmLost(DateTime timestamp) { this.Arm = Arm.Unknown; var handler = ArmLost; if (handler != null) { var args = new MyoEventArgs(this, timestamp); handler.Invoke(this, args); } }
/// <summary> /// Called when the Myo has disconnected. /// </summary> /// <param name="timestamp">The timestamp of the event.</param> protected virtual void OnDisconnected(DateTime timestamp) { this.IsConnected = false; var handler = Disconnected; if (handler != null) { var args = new MyoEventArgs(this, timestamp); handler(this, args); } }
/// <summary> /// Called when the Myo has connected.. /// </summary> /// <param name="timestamp">The timestamp of the event.</param> protected virtual void OnConnected(DateTime timestamp) { this.IsConnected = true; var handler = Connected; if (handler != null) { var args = new MyoEventArgs(this, timestamp); handler.Invoke(this, args); } }
/// <summary> /// Called when the Myo has locked. /// </summary> /// <param name="timestamp">The timestamp of the event.</param> protected virtual void OnLock(DateTime timestamp) { this.IsUnlocked = false; var handler = Locked; if (handler != null) { var args = new MyoEventArgs(this, timestamp); handler.Invoke(this, args); } }
public void GetMyo_ValidState_EqualsConstructorParameter() { // Setup var myo = new Mock<IMyo>(); var args = new MyoEventArgs( myo.Object, DateTime.UtcNow); // Execute var result = args.Myo; // Assert Assert.Equal(myo.Object, result); }
public void GetTimestamp_ValidState_EqualsConstructorParameter() { // Setup var timestamp = DateTime.UtcNow; var args = new MyoEventArgs( new Mock<IMyo>().Object, timestamp); // Execute var result = args.Timestamp; // Assert Assert.Equal(timestamp, result); }
private void OnUnlocked(object sender, MyoEventArgs e) { e.Myo.Unlock(UnlockType.Hold); _isLock = false; Console.WriteLine("Myo UnLocked"); }
private static void Myo_Locked(object sender, MyoEventArgs e) { Console.WriteLine("{0} arm Myo has locked!", e.Myo.Arm); }
private void Hub_MyoConnected(object sender, MyoEventArgs e) { e.Myo.EmgDataAcquired += Myo_EmgDataAcquired; e.Myo.Unlock(UnlockType.Timed); }
private void Hub_MyoDisconnected(object sender, MyoEventArgs e) { e.Myo.EmgDataAcquired -= Myo_EmgDataAcquired; }
private void Myo_Locked(object sender, MyoEventArgs e) { }
private void Myo_Connected(object sender, MyoEventArgs e) { _myos[e.Myo.Handle] = e.Myo; OnMyoConnected(e); }
/// <summary> /// Raises the <see cref="E:MyoDisconnected" /> event. /// </summary> /// <param name="e">The <see cref="MyoEventArgs"/> instance containing the event data.</param> protected virtual void OnMyoDisconnected(MyoEventArgs e) { Contract.Requires<ArgumentNullException>(e != null, "e"); var handler = MyoDisconnected; if (handler != null) { handler.Invoke(this, e); } }
private void Myo_Connected(object sender, MyoEventArgs e) { OnMyoConnected(e); }
private void Myo_Disconnected(object sender, MyoEventArgs e) { Contract.Requires<ArgumentNullException>(sender != null, "sender"); OnMyoDisconnected(e); }
private void OnLocked(object sender, MyoEventArgs e) { e.Myo.Lock(); _isLock = true; Console.WriteLine("Myo Locked"); }
private static void Myo_Locked(object sender, MyoEventArgs e) { Console.SetCursorPosition(0, 14); ClearCurrentConsoleLine(); Console.WriteLine("Myo del brazo {0} se ha bloqueado!", e.Myo.Arm); }
private void Myo_Connected(object sender, MyoEventArgs e) { Contract.Requires <ArgumentNullException>(sender != null, "sender"); OnMyoConnected(e); }
private void MyoDisconnected(object sender, MyoEventArgs e) { Console.WriteLine("Myo Disconnented!!"); e.Myo.PoseChanged -= OnPose; e.Myo.OrientationDataAcquired -= OnOrientationData; e.Myo.Locked -= OnLocked; e.Myo.Unlocked -= OnUnlocked; //e.Myo.EmgDataAcquired -= OnEmgData; //e.Myo.SetEmgStreaming(false); }