修改分包接收前板发的YUV数据,取图成功后保存YUV图和JPG图

This commit is contained in:
2024-09-03 15:58:23 +08:00
parent 15eb213578
commit c6e16094b9
18 changed files with 3799 additions and 123 deletions

View File

@@ -142,13 +142,11 @@ void ClientHandler::sendJsonItem(const QJsonArray& jsonArray, int itemIndex, con
isClickedSend = true;
isRecvImgData = false;
if (itemType == "handleVideo") {
if (itemIndex == 0) {
qDebug() << "0 itemIndex: " << itemIndex;
if (itemIndex == 0) {
isSingleSend = false;
isClickedSend = false;
}
else {
qDebug() << "!0 itemIndex: " << itemIndex;
stopReadVideoDataTimer(preVideoClientId);
}
}
@@ -157,8 +155,8 @@ void ClientHandler::sendJsonItem(const QJsonArray& jsonArray, int itemIndex, con
isClickedSend = false;
isRecvImgData = true;
}
qDebug() << "itemIndex" << itemIndex;
qDebug() << "jsonArray.size()" << jsonArray.size();
//qDebug() << "itemIndex" << itemIndex;
//qDebug() << "jsonArray.size()" << jsonArray.size();
if (itemIndex >= 0 && itemIndex < jsonArray.size()) {
currentItemIndex = (itemType == "test") ? itemIndex : 0;
currentFuncItemIndex = (itemType == "func") ? itemIndex : 0;
@@ -210,7 +208,6 @@ void ClientHandler::sendGetPicItem(int itemIndex, int GetPicCamIndex)
void ClientHandler::sendGetVideoItem(int itemIndex, int GetVideoCamIndex)
{
qDebug() << "sendGetVideoItem itemIndex:" << itemIndex;
qDebug() << "sendGetVideoItem GetVideoCamIndex:" << GetVideoCamIndex;
if(isBackBoardOrAllBoard) {
sendJsonItem(getVideoJson, itemIndex, QString::number(GetVideoCamIndex), "handleVideo");
}
@@ -521,7 +518,7 @@ void ClientHandler::setThreadPriority(QThread::Priority priority) {
QThread* thread = QThread::currentThread();
if (thread) {
thread->setPriority(priority);
qDebug() << "Thread priority set to" << priority << "for clientId:" << clientId;
//qDebug() << "Thread priority set to" << priority << "for clientId:" << clientId;
}
else {
qWarning() << "Failed to set thread priority. Current thread is null.";
@@ -531,7 +528,6 @@ void ClientHandler::setThreadPriority(QThread::Priority priority) {
// 处理数据接收
void ClientHandler::onDataReceived()
{
// 接收其他数据 添加区分 视频与其他数据 的标志位
//qDebug() << "isRecvVideoData:" << isRecvVideoData;
//qDebug() << "isPowerOnSend:" << isPowerOnSend;
//qDebug() << "isClickedSend:" << isClickedSend;
@@ -556,20 +552,16 @@ void ClientHandler::onDataReceived()
emit startTimeout(0);
}
if (!allData.isEmpty()) {
//emit dataReceived(getClientAddress(), allData, 0xFF, currentItemIndex, currentFuncItemIndex, "", "");
emit dataReceived(getClientAddress(), allData, 0xFF, currentItemIndex, currentFuncItemIndex, getCurrentItemLable(), "", currentJson, currentJsonItem);
if (!isSingleSend && !isPowerOnSend) {
currentItemIndex ++;
itemsProcessedCount ++;
}
}
// 由于启动了 onTimeoutRead 所以 isSingleSend = false 导致连续发送
//if (isSingleSend && clientId >= 4) {
if (isSingleSend) {
isSingleSend = false; // 重置标志
isSingleSend = false;
isClickedSend = false;
}
else if (isPowerOnSend && currentFrontBoardIndex < frontBoardDevInfoJson.size()) {
sendDevInfoItem();
}