quint8 caculateChecksum(QByteArray buf, int len) { int i; quint8 checksum = 0; for(i=0;i<len;i++) { checksum^=buf.at(i); } #if (BEDUG_PRINT_CHECK) qDebug()<<QString("#异或校验#校验值:0x%1").arg(checksum,0,16); #endif return checksum; }