示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ChannelDriver"/> class.
        /// </summary>
        /// <param name="channelBridge">The channel bridge. Cannot be <c>null</c>.</param>
        /// <exception cref="System.ArgumentNullException">
        /// The exception that is thrown when <paramref name="channelBridge"/> is null.
        /// </exception>
        private ChannelDriver(IChannelBridge channelBridge, IMyoErrorHandlerDriver myoErrorHandlerDriver)
        {
            // Contract.Requires<ArgumentNullException>(channelBridge != null, "channelBridge");
            // Contract.Requires<ArgumentNullException>(myoErrorHandlerDriver != null, "myoErrorHandlerDriver");

            _channelBridge         = channelBridge;
            _myoErrorHandlerDriver = myoErrorHandlerDriver;
        }
示例#2
0
        public static IMyoCommand Create(IMyoErrorHandlerDriver myoErrorHandlerDriver, MyoCommandDelegate command)
        {
            ////Contract.Requires<ArgumentNullException>(myoErrorHandlerDriver != null, "myoErrorHandlerDriver");
            ////Contract.Requires<ArgumentNullException>(command != null, "command");
            Contract.Ensures(Contract.Result <IMyoCommand>() != null);

            return(new MyoCommand(myoErrorHandlerDriver, command));
        }
示例#3
0
        /// <summary>
        /// Creates a new <see cref="IChannelDriver"/> instance.
        /// </summary>
        /// <param name="channelBridge">The channel bridge. Cannot be <c>null</c>.</param>
        /// <param name="myoErrorHandlerDriver">The error handler driver. Cannot be <c>null</c>.</param>
        /// <returns>Returns a new <see cref="IChannelDriver"/> instance.</returns>
        /// <exception cref="System.ArgumentNullException">
        /// The exception that is thrown when <paramref name="channelBridge"/> or <paramref name="myoErrorHandlerDriver" is null.
        /// </exception>
        public static IChannelDriver Create(IChannelBridge channelBridge, IMyoErrorHandlerDriver myoErrorHandlerDriver)
        {
            // Contract.Requires<ArgumentNullException>(channelBridge != null, "channelBridge");
            // Contract.Requires<ArgumentNullException>(myoErrorHandlerDriver != null, "myoErrorHandlerDriver");
            Contract.Ensures(Contract.Result <IChannelDriver>() != null);

            return(new ChannelDriver(channelBridge, myoErrorHandlerDriver));
        }
示例#4
0
        private MyoCommand(IMyoErrorHandlerDriver myoErrorHandlerDriver, MyoCommandDelegate command)
        {
            ////Contract.Requires<ArgumentNullException>(myoErrorHandlerDriver != null, "myoErrorHandlerDriver");
            ////Contract.Requires<ArgumentNullException>(command != null, "command");

            _myoErrorHandlerDriver = myoErrorHandlerDriver;
            _command = command;
        }
示例#5
0
        /// <summary>
        /// Creates a new <see cref="IChannelDriver"/> instance.
        /// </summary>
        /// <param name="channelBridge">The channel bridge. Cannot be <c>null</c>.</param>
        /// <param name="myoErrorHandlerDriver">The error handler driver. Cannot be <c>null</c>.</param>
        /// <returns>Returns a new <see cref="IChannelDriver"/> instance.</returns>
        /// <exception cref="System.ArgumentNullException">
        /// The exception that is thrown when <paramref name="channelBridge"/> or <paramref name="myoErrorHandlerDriver" is null.
        /// </exception>
        public static IChannelDriver Create(IChannelBridge channelBridge, IMyoErrorHandlerDriver myoErrorHandlerDriver)
        {
            Contract.Requires<ArgumentNullException>(channelBridge != null, "channelBridge");
            Contract.Requires<ArgumentNullException>(myoErrorHandlerDriver != null, "myoErrorHandlerDriver");
            Contract.Ensures(Contract.Result<IChannelDriver>() != null);

            return new ChannelDriver(channelBridge, myoErrorHandlerDriver);
        }
示例#6
0
        private MyoCommand(IMyoErrorHandlerDriver myoErrorHandlerDriver, MyoCommandDelegate command)
        {
            Contract.Requires<ArgumentNullException>(myoErrorHandlerDriver != null, "myoErrorHandlerDriver");
            Contract.Requires<ArgumentNullException>(command != null, "command");

            _myoErrorHandlerDriver = myoErrorHandlerDriver;
            _command = command;
        }
示例#7
0
        public static IMyoCommand Create(IMyoErrorHandlerDriver myoErrorHandlerDriver, MyoCommandDelegate command)
        {
            Contract.Requires<ArgumentNullException>(myoErrorHandlerDriver != null, "myoErrorHandlerDriver");
            Contract.Requires<ArgumentNullException>(command != null, "command");
            Contract.Ensures(Contract.Result<IMyoCommand>() != null);

            return new MyoCommand(myoErrorHandlerDriver, command);
        }
示例#8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ChannelDriver"/> class.
        /// </summary>
        /// <param name="channelBridge">The channel bridge. Cannot be <c>null</c>.</param>
        /// <exception cref="System.ArgumentNullException">
        /// The exception that is thrown when <paramref name="channelBridge"/> is null.
        /// </exception>
        private ChannelDriver(IChannelBridge channelBridge, IMyoErrorHandlerDriver myoErrorHandlerDriver)
        {
            Contract.Requires<ArgumentNullException>(channelBridge != null, "channelBridge");
            Contract.Requires<ArgumentNullException>(myoErrorHandlerDriver != null, "myoErrorHandlerDriver");

            _channelBridge = channelBridge;
            _myoErrorHandlerDriver = myoErrorHandlerDriver;
        }
示例#9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MyoDeviceDriver" /> class.
        /// </summary>
        /// <param name="handle">The handle to the Myo.</param>
        /// <param name="myoDeviceBridge">An instance of <see cref="IMyoDeviceBridge" /> for communicating with the device. Cannot be null.</param>
        /// <param name="myoErrorHandlerDriver">The myo error handler driver. Cannot be null.</param>
        /// <exception cref="System.ArgumentException">The exception that is thrown when the handle is not set.</exception>
        /// <exception cref="System.ArgumentNullException">The exception that is thrown when the <paramref name="myoDeviceBridge" /> or <paramref name="myoErrorHandlerDriver" /> is <c>null</c>.</exception>
        private MyoDeviceDriver(IntPtr handle, IMyoDeviceBridge myoDeviceBridge, IMyoErrorHandlerDriver myoErrorHandlerDriver)
        {
            Contract.Requires<ArgumentException>(handle != IntPtr.Zero, "handle");
            Contract.Requires<ArgumentNullException>(myoDeviceBridge != null, "myoDeviceBridge");
            Contract.Requires<ArgumentNullException>(myoErrorHandlerDriver != null, "myoErrorHandlerDriver");

            _handle = handle;
            _myoDeviceBridge = myoDeviceBridge;
            _myoErrorHandlerDriver = myoErrorHandlerDriver;
        }
示例#10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MyoDeviceDriver" /> class.
        /// </summary>
        /// <param name="handle">The handle to the Myo.</param>
        /// <param name="myoDeviceBridge">An instance of <see cref="IMyoDeviceBridge" /> for communicating with the device. Cannot be null.</param>
        /// <param name="myoErrorHandlerDriver">The myo error handler driver. Cannot be null.</param>
        /// <exception cref="System.ArgumentException">The exception that is thrown when the handle is not set.</exception>
        /// <exception cref="System.ArgumentNullException">The exception that is thrown when the <paramref name="myoDeviceBridge" /> or <paramref name="myoErrorHandlerDriver" /> is <c>null</c>.</exception>
        private MyoDeviceDriver(IntPtr handle, IMyoDeviceBridge myoDeviceBridge, IMyoErrorHandlerDriver myoErrorHandlerDriver)
        {
            //Contract.Requires<ArgumentException>(handle != IntPtr.Zero, "handle");
            //Contract.Requires<ArgumentNullException>(myoDeviceBridge != null, "myoDeviceBridge");
            //Contract.Requires<ArgumentNullException>(myoErrorHandlerDriver != null, "myoErrorHandlerDriver");

            _handle                = handle;
            _myoDeviceBridge       = myoDeviceBridge;
            _myoErrorHandlerDriver = myoErrorHandlerDriver;
        }
示例#11
0
        /// <summary>
        /// Creates a new <see cref="IMyoDeviceDriver" /> instance.
        /// </summary>
        /// <param name="handle">The handle to the Myo.</param>
        /// <param name="myoDeviceBridge">An instance of <see cref="IMyoDeviceBridge" /> for communicating with the device. Cannot be null.</param>
        /// <param name="myoErrorHandlerDriver">The myo error handler driver. Cannot be null.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentException">The exception that is thrown when the handle is not set.</exception>
        /// <exception cref="System.ArgumentNullException">The exception that is thrown when the <paramref name="myoDeviceBridge" /> or <paramref name="myoErrorHandlerDriver" /> is <c>null</c>.</exception>
        public static IMyoDeviceDriver Create(IntPtr handle, IMyoDeviceBridge myoDeviceBridge, IMyoErrorHandlerDriver myoErrorHandlerDriver)
        {
            Contract.Requires<ArgumentException>(handle != IntPtr.Zero, "handle");
            Contract.Requires<ArgumentNullException>(myoDeviceBridge != null, "myoDeviceBridge");
            Contract.Requires<ArgumentNullException>(myoErrorHandlerDriver != null, "myoErrorHandlerDriver");
            Contract.Ensures(Contract.Result<IMyoDeviceDriver>() != null);

            return new MyoDeviceDriver(
                handle,
                myoDeviceBridge,
                myoErrorHandlerDriver);
        }
示例#12
0
 /// <summary>
 /// Creates a new <see cref="IMyoDeviceDriver" />.
 /// </summary>
 /// <param name="myoHandle">The Myo handle.</param>
 /// <param name="myoDeviceBridge">The Myo device bridge. Cannot be <c>null</c>.</param>
 /// <param name="myoErrorHandlerDriver">The myo error handler driver. Cannot be <c>null</c>.</param>
 /// <returns>
 /// Returns a new <see cref="IMyoDeviceDriver" /> instance.
 /// </returns>
 protected virtual IMyoDeviceDriver CreateMyoDeviceDriver(IntPtr myoHandle, IMyoDeviceBridge myoDeviceBridge, IMyoErrorHandlerDriver myoErrorHandlerDriver)
 {
     return(MyoDeviceDriver.Create(myoHandle, myoDeviceBridge, myoErrorHandlerDriver));
 }
示例#13
0
        /// <summary>
        /// Creates a new <see cref="IMyoDeviceDriver" /> instance.
        /// </summary>
        /// <param name="handle">The handle to the Myo.</param>
        /// <param name="myoDeviceBridge">An instance of <see cref="IMyoDeviceBridge" /> for communicating with the device. Cannot be null.</param>
        /// <param name="myoErrorHandlerDriver">The myo error handler driver. Cannot be null.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentException">The exception that is thrown when the handle is not set.</exception>
        /// <exception cref="System.ArgumentNullException">The exception that is thrown when the <paramref name="myoDeviceBridge" /> or <paramref name="myoErrorHandlerDriver" /> is <c>null</c>.</exception>
        public static IMyoDeviceDriver Create(IntPtr handle, IMyoDeviceBridge myoDeviceBridge, IMyoErrorHandlerDriver myoErrorHandlerDriver)
        {
            //Contract.Requires<ArgumentException>(handle != IntPtr.Zero, "handle");
            //Contract.Requires<ArgumentNullException>(myoDeviceBridge != null, "myoDeviceBridge");
            //Contract.Requires<ArgumentNullException>(myoErrorHandlerDriver != null, "myoErrorHandlerDriver");
            Contract.Ensures(Contract.Result <IMyoDeviceDriver>() != null);

            return(new MyoDeviceDriver(
                       handle,
                       myoDeviceBridge,
                       myoErrorHandlerDriver));
        }
 /// <summary>
 /// Creates a new <see cref="IChannelDriver"/> instance.
 /// </summary>
 /// <param name="channelBridge">The channel bridge. Cannot be <c>null</c>.</param>
 /// <param name="myoErrorHandlerDriver">The error handler driver. Cannot be <c>null</c>.</param>
 /// <returns>Returns a new <see cref="IChannelDriver"/> instance.</returns>
 /// <exception cref="System.ArgumentNullException">
 /// The exception that is thrown when <paramref name="channelBridge"/> or <paramref name="myoErrorHandlerDriver" is null.
 /// </exception>
 public static IChannelDriver Create(IChannelBridge channelBridge, IMyoErrorHandlerDriver myoErrorHandlerDriver)
 {
     return(new ChannelDriver(channelBridge, myoErrorHandlerDriver));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ChannelDriver"/> class.
 /// </summary>
 /// <param name="channelBridge">The channel bridge. Cannot be <c>null</c>.</param>
 /// <exception cref="System.ArgumentNullException">
 /// The exception that is thrown when <paramref name="channelBridge"/> is null.
 /// </exception>
 private ChannelDriver(IChannelBridge channelBridge, IMyoErrorHandlerDriver myoErrorHandlerDriver)
 {
     _channelBridge         = channelBridge;
     _myoErrorHandlerDriver = myoErrorHandlerDriver;
 }
示例#16
0
 /// <summary>
 /// Creates a new <see cref="IMyoDeviceDriver" /> instance.
 /// </summary>
 /// <param name="handle">The handle to the Myo.</param>
 /// <param name="myoDeviceBridge">An instance of <see cref="IMyoDeviceBridge" /> for communicating with the device. Cannot be null.</param>
 /// <param name="myoErrorHandlerDriver">The myo error handler driver. Cannot be null.</param>
 /// <returns></returns>
 /// <exception cref="System.ArgumentException">The exception that is thrown when the handle is not set.</exception>
 /// <exception cref="System.ArgumentNullException">The exception that is thrown when the <paramref name="myoDeviceBridge" /> or <paramref name="myoErrorHandlerDriver" /> is <c>null</c>.</exception>
 public static IMyoDeviceDriver Create(IntPtr handle, IMyoDeviceBridge myoDeviceBridge, IMyoErrorHandlerDriver myoErrorHandlerDriver)
 {
     return(new MyoDeviceDriver(
                handle,
                myoDeviceBridge,
                myoErrorHandlerDriver));
 }
示例#17
0
文件: Hub.cs 项目: rafme/MyoSharp
        /// <summary>
        /// Creates a new <see cref="IMyoDeviceDriver" />.
        /// </summary>
        /// <param name="myoHandle">The Myo handle.</param>
        /// <param name="myoDeviceBridge">The Myo device bridge. Cannot be <c>null</c>.</param>
        /// <param name="myoErrorHandlerDriver">The myo error handler driver. Cannot be <c>null</c>.</param>
        /// <returns>
        /// Returns a new <see cref="IMyoDeviceDriver" /> instance.
        /// </returns>
        protected virtual IMyoDeviceDriver CreateMyoDeviceDriver(IntPtr myoHandle, IMyoDeviceBridge myoDeviceBridge, IMyoErrorHandlerDriver myoErrorHandlerDriver)
        {
            Contract.Requires<ArgumentException>(myoHandle != IntPtr.Zero, "The handle to the Myo must be set.");
            Contract.Requires<ArgumentNullException>(myoDeviceBridge != null, "myoDeviceBridge");
            Contract.Requires<ArgumentNullException>(myoErrorHandlerDriver != null, "myoErrorHandlerDriver");
            Contract.Ensures(Contract.Result<IMyoDeviceDriver>() != null);

            return MyoDeviceDriver.Create(myoHandle, myoDeviceBridge, myoErrorHandlerDriver);
        }
示例#18
0
 private MyoCommand(IMyoErrorHandlerDriver myoErrorHandlerDriver, MyoCommandDelegate command)
 {
     _myoErrorHandlerDriver = myoErrorHandlerDriver;
     _command = command;
 }
示例#19
0
 public static IMyoCommand Create(IMyoErrorHandlerDriver myoErrorHandlerDriver, MyoCommandDelegate command)
 {
     return(new MyoCommand(myoErrorHandlerDriver, command));
 }
示例#20
0
        /// <summary>
        /// Creates a new <see cref="IMyoDeviceDriver" />.
        /// </summary>
        /// <param name="myoHandle">The Myo handle.</param>
        /// <param name="myoDeviceBridge">The Myo device bridge. Cannot be <c>null</c>.</param>
        /// <param name="myoErrorHandlerDriver">The myo error handler driver. Cannot be <c>null</c>.</param>
        /// <returns>
        /// Returns a new <see cref="IMyoDeviceDriver" /> instance.
        /// </returns>
        protected virtual IMyoDeviceDriver CreateMyoDeviceDriver(IntPtr myoHandle, IMyoDeviceBridge myoDeviceBridge, IMyoErrorHandlerDriver myoErrorHandlerDriver)
        {
            Contract.Requires <ArgumentException>(myoHandle != IntPtr.Zero, "The handle to the Myo must be set.");
            Contract.Requires <ArgumentNullException>(myoDeviceBridge != null, "myoDeviceBridge");
            Contract.Requires <ArgumentNullException>(myoErrorHandlerDriver != null, "myoErrorHandlerDriver");
            Contract.Ensures(Contract.Result <IMyoDeviceDriver>() != null);

            return(MyoDeviceDriver.Create(myoHandle, myoDeviceBridge, myoErrorHandlerDriver));
        }
示例#21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MyoDeviceDriver" /> class.
 /// </summary>
 /// <param name="handle">The handle to the Myo.</param>
 /// <param name="myoDeviceBridge">An instance of <see cref="IMyoDeviceBridge" /> for communicating with the device. Cannot be null.</param>
 /// <param name="myoErrorHandlerDriver">The myo error handler driver. Cannot be null.</param>
 /// <exception cref="System.ArgumentException">The exception that is thrown when the handle is not set.</exception>
 /// <exception cref="System.ArgumentNullException">The exception that is thrown when the <paramref name="myoDeviceBridge" /> or <paramref name="myoErrorHandlerDriver" /> is <c>null</c>.</exception>
 private MyoDeviceDriver(IntPtr handle, IMyoDeviceBridge myoDeviceBridge, IMyoErrorHandlerDriver myoErrorHandlerDriver)
 {
     _handle                = handle;
     _myoDeviceBridge       = myoDeviceBridge;
     _myoErrorHandlerDriver = myoErrorHandlerDriver;
 }