Ejemplo n.º 1
0
        /// <summary>
        /// CRC16校验器
        /// </summary>
        /// <param name="package"></param>
        /// <returns></returns>
        public static bool Crc16Checker(IProtocolPackage package)
        {
            var calcCrc = Check.GetCCITTCheck(package.GetBytes(), (ushort)(package.PackageLenth - 3));

            var protocolCrc = NumberConvert.BytesToUint16(package[StructureNames.CRCValue].ComponentBytes, 0, false);

            return(calcCrc == protocolCrc);
        }