QStringList pChar_2_QString(char *data, int size)
{
QByteArray byArr;
QString back_data;
byArr.resize(size);
for (int i = 0; i<size; i++)
byArr[i] = data[i];
QDataStream out(&byArr, QIODevice::ReadWrite);
while (!out.atEnd())
{
qint8 outchar = 0;
out >> outchar;
QString str = QString("%1").arg(outchar & 0xFF, 2, 16, QLatin1Char('0')).toUpper() + QString((" "));
back_data += str;
}
back_data.simplified();
QStringList outlist = back_data.split(" ");
if (outlist.last().isEmpty())
outlist.removeLast();
return outlist;
}
void Bytearry_2_String(QByteArray arry, QStringList &data){
char buf[ Len ] ; //数组
int len_array = arry.size();
int len_buf = sizeof(buf);
int len = qMin(len_array, len_buf);
memcpy(buf, arry, len); // 转化
data = pChar_2_QString(buf, Len);
return;
}