private async Task <ButtplugMessage> HandleSingleMotorVibrateCmd(ButtplugDeviceMessage aMsg, CancellationToken aToken) { var cmdMsg = CheckMessageHandler <SingleMotorVibrateCmd>(aMsg); return(await HandleVibrateCmd( VibrateCmd.Create(cmdMsg.DeviceIndex, cmdMsg.Id, cmdMsg.Speed, 6), aToken).ConfigureAwait(false)); }
public async Task TestVibrateCmd() { var expected = new List <(byte[], string)>() { (new byte[] { 0x00 }, Endpoints.Tx), (new byte[] { 0x02 }, Endpoints.TxMode), }; await testUtil.TestDeviceMessage(VibrateCmd.Create(4, 1, 0.5, 1), expected, false); expected = new List <(byte[], string)>() { }; await testUtil.TestDeviceMessage(VibrateCmd.Create(4, 1, 0.5, 1), expected, false); expected = new List <(byte[], string)>() { (new byte[] { 0x61 }, Endpoints.Tx), }; await testUtil.TestDeviceMessage(VibrateCmd.Create(4, 1, 0.5, 2), expected, false); }
public async Task SendVibrateCmd(IEnumerable <double> aCmds) { CheckAllowedMessageType <VibrateCmd>(); var msg = VibrateCmd.Create(aCmds); CheckGenericSubcommandList(msg.Speeds, GetMessageAttributes <VibrateCmd>().FeatureCount.Value); await SendMessageAsync(VibrateCmd.Create(aCmds)).ConfigureAwait(false); }
private async Task <ButtplugMessage> HandleSingleMotorVibrateCmd(ButtplugDeviceMessage aMsg) { if (!(aMsg is SingleMotorVibrateCmd cmdMsg)) { return(BpLogger.LogErrorMsg(aMsg.Id, Error.ErrorClass.ERROR_DEVICE, "Wrong Handler")); } return(await HandleVibrateCmd(VibrateCmd.Create(cmdMsg.DeviceIndex, cmdMsg.Id, cmdMsg.Speed, _vibratorCount))); }
public async Task TestVibrateCmd() { var expected = new List <(byte[], string)>() { (new byte[] { 0x0f, 0x03, 0x00, 0x4B, 0x00, 0x03, 0x00, 0x00 }, Endpoints.Tx), }; await testUtil.TestDeviceMessage(VibrateCmd.Create(4, 1, new[] { 0.25, 0.75 }), expected, false); }
public async Task TestVibrateCmd() { var expected = new List <(byte[], uint)>() { (new byte[] { 0x01, 0x01, 0x05 }, (uint)PicobongBluetoothInfo.Chrs.Tx), }; await testUtil.TestDeviceMessage(VibrateCmd.Create(4, 1, 0.5, 1), expected, false); }
public async Task TestVibrateCmd() { var expected = new List <(byte[], uint)>() { (new byte[] { 2 }, (uint)LiBoBluetoothInfo.Chrs.WriteVibrate), }; await testUtil.TestDeviceMessage(VibrateCmd.Create(4, 1, 0.5, 1), expected, false); }
public async Task TestVibrateCmd() { var expected = new List <(byte[], uint)>() { (Encoding.ASCII.GetBytes("$SYS,4?"), (uint)YoucupsBluetoothInfo.Chrs.Tx), }; await testUtil.TestDeviceMessage(VibrateCmd.Create(4, 1, 0.5, 1), expected, false); }
public async Task TestVibrateCmd() { var expected = new List <(byte[], uint)>() { (Encoding.ASCII.GetBytes("2,\n"), testUtil.NoCharacteristic), }; await testUtil.TestDeviceMessage(VibrateCmd.Create(4, 1, 0.5, 1), expected, false); }
public void TestVibrateCmd() { var expected = new List <(byte[], uint)>() { (new byte[] { 0x0f, 0x03, 0x00, 0x88, 0x00, 0x03, 0x00, 0x00 }, (uint)WeVibeBluetoothInfo.Chrs.Tx), }; testUtil.TestDeviceMessage(VibrateCmd.Create(4, 1, 0.5, 1), expected, false); }
public async Task TestVibrateCmd() { var expected = new List <(byte[], uint)>() { (new byte[] { 0x0f, 0x03, 0x00, 0x4B, 0x00, 0x03, 0x00, 0x00 }, (uint)WeVibeBluetoothInfo.Chrs.Tx), }; await testUtil.TestDeviceMessage(VibrateCmd.Create(4, 1, new[] { 0.25, 0.75 }), expected, false); }
public void TestVibrateCmd() { var expected = new List <(byte[], uint)>() { (new byte[] { 0x0b, 0xff, 0x04, 0x0a, 0x32, 0x32, 0x00, 0x04, 0x08, 0x80, 0x64, 0x00 }, (uint)MagicMotionBluetoothInfo.Chrs.Tx), }; testUtil.TestDeviceMessage(VibrateCmd.Create(4, 1, 0.5, 1), expected, false); }
public void TestVibrateCmd() { var expected = new List <(byte[], uint)>() { (new byte[] { 0x03, 0xff }, (uint)VibratissimoBluetoothInfo.Chrs.TxMode), (new byte[] { 0x80, 0x00 }, (uint)VibratissimoBluetoothInfo.Chrs.TxSpeed), }; testUtil.TestDeviceMessage(VibrateCmd.Create(4, 1, 0.5, 1), expected, false); }
public async Task TestVibrateCmd() { var expected = new List <(byte[], string)>() { (Enumerable.Repeat((byte)(MysteryVibeProtocol.MaxSpeed * 0.5), 6).ToArray(), Endpoints.TxVibrate), }; await testUtil.TestDeviceMessage(VibrateCmd.Create(4, 1, 0.5, 6), expected, false); }
public async Task TestVibrateCmd() { var expected = new List <(byte[], string)>() { (new byte[] { 0x55, 0x04, 0x03, 0x00, 0x01, 0x0A }, Endpoints.Tx), }; await testUtil.TestDeviceMessage(VibrateCmd.Create(4, 1, 0.5, 1), expected, false); }
public async Task TestVibrateCmd() { var expected = new List <(byte[], uint)>() { (Enumerable.Repeat((byte)(MysteryVibe.MaxSpeed * 0.5), 6).ToArray(), testUtil.NoCharacteristic), }; await testUtil.TestDeviceMessage(VibrateCmd.Create(4, 1, 0.5, 6), expected, false); }
public void TestVibrateCmd() { var expected = new List <(byte[], uint)>() { (Encoding.ASCII.GetBytes("Vibrate:10;"), testUtil.NoCharacteristic), }; testUtil.TestDeviceMessage(VibrateCmd.Create(4, 1, 0.5, 1), expected, false); }
public async Task TestVibrateCmd() { var expected = new List <(byte[], string)>() { (Encoding.ASCII.GetBytes("Vibrate:10;"), Endpoints.Tx), }; await testUtil.TestDeviceMessage(VibrateCmd.Create(4, 1, 0.5, 1), expected, false); }
private async Task <ButtplugMessage> HandleStopDeviceCmd([NotNull] ButtplugDeviceMessage aMsg, CancellationToken aToken) { BpLogger.Debug($"Stopping Device {Name}"); if (_devInfo.VibeCount == 0) { return(new Ok(aMsg.Id)); } return(await HandleVibrateCmd(VibrateCmd.Create(aMsg.DeviceIndex, aMsg.Id, 0, _devInfo.VibeCount), aToken).ConfigureAwait(false)); }
internal static Task <ServerMessage> SendVibrateCmd(ButtplugFFIMessageSorter aSorter, ButtplugFFIDeviceHandle aHandle, uint aDeviceindex, Dictionary <uint, double> aSpeeds) { var builder = new FlatBufferBuilder(1024); var command_list = new List <Offset <VibrateComponent> >(); foreach (var pair in aSpeeds) { VibrateComponent.StartVibrateComponent(builder); VibrateComponent.AddIndex(builder, pair.Key); VibrateComponent.AddSpeed(builder, pair.Value); var component = VibrateComponent.EndVibrateComponent(builder); command_list.Add(component); } var param_array = VibrateCmd.CreateSpeedsVector(builder, command_list.ToArray()); VibrateCmd.StartVibrateCmd(builder); VibrateCmd.AddSpeeds(builder, param_array); var cmd = VibrateCmd.EndVibrateCmd(builder); return(SendDeviceMessage(aSorter, aHandle, aDeviceindex, builder, DeviceMessageType.VibrateCmd, cmd.Value)); }
public void TestVibrateCmd() { void CheckMsg(VibrateCmd aMsg) { aMsg.Id.Should().Be(4); aMsg.DeviceIndex.Should().Be(2); aMsg.Speeds.Count.Should().Be(1); aMsg.Speeds[0].Index.Should().Be(0); aMsg.Speeds[0].Speed.Should().Be(0.5); } var msg = new VibrateCmd(2, new List <VibrateCmd.VibrateSubcommand> { new VibrateCmd.VibrateSubcommand(0, 0.5) }, 4); CheckMsg(msg); var newMsg = CheckParsedVersion <VibrateCmd>(msg, 1, "[{\"VibrateCmd\":{\"Speeds\":[{\"Index\":0,\"Speed\":0.5}],\"DeviceIndex\":2,\"Id\":4}}]"); CheckMsg(newMsg); _parser.Invoking(x => x.Serialize(msg, 0)).Should().Throw <ButtplugMessageException>(); }
public async Task SendVibrateCmd(double aSpeed) { CheckAllowedMessageType <VibrateCmd>(); await SendMessageAsync(VibrateCmd.Create(aSpeed, GetMessageAttributes <VibrateCmd>().FeatureCount.Value)).ConfigureAwait(false); }
private async Task <ButtplugMessage> HandleStopDeviceCmd([NotNull] ButtplugDeviceMessage aMsg) { BpLogger.Debug($"Stopping Device {Name}"); return(await HandleVibrateCmd(VibrateCmd.Create(aMsg.DeviceIndex, aMsg.Id, 0, _devInfo.VibeCount))); }