QByteArray temp;
if(m_comm->bytesAvailable() >= 8)
{
temp = m_comm->readAll(); //读串口缓冲区数据
}
QDataStream out(&temp,QIODevice::ReadWrite); //将字节数组读入
while(!out.atEnd())
{
qint8 outChar = 0;
out>>outChar; //每字节填充一次,直到结束
QString str = QString("%1").arg(outChar&0xFF,2,16,QLatin1Char('0'));
//十六进制的转换
m_browser->insertPlainText(str);
}
m_browser->insertPlainText(tr("\n"));
if(m_comm->bytesAvailable() >= 8)
{
temp = m_comm->readAll(); //读串口缓冲区数据
}
QDataStream out(&temp,QIODevice::ReadWrite); //将字节数组读入
while(!out.atEnd())
{
qint8 outChar = 0;
out>>outChar; //每字节填充一次,直到结束
QString str = QString("%1").arg(outChar&0xFF,2,16,QLatin1Char('0'));
//十六进制的转换
m_browser->insertPlainText(str);
}
m_browser->insertPlainText(tr("\n"));