/// <inheritdoc /> public void Run(IntPtr hubHandle, MyoRunHandler handler, IntPtr userData) { var command = MyoCommand.Create( _myoErrorHandlerDriver, () => { IntPtr errorHandle; var result = PlatformInvocation.Running32Bit ? _channelBridge.Run32( hubHandle, 1000 / 20, handler, userData, out errorHandle) : _channelBridge.Run64( hubHandle, 1000 / 20, handler, userData, out errorHandle); return(MyoCommandResult.Create(result, errorHandle)); }); command.Execute(); }
public void Run_ValidParameters_ExpectedBridgeCalls() { // Setup var myoHandle = new IntPtr(123); var userData = new IntPtr(789); var bridge = new Mock <IChannelBridge>(); var errorHandlerDriver = new Mock <IMyoErrorHandlerDriver>(MockBehavior.Strict); errorHandlerDriver .Setup(x => x.FreeMyoError(IntPtr.Zero)); var driver = ChannelDriver.Create(bridge.Object, errorHandlerDriver.Object); MyoRunHandler handler = (_, __) => MyoRunHandlerResult.Continue; // Execute driver.Run(myoHandle, handler, userData); // Assert IntPtr errorHandle; bridge.Verify(x => x.Run32(myoHandle, 50, handler, userData, out errorHandle), PlatformInvocation.Running32Bit ? Times.Once() : Times.Never()); bridge.Verify(x => x.Run64(myoHandle, 50, handler, userData, out errorHandle), PlatformInvocation.Running32Bit ? Times.Never() : Times.Once()); errorHandlerDriver.Verify(x => x.FreeMyoError(IntPtr.Zero), Times.Once()); }
public MyoResult Run64(IntPtr hub, uint durationMs, MyoRunHandler handler, IntPtr userData, out IntPtr error) { Contract.Requires <ArgumentException>(hub != IntPtr.Zero, "The pointer to the hub must be set."); Contract.Requires <ArgumentException>(userData != IntPtr.Zero, "The pointer to user data must be set."); Contract.Requires <NullReferenceException>(handler != null, "handler"); error = default(IntPtr); return(default(MyoResult)); }
private static void Run(IntPtr hubHandle, MyoRunHandler handler, IntPtr userData) { if (PlatformInvocation.Running32Bit) { run_32( hubHandle, 1000 / 20, handler, userData, IntPtr.Zero); } else { run_64( hubHandle, 1000 / 20, handler, userData, IntPtr.Zero); } }
private static extern MyoResult run_64(IntPtr hub, uint durationMs, MyoRunHandler handler, IntPtr userData, out IntPtr error);
/// <inheritdoc /> public MyoResult Run64(IntPtr hub, uint durationMs, MyoRunHandler handler, IntPtr userData, out IntPtr error) { return run_64(hub, durationMs, handler, userData, out error); }
private static extern MyoResult run_64(IntPtr hub, uint durationMs, MyoRunHandler handler, IntPtr userData, IntPtr error);
public void Run(IntPtr hubHandle, MyoRunHandler handler, IntPtr userData) { Contract.Requires <ArgumentException>(hubHandle != IntPtr.Zero, "The pointer to the hub must be set."); Contract.Requires <ArgumentNullException>(handler != null, "handler"); Contract.Requires <ArgumentException>(userData != IntPtr.Zero, "The pointer to the user data must be set."); }
public MyoResult Run64(IntPtr hub, uint durationMs, MyoRunHandler handler, IntPtr userData, out IntPtr error) { Contract.Requires<ArgumentException>(hub != IntPtr.Zero, "The pointer to the hub must be set."); Contract.Requires<ArgumentException>(userData != IntPtr.Zero, "The pointer to user data must be set."); Contract.Requires<NullReferenceException>(handler != null, "handler"); error = default(IntPtr); return default(MyoResult); }
/// <inheritdoc /> public MyoResult Run64(IntPtr hub, uint durationMs, MyoRunHandler handler, IntPtr userData, out IntPtr error) { return(run_64(hub, durationMs, handler, userData, out error)); }
public void Run(IntPtr hubHandle, MyoRunHandler handler, IntPtr userData) { Contract.Requires<ArgumentException>(hubHandle != IntPtr.Zero, "The pointer to the hub must be set."); Contract.Requires<ArgumentNullException>(handler != null, "handler"); Contract.Requires<ArgumentException>(userData != IntPtr.Zero, "The pointer to the user data must be set."); }
/// <inheritdoc /> public void Run(IntPtr hubHandle, MyoRunHandler handler, IntPtr userData) { var command = MyoCommand.Create( _myoErrorHandlerDriver, () => { IntPtr errorHandle; var result = PlatformInvocation.Running32Bit ? _channelBridge.Run32( hubHandle, 1000 / 20, handler, userData, out errorHandle) : _channelBridge.Run64( hubHandle, 1000 / 20, handler, userData, out errorHandle); return MyoCommandResult.Create(result, errorHandle); }); command.Execute(); }