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"); } }
// 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); }