解析定位标签数据

 

void anasysData(QByteArray baRevDataParam)
{
    int Datalen = sizeof(stuDevData);
    int Revlen = baRevDataParam.size();
    int num = 0;

    int remainder = Revlen%Datalen;//求余
    if (remainder != 0)
    {
        qDebug() << QString::fromLocal8Bit("数据错误");
        return "";
    }
    num = Revlen / Datalen;
    if (num > 0)
    {
        //收到的16进制数先转成字符串
        QString Hexstr = baRevDataParam.toHex().toUpper();
        QByteArray ba = Hexstr.toLatin1();

        uint8_t *pbuf = (uint8_t *)baRevDataParam.data();
        stuDevData *stuData = (stuDevData*)pbuf;

        int tagID = stuData->TAG_ID;
        int serialNum = stuData->seq_num;
        int x_value = stuData->pos[0];
        int y_value = stuData->pos[1];
        int z_value = stuData->pos[2];
        int num = stuData->seq_num;
        int Elct = stuData->Precision;

        qDebug() << QString::fromLocal8Bit("收到标签数据:") << ba.data();
        qDebug() << QString::fromLocal8Bit("标签ID:") << tagID;
        
        qDebug() << QString::fromLocal8Bit("序列号:") << serialNum;
        qDebug() << QString::fromLocal8Bit("坐  标:") << "X-" << stuData->pos[0] << " " << "Y-" << stuData->pos[1] << " " << "Z-" << stuData->pos[2];
        
        qDebug() << QString::fromLocal8Bit("电  量:") << Elct;
        qDebug() << "\r\n";
      
        emit signalDrawTadPoint(tagID, serialNum, x_value, y_value, z_value, Elct);
    }

}

解析定位标签数据_第1张图片

 

你可能感兴趣的:(解析定位标签数据)