Exemple #1
0
        public void BrickUpdater_50_00_Update_Test_005()
        {
            var Command = new Command_50_01();

            Command.ResData     = new byte[11];
            Command.ResData[4]  = 0x02;
            Command.ResData[5]  = 0x03;
            Command.ResData[6]  = 0x00;
            Command.ResData[7]  = 0x80;
            Command.ResData[8]  = 0x02;
            Command.ResData[9]  = 0xAA;
            Command.ResData[10] = 0x55;

            var Updater = new BrickUpdater_50_01();
            var Brick   = Ev3Brick.GetInstance();

            Updater.Update(Command, Brick);

            Assert.IsTrue(Brick.SensorDevice(3).IsConnected);
            Assert.AreEqual((Ev3SensorDevice.INPORT) 3, Brick.SensorDevice(3).ConnectedPort);
            Assert.AreEqual(-32768, Brick.SensorDevice(3).Value2);
            Assert.AreEqual(Ev3SensorDevice.DEVICE_TYPE.SENSOR_DEVICE_GYRO,
                            Brick.SensorDevice(3).DeviceType);
            Assert.IsTrue(Brick.SensorDevice(2).IsConnected);
            Assert.AreEqual((Ev3SensorDevice.INPORT) 2, Brick.SensorDevice(2).ConnectedPort);
            Assert.AreEqual(0x55AA, Brick.SensorDevice(2).Value2);
            Assert.AreEqual(Ev3SensorDevice.DEVICE_TYPE.SENSOR_DEVICE_GYRO,
                            Brick.SensorDevice(2).DeviceType);
        }
Exemple #2
0
        public void BrickUpdater_50_00_Update_Test_003()
        {
            var Command = new Command_50_01();

            Command.ResData    = new byte[8];
            Command.ResData[4] = 0x01;
            Command.ResData[5] = 0x02;
            Command.ResData[6] = 0xFF;
            Command.ResData[7] = 0x7F;

            var Updater = new BrickUpdater_50_01();
            var Brick   = Ev3Brick.GetInstance();

            Updater.Update(Command, Brick);

            Assert.IsTrue(Brick.SensorDevice(2).IsConnected);
            Assert.AreEqual((Ev3SensorDevice.INPORT) 2, Brick.SensorDevice(2).ConnectedPort);
            Assert.AreEqual(0x7FFF, Brick.SensorDevice(2).Value2);
            Assert.AreEqual(Ev3SensorDevice.DEVICE_TYPE.SENSOR_DEVICE_GYRO,
                            Brick.SensorDevice(2).DeviceType);
        }