当前位置: 首页>>代码示例>>C#>>正文


C# MockSerialConnection.EnqueueRequestAndResponse方法代码示例

本文整理汇总了C#中Solid.Arduino.Test.MockSerialConnection.EnqueueRequestAndResponse方法的典型用法代码示例。如果您正苦于以下问题:C# MockSerialConnection.EnqueueRequestAndResponse方法的具体用法?C# MockSerialConnection.EnqueueRequestAndResponse怎么用?C# MockSerialConnection.EnqueueRequestAndResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Solid.Arduino.Test.MockSerialConnection的用法示例。


在下文中一共展示了MockSerialConnection.EnqueueRequestAndResponse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConfigureServo_PinNumber_Is128

        public void ConfigureServo_PinNumber_Is128()
        {
            var connection = new MockSerialConnection();
            var session = CreateServoSession(connection);

            connection.EnqueueRequestAndResponse(new byte[] { 0xF0, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00 });
            session.ConfigureServo(128, 0, 0);
        }
开发者ID:nahueltaibo,项目名称:Arduino,代码行数:8,代码来源:IServoProtocolTester.cs

示例2: ConfigureServo_MinPulse_Is0x4000

        public void ConfigureServo_MinPulse_Is0x4000()
        {
            var connection = new MockSerialConnection();
            var session = CreateServoSession(connection);

            connection.EnqueueRequestAndResponse(new byte[] { 0xF0, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00 });
            session.ConfigureServo(0, 0x4000, 0);
        }
开发者ID:nahueltaibo,项目名称:Arduino,代码行数:8,代码来源:IServoProtocolTester.cs

示例3: ConfigureServo_MaxPulse_IsNegative

        public void ConfigureServo_MaxPulse_IsNegative()
        {
            var connection = new MockSerialConnection();
            var session = CreateServoSession(connection);

            connection.EnqueueRequestAndResponse(new byte[] { 0xF0, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF7 });
            session.ConfigureServo(15, 0, -1);
        }
开发者ID:nahueltaibo,项目名称:Arduino,代码行数:8,代码来源:IServoProtocolTester.cs

示例4: SetI2CReadInterval_Interval_Is0x3FFF

        public void SetI2CReadInterval_Interval_Is0x3FFF()
        {
            var connection = new MockSerialConnection();
            var session = CreateFirmataSession(connection);

            connection.EnqueueRequestAndResponse(new byte[] { 0xF0, 0x78, 0x7F, 0x7F, 0xF7 });
            session.SetI2CReadInterval(0x3FFF);
        }
开发者ID:nahueltaibo,项目名称:Arduino,代码行数:8,代码来源:I2cProtocolTester.cs

示例5: GetProtocolVersionAsync

        public void GetProtocolVersionAsync()
        {
            var connection = new MockSerialConnection();
            var session = CreateFirmataSession(connection);

            connection.EnqueueRequestAndResponse(new byte[] { 0xF9 }, new byte[] { 0xF9, 2, 3 });
            ProtocolVersion version = session.GetProtocolVersionAsync().Result;
            Assert.AreEqual(2, version.Major);
            Assert.AreEqual(3, version.Minor);
            Assert.AreEqual(1, _messagesReceived.Count);
        }
开发者ID:nahueltaibo,项目名称:Arduino,代码行数:11,代码来源:IFirmataProtocolTester.cs

示例6: ResetBoard

        public void ResetBoard()
        {
            var connection = new MockSerialConnection();
            var session = CreateFirmataSession(connection);

            connection.EnqueueRequestAndResponse(new byte[] { 0xFF }, new byte[] { 0xF9, 2, 3 });
            session.ResetBoard();

            Assert.AreEqual(1, _messagesReceived.Count);
            FirmataMessage message = _messagesReceived.Dequeue();
            Assert.AreEqual(MessageType.ProtocolVersion, message.Type);
            var version = (ProtocolVersion)message.Value;
            Assert.AreEqual(2, version.Major);
            Assert.AreEqual(3, version.Minor);
        }
开发者ID:nahueltaibo,项目名称:Arduino,代码行数:15,代码来源:IFirmataProtocolTester.cs

示例7: GetFirmware

        public void GetFirmware()
        {
            const int majorVersion = 3;
            const int minorVersion = 7;
            const string Name = "Arduino Firmata";

            var connection = new MockSerialConnection();
            var session = new ArduinoSession(connection);

            connection.EnqueueRequestAndResponse(new byte[] { 0xF0, 0x79, 0xF7 }, new byte[] { 0xF0, 0x79, majorVersion, minorVersion });
            connection.EnqueueResponse(Name.To14BitIso());
            connection.EnqueueResponse(0xF7);

            Firmware firmware = session.GetFirmware();
            Assert.AreEqual(firmware.MajorVersion, majorVersion);
            Assert.AreEqual(firmware.MinorVersion, minorVersion);
            Assert.AreEqual(firmware.Name, Name);
        }
开发者ID:nahueltaibo,项目名称:Arduino,代码行数:18,代码来源:IFirmataProtocolTester.cs

示例8: SetAnalogReportMode_Channel_Is15_Disable

        public void SetAnalogReportMode_Channel_Is15_Disable()
        {
            var connection = new MockSerialConnection();
            var session = CreateFirmataSession(connection);

            connection.EnqueueRequestAndResponse(new byte[] { 0xCF, 0x00 });
            session.SetAnalogReportMode(15, false);
        }
开发者ID:nahueltaibo,项目名称:Arduino,代码行数:8,代码来源:IFirmataProtocolTester.cs

示例9: SetSamplingInterval_Interval_Is0

        public void SetSamplingInterval_Interval_Is0()
        {
            var connection = new MockSerialConnection();
            var session = CreateFirmataSession(connection);

            connection.EnqueueRequestAndResponse(new byte[] { 0xF0, 0x7A, 0x00, 0x00, 0xF7 });
            session.SetSamplingInterval(0);
        }
开发者ID:nahueltaibo,项目名称:Arduino,代码行数:8,代码来源:IFirmataProtocolTester.cs

示例10: ConfigureServo_MinPulse_EQ_MaxPulse

        public void ConfigureServo_MinPulse_EQ_MaxPulse()
        {
            var connection = new MockSerialConnection();
            var session = CreateServoSession(connection);

            connection.EnqueueRequestAndResponse(new byte[] { 0xF0, 0x70, 0x01, 0x01, 0x02, 0x01, 0x02, 0xF7 });
            session.ConfigureServo(1, 257, 257);
        }
开发者ID:nahueltaibo,项目名称:Arduino,代码行数:8,代码来源:IServoProtocolTester.cs

示例11: SetDigitalPinMode_PinNumber_Is128

        public void SetDigitalPinMode_PinNumber_Is128()
        {
            var connection = new MockSerialConnection();
            var session = CreateFirmataSession(connection);

            connection.EnqueueRequestAndResponse(new byte[] { 0xF4, 0x00, (byte)PinMode.DigitalInput });
            session.SetDigitalPinMode(128, PinMode.DigitalInput);
        }
开发者ID:nahueltaibo,项目名称:Arduino,代码行数:8,代码来源:IFirmataProtocolTester.cs

示例12: MixedOrderResponses

        public void MixedOrderResponses()
         {
             var connection = new MockSerialConnection();
             var session = CreateFirmataSession(connection, 3);

            // We get first ProtocolVersion response and then FirmwareResponse
            connection.EnqueueRequestAndResponse(new byte[] { 0xF0, 0x79, 0xF7 },
                new byte[]
                {
                    0xF9, 0x02, 0x04, 0xF0, 
                    0x79, 
                    0x01, 0x03,                    
                    0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00,
                    0xF7
                });
             var f = session.GetFirmware();
             Assert.AreEqual(1, f.MajorVersion);
             Assert.AreEqual(3, f.MinorVersion);
             Assert.AreEqual("test", f.Name);
         }
开发者ID:nahueltaibo,项目名称:Arduino,代码行数:20,代码来源:IFirmataProtocolTester.cs

示例13: GetPinState_PinNumber_Argument_Is127_Returned_Pin0

        public void GetPinState_PinNumber_Argument_Is127_Returned_Pin0()
        {
            var connection = new MockSerialConnection();
            var session = CreateFirmataSession(connection);

            connection.EnqueueRequestAndResponse(new byte[] { 0xF0, 0x6D, 0x7F, 0xF7 }, 0xF0, 0x6E);
            // Pin 0 analog mode, value = 1023
            connection.EnqueueResponse(0x00, 0x02, 0x7F, 0x07);
            connection.EnqueueResponse(0xF7);

            PinState state = session.GetPinState(127);

            Assert.AreEqual(0, state.PinNumber);
            Assert.AreEqual(PinMode.AnalogInput, state.Mode);
            Assert.AreEqual(1023U, state.Value);
        }
开发者ID:nahueltaibo,项目名称:Arduino,代码行数:16,代码来源:IFirmataProtocolTester.cs

示例14: SetDigitalPort_Pins_Argument_IsNegative

        public void SetDigitalPort_Pins_Argument_IsNegative()
        {
            var connection = new MockSerialConnection();
            var session = CreateFirmataSession(connection);

            connection.EnqueueRequestAndResponse(new byte[] { 0x90, 0x00, 0x00 });
            session.SetDigitalPort(0, -1);
        }
开发者ID:nahueltaibo,项目名称:Arduino,代码行数:8,代码来源:IFirmataProtocolTester.cs

示例15: SetDigitalPort_PortNumber_Is0_Pins_Is0

        public void SetDigitalPort_PortNumber_Is0_Pins_Is0()
        {
            var connection = new MockSerialConnection();
            var session = CreateFirmataSession(connection);

            connection.EnqueueRequestAndResponse(new byte[] { 0x90, 0x00, 0x00 });
            session.SetDigitalPort(0, 0);
        }
开发者ID:nahueltaibo,项目名称:Arduino,代码行数:8,代码来源:IFirmataProtocolTester.cs


注:本文中的Solid.Arduino.Test.MockSerialConnection.EnqueueRequestAndResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。