예제 #1
0
        /// <summary>
        /// Called when the Myo sends a <see cref="MyoEventType.Rssi"/> event.
        /// </summary>
        /// <param name="evt">The pointer to the event.</param>
        /// <param name="timestamp">The timestamp of the event.</param>
        protected virtual void OnRssi(IntPtr evt, DateTime timestamp)
        {
            var handler = Rssi;

            if (handler != null)
            {
                var rssi = _myoDeviceDriver.GetEventRssi(evt);
                var args = new RssiEventArgs(
                    this,
                    timestamp,
                    rssi);
                handler.Invoke(this, args);
            }
        }
예제 #2
0
        public void GetMyo_ValidState_EqualsConstructorParameter()
        {
            // Setup
            var myo = new Mock<IMyo>();

            var args = new RssiEventArgs(
                myo.Object,
                DateTime.UtcNow,
                0);

            // Execute
            var result = args.Myo;

            // Assert
            Assert.Equal(myo.Object, result);
        }
예제 #3
0
        public void GetRssi_ValidState_EqualsConstructorParameter()
        {
            // Setup
            sbyte rssi = 123;

            var args = new RssiEventArgs(
                new Mock<IMyo>().Object,
                DateTime.UtcNow,
                rssi);

            // Execute
            var result = args.Rssi;

            // Assert
            Assert.Equal(rssi, result);
        }
예제 #4
0
        /// <summary>
        /// Called when the Myo sends a <see cref="MyoEventType.Rssi"/> event.
        /// </summary>
        /// <param name="evt">The pointer to the event.</param>
        /// <param name="timestamp">The timestamp of the event.</param>
        protected virtual void OnRssi(IntPtr evt, DateTime timestamp)
        {
            // Contract.Requires<ArgumentException>(evt != IntPtr.Zero, "The event handle must be set.");

            var handler = Rssi;

            if (handler != null)
            {
                var rssi = _myoDeviceDriver.GetEventRssi(evt);
                var args = new RssiEventArgs(
                    this,
                    timestamp,
                    rssi);
                handler.Invoke(this, args);
            }
        }
예제 #5
0
        public void GetTimestamp_ValidState_EqualsConstructorParameter()
        {
            // Setup
            var timestamp = DateTime.UtcNow;

            var args = new RssiEventArgs(
                new Mock<IMyo>().Object,
                timestamp,
                0);

            // Execute
            var result = args.Timestamp;

            // Assert
            Assert.Equal(timestamp, result);
        }