Exemple #1
0
        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++;
            }
        }
Exemple #2
0
        internal async Task TestAllowedMessages(string aDeviceName, VorzeSA.CommandType aCommandType)
        {
            testUtil = new BluetoothDeviceTestUtils <VorzeSABluetoothInfo>();
            await testUtil.SetupTest(aDeviceName);

            if (aCommandType == VorzeSA.CommandType.Rotate)
            {
                testUtil.TestDeviceAllowedMessages(new Dictionary <System.Type, uint>()
                {
                    { typeof(StopDeviceCmd), 0 },
                    { typeof(VorzeA10CycloneCmd), 0 },
                    { typeof(RotateCmd), 1 },
                });
            }
            else if (aCommandType == VorzeSA.CommandType.Vibrate)
            {
                testUtil.TestDeviceAllowedMessages(new Dictionary <System.Type, uint>()
                {
                    { typeof(StopDeviceCmd), 0 },
                    { typeof(SingleMotorVibrateCmd), 0 },
                    { typeof(VibrateCmd), 1 },
                });
            }
            else
            {
                Assert.Fail("Unknown command type");
            }
        }
Exemple #3
0
        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);
            }
        }
Exemple #4
0
 public void Init()
 {
     testUtil = new BluetoothDeviceTestUtils <LovenseBluetoothInfo>();
     // Just leave name the same as the prefix, we'll set device type via initialize.
     testUtil.SetupTest("LVS", false);
     testUtil.AddExpectedRead(testUtil.NoCharacteristic, Encoding.ASCII.GetBytes("A:13:000000000000"));
     testUtil.Initialize();
 }
Exemple #5
0
 public void TestInvalidVibrateCmd()
 {
     foreach (var item in KiirooGen2Vibe.DevInfos)
     {
         var testUtil = new BluetoothDeviceTestUtils <KiirooGen2VibeBluetoothInfo>();
         testUtil.SetupTest(item.Key);
         testUtil.TestInvalidVibrateCmd(item.Value.VibeCount);
     }
 }
Exemple #6
0
        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);
Exemple #7
0
 public void TestAllowedMessages()
 {
     foreach (var name in _deviceNames)
     {
         testUtil = new BluetoothDeviceTestUtils <VorzeSABluetoothInfo>();
         testUtil.SetupTest(name);
         testUtil.TestDeviceAllowedMessages(new Dictionary <System.Type, uint>()
         {
             { typeof(StopDeviceCmd), 0 },
             { typeof(VorzeA10CycloneCmd), 0 },
             { typeof(RotateCmd), 1 },
         });
     }
 }
Exemple #8
0
 public void TestAllowedMessages()
 {
     foreach (var item in KiirooGen2Vibe.DevInfos)
     {
         var testUtil = new BluetoothDeviceTestUtils <KiirooGen2VibeBluetoothInfo>();
         testUtil.SetupTest(item.Key);
         testUtil.TestDeviceAllowedMessages(new Dictionary <System.Type, uint>()
         {
             { typeof(StopDeviceCmd), 0 },
             { typeof(SingleMotorVibrateCmd), 0 },
             { typeof(VibrateCmd), item.Value.VibeCount },
         });
     }
 }
Exemple #9
0
 public void TestInvalidVibrateCmd()
 {
     foreach (var name in _deviceNames)
     {
         testUtil = new BluetoothDeviceTestUtils <VorzeSABluetoothInfo>();
         testUtil.SetupTest(name);
         testUtil.TestInvalidDeviceMessage(RotateCmd.Create(4, 1, 0.5, false, 0));
         testUtil.TestInvalidDeviceMessage(RotateCmd.Create(4, 1, 0.5, false, 2));
         testUtil.TestInvalidDeviceMessage(
             new RotateCmd(4, new List <RotateCmd.RotateSubcommand>()
         {
             new RotateCmd.RotateSubcommand(0xffffffff, 0.5, true),
         }));
     }
 }
Exemple #10
0
        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);
            }
        }
Exemple #11
0
        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);
        }
Exemple #12
0
        // 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);
        }
Exemple #13
0
 public void Init()
 {
     testUtil = new BluetoothDeviceTestUtils <MagicMotionBluetoothInfo>();
     testUtil.SetupTest("Smart Mini Vibe");
 }
Exemple #14
0
 public void Init()
 {
     testUtil = new BluetoothDeviceTestUtils <YoucupsBluetoothInfo>();
     testUtil.SetupTest("Youcups");
 }
 public void Init()
 {
     testUtil = new BluetoothDeviceTestUtils <VibratissimoBluetoothInfo>();
     testUtil.SetupTest("Vibratissimo");
 }
Exemple #16
0
 public async Task Init()
 {
     testUtil = new BluetoothDeviceTestUtils <MysteryVibeBluetoothInfo>();
     await testUtil.SetupTest("MV Crescendo");
 }
Exemple #17
0
 public void Init()
 {
     testUtil = new BluetoothDeviceTestUtils <FleshlightLaunchBluetoothInfo>();
     testUtil.SetupTest("Launch");
 }
Exemple #18
0
 public async Task Init()
 {
     testUtil = new BluetoothDeviceTestUtils <YoucupsBluetoothInfo>();
     await testUtil.SetupTest("Youcups");
 }
Exemple #19
0
 public async Task Init()
 {
     testUtil = new BluetoothDeviceTestUtils <FleshlightLaunchBluetoothInfo>();
     await testUtil.SetupTest("Launch");
 }
Exemple #20
0
 public async Task Init()
 {
     testUtil = new BluetoothDeviceTestUtils <MagicMotionBluetoothInfo>();
     await testUtil.SetupTest("Smart Mini Vibe");
 }
Exemple #21
0
 public async Task Init()
 {
     testUtil = new BluetoothDeviceTestUtils <MagicMotionBluetoothInfo>();
     await testUtil.SetupTest("Eidolon");
 }
Exemple #22
0
 public async Task Init()
 {
     testUtil = new BluetoothDeviceTestUtils <LiBoBluetoothInfo>();
     await testUtil.SetupTest("PiPiJing");
 }
Exemple #23
0
 public void Init()
 {
     testUtil = new BluetoothDeviceTestUtils <LiBoBluetoothInfo>();
     testUtil.SetupTest("PiPiJing");
 }
Exemple #24
0
 public async Task Init()
 {
     testUtil = new BluetoothDeviceTestUtils <PicobongBluetoothInfo>();
     await testUtil.SetupTest("Diver");
 }
 public void Init()
 {
     testUtil = new BluetoothDeviceTestUtils <WeVibeBluetoothInfo>();
     testUtil.SetupTest("4plus");
 }
 public void Init()
 {
     testUtil = new BluetoothDeviceTestUtils <KiirooOnyx2BluetoothInfo>();
     testUtil.SetupTest("Onyx2");
 }
Exemple #27
0
 public async Task Init()
 {
     testUtil = new BluetoothDeviceTestUtils <KiirooOnyx2BluetoothInfo>();
     await testUtil.SetupTest("Onyx2");
 }
Exemple #28
0
 public async Task Init()
 {
     testUtil = new BluetoothDeviceTestUtils <VibratissimoBluetoothInfo>();
     await testUtil.SetupTest("Vibratissimo");
 }
Exemple #29
0
 public void Init()
 {
     testUtil = new BluetoothDeviceTestUtils <MysteryVibeBluetoothInfo>();
     testUtil.SetupTest("MV Crescendo");
 }
Exemple #30
0
 public void Init()
 {
     testUtil = new BluetoothDeviceTestUtils <KiirooBluetoothInfo>();
     testUtil.SetupTest("PEARL");
 }