Example #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);
            }
        }
Example #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");
            }
        }
Example #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);
            }
        }
        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);
            }
        }
Example #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();
        }
Example #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 },
                });
            }
        }
Example #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);
        }
Example #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);
        }
Example #12
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <SvakomProtocol>("Aogu SCB");
 }
Example #13
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <KiirooGen1Protocol>("ONYX");
 }
Example #14
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <YououProtocol>("Youou");
 }
Example #15
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <PrettyLoveProtocol>("Aogu BLE Device");
 }
Example #16
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <KiirooGen2Protocol>("Launch");
 }
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <LeloF1sProtocol>("F1s");
 }
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <MysteryVibeProtocol>("MV Crescendo");
 }
Example #19
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <PicobongProtocol>("Diver");
 }
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <LovehoneyDesireProtocol>("KNICKER VIBE");
 }
 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");
 }
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <LiBoProtocol>("PiPiJing");
 }
Example #24
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <RealovProtocol>("REALOV_VIBE");
 }
Example #25
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <LiBoProtocol>("LuXiaoHan");
 }
Example #26
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <VibratissimoProtocol>("Vibratissimo");
 }
Example #27
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <WeVibeProtocol>("Ditto");
 }
Example #28
0
 public async Task Init()
 {
     testUtil = new ProtocolTestUtils();
     await testUtil.SetupTest <AnerosProtocol>("Massage Demo");
 }