Exemplo n.º 1
0
 private void Myo_Disconnected(object sender, MyoEventArgs e)
 {
     OnMyoDisconnected(e);
     UnhookMyoEvents(e.Myo);
     _myos.Remove(e.Myo.Handle);
     e.Myo.Dispose();
 }
Exemplo n.º 2
0
 private void Myo_Locked(object sender, MyoEventArgs e)
 {
     if (MyoUnlocked != null)
     {
         MyoUnlocked.Invoke(this, e);
     }
 }
Exemplo n.º 3
0
        /// <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);
            }
        }
Exemplo n.º 4
0
        /// <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);
            }
        }
Exemplo n.º 5
0
        /// <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);
            }
        }
Exemplo n.º 6
0
        /// <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);
            }
        }
Exemplo n.º 7
0
        /// <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);
            }
        }
Exemplo n.º 8
0
        /// <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);
            }
        }
Exemplo n.º 9
0
        /// <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);
            }
        }
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
0
        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);
 }
Exemplo n.º 14
0
 private void Hub_MyoConnected(object sender, MyoEventArgs e)
 {
     e.Myo.EmgDataAcquired += Myo_EmgDataAcquired;
     e.Myo.Unlock(UnlockType.Timed);
 }
Exemplo n.º 15
0
 private void Hub_MyoDisconnected(object sender, MyoEventArgs e)
 {
     e.Myo.EmgDataAcquired -= Myo_EmgDataAcquired;
 }
Exemplo n.º 16
0
 private void Myo_Locked(object sender, MyoEventArgs e)
 {
 }
Exemplo n.º 17
0
 private void Myo_Connected(object sender, MyoEventArgs e)
 {
     _myos[e.Myo.Handle] = e.Myo;
     OnMyoConnected(e);
 }
Exemplo n.º 18
0
        /// <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);
            }
        }
Exemplo n.º 19
0
 private void Myo_Connected(object sender, MyoEventArgs e)
 {
     OnMyoConnected(e);
 }
Exemplo n.º 20
0
        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");
 }
Exemplo n.º 22
0
 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);
 }
Exemplo n.º 23
0
        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);
 }