public void TestVorzeA10CycloneCmd() { byte deviceIndex = 1; foreach (var name in _deviceNames) { testUtil = new BluetoothDeviceTestUtils <VorzeSABluetoothInfo>(); testUtil.SetupTest(name); var expected = new byte[] { deviceIndex, 0x1, 50 }; testUtil.TestDeviceMessage(new VorzeA10CycloneCmd(4, 50, false), new List <(byte[], uint)>() { (expected, (uint)VorzeSABluetoothInfo.Chrs.Tx), }, false); expected = new byte[] { deviceIndex, 0x1, 50 + 128 }; testUtil.TestDeviceMessage(new VorzeA10CycloneCmd(4, 50, true), new List <(byte[], uint)>() { (expected, (uint)VorzeSABluetoothInfo.Chrs.Tx), }, false); deviceIndex++; } }
public async Task TestFleshlightLaunchFW12Cmd() { await testUtil.TestDeviceMessage(new FleshlightLaunchFW12Cmd(4, 50, 50), new List <(byte[], uint)>() { (new byte[] { 50, 50 }, (uint)KiirooOnyx2BluetoothInfo.Chrs.Tx), }, false); }
public void TestFleshlightLaunchFW12Cmd() { testUtil.TestDeviceMessage(new FleshlightLaunchFW12Cmd(4, 50, 50), new List <(byte[], uint)>() { (new byte[2] { 50, 50 }, (uint)FleshlightLaunchBluetoothInfo.Chrs.Tx), }, false); }
public async Task TestVibrateCmd() { foreach (var item in KiirooGen2Vibe.DevInfos) { var testUtil = new BluetoothDeviceTestUtils <KiirooGen2VibeBluetoothInfo>(); await testUtil.SetupTest(item.Key); var speeds = new[] { 0.25, 0.5, 0.75 }; var features = new List <VibrateCmd.VibrateSubcommand>(); for (var i = 0u; i < item.Value.VibeCount; ++i) { features.Add(new VibrateCmd.VibrateSubcommand(i, speeds[i])); } var expected = new byte[] { 0, 0, 0 }; for (var i = 0u; i < item.Value.VibeCount; ++i) { item.Value.VibeOrder.Should().Contain(i); expected[Array.IndexOf(item.Value.VibeOrder, i)] = (byte)(speeds[i] * 100); } await testUtil.TestDeviceMessage(new VibrateCmd(4, features), new List <(byte[], uint)>() { (expected, (uint)KiirooGen2VibeBluetoothInfo.Chrs.Tx), }, false); } }
public void TestSingleMotorVibrateCmd() { var expected = new List <(byte[], uint)>() { (new byte[] { 0x03, 0xff }, (uint)VibratissimoBluetoothInfo.Chrs.TxMode), (new byte[] { 0x80, 0x00 }, (uint)VibratissimoBluetoothInfo.Chrs.TxSpeed), }; testUtil.TestDeviceMessage(new SingleMotorVibrateCmd(4, 0.5), expected, false); testUtil.TestDeviceMessageNoop(new SingleMotorVibrateCmd(4, 0.5)); expected = new List <(byte[], uint)>() { (new byte[] { 0x03, 0xff }, (uint)VibratissimoBluetoothInfo.Chrs.TxMode), (new byte[] { 0xff, 0x00 }, (uint)VibratissimoBluetoothInfo.Chrs.TxSpeed), }; testUtil.TestDeviceMessage(new SingleMotorVibrateCmd(4, 1), expected, false); }
public async Task TestStopDeviceCmd() { var expected = new List <(byte[], uint)>() { (Enumerable.Repeat((byte)(MysteryVibe.MaxSpeed * 0.5), 6).ToArray(), testUtil.NoCharacteristic), }; await testUtil.TestDeviceMessage(new SingleMotorVibrateCmd(4, 0.5), expected, false); expected = new List <(byte[], uint)>() { (MysteryVibe.NullSpeed, testUtil.NoCharacteristic), }; await testUtil.TestDeviceMessageOnWrite(new StopDeviceCmd(4), expected, false); }
public void TestStopDeviceCmd() { var expected = new List <(byte[], uint)>() { (Encoding.ASCII.GetBytes("Vibrate:10;"), testUtil.NoCharacteristic), }; testUtil.TestDeviceMessage(new SingleMotorVibrateCmd(4, 0.5), expected, false); expected = new List <(byte[], uint)>() { (Encoding.ASCII.GetBytes("Vibrate:0;"), testUtil.NoCharacteristic), }; testUtil.TestDeviceMessage(new StopDeviceCmd(4), expected, false); }
public void TestStopDeviceCmd() { var expected = new List <(byte[], uint)>() { (new byte[] { 0x0f, 0x03, 0x00, 0x88, 0x00, 0x03, 0x00, 0x00 }, (uint)WeVibeBluetoothInfo.Chrs.Tx), }; testUtil.TestDeviceMessage(new SingleMotorVibrateCmd(4, 0.5), expected, false); expected = new List <(byte[], uint)>() { (new byte[] { 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, (uint)WeVibeBluetoothInfo.Chrs.Tx), }; testUtil.TestDeviceMessage(new StopDeviceCmd(4), expected, false); }
public async Task TestStopDeviceCmd() { var expected = new List <(byte[], uint)>() { (new byte[] { 0x01, 0x01, 0x05 }, (uint)PicobongBluetoothInfo.Chrs.Tx), }; await testUtil.TestDeviceMessage(new SingleMotorVibrateCmd(4, 0.5), expected, false); expected = new List <(byte[], uint)>() { (new byte[] { 0x01, 0xff, 0x00 }, (uint)PicobongBluetoothInfo.Chrs.Tx), }; await testUtil.TestDeviceMessage(new StopDeviceCmd(4), expected, false); }
public async Task TestStopDeviceCmd() { var expected = new List <(byte[], uint)>() { (new byte[] { 2 }, (uint)LiBoBluetoothInfo.Chrs.WriteVibrate), }; await testUtil.TestDeviceMessage(new SingleMotorVibrateCmd(4, 0.5), expected, false); expected = new List <(byte[], uint)>() { (new byte[] { 0 }, (uint)LiBoBluetoothInfo.Chrs.WriteVibrate), }; await testUtil.TestDeviceMessage(new StopDeviceCmd(4), expected, false); }
public async Task TestStopDeviceCmd() { var expected = new List <(byte[], uint)>() { (Encoding.ASCII.GetBytes("$SYS,4?"), (uint)YoucupsBluetoothInfo.Chrs.Tx), }; await testUtil.TestDeviceMessage(new SingleMotorVibrateCmd(4, 0.5), expected, false); expected = new List <(byte[], uint)>() { (Encoding.ASCII.GetBytes("$SYS,0?"), (uint)YoucupsBluetoothInfo.Chrs.Tx), }; await testUtil.TestDeviceMessage(new StopDeviceCmd(4), expected, false); }
public async Task TestStopDeviceCmd() { var expected = new List <(byte[], uint)>() { (Encoding.ASCII.GetBytes("2,\n"), testUtil.NoCharacteristic), }; await testUtil.TestDeviceMessage(new SingleMotorVibrateCmd(4, 0.5), expected, false); expected = new List <(byte[], uint)>() { (Encoding.ASCII.GetBytes("0,\n"), testUtil.NoCharacteristic), }; await testUtil.TestDeviceMessage(new StopDeviceCmd(4), expected, false); }
public void TestStopDeviceCmd() { 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(new SingleMotorVibrateCmd(4, 0.5), expected, false); expected = new List <(byte[], uint)>() { (new byte[] { 0x0b, 0xff, 0x04, 0x0a, 0x32, 0x32, 0x00, 0x04, 0x08, 0x00, 0x64, 0x00 }, (uint)MagicMotionBluetoothInfo.Chrs.Tx), }; testUtil.TestDeviceMessage(new StopDeviceCmd(4), expected, false); }
public void TestStopDeviceCmd() { var expected = new List <(byte[], uint)>() { (Encoding.ASCII.GetBytes("Rotate:10;"), testUtil.NoCharacteristic), }; testUtil.TestDeviceMessage(RotateCmd.Create(4, 1, 0.5, true, 1), expected, false); expected = new List <(byte[], uint)>() { (Encoding.ASCII.GetBytes("Rotate:0;"), testUtil.NoCharacteristic), }; testUtil.TestDeviceMessage(new StopDeviceCmd(4), expected, false); }
public async Task TestKiirooCmd() { var expected = new List <(byte[], uint)>() { (Encoding.ASCII.GetBytes("3,\n"), testUtil.NoCharacteristic), }; await testUtil.TestDeviceMessage(new KiirooCmd(4, 3), expected, false); }
public async Task TestVorzeA10CycloneCmd(string aDeviceName, byte aPrefix) { testUtil = new BluetoothDeviceTestUtils <VorzeSABluetoothInfo>(); await testUtil.SetupTest(aDeviceName); var expected = new byte[] { aPrefix, 0x1, 50 }; await testUtil.TestDeviceMessage(new VorzeA10CycloneCmd(4, 50, false), new List <(byte[], uint)>() { (expected, (uint)VorzeSABluetoothInfo.Chrs.Tx), }, false); expected = new byte[] { aPrefix, 0x1, 50 + 128 }; await testUtil.TestDeviceMessage(new VorzeA10CycloneCmd(4, 50, true), new List <(byte[], uint)>() { (expected, (uint)VorzeSABluetoothInfo.Chrs.Tx), }, false); }
public async Task TestRotateCmd(string aDeviceName, byte aPrefix) { testUtil = new BluetoothDeviceTestUtils <VorzeSABluetoothInfo>(); await testUtil.SetupTest(aDeviceName); var expected = new byte[] { aPrefix, 0x1, 50 }; await testUtil.TestDeviceMessage( RotateCmd.Create(4, 1, 0.5, false, 1), new List <(byte[], uint)> { (expected, (uint)VorzeSABluetoothInfo.Chrs.Tx), }, false);
// StopDeviceCmd noop test handled in GeneralDeviceTests internal async Task TestStopDeviceCmd(string aDeviceName, byte aPrefix, VorzeSA.CommandType aCommandType) { testUtil = new BluetoothDeviceTestUtils <VorzeSABluetoothInfo>(); await testUtil.SetupTest(aDeviceName); var expected = new byte[] { aPrefix, (byte)aCommandType, 50 }; if (aCommandType == VorzeSA.CommandType.Rotate) { await testUtil.TestDeviceMessage(new VorzeA10CycloneCmd(4, 50, false), new List <(byte[], uint)>() { (expected, (uint)VorzeSABluetoothInfo.Chrs.Tx), }, false); } else if (aCommandType == VorzeSA.CommandType.Vibrate) { await testUtil.TestDeviceMessage(new SingleMotorVibrateCmd(4, 0.5), new List <(byte[], uint)>() { (expected, (uint)VorzeSABluetoothInfo.Chrs.Tx), }, false); } else { Assert.Fail("Unknown command type"); } expected = new byte[] { aPrefix, (byte)aCommandType, 0 }; await testUtil.TestDeviceMessage(new StopDeviceCmd(4), new List <(byte[], uint)>() { (expected, (uint)VorzeSABluetoothInfo.Chrs.Tx), }, false); }
public void TestSingleMotorVibrateCmd() { foreach (var item in KiirooGen2Vibe.DevInfos) { var testUtil = new BluetoothDeviceTestUtils <KiirooGen2VibeBluetoothInfo>(); testUtil.SetupTest(item.Key); var expected = new byte[] { 0, 0, 0 }; for (var i = 0u; i < item.Value.VibeCount; ++i) { Assert.True(item.Value.VibeOrder.Contains(i)); expected[Array.IndexOf(item.Value.VibeOrder, i)] = 50; } testUtil.TestDeviceMessage(new SingleMotorVibrateCmd(4, 0.5), new List <(byte[], uint)>() { (expected, (uint)KiirooGen2VibeBluetoothInfo.Chrs.Tx), }, false); } }