Exemple #1
0
        private byte[] GetBuffFromPQ(int doorIndex, bool FE, byte door)
        {
            byte[] buff = Num.GetHexByte(pqStr);
            buff[1] = (byte)doorIndex;//内机地址
            if (door == 3)
            {
                buff[6] = 0xFA;//写入正确的机型
            }
            else
            {
                buff[6] = 0x00;
            }
            cMideaSnCode.Crc(buff, cMideaSnCode.CrcList.PQ, ref buff[8]);//重算校验
            byte[] result = new byte[10];
            int    index  = 0;

            if (FE)//是否加前面的0xFE冗余码
            {
                result          = new byte[12];
                result[index++] = 0xFE;
            }
            for (int i = index, j = 0; i < result.Length && j < buff.Length; i++, j++)
            {
                result[index++] = buff[j];
            }
            if (FE)//结尾加上0xFE冗余码
            {
                result[index++] = 0xFE;
            }
            return(result);
        }