Ejemplo n.º 1
0
        public async Task TestSingleMotorVibrateCmd()
        {
            foreach (var item in KiirooGen21Protocol.DevInfos)
            {
                if (item.Value.VibeCount == 0)
                {
                    continue;
                }

                var testUtil = new ProtocolTestUtils();
                await testUtil.SetupTest <KiirooGen21Protocol>(item.Key);

                var expected = new byte[] { 1, 0 };
                for (var i = 0u; i < item.Value.VibeCount; ++i)
                {
                    item.Value.VibeOrder.Should().Contain(i);
                    expected[Array.IndexOf(item.Value.VibeOrder, i) + 1] = 50;
                }

                await testUtil.TestDeviceMessage(new SingleMotorVibrateCmd(4, 0.5),
                                                 new List <(byte[], string)>()
                {
                    (expected, Endpoints.Tx),
                }, false);
            }
        }
Ejemplo n.º 2
0
        public async Task TestVibrateCmd()
        {
            foreach (var item in KiirooGen2VibeProtocol.DevInfos)
            {
                var testUtil = new ProtocolTestUtils();
                await testUtil.SetupTest <KiirooGen2VibeProtocol>(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[], string)>()
                {
                    (expected, Endpoints.Tx),
                }, false);
            }
        }
Ejemplo n.º 3
0
        internal async Task TestAllowedMessages(string aDeviceName, VorzeSAProtocol.CommandType aCommandType)
        {
            testUtil = new ProtocolTestUtils();
            await testUtil.SetupTest <VorzeSAProtocol>(aDeviceName);

            if (aCommandType == VorzeSAProtocol.CommandType.Rotate)
            {
                testUtil.TestDeviceAllowedMessages(new Dictionary <System.Type, uint>()
                {
                    { typeof(StopDeviceCmd), 0 },
                    { typeof(VorzeA10CycloneCmd), 0 },
                    { typeof(RotateCmd), 1 },
                });
            }
            else if (aCommandType == VorzeSAProtocol.CommandType.Vibrate)
            {
                testUtil.TestDeviceAllowedMessages(new Dictionary <System.Type, uint>()
                {
                    { typeof(StopDeviceCmd), 0 },
                    { typeof(SingleMotorVibrateCmd), 0 },
                    { typeof(VibrateCmd), 1 },
                });
            }
            else
            {
                Assert.Fail("Unknown command type");
            }
        }
Ejemplo n.º 4
0
        public async Task TestAllowedMessages()
        {
            foreach (var item in KiirooGen21Protocol.DevInfos)
            {
                if (item.Value.VibeCount == 0)
                {
                    continue;
                }

                var testUtil = new ProtocolTestUtils();
                await testUtil.SetupTest <KiirooGen21Protocol>(item.Key);

                var expected = new Dictionary <Type, uint>()
                {
                    { typeof(StopDeviceCmd), 0 },
                    { typeof(SingleMotorVibrateCmd), 0 },
                    { typeof(VibrateCmd), item.Value.VibeCount },
                };

                if (item.Value.HasLinear)
                {
                    expected.Add(typeof(LinearCmd), 1);
                    expected.Add(typeof(FleshlightLaunchFW12Cmd), 0);
                }

                testUtil.TestDeviceAllowedMessages(expected);
            }
        }
Ejemplo n.º 5
0
        public async Task Init()
        {
            testUtil = new ProtocolTestUtils();

            // Just leave name the same as the prefix, we'll set device type via initialize.
            await testUtil.SetupTest <MotorbunnyProtocol>("MB Controller", false);
        }
Ejemplo n.º 6
0
        public async Task TestInvalidCmds()
        {
            foreach (var item in KiirooGen2VibeProtocol.DevInfos)
            {
                var testUtil = new ProtocolTestUtils();
                await testUtil.SetupTest <KiirooGen2VibeProtocol>(item.Key);

                testUtil.TestInvalidVibrateCmd(item.Value.VibeCount);
            }
        }
Ejemplo n.º 7
0
        public async Task Init()
        {
            testUtil = new ProtocolTestUtils();

            // Just leave name the same as the prefix, we'll set device type via initialize.
            await testUtil.SetupTest <LovenseProtocol>("LVS", false);

            testUtil.AddExpectedRead(Endpoints.Tx, Encoding.ASCII.GetBytes("W:39:000000000000"));
            await testUtil.Initialize();
        }
Ejemplo n.º 8
0
        public async Task TestRotateCmd(string aDeviceName, byte aPrefix)
        {
            testUtil = new ProtocolTestUtils();
            await testUtil.SetupTest <VorzeSAProtocol>(aDeviceName);

            var expected = new byte[] { aPrefix, 0x1, 50 };

            await testUtil.TestDeviceMessage(
                RotateCmd.Create(4, 1, 0.5, false, 1),
                new List <(byte[], string)>
            {
                (expected, Endpoints.Tx),
            }, false);
Ejemplo n.º 9
0
        public async Task TestAllowedMessages()
        {
            foreach (var item in KiirooGen2VibeProtocol.DevInfos)
            {
                var testUtil = new ProtocolTestUtils();
                await testUtil.SetupTest <KiirooGen2VibeProtocol>(item.Key);

                testUtil.TestDeviceAllowedMessages(new Dictionary <Type, uint>()
                {
                    { typeof(StopDeviceCmd), 0 },
                    { typeof(SingleMotorVibrateCmd), 0 },
                    { typeof(VibrateCmd), item.Value.VibeCount },
                });
            }
        }
Ejemplo n.º 10
0
        public async Task TestVorzeA10CycloneCmd(string aDeviceName, byte aPrefix)
        {
            testUtil = new ProtocolTestUtils();
            await testUtil.SetupTest <VorzeSAProtocol>(aDeviceName);

            var expected = new byte[] { aPrefix, 0x1, 50 };

            await testUtil.TestDeviceMessage(new VorzeA10CycloneCmd(4, 50, false),
                                             new List <(byte[], string)>()
            {
                (expected, Endpoints.Tx),
            }, false);

            expected = new byte[] { aPrefix, 0x1, 50 + 128 };

            await testUtil.TestDeviceMessage(new VorzeA10CycloneCmd(4, 50, true),
                                             new List <(byte[], string)>()
            {
                (expected, Endpoints.Tx),
            }, false);
        }
Ejemplo n.º 11
0
        // StopDeviceCmd noop test handled in GeneralDeviceTests

        internal async Task TestStopDeviceCmd(string aDeviceName, byte aPrefix, VorzeSAProtocol.CommandType aCommandType)
        {
            testUtil = new ProtocolTestUtils();
            await testUtil.SetupTest <VorzeSAProtocol>(aDeviceName);

            var expected = new byte[] { aPrefix, (byte)aCommandType, 50 };

            if (aCommandType == VorzeSAProtocol.CommandType.Rotate)
            {
                await testUtil.TestDeviceMessage(new VorzeA10CycloneCmd(4, 50, false),
                                                 new List <(byte[], string)>()
                {
                    (expected, Endpoints.Tx),
                }, false);
            }
            else if (aCommandType == VorzeSAProtocol.CommandType.Vibrate)
            {
                await testUtil.TestDeviceMessage(new SingleMotorVibrateCmd(4, 0.5),
                                                 new List <(byte[], string)>()
                {
                    (expected, Endpoints.Tx),
                }, false);
            }
            else
            {
                Assert.Fail("Unknown command type");
            }

            expected = new byte[] { aPrefix, (byte)aCommandType, 0 };

            await testUtil.TestDeviceMessage(new StopDeviceCmd(4),
                                             new List <(byte[], string)>()
            {
                (expected, Endpoints.Tx),
            }, false);
        }
Ejemplo n.º 12
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <LiBoProtocol>("PiPiJing");
 }
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <LovehoneyDesireProtocol>("KNICKER VIBE");
 }
Ejemplo n.º 14
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <SvakomProtocol>("Aogu SCB");
 }
Ejemplo n.º 15
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <KiirooGen1Protocol>("ONYX");
 }
Ejemplo n.º 16
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <YououProtocol>("Youou");
 }
Ejemplo n.º 17
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <PrettyLoveProtocol>("Aogu BLE Device");
 }
Ejemplo n.º 18
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <KiirooGen2Protocol>("Launch");
 }
Ejemplo n.º 19
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <LeloF1sProtocol>("F1s");
 }
Ejemplo n.º 20
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <MysteryVibeProtocol>("MV Crescendo");
 }
Ejemplo n.º 21
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <VibratissimoProtocol>("Vibratissimo");
 }
Ejemplo n.º 22
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <PicobongProtocol>("Diver");
 }
Ejemplo n.º 23
0
 public async Task Init()
 {
     await _testUtil.SetupTest <CuemeProtocol>("FUNCODE_");
 }
Ejemplo n.º 24
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <MagicMotionProtocol>("Krush");
 }
Ejemplo n.º 25
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <MagicMotionProtocol>("Smart Mini Vibe");
 }
Ejemplo n.º 26
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <RealovProtocol>("REALOV_VIBE");
 }
Ejemplo n.º 27
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <LiBoProtocol>("LuXiaoHan");
 }
Ejemplo n.º 28
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <WeVibeProtocol>("Ditto");
 }
Ejemplo n.º 29
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <AnerosProtocol>("Massage Demo");
 }