Esempio 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);
            }
        }
        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);
            }
        }
Esempio 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");
            }
        }
Esempio 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);
            }
        }
Esempio 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);
        }
        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);
            }
        }
Esempio 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();
        }
Esempio 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);
        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 },
                });
            }
        }
Esempio 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);
        }
Esempio 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);
        }
Esempio 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");
 }
Esempio n. 14
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <SvakomProtocol>("Aogu SCB");
 }
Esempio n. 15
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <KiirooGen1Protocol>("ONYX");
 }
Esempio n. 16
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <YououProtocol>("Youou");
 }
Esempio n. 17
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <PrettyLoveProtocol>("Aogu BLE Device");
 }
Esempio n. 18
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <KiirooGen2Protocol>("Launch");
 }
Esempio n. 19
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <LeloF1sProtocol>("F1s");
 }
Esempio n. 20
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <MysteryVibeProtocol>("MV Crescendo");
 }
Esempio n. 21
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <VibratissimoProtocol>("Vibratissimo");
 }
Esempio n. 22
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <PicobongProtocol>("Diver");
 }
Esempio n. 23
0
 public async Task Init()
 {
     await _testUtil.SetupTest <CuemeProtocol>("FUNCODE_");
 }
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <MagicMotionProtocol>("Krush");
 }
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <MagicMotionProtocol>("Smart Mini Vibe");
 }
Esempio n. 26
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <RealovProtocol>("REALOV_VIBE");
 }
Esempio n. 27
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <LiBoProtocol>("LuXiaoHan");
 }
Esempio n. 28
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <WeVibeProtocol>("Ditto");
 }
Esempio n. 29
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <AnerosProtocol>("Massage Demo");
 }