예제 #1
0
        public void UShort_address_40577_is_12_6_129()
        {
            var sut    = GroupAddress.FromUShort(40577);
            var result = sut.As3Level;

            Assert.Equal(new byte[] { 19, 6, 129 }, result);
        }
예제 #2
0
        public void UShort_address_775_is_0_3_7()
        {
            var sut    = GroupAddress.FromUShort(775);
            var result = sut.As3Level;

            Assert.Equal(new byte[] { 0, 3, 7 }, result);
        }
예제 #3
0
        private static KnxTelegramPayload ParseTunnelingRequest(KnxTelegramHeader arg1, byte[] arg2)
        {
            var dataLength = arg2[18] & 15;
            var cemiFrame  = new CemiFrame(
                (CemiFrame.MessageCodes)arg2[10],
                (CemiFrame.Control1Flags)arg2[12],
                (CemiFrame.Control2Flags)arg2[13],
                IndividualAddress.FromUShort((ushort)((arg2[14] << 8) + arg2[15])),
                GroupAddress.FromUShort((ushort)((arg2[16] << 8) + arg2[17])),
                arg2[18],
                (ushort)((arg2[19] << 8) + arg2[20]), new ArraySegment <byte>(arg2, 21, dataLength == 0 ? 0 : dataLength - 1)); // protect against unknown datagrams with datalength = 0

            return(new KnxTunnelingRequest(arg2[7], arg2[8], cemiFrame));
        }