Example #1
0
        public void MockEcuStreamDefoggerTest()
        {
            MockEcuStream stream = MockEcuStream.CreateInstance();

            stream.DefoggerSwitch = false;
            SsmPacket send = SsmPacket.CreateBlockReadRequest(0x64, 1);

            byte[]    payload = new byte[1];
            SsmPacket receive = SsmPacket.CreateBlockReadResponse(payload);

            MockEcuStreamTest.SendReceive("Defogger off", stream, send, receive);

            stream.DefoggerSwitch = true;
            send       = SsmPacket.CreateBlockReadRequest(0x64, 1);
            payload    = new byte[1];
            payload[0] = 1 << 5;
            receive    = SsmPacket.CreateBlockReadResponse(payload);
            MockEcuStreamTest.SendReceive("Defogger on", stream, send, receive);

            stream.DefoggerSwitch = false;
            send    = SsmPacket.CreateBlockReadRequest(0x64, 1);
            payload = new byte[1];
            receive = SsmPacket.CreateBlockReadResponse(payload);
            MockEcuStreamTest.SendReceive("Defogger off again", stream, send, receive);
        }
Example #2
0
        public void MockEcuStreamBlockRead()
        {
            MockEcuStream stream = MockEcuStream.CreateInstance();
            SsmPacket     send   = SsmPacket.CreateBlockReadRequest(0x200000, 128);

            byte[]    payload = new byte[128];
            SsmPacket receive = SsmPacket.CreateBlockReadResponse(payload);

            MockEcuStreamTest.SendReceive("Read", stream, send, receive);
        }
Example #3
0
        public void SsmPacketCreateArbitrary()
        {
            SsmPacket expectedReadRequest = SsmPacket.CreateBlockReadRequest(123, 12);
            SsmPacket actualReadRequest   = SsmPacket.CreateArbitrary(
                0x10,
                (byte)SsmCommand.ReadBlockRequest,
                true,
                new byte[] { 0, 0, 123, 11, });

            Utility.CompareArrays("Block read request", expectedReadRequest.Data, actualReadRequest.Data);
        }
Example #4
0
        public void SsmPacketBlockReadRequest()
        {
            int          address  = 0x200000;
            byte         length   = 0x80;
            SsmPacket    packet   = SsmPacket.CreateBlockReadRequest(address, length);
            IList <byte> expected = SamplePacketData.BlockReadRequest;

            Utility.CompareArrays("BlockReadRequest", expected, packet.Data);
            Assert.AreEqual(SsmDirection.ToEcu, packet.Direction, "Direction");
            Assert.AreEqual(SsmCommand.ReadBlockRequest, packet.Command, "Command");
            Assert.AreEqual(address, packet.BlockStart, "Block start");
            Assert.AreEqual(length, packet.BlockLength, "Block length");
        }