16,235
社区成员
发帖
与我相关
我的任务
分享
while(1)
{
ERROR_NO perr = ERR_UNKNOWN;
uint32 msgItem = portMessageQPend(gLocalUpdateUpdateStatusMsgQ, 0, &perr);
if (ERR_SUCCESS == perr)
{
mutex.lock();
LOCAL_UPDATE_MSG_ITEM item = *((LOCAL_UPDATE_MSG_ITEM*)&msgItem);
MEM_HANDLE hData = item.msg_data;
int dataLen = mem_len(hData);
unsigned char *buf = new unsigned char[dataLen];
mem_read(buf, dataLen, hData, 0, dataLen);
mem_free(hData);
if (item.msg_type == UPDATE_DATA_INFO)
{
char updateBuf[256] = {0};
char temp_buf[10];
for(int i = 0; i < dataLen; i++)
{
sprintf_s(temp_buf,10,"%02x,",buf[i]);
strcat(updateBuf, temp_buf);
}
strList.append(QString::fromLocal8Bit(updateBuf));
}
else
{
strList.append(QString::fromLocal8Bit((const char*)buf));
}
int count = strList.count();
if(count > 20)
strList.erase(strList.begin());
strModel.setStringList(strList);
delete[] buf;
mutex.unlock();
}
}