1.增加整机测试工厂信息输入; 2. 增加前后板连接后自动发送获取设备版本信息指令; 3. 优化UI布局代码

This commit is contained in:
钟富强 2024-09-10 11:29:44 +08:00
parent 9a49eab4af
commit 843b2058c3
377 changed files with 197841 additions and 231069 deletions

View File

@ -78,6 +78,7 @@
<None Include="SourceCode\Json\JsonFile\backBoardTest.json" />
<None Include="SourceCode\Json\JsonFile\backBoardUuid.json" />
<None Include="SourceCode\Json\JsonFile\backDevInfo.json" />
<None Include="SourceCode\Json\JsonFile\factoryProductInfo.json" />
<None Include="SourceCode\Json\JsonFile\frontBoardFuncConfig.json" />
<None Include="SourceCode\Json\JsonFile\frontBoardLicense.json" />
<None Include="SourceCode\Json\JsonFile\frontBoardOneClickTest.json" />
@ -96,6 +97,7 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="SourceCode\Json\readJsonFile.h" />
<ClInclude Include="SourceCode\Widget\UI_Widget\UI_Name.h" />
<QtMoc Include="SourceCode\LicenseGenerate\LicenseConfirmWindow.h" />
<ClInclude Include="SourceCode\LicenseGenerate\LicenseGenerate.h" />
<ClInclude Include="SourceCode\LicenseGenerate\p_code.h" />

View File

@ -208,6 +208,9 @@
<None Include="SourceCode\Json\JsonFile\backBoardUuid.json">
<Filter>Json\JsonFile</Filter>
</None>
<None Include="SourceCode\Json\JsonFile\factoryProductInfo.json">
<Filter>Json\JsonFile</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Filter Include="Widget">
@ -308,6 +311,9 @@
<ClInclude Include="SourceCode\Network\mdns\qmdnsengine\include\qmdnsengine_export.h">
<Filter>Network\mdns\qmdnsengine\include</Filter>
</ClInclude>
<ClInclude Include="SourceCode\Widget\UI_Widget\UI_Name.h">
<Filter>Widget\UI_Widget</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="icon.rc" />

View File

@ -89,13 +89,13 @@
"cmd": "VIDEO_TEST",
"val": 0,
"lable": "开启视频",
"timeout": 2000
"timeout": 0
},
{
"cmd": "VIDEO_TEST",
"val": 1,
"lable": "关闭视频",
"timeout": 2000
"timeout": 0
},
{
"cmd": "WIFI_SIGNAL_TEST",

View File

@ -1,19 +1,20 @@
[
{
"cmd": "GET_BACK_MAC",
"val": 0,
"val": "0",
"lable": "get_MAC_addr",
"timeout": 0
},
{
"cmd": "GET_BACK_UUID_SN",
"val": 0,
"val": "0",
"lable": "get_UUID_SN",
"timeout": 0
},
{
"cmd": "WRITE_BACK_UUID_SN",
"val": 0,
"UUID": "123",
"SN": "123",
"lable": "write_UUID_SN",
"timeout": 0
}

View File

@ -0,0 +1,26 @@
[
{
"cmd": "FACTORY_ID",
"val": "1",
"lable": "工厂ID:",
"timeout": 0
},
{
"cmd": "FACTORY_LABEL",
"val": "0",
"lable": "设备出厂标签:",
"timeout": 0
},
{
"cmd": "FACTORY_BATCH",
"val": "0",
"lable": "设备出厂批次:",
"timeout": 0
},
{
"cmd": "FACTORY_DEVICE_TYPE",
"val": "0",
"lable": "设备型号:",
"timeout": 0
}
]

View File

@ -69,13 +69,13 @@
"cmd": "GET_IMG",
"val": 0,
"lable": "左边镜头取图",
"timeout": 2000
"timeout": 0
},
{
"cmd": "GET_IMG",
"val": 1,
"lable": "右边镜头取图",
"timeout": 2000
"timeout": 0
},
{
"cmd": "TOUCH_TEST",

View File

@ -142,13 +142,13 @@
{
"cmd": "IR_LED",
"val": 1,
"lable": "IR灯测试",
"lable": "IR灯",
"timeout": 2000
},
{
"cmd": "IR_LED",
"val": 0,
"lable": "IR灯测试",
"lable": "IR灯",
"timeout": 2000
},
{

View File

@ -78,3 +78,7 @@ QJsonArray readJson_getPic() {
QJsonArray readJson_getVideo() {
return readJsonArrayFromFile("./SourceCode/Json/JsonFile/getVideo.json");
}
QJsonArray readJson_factoryProductInfo() {
return readJsonArrayFromFile("./SourceCode/Json/JsonFile/factoryProductInfo.json");
}

View File

@ -19,6 +19,8 @@ QJsonArray readJson_backBoardFuncConfig();
QJsonArray readJson_backDevInfo();
QJsonArray readJson_backUuid();
QJsonArray readJson_factoryProductInfo();
QJsonArray readJson_testConfig();
QJsonArray readJson_funcConfig();

View File

@ -4,7 +4,9 @@
FFmpegDecoder::FFmpegDecoder(QObject* parent) :
QThread(parent),
videoLabel(nullptr),
videoLabel_back(nullptr),
resolutionEdit(nullptr),
resolutionEdit_back(nullptr),
abort(false),
restart(false),
formatContext(nullptr),
@ -24,6 +26,7 @@ FFmpegDecoder::~FFmpegDecoder()
qDebug() << "Destroying FFmpegDecoder thread";
mutex.lock();
abort = true;
isStartVideo = false;
condition.wakeOne();
mutex.unlock();
wait();
@ -34,7 +37,13 @@ FFmpegDecoder::~FFmpegDecoder()
void FFmpegDecoder::processVideo(int itemIndex)
{
QLabel* originalLabel = this->videoLabel;
QLabel* originalLabel;
if (isBackBoardOrAllBoard) {
originalLabel = this->videoLabel_back;
}
else {
originalLabel = this->videoLabel;
}
if ((FocusWindowWidth != 0) && (FocusWindowHeight != 0)) {
qDebug() << "------ processVideo";
FocusWindowDialog* dialog = nullptr;
@ -54,25 +63,18 @@ void FFmpegDecoder::processVideo(int itemIndex)
qDebug() << "------ Other scaled resolutions use 480x640";
dialog = new FocusWindowDialog(nullptr, QSize(480, 640));
}
#if 0
// 将视频显示的 QLabel 切换为对话框内的 videoDisplayLabel
this->videoLabel = dialog->videoDisplayLabel;
if ((dialog->exec() == QDialog::Accepted) || (dialog->exec() == QDialog::Rejected)) {
this->videoLabel = originalLabel;
}
#else
mutex.lock();
this->videoLabelTemp = dialog->videoDisplayLabel; // 更新临时标签
this->videoLabelChanged = true; // 设置标志位,表示标签已更改
this->videoLabelTemp = dialog->videoDisplayLabel;
this->videoLabelChanged = true;
mutex.unlock();
if ((dialog->exec() == QDialog::Accepted) || (dialog->exec() == QDialog::Rejected)) {
mutex.lock();
this->videoLabelTemp = originalLabel; // 还原回原始标签
this->videoLabelChanged = true; // 设置标志位
this->videoLabelTemp = originalLabel;
this->videoLabelChanged = true;
mutex.unlock();
}
#endif
delete dialog;
}
else {
@ -89,17 +91,23 @@ void FFmpegDecoder::initialize()
void FFmpegDecoder::stopFFmpegDecoder()
{
mutex.lock();
abort = true;
abort = true;
isStartVideo = false;
condition.wakeOne();
mutex.unlock();
}
void FFmpegDecoder::decodeFile(const QString& videoFilePath, QLabel* videoDisplayLabel, QLineEdit* VideoResolutionEdit)
void FFmpegDecoder::decodeFile(const QString& videoFilePath, int isBackBoardOrAllBoard,
QLabel* videoDisplayLabel, QLabel* videoDisplayLabel_back,
QLineEdit* VideoResolutionEdit, QLineEdit* VideoResolutionEdit_back)
{
QMutexLocker locker(&mutex);
this->filePath = videoFilePath;
this->videoLabel = videoDisplayLabel;
this->resolutionEdit = VideoResolutionEdit;
this->filePath = videoFilePath;
this->videoLabel = videoDisplayLabel;
this->videoLabel_back = videoDisplayLabel_back;
this->resolutionEdit = VideoResolutionEdit;
this->resolutionEdit_back = VideoResolutionEdit_back;
this->isBackBoardOrAllBoard = isBackBoardOrAllBoard;
if (!isRunning()) {
qDebug() << "Starting decoder thread";
start(NormalPriority);
@ -112,7 +120,13 @@ void FFmpegDecoder::run()
{
QFile file(filePath);
qint64 fileSize = 0;
QLabel* currentVideoLabel = videoLabel;
QLabel* currentVideoLabel;
if (isBackBoardOrAllBoard) {
currentVideoLabel = videoLabel_back;
}
else {
currentVideoLabel = videoLabel;
}
while (!isInterruptionRequested()) {
mutex.lock();
while (!restart && !abort) {
@ -132,18 +146,19 @@ void FFmpegDecoder::run()
currentVideoLabel->setFixedSize(labelSize);
qDebug() << "Adjusting video label size to: Width =" << labelSize.width() << ", Height =" << labelSize.height();
}
qDebug() << "Video label size: Width =" << labelSize.width() << ", Height =" << labelSize.height();
//qDebug() << "Video label size: Width =" << labelSize.width() << ", Height =" << labelSize.height();
if (!file.open(QIODevice::ReadOnly)) {
qWarning() << "Failed to open file:" << filePath;
continue;
}
if (!initializeFFmpeg(filePath)) {
qDebug() << "Failed to initialize FFmpeg for file:" << filePath;
//qDebug() << "Failed to initialize FFmpeg for file:" << filePath;
cleanup();
file.close();
continue;
}
isStartVideo = true;
restart = false;
while (!abort) {
qint64 currentFileSize = file.size();
@ -220,7 +235,7 @@ bool FFmpegDecoder::initializeFFmpeg(const QString& filePath)
}
if (avformat_find_stream_info(formatContext, nullptr) < 0) {
qWarning() << "Failed to retrieve stream info";
//qWarning() << "Failed to retrieve stream info";
return false;
}
@ -300,8 +315,14 @@ QImage FFmpegDecoder::avFrameToQImage(AVFrame* frame)
FocusWindowHeight = height;
}
QString resolutionText = QString::number(width) + " x " + QString::number(height);
//resolutionEdit->setText(resolutionText);
QMetaObject::invokeMethod(resolutionEdit, "setText", Qt::QueuedConnection, Q_ARG(QString, resolutionText));
if (isBackBoardOrAllBoard) {
QMetaObject::invokeMethod(resolutionEdit_back, "setText", Qt::QueuedConnection, Q_ARG(QString, resolutionText));
}
else {
QMetaObject::invokeMethod(resolutionEdit, "setText", Qt::QueuedConnection, Q_ARG(QString, resolutionText));
}
//qDebug() << "H264 video resolution: Width =" << frame->width << ", Height =" << frame->height;
AVPixelFormat pixFmt = (AVPixelFormat)frame->format;

View File

@ -38,8 +38,11 @@ public:
explicit FFmpegDecoder(QObject* parent = nullptr);
~FFmpegDecoder() override;
bool isStartVideo = false;
void initialize();
void decodeFile(const QString& videoFilePath, QLabel* videoLabel, QLineEdit* VideoResolutionEdit);
void decodeFile(const QString& videoFilePath, int isBackBoardOrAllBoard, QLabel* videoLabel, QLabel* videoDisplayLabel_back,
QLineEdit* VideoResolutionEdit, QLineEdit* VideoResolutionEdit_back);
void decodeSingleFrame(const QByteArray& data, QLabel* videoLabel); // 添加 videoLabel 参数
void FFmpegDecoder::processVideo(int itemIndex);
bool initializeFFmpeg(const QString& filePath);
@ -56,12 +59,15 @@ private:
QWaitCondition condition;
QString filePath;
QLabel* videoLabel;
QLabel* videoLabel_back;
QLabel* videoLabelTemp; // 临时存储新标签
QLineEdit* resolutionEdit;
QLineEdit* resolutionEdit_back;
bool videoLabelChanged = false;
bool abort;
bool restart;
bool isGotResolution = false;
int isBackBoardOrAllBoard = 0;
AVFormatContext* formatContext;
AVCodecContext* codecContext;

View File

@ -75,7 +75,7 @@ void ClientHandler::resetCurrentItemIndex()
void ClientHandler::start()
{
resetCurrentItemIndex(); // 初始化计数器和索引
sendNextItem();
//sendNextItem();
}
// 处理客户端断开连接
@ -91,7 +91,7 @@ void ClientHandler::startReadVideoDataTimer(int client_Id)
{
//emit startReadTimer(clientId);
emit startReadTimer(client_Id);
//qDebug() << "------ startClientReadTimer clientId:" << clientId;
qDebug() << "------ startClientReadTimer clientId:" << clientId;
}
void ClientHandler::stopReadVideoDataTimer(int client_Id)
@ -175,21 +175,40 @@ void ClientHandler::sendDataToClient(const QByteArray& data)
emit sendData(data, isBackBoardOrAllBoard);
}
void ClientHandler::sendJsonItem(const QJsonArray& jsonArray, int itemIndex, const QString text, const QString& itemType)
void ClientHandler::sendJsonItem(const QJsonArray& jsonArray, int itemIndex, const QString text, const QString backBoardSn, const QString& itemType)
{
startReadVideoDataTimer(preVideoClientId);
currentJson = jsonArray;
currentJsonItem = itemIndex;
QMutexLocker locker(&mutex);
if (itemType == "License") {
}
isSingleSend = true;
isClickedSend = true;
isRecvImgData = false;
if (jsonArray == backBoardTest) {
QJsonObject tempItem = jsonArray[itemIndex].toObject();
if (tempItem["cmd"] == "VIDEO_TEST") {
if (tempItem["val"] == 0) {
isSingleSend = false;
isClickedSend = false;
isRecvVideoData = true;
isStartVideo = true;
startReadVideoDataTimer(isBackBoardOrAllBoard);
}
else if (tempItem["val"] == 1) {
isRecvVideoData = false;
isStartVideo = false;
stopReadVideoDataTimer(isBackBoardOrAllBoard);
}
}
}
if (itemType == "handleVideo") {
if (itemIndex == 0) {
isSingleSend = false;
isClickedSend = false;
isClickedSend = false;
}
else {
stopReadVideoDataTimer(preVideoClientId);
@ -200,12 +219,15 @@ void ClientHandler::sendJsonItem(const QJsonArray& jsonArray, int itemIndex, con
isClickedSend = false;
isRecvImgData = true;
}
//qDebug() << "itemIndex" << itemIndex;
//qDebug() << "jsonArray.size()" << jsonArray.size();
if (itemType == "Uuid") {
}
qDebug() << "itemIndex" << itemIndex;
qDebug() << "jsonArray.size()" << jsonArray.size();
if (itemIndex >= 0 && itemIndex < jsonArray.size()) {
currentItemIndex = (itemType == "test") ? itemIndex : 0;
currentFuncItemIndex = (itemType == "func") ? itemIndex : 0;
QJsonObject currentItem = jsonArray[itemIndex].toObject();
currentItem = jsonArray[itemIndex].toObject();
if (!text.isEmpty() && currentItem.contains("val")) {
QJsonValue originalValue = currentItem["val"];
qDebug() << "text:" << text;
@ -223,12 +245,47 @@ void ClientHandler::sendJsonItem(const QJsonArray& jsonArray, int itemIndex, con
currentItem["val"] = text;
}
}
else if (!text.isEmpty() && currentItem.contains("UUID") && currentItem.contains("SN")) {
QJsonValue originalUUID = currentItem["UUID"];
QJsonValue originalSN = currentItem["SN"];
qDebug() << "UUID:" << text;
qDebug() << "SN:" << backBoardSn;
if (originalUUID.isDouble()) {
bool ok;
double doubleValue = text.toDouble(&ok);
if (ok) {
currentItem["UUID"] = doubleValue;
}
else {
qWarning() << "Text conversion to double failed, original value is kept.";
}
}
else if (originalUUID.isString()) {
currentItem["UUID"] = text;
}
if (originalSN.isDouble()) {
bool ok;
double doubleValue = backBoardSn.toDouble(&ok);
if (ok) {
currentItem["SN"] = doubleValue;
}
else {
qWarning() << "backBoardSn conversion to double failed, original value is kept.";
}
}
else if (originalSN.isString()) {
currentItem["SN"] = backBoardSn;
}
}
QString itemData = QJsonDocument(currentItem).toJson();
//emit sendData(itemData.toUtf8());
emit sendDataToSomeClient(controlClientId, itemData.toUtf8());
// 设置超时处理
if (isBackBoardOrAllBoard) {
emit sendDataToSomeClient(isBackBoardOrAllBoard, itemData.toUtf8());
}
else {
emit sendDataToSomeClient(controlClientId, itemData.toUtf8());
}
if (currentItem.contains("timeout")) {
qDebug() << "sendJsonItem currentItem.contains(\"timeout\")";
int timeout = currentItem.value("timeout").toInt();
if (timeout > 0) {
emit startTimeout(timeout);
@ -240,13 +297,13 @@ void ClientHandler::sendJsonItem(const QJsonArray& jsonArray, int itemIndex, con
// 发送获取设备信息按键
void ClientHandler::sendGetDevInfoItem(int itemIndex)
{
sendJsonItem(getDevInfoJson, itemIndex, "", "devInfo");
sendJsonItem(getDevInfoJson, itemIndex, "", "", "devInfo");
}
// 发送取图按键
void ClientHandler::sendGetPicItem(int itemIndex, int GetPicCamIndex)
{
sendJsonItem(getPicJson, itemIndex, QString::number(GetPicCamIndex), "getPic");
sendJsonItem(getPicJson, itemIndex, QString::number(GetPicCamIndex), "", "getPic");
}
// 发送拉视频按键
@ -254,122 +311,162 @@ void ClientHandler::sendGetVideoItem(int itemIndex, int GetVideoCamIndex)
{
qDebug() << "sendGetVideoItem itemIndex:" << itemIndex;
if(isBackBoardOrAllBoard) {
sendJsonItem(getVideoJson, itemIndex, QString::number(GetVideoCamIndex), "handleVideo");
sendJsonItem(getVideoJson, itemIndex, QString::number(GetVideoCamIndex), "", "handleVideo");
}
else {
sendJsonItem(getVideoJson, itemIndex, QString::number(GetVideoCamIndex), "handleVideo");
sendJsonItem(getVideoJson, itemIndex, QString::number(GetVideoCamIndex), "", "handleVideo");
}
}
// 发送License处理按键
void ClientHandler::sendLicenseItem(int itemIndex, const QString text)
{
if (itemIndex < 0 || itemIndex >= frontBoardLicenseJson.size()) {
qDebug() << "Invalid itemIndex";
if (isBackBoardOrAllBoard != 0) {
emit HandleInvalidOperate("当前连接的是后板或整机,请勿操作前板页面的按键!!!");
return;
}
sendJsonItem(frontBoardLicenseJson, itemIndex, text, "License");
else {
if (itemIndex < 0 || itemIndex >= frontBoardLicenseJson.size()) {
qDebug() << "Invalid itemIndex";
return;
}
sendJsonItem(frontBoardLicenseJson, itemIndex, text, "", "License");
}
}
void ClientHandler::sendUuidItem(int itemIndex, const QString text)
void ClientHandler::sendUuidItem(int itemIndex, const QString backBoardUuid, const QString backBoardSn)
{
qDebug() << "ClientHandler::sendUuidItem itemIndex:" << itemIndex;
if (isBackBoardOrAllBoard == 0) {
emit HandleInvalidOperate("当前连接的是前板,请勿操作后板或整机页面的按键!!!");
return;
}
else {
if (itemIndex < 0 || itemIndex >= backBoardUuidJson.size()) {
qDebug() << "Invalid itemIndex";
return;
}
sendJsonItem(backBoardUuidJson, itemIndex, backBoardUuid, backBoardSn, "Uuid");
}
}
// 发送单独一个功能配置 JSON 项目
void ClientHandler::sendFrontFuncItem(int itemIndex, const QString text)
{
//qDebug() << "sendFuncItem Text:" << text;
sendJsonItem(frontBoardFuncConfig, itemIndex, text, "func");
if (isBackBoardOrAllBoard != 0) {
emit HandleInvalidOperate("当前连接的是后板或整机,请勿操作前板页面的按键!!!");
return;
}
else {
//qDebug() << "sendFuncItem Text:" << text;
sendJsonItem(frontBoardFuncConfig, itemIndex, text, "", "func");
}
}
void ClientHandler::sendBackFuncItem(int itemIndex, const QString text)
{
//qDebug() << "sendFuncItem Text:" << text;
sendJsonItem(backBoardFuncConfig, itemIndex, text, "func");
if (isBackBoardOrAllBoard == 0) {
emit HandleInvalidOperate("当前连接的是前板,请勿操作后板或整机页面的按键!!!");
return;
}
else {
//qDebug() << "sendFuncItem Text:" << text;
sendJsonItem(backBoardFuncConfig, itemIndex, text, "", "func");
}
}
// 发送单独一个测试配置 JSON 项目
void ClientHandler::sendFrontItem(int itemIndex)
{
QString text = "";
QJsonObject currentItem = frontBoardTest[itemIndex].toObject();
if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "IMG_ENROLL") {
ImageEnrollWindow dialog;
if (dialog.exec() == QDialog::Accepted) {
text = dialog.getFilePath();
QByteArray imageData = dialog.getImageData();
if (!imageData.isEmpty()) {
text = QString::fromUtf8(imageData);
if (isBackBoardOrAllBoard != 0) {
emit HandleInvalidOperate("当前连接的是后板或整机,请勿操作前板页面的按键!!!");
return;
}
else {
QString text = "";
QJsonObject currentItem = frontBoardTest[itemIndex].toObject();
if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "IMG_ENROLL") {
ImageEnrollWindow dialog;
if (dialog.exec() == QDialog::Accepted) {
text = dialog.getFilePath();
QByteArray imageData = dialog.getImageData();
if (!imageData.isEmpty()) {
text = QString::fromUtf8(imageData);
}
}
else {
return;
}
}
else {
return;
}
}
else if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "DEL_USER") {
DelUserWindow dialog;
if (dialog.exec() == QDialog::Accepted) {
QString userInput = dialog.getUserInput();
if (!userInput.isEmpty() && currentItem.contains("val")) {
text = userInput;
else if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "DEL_USER") {
DelUserWindow dialog;
if (dialog.exec() == QDialog::Accepted) {
QString userInput = dialog.getUserInput();
if (!userInput.isEmpty() && currentItem.contains("val")) {
text = userInput;
}
}
else {
return;
}
}
else {
return;
else if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "PASSWD_ENROLL") {
PasswordEnrollWindow dialog;
if (dialog.exec() == QDialog::Accepted) {
text = dialog.getPassword();
}
else {
return;
}
}
sendJsonItem(frontBoardTest, itemIndex, text, "", "test");
}
else if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "PASSWD_ENROLL") {
PasswordEnrollWindow dialog;
if (dialog.exec() == QDialog::Accepted) {
text = dialog.getPassword();
}
else {
return;
}
}
sendJsonItem(frontBoardTest, itemIndex, text, "test");
}
void ClientHandler::sendBackItem(int itemIndex)
{
QString text = "";
QJsonObject currentItem = backBoardTest[itemIndex].toObject();
if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "IMG_ENROLL") {
ImageEnrollWindow dialog;
if (dialog.exec() == QDialog::Accepted) {
text = dialog.getFilePath();
QByteArray imageData = dialog.getImageData();
if (!imageData.isEmpty()) {
text = QString::fromUtf8(imageData);
if (isBackBoardOrAllBoard == 0) {
emit HandleInvalidOperate("当前连接的是前板,请勿操作后板或整机页面的按键!!!");
return;
}
else {
QString text = "";
QJsonObject currentItem = backBoardTest[itemIndex].toObject();
if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "IMG_ENROLL") {
ImageEnrollWindow dialog;
if (dialog.exec() == QDialog::Accepted) {
text = dialog.getFilePath();
QByteArray imageData = dialog.getImageData();
if (!imageData.isEmpty()) {
text = QString::fromUtf8(imageData);
}
}
else {
return;
}
}
else {
return;
}
}
else if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "DEL_USER") {
DelUserWindow dialog;
if (dialog.exec() == QDialog::Accepted) {
QString userInput = dialog.getUserInput();
if (!userInput.isEmpty() && currentItem.contains("val")) {
text = userInput;
else if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "DEL_USER") {
DelUserWindow dialog;
if (dialog.exec() == QDialog::Accepted) {
QString userInput = dialog.getUserInput();
if (!userInput.isEmpty() && currentItem.contains("val")) {
text = userInput;
}
}
else {
return;
}
}
else {
return;
else if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "PASSWD_ENROLL") {
PasswordEnrollWindow dialog;
if (dialog.exec() == QDialog::Accepted) {
text = dialog.getPassword();
}
else {
return;
}
}
isRecvVideoData = false;
sendJsonItem(backBoardTest, itemIndex, text, "", "test");
}
else if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "PASSWD_ENROLL") {
PasswordEnrollWindow dialog;
if (dialog.exec() == QDialog::Accepted) {
text = dialog.getPassword();
}
else {
return;
}
}
sendJsonItem(backBoardTest, itemIndex, text, "test");
}
void ClientHandler::sendDevInfoJsonItem(const QJsonObject& jsonItem, int itemIndex)
@ -381,7 +478,13 @@ void ClientHandler::sendDevInfoJsonItem(const QJsonObject& jsonItem, int itemInd
QString itemData = QJsonDocument(jsonItem).toJson();
//emit sendData(itemData.toUtf8());
emit sendDataToSomeClient(controlClientId, itemData.toUtf8());
if (isBackBoardOrAllBoard) {
emit sendDataToSomeClient(isBackBoardOrAllBoard, itemData.toUtf8());
}
else {
emit sendDataToSomeClient(controlClientId, itemData.toUtf8());
}
if (jsonItem.contains("timeout")) {
int timeout = jsonItem.value("timeout").toInt();
@ -396,58 +499,60 @@ void ClientHandler::sendDevInfoJsonItem(const QJsonObject& jsonItem, int itemInd
void ClientHandler::sendDevInfoItem()
{
// 前板
if (1) {
qDebug() << "frontBoardDevInfoJson.size()" << frontBoardDevInfoJson.size();
if (currentFrontBoardIndex < frontBoardDevInfoJson.size()) {
sendDevInfoJsonItem(frontBoardDevInfoJson[currentFrontBoardIndex].toObject(), 1);
currentFrontBoardIndex ++;
if (isBackBoardOrAllBoard) {
currentJson = backBoardDevInfoJson;
currentJsonItem = currentBackBoardIndex;
if (currentBackBoardIndex < backBoardDevInfoJson.size()) {
sendDevInfoJsonItem(backBoardDevInfoJson[currentBackBoardIndex++].toObject(), 1);
}
else
isPowerOnSend = false;
}
// 后板
else {
if (currentBackBoardIndex < backBoardDevInfoJson.size()) {
sendDevInfoJsonItem(backBoardDevInfoJson[currentBackBoardIndex ++].toObject(), 1);
currentJson = frontBoardDevInfoJson;
currentJsonItem = currentFrontBoardIndex;
if (currentFrontBoardIndex < frontBoardDevInfoJson.size()) {
sendDevInfoJsonItem(frontBoardDevInfoJson[currentFrontBoardIndex].toObject(), 1);
currentFrontBoardIndex++;
}
else
isPowerOnSend = false;
}
}
// 发送下一个 JSON 项目
void ClientHandler::sendNextItem()
void ClientHandler::sendNextItem(QJsonArray& currentOneClickedItem)
{
//qDebug() << "------> start mutex " << __FUNCTION__;
QMutexLocker locker(&mutex);
QMutexLocker locker(&mutex);
isClickedSend = true;
qDebug() << "------> locker(&mutex) :" << itemsProcessedCount;
if (currentItemIndex < frontBoardOneClickTest.size()) {
currentJson = frontBoardOneClickTest;
//qDebug() << "------> locker(&mutex) :" << itemsProcessedCount;
//qDebug() << "------> currentItemIndex :" << currentItemIndex;
//qDebug() << "------> currentOneClickedItem.size() :" << currentOneClickedItem.size();
if (currentItemIndex < currentOneClickedItem.size()) {
currentJson = currentOneClickedItem;
currentJsonItem = currentItemIndex;
currentItem = frontBoardOneClickTest[currentItemIndex].toObject();
currentItem = currentOneClickedItem[currentItemIndex].toObject();
QString itemData = QJsonDocument(currentItem).toJson();
//qDebug() << "Sending item index:" << currentItemIndex << "data:" << itemData;
if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "DEL_USER") {
if (currentItem.contains("cmd") && currentItem["cmd"].toString() == "DEL_USER") {
DelUserWindow dialog;
if (dialog.exec() == QDialog::Accepted) {
//qDebug() << "用户确认删除,关闭窗口";
QString userInput = dialog.getUserInput();
if (!userInput.isEmpty() && currentItem.contains("val")) {
currentItem["val"] = userInput;
itemData = QJsonDocument(currentItem).toJson();
}
}
}
}
//emit sendData(itemData.toUtf8());
emit sendDataToSomeClient(controlClientId, itemData.toUtf8());
if (isBackBoardOrAllBoard) {
emit sendDataToSomeClient(isBackBoardOrAllBoard, itemData.toUtf8());
}
else {
emit sendDataToSomeClient(controlClientId, itemData.toUtf8());
}
if (currentItem.contains("timeout")) {
int timeout = currentItem.value("timeout").toInt();
if (timeout > 0) {
qDebug() << "------> sendNextItem :" << itemsProcessedCount;
emit startTimeout(timeout);
}
}
@ -458,12 +563,11 @@ void ClientHandler::sendNextItem()
else if (isManualSend) {
emit allItemsProcessed(getClientAddress(), itemsProcessedCount);
// 处理完毕后重置标记
isManualSend = false;
isManualSend = false;
isClickedSend = false;
// 重置索引,可以再次一键功能测试
// 重置索引
resetCurrentItemIndex();
}
//qDebug() << "------> end mutex " << __FUNCTION__;
}
void ClientHandler::RNDISClient1Data(QByteArray& data) {
@ -570,7 +674,16 @@ void ClientHandler::setThreadPriority(QThread::Priority priority) {
}
}
// 处理数据接收
void ClientHandler::onPicRecvFinished()
{
if (currentJson != getPicJson && currentJson != frontBoardTest) {
currentItemIndex ++;
itemsProcessedCount ++;
qDebug() << "------> onPicRecvFinished " << __FUNCTION__;
sendNextItem(currentJson);
}
}
void ClientHandler::onDataReceived()
{
//qDebug() << "isRecvVideoData:" << isRecvVideoData;
@ -578,8 +691,10 @@ void ClientHandler::onDataReceived()
//qDebug() << "isClickedSend:" << isClickedSend;
//qDebug() << "isSingleSend:" << isSingleSend;
//qDebug() << "isRecvImgData:" << isRecvImgData;
/*if (!isRecvVideoData &&
(isRecvImgData || isPowerOnSend || isClickedSend || (isSingleSend && (currentItemIndex < frontBoardTest.size())))) {*/
if (!isRecvVideoData &&
(isRecvImgData || isPowerOnSend || isClickedSend || (isSingleSend && (currentItemIndex < frontBoardTest.size())))) {
(isRecvImgData || isPowerOnSend || isClickedSend || (isSingleSend && (currentItemIndex < currentJson.size())))) {
QByteArray allData;
while (socket->bytesAvailable() > 0) {
qint64 bytesAvailableBefore = socket->bytesAvailable();
@ -593,59 +708,72 @@ void ClientHandler::onDataReceived()
qint64 bytesAvailableAfter = socket->bytesAvailable();
}
}
getCurrentItemLable();
if ((currentItem.contains("timeout")) || (currentFuncItem.contains("timeout"))) {
emit startTimeout(0);
}
QJsonObject currentTempItem = currentJson[currentItemIndex].toObject();
if (!allData.isEmpty()) {
emit dataReceived(getClientAddress(), allData, 0xFF, currentItemIndex, currentFuncItemIndex, getCurrentItemLable(), "", currentJson, currentJsonItem);
if (!isSingleSend && !isPowerOnSend) {
if (!isSingleSend && !isPowerOnSend && (currentTempItem["cmd"] != "GET_IMG")) {
currentItemIndex ++;
itemsProcessedCount ++;
}
}
}
if (isSingleSend) {
isSingleSend = false;
if (currentTempItem["cmd"] != "GET_IMG") {
isSingleSend = false;
}
isClickedSend = false;
}
else if (isPowerOnSend && currentFrontBoardIndex < frontBoardDevInfoJson.size()) {
sendDevInfoItem();
else if (isPowerOnSend) {
if (isBackBoardOrAllBoard) {
if (currentBackBoardIndex < backBoardDevInfoJson.size()) {
sendDevInfoItem();
}
else {
qDebug() << "All items processed in onDataReceived.";
emit allItemsProcessed(getClientAddress(), currentBackBoardIndex);
isPowerOnSend = false;
}
}
else {
if (currentFrontBoardIndex < frontBoardDevInfoJson.size()) {
sendDevInfoItem();
}
else {
qDebug() << "All items processed in onDataReceived.";
emit allItemsProcessed(getClientAddress(), currentFrontBoardIndex);
isPowerOnSend = false;
}
}
}
else if (isPowerOnSend && currentBackBoardIndex < backBoardDevInfoJson.size()) {
sendDevInfoItem();
}
/*else if (isPowerOnSend) {
qDebug() << "All items processed in onDataReceived.";
emit allItemsProcessed(getClientAddress(), currentFrontBoardIndex);
isPowerOnSend = false;
}*/
else if (isClickedSend && (currentItemIndex < frontBoardOneClickTest.size())) {
//qDebug() << "-------- start sendNextItem";
sendNextItem();
else if (isClickedSend && (currentItemIndex < currentJson.size())) {
// 判断是否是取图或者其他会接收很多数据的指令
if (currentTempItem["cmd"] != "GET_IMG") {
sendNextItem(currentJson);
}
}
else if(isClickedSend) {
//qDebug() << "All items processed in onDataReceived.";
emit allItemsProcessed(getClientAddress(), itemsProcessedCount);
isClickedSend = false;
//resetCurrentItemIndex();
}
//qDebug() << "" << __FUNCTION__ << "------> itemsProcessedCount " << itemsProcessedCount;
}
// 接收视频流数据 isRecvVideoData 置 0
else if (isRecvVideoData && (!dataProcessingActive)) {
dataProcessingActive = true;
if (!isStartVideo) {
isRecvVideoData = false;
if ((isBackBoardOrAllBoard == 0) && !isStartVideo) {
isRecvVideoData = false;
}
QTimer::singleShot(0, this, &ClientHandler::processPendingData);
}
else if(!isRecvVideoData && !isRecvImgData){
if (preVideoClientId == clientId) {
qDebug() << "-----------------" << preVideoClientId << "isRecvVideoData:" << isRecvVideoData;
}
}
socket->readAll();
//QByteArray data = socket->readAll();
//qDebug() << "Received data:" << data;
//qDebug() << "--------- socket->readAll()" ;
}
}
@ -673,7 +801,7 @@ void ClientHandler::processPendingData()
<< "at" << QDateTime::currentDateTime().toString(Qt::ISODate)
<< "bytesAvailable after read:" << bytesAvailableAfter; */
if (isFirstDataReceived) {
if ((isBackBoardOrAllBoard == 0) && isFirstDataReceived) {
RNDISFirstData(buffer);
isFirstDataReceived = false;
}
@ -725,17 +853,12 @@ void ClientHandler::processPendingData()
}
}
// 处理超时
void ClientHandler::onTimeout()
{
//qDebug() << "------> start mutex " << __FUNCTION__;
{
QMutexLocker locker(&mutex);
// 获取当前项的 "data" 字段
//QString itemData = currentItem.value("data").toString();
//emit statusUpdated(socket->peerAddress().toString(), currentItemIndex, false, itemData);
emit statusUpdated(getClientAddress(), currentItemIndex + 1, currentFuncItemIndex + 1,
false, getCurrentItemLable(), getCurrentFuncItemLable(), currentJson, currentJsonItem);
emit statusUpdated(getClientAddress(), false, currentJson, currentJsonItem);
qDebug() << "isSingleSend:" << isSingleSend << "isPowerOnSend:" << isPowerOnSend;
if (!isSingleSend && !isPowerOnSend) {
currentItemIndex ++;
itemsProcessedCount ++;
@ -744,23 +867,51 @@ void ClientHandler::onTimeout()
if (isSingleSend) {
isSingleSend = false;
}
else if (isPowerOnSend && currentFrontBoardIndex < frontBoardDevInfoJson.size()) {
sendDevInfoItem();
}
else if (isClickedSend && (currentItemIndex < frontBoardOneClickTest.size())) {
//qDebug() << "------> onTimeout";
sendNextItem();
}
else if(isClickedSend) {
qDebug() << "All items processed in onTimeout.";
emit allItemsProcessed(getClientAddress(), itemsProcessedCount);
//resetCurrentItemIndex();
else if (isClickedSend) {
if (isBackBoardOrAllBoard) {
if (currentItemIndex < backBoardOneClickTest.size()) {
sendNextItem(currentJson);
}
else if (currentItemIndex >= backBoardOneClickTest.size()) {
qDebug() << "All backBoardOneClickTest items processed in onTimeout().";
emit allItemsProcessed(getClientAddress(), itemsProcessedCount);
}
}
else {
if (currentItemIndex < frontBoardOneClickTest.size()) {
sendNextItem(currentJson);
}
else if (currentItemIndex >= frontBoardOneClickTest.size()) {
qDebug() << "All frontBoardOneClickTest items processed in onTimeout().";
emit allItemsProcessed(getClientAddress(), itemsProcessedCount);
}
}
}
else if (isPowerOnSend) {
qDebug() << "All items processed in onTimeout.";
emit allItemsProcessed(getClientAddress(), currentFrontBoardIndex);
//resetCurrentItemIndex();
if (isBackBoardOrAllBoard) {
if (currentBackBoardIndex < backBoardDevInfoJson.size()) {
sendDevInfoItem();
}
else {
qDebug() << "All items processed in onTimeout.";
emit allItemsProcessed(getClientAddress(), currentBackBoardIndex);
currentFrontBoardIndex = 0;
currentBackBoardIndex = 0;
isPowerOnSend = false;
}
}
else {
if (currentFrontBoardIndex < frontBoardDevInfoJson.size()) {
sendDevInfoItem();
}
else {
qDebug() << "All items processed in onTimeout.";
emit allItemsProcessed(getClientAddress(), currentFrontBoardIndex);
currentFrontBoardIndex = 0;
currentBackBoardIndex = 0;
isPowerOnSend = false;
}
}
}
//qDebug() << "------> end mutex " << __FUNCTION__;
qDebug() << "" << __FUNCTION__ << "------> itemsProcessedCount " << itemsProcessedCount;
}

View File

@ -25,6 +25,7 @@
#include "DelUserWindows.h"
#define TEST_TCP_MOVE_TO_MAIN 0
#define GET_PIC_DATA_SIZE (480 * 640 * 1.5)
class ClientHandler : public QObject, public QRunnable
{
@ -59,7 +60,7 @@ public:
void run() override;
// 开始处理客户端
void start();
void sendJsonItem(const QJsonArray& jsonArray, int itemIndex, const QString text, const QString& itemType);
void sendJsonItem(const QJsonArray& jsonArray, int itemIndex, const QString text, const QString backBoardSn, const QString& itemType);
// 发送获取设备信息按键
void sendGetDevInfoItem(int itemIndex);
// 发送取图按键
@ -68,12 +69,12 @@ public:
void sendGetVideoItem(int itemIndex, int GetVideoCamIndex);
// 发送License处理按键
void sendLicenseItem(int itemIndex, const QString text);
void sendUuidItem(int itemIndex, const QString text);
void sendUuidItem(int itemIndex, const QString uuid, const QString sn);
// 发送下一个功能配置 JSON 项目
void sendFrontFuncItem(int itemIndex, QString text);
void sendBackFuncItem(int itemIndex, QString text);
// 发送下一个 JSON 项目
void sendNextItem();
void sendNextItem(QJsonArray& currentOneClickedItem);
// 处理发送单独指令
void sendFrontItem(int itemIndex);
void sendBackItem(int itemIndex);
@ -105,9 +106,8 @@ signals:
// 数据发送信号
void sendData(const QByteArray& data, int isBoardType);
// 状态更新信号
void statusUpdated(const QString& client, int itemIndex, int funcItemIndex,
bool success, const QString& itemData, const QString& funcItemData,
const QJsonArray& jsonArray, int itemJsonIndex);
void statusUpdated(const QString& client, bool success, const QJsonArray& jsonArray, int itemJsonIndex);
void HandleInvalidOperate(const QString& text);
// 客户端断开连接信号
void clientDisconnected(ClientHandler* handler);
// json文件配置项发送完毕
@ -132,6 +132,7 @@ public slots:
void onDisconnected();
//void onSocketError(QAbstractSocket::SocketError socketError);
void onTimeoutRead();
void onPicRecvFinished();
void checkConnectionStatus(); // 定期检查连接状态
void processPendingData();
void startReadVideoDataTimer(int client_Id);

View File

@ -69,7 +69,12 @@
#define GET_BACK_V851_VERSION 0x0450
#define GET_BACK_806_VERSION 0x0451
#define GET_BACK_HW_VERSION 0x0452
#define GET_BACK_SN 0x0453
#define GET_BACK_UID 0x0454
#define GET_BACK_MAC 0x0470
#define WRITE_BACK_UID_SN 0x0471
#define VIDEO_TEST 0x050A
#endif

View File

@ -2,7 +2,8 @@
#include "RecvDataHandler.h"
#include "../Network/ClientHandler.h"
DataHandler::DataHandler(QLabel* videoLabel, QLineEdit* VideoResolutionEdit, QSize labelSize, QMap<QString, QLineEdit*>* devInfoLineEdits,
DataHandler::DataHandler(QLabel* videoLabel, QLabel* video_Label_back, QLineEdit* VideoResolutionEdit, QLineEdit* VideoResolutionEdit_back,
QSize labelSize, QMap<QString, QLineEdit*>* devInfoLineEdits, int isBackBoardOrAllBoard,
QJsonArray frontBoardOneClickTest, QJsonArray frontBoardTest, QJsonArray frontBoardFuncConfig,
QJsonArray frontBoardDevInfoJson, QJsonArray frontBoardLicenseJson,
QJsonArray backBoardOneClickTest, QJsonArray backBoardTest, QJsonArray backBoardFuncConfig,
@ -10,9 +11,12 @@ DataHandler::DataHandler(QLabel* videoLabel, QLineEdit* VideoResolutionEdit, QSi
QJsonArray getPicJson, QJsonArray getVideoJson, QObject* parent)
: QObject(parent),
videoLabel(videoLabel),
video_Label_back(video_Label_back),
VideoResolutionEdit(VideoResolutionEdit),
VideoResolutionEdit_back(VideoResolutionEdit_back),
labelSize(labelSize),
devInfoLineEdits(devInfoLineEdits),
isBackBoardOrAllBoard(isBackBoardOrAllBoard),
frontBoardOneClickTest(frontBoardOneClickTest), frontBoardTest(frontBoardTest),
frontBoardFuncConfig(frontBoardFuncConfig), frontBoardDevInfoJson(frontBoardDevInfoJson),
frontBoardLicenseJson(frontBoardLicenseJson),
@ -22,7 +26,7 @@ DataHandler::DataHandler(QLabel* videoLabel, QLineEdit* VideoResolutionEdit, QSi
buffer(new QByteArray()), picBuffer(new QByteArray()),
ffmpegDecoder(new FFmpegDecoder()) // 初始化FFmpeg解码器
{
ffmpegDecoder->initialize(); // 初始化解码器
//ffmpegDecoder->initialize(); // 初始化解码器
clearAllRecvData();
initializeMsgIdToCmdMap();
qDebug() << "DataHandler thread created";
@ -81,8 +85,9 @@ void DataHandler::showVideo(const QString& client, const QByteArray& valData)
}
if (!start_run) {
ffmpegDecoder->initialize(); // 初始化解码器
start_run = 1;
ffmpegDecoder->decodeFile(h264filePath, videoLabel, VideoResolutionEdit);
ffmpegDecoder->decodeFile(h264filePath, isBackBoardOrAllBoard, videoLabel, video_Label_back, VideoResolutionEdit, VideoResolutionEdit_back);
}
//ffmpegDecoder->decodeFile(filePath_1, videoLabel);
}
@ -150,26 +155,23 @@ void DataHandler::handleData(const QString& client, const QByteArray& recv
/*for (int i = 0; i < 19; i++) {
qDebug() << "buffer->at(" << i << "):" << QString::number(static_cast<unsigned char>(buffer->at(i)), 16).toUpper();
}*/
// 去掉前面 11 字节
QByteArray data = buffer->mid(11, dataSize);
//QByteArray data = buffer->mid(10, dataSize);
QString hexString = QString::fromUtf8(data.toHex().data());
QString hexString = QString::fromUtf8(data.toHex().data());
QByteArray actual_data = hexStringToByteArray(hexString);
buffer->remove(0, totalSize); // 移除已处理的数据
if(msg_id != 0x0040 && msg_id != START_VIDEO && msg_id != GET_IMG) {
buffer->remove(0, totalSize); // 移除已处理的数据
if(msg_id != 0x0040 && msg_id != START_VIDEO && msg_id != GET_IMG && msg_id != VIDEO_TEST &&
msg_id != STOP_VIDEO) {
qDebug() << "--- msg_id:" << msg_id;
qDebug() << "--- clientLastMsgId.value(client, 0):" << clientLastMsgId.value(client, 0);
// 同一个client仅当 msg_id 不连续为 0x11/0x21 或第一次处理时才执行 emit statusUpdated
if ((msg_id != 0x0011 || clientLastMsgId.value(client, 0) != 0x0011) &&
(msg_id != 0x0021 || clientLastMsgId.value(client, 0) != 0x0021) &&
(msg_id != START_VIDEO || clientLastMsgId.value(client, 0) != START_VIDEO)) {
//qDebug() << "Emitting statusUpdated for client:" << client << "with msg_id:" << QString::number(msg_id, 16).toUpper();
emit statusUpdated(client, currentRecvItemIndex + 1, currentRecvFuncItemIndex + 1,
true, itemData, funcItemData, jsonArray, itemJsonIndex);
emit statusUpdated(client, true, jsonArray, itemJsonIndex);
}
clientLastMsgId[client] = msg_id;
}
handleCmd(msg_id, client, actual_data);
handleCmd(msg_id, client, actual_data, jsonArray, itemJsonIndex);
}
else {
break; // 数据还不完整,等待下一次接收
@ -191,80 +193,56 @@ void DataHandler::initializeMsgIdToCmdMap() {
msgIdToCmdMap[GET_BACK_V851_VERSION] = "GET_BACK_V851_VERSION";
msgIdToCmdMap[GET_BACK_806_VERSION] = "GET_BACK_806_VERSION";
msgIdToCmdMap[GET_BACK_HW_VERSION] = "GET_BACK_HW_VERSION";
msgIdToCmdMap[GET_BACK_SN] = "GET_BACK_SN";
msgIdToCmdMap[GET_BACK_UID] = "GET_BACK_UID";
}
void DataHandler::handleCmd(int msg_id, const QString& client, QByteArray actual_data)
void DataHandler::handleCmd(int msg_id, const QString& client, QByteArray actual_data, const QJsonArray& jsonArray, int itemJsonIndex)
{
if (msg_id < 0x0400) {
handleFrontCmd(msg_id, client, actual_data);
handleFrontCmd(msg_id, client, actual_data, jsonArray, itemJsonIndex);
}
else if (msg_id < 0x0500) {
handleDevInfo(msg_id, client, actual_data);
}
else if (msg_id < 0x0800) {
handleBackCmd(msg_id, client, actual_data);
handleBackCmd(msg_id, client, actual_data, jsonArray, itemJsonIndex);
}
}
void DataHandler::handleFrontCmd(int msg_id, const QString& client, QByteArray actual_data)
void DataHandler::handleFrontCmd(int msg_id, const QString& client, QByteArray actual_data, const QJsonArray& jsonArray, int itemJsonIndex)
{
switch (msg_id) {
case FACE_ENROLL_SINGLE:
{
}
{}
break;
case FACE_ENROLL:
{
}
{}
break;
case HAND_ENROLL:
{
}
{}
break;
case FACE_VERIFY:
{
}
{}
break;
case HAND_VERIFY:
{
}
{}
break;
case DEL_USER:
{
}
{}
break;
case DEL_ALLUSER:
{
}
{}
break;
case GET_USER:
{
}
{}
break;
case GET_ALLUSER:
{
}
{}
break;
case PASSWD_ENROLL:
{
}
{}
break;
case IMG_ENROLL:
{
}
{}
break;
case GET_IMG:
{
@ -272,14 +250,16 @@ void DataHandler::handleFrontCmd(int msg_id, const QString& client, QByteArray a
int width = (static_cast<unsigned char>(actual_data[3]) << 8) | static_cast<unsigned char>(actual_data[2]);
int height = (static_cast<unsigned char>(actual_data[5]) << 8) | static_cast<unsigned char>(actual_data[4]);
int format = static_cast<unsigned char>(actual_data[6]);
qint32 picSize = width * height * 1.5;
qint32 picSize = width * height * 1.5;
QByteArray yuvData = actual_data.mid(7);
qDebug() << "showPic width * height * 1.5:" << picSize;
qDebug() << "showPic picBuffer.size():" << picBuffer->size();
if (yuvData.size() + picBuffer->size() == picSize) {
emit picRecvFinished();
picBuffer->append(yuvData);
showPic(labelSize, lens_n, width, height, format, picBuffer);
QJsonObject currentTempItem = jsonArray[itemJsonIndex].toObject();
emit statusUpdated(client, true, jsonArray, itemJsonIndex);
picBuffer->remove(0, picSize);
}
else if (yuvData.size() + picBuffer->size() > picSize) {
@ -295,173 +275,130 @@ void DataHandler::handleFrontCmd(int msg_id, const QString& client, QByteArray a
break;
case START_VIDEO:
{
if (!isStartVideo) {
isStartVideo = ffmpegDecoder->isStartVideo;
if (isStartVideo) {
emit statusUpdated(client, true, getVideoJson, 0);
}
}
showVideo(client, actual_data);
}
break;
case STOP_VIDEO:
{
isStartVideo = false;
emit statusUpdated(client, true, jsonArray, itemJsonIndex);
qDebug() << "--- STOP_VIDEO Current path: " << QDir::currentPath();
QString filePath = QDir::currentPath() + "/add1.h264";
if (QFile::exists(filePath)) {
QFile file(filePath);
if (file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
qDebug() << "File add1.h264 cleared successfully.";
}
else {
qDebug() << "Failed to clear file add1.h264:" << file.errorString();
}
}
else {
qDebug() << "File add1.h264 does not exist.";
}
}
break;
case TOUCH_TEST:
{
}
{}
break;
case MIC_TEST:
{
}
{}
break;
case SPK_TEST:
{
}
{}
break;
case RADAR_TEST:
{
}
{}
break;
case NFC_TEST:
{
}
{}
break;
case PR_SWITCH:
{
}
{}
break;
case PS_TEST:
{
}
{}
break;
case BACKLIGHT:
{
}
{}
break;
case IR_LED:
{
}
{}
break;
case UART_TEST:
{
}
{}
break;
case PIR_TEST:
{
}
{}
break;
case FACE_VERIFY_THRES:
{
}
{}
break;
case FACE_THRES_LEVEL:
{
}
{}
break;
case FACE_LIVE_THRES:
{
}
{}
break;
case FACE_ACC_THRES:
{
}
{}
break;
case FACE_ACC_LEVEL:
{
}
{}
break;
case FACE_DIS_RANGE:
{
}
{}
break;
case FACE_ANGLE_RANGE:
{
}
{}
break;
case HAND_VERIFY_THRES:
{
}
{}
break;
case HANS_THRES_LEVEL:
{
}
{}
break;
case HAND_LIVE_THRES:
{
}
{}
break;
case USER_MAX_NUM:
{
}
{}
break;
case ADMI_USER_MAX_NUM:
{
}
{}
break;
case FACE_REPEAT:
{
}
{}
break;
case HAND_REPEAT:
{
}
{}
break;
case SET_IP:
{
}
{}
break;
case SET_PORT:
{
}
{}
break;
case SET_VOLUME:
{
}
{}
break;
case SET_BACKLIGHT:
{
}
{}
break;
case SET_RADAR_DIS:
{
}
{}
break;
case SET_UART_BARTRATE:
{
}
{}
break;
case SET_LOG_LEVEL:
{
}
{}
break;
default:
{}
@ -471,6 +408,8 @@ void DataHandler::handleFrontCmd(int msg_id, const QString& client, QByteArray a
void DataHandler::handleDevInfo(int msg_id, const QString& client, QByteArray actual_data)
{
qDebug() << "actual_data.size(): " << actual_data.size();
qDebug() << "actual_data: " << QString::fromUtf8(actual_data.toHex().data());
switch (msg_id) {
case GET_FRONT_V851_VERSION:
case GET_FRONT_MCU_VERSION:
@ -481,8 +420,8 @@ void DataHandler::handleDevInfo(int msg_id, const QString& client, QByteArray ac
case GET_BACK_V851_VERSION:
case GET_BACK_806_VERSION:
case GET_BACK_HW_VERSION:
case GET_BACK_SN:
case GET_BACK_UID:
/*case GET_BACK_SN:
case GET_BACK_UID:*/
{
// aa55aa5503041d00000048464d3231305f4b3431343234395f423230323031305f41302e302e38
qDebug() << "GET_DEV_INFO";
@ -502,8 +441,6 @@ void DataHandler::handleDevInfo(int msg_id, const QString& client, QByteArray ac
qDebug() << "GET_FRONT_HW_INFO";
QStringList hexList;
QString dataStr;
qDebug() << "actual_data.size(): " << actual_data.size();
qDebug() << "actual_data: " << QString::fromUtf8(actual_data.toHex().data());
if (actual_data.size() == PIX_HARDWARE_INFO_BYTES) {
for (int i = 0; i < actual_data.size(); ++i) {
hexList << QString("0x%1").arg(static_cast<unsigned char>(actual_data[i]), 2, 16, QLatin1Char('0')).toUpper().replace("0X", "0x");
@ -511,15 +448,26 @@ void DataHandler::handleDevInfo(int msg_id, const QString& client, QByteArray ac
dataStr = hexList.join(", ");
}
else
dataStr = "前板发送的HW INFO 数据大小不正确";
dataStr = "前板发送的 HW INFO 数据大小不正确";
QString displayText = dataStr;
//licenseHwInfoEdit->setPlainText(displayText);
emit updateLicenseHwInfoEdit(displayText);
}
break;
case WRITE_FRONT_LICENSE:
case GET_BACK_MAC:
{
qDebug() << "WRITE_FRONT_LICENSE";
qDebug() << "GET_BACK_MAC";
QString dataStr;
if (actual_data.size() == BACK_MAC_ADDRESS_LEN) {
for (int i = 0; i < actual_data.size(); ++i) {
char ch = static_cast<unsigned char>(actual_data[i]);
dataStr.append(ch);
}
}
else
dataStr = "后板发送的 MAC addr 数据大小不正确";
QString displayText = dataStr;
emit updateUuidHwInfoEdit(displayText);
}
break;
default:
@ -527,9 +475,51 @@ void DataHandler::handleDevInfo(int msg_id, const QString& client, QByteArray ac
}
}
void DataHandler::handleBackCmd(int msg_id, const QString& client, QByteArray actual_data)
void DataHandler::handleBackCmd(int msg_id, const QString& client, QByteArray actual_data, const QJsonArray& jsonArray, int itemJsonIndex)
{
switch (msg_id) {
case VIDEO_TEST:
{
if (!isStartVideo) {
isStartVideo = ffmpegDecoder->isStartVideo;
if (isStartVideo) {
emit statusUpdated(client, true, jsonArray, itemJsonIndex);
}
}
QJsonObject jsonObject = jsonArray[itemJsonIndex].toObject();
if (jsonObject["val"] == 0) {
showVideo(client, actual_data);
}
else if (jsonObject["val"] == 1) {
isStartVideo = false;
emit statusUpdated(client, true, jsonArray, itemJsonIndex);
qDebug() << "--- STOP_VIDEO";
qDebug() << "Current path: " << QDir::currentPath();
QString filePath = QDir::currentPath() + "/add1.h264";
if (QFile::exists(filePath)) {
QFile file(filePath);
if (file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
qDebug() << "File add1.h264 cleared successfully.";
}
else {
qDebug() << "Failed to clear file add1.h264:" << file.errorString();
}
}
else {
qDebug() << "File add1.h264 does not exist.";
}
if (ffmpegDecoder) {
ffmpegDecoder->stopFFmpegDecoder();
ffmpegDecoder->requestInterruption();
ffmpegDecoder->wait(); // 等待解码器线程完成
delete ffmpegDecoder;
ffmpegDecoder = nullptr;
}
}
}
break;
default:
{}
break;
}
}

View File

@ -28,12 +28,15 @@
#define YUV420 1
#define YUV422 2
#define BACK_MAC_ADDRESS_LEN 11
class DataHandler : public QObject
{
Q_OBJECT
public:
explicit DataHandler(QLabel* videoLabel, QLineEdit* VideoResolutionEdit, QSize labelSize, QMap<QString, QLineEdit*>* devInfoLineEdits,
explicit DataHandler(QLabel* videoLabel, QLabel* video_Label_back, QLineEdit* VideoResolutionEdit, QLineEdit* VideoResolutionEdit_back,
QSize labelSize, QMap<QString, QLineEdit*>* devInfoLineEdits, int isBackBoardOrAllBoard,
QJsonArray frontBoardOneClickTest, QJsonArray frontBoardTest, QJsonArray frontBoardFuncConfig,
QJsonArray frontBoardDevInfoJson, QJsonArray frontBoardLicenseJson,
QJsonArray backBoardOneClickTest, QJsonArray backBoardTest, QJsonArray backBoardFuncConfig,
@ -46,14 +49,14 @@ public slots:
int currentRecvFuncItemIndex, const QString& itemData, const QString& funcItemData,
const QJsonArray& jsonArray, int itemJsonIndex);
signals:
void statusUpdated(const QString& clientAddress, int currentItemIndex, int currentFuncItemIndex,
bool success, const QString& currentItemLabel, const QString& currentFuncItemLabel,
const QJsonArray& jsonArray, int itemJsonIndex);
void statusUpdated(const QString& clientAddress, bool success, const QJsonArray& jsonArray, int itemJsonIndex);
void updateLicenseHwInfoEdit(const QString& text);
void updateUuidHwInfoEdit(const QString& text);
void updateLeftLensImage(const QPixmap& pixmap);
void updateRightLensImage(const QPixmap& pixmap);
void updateVideoLabel(const QPixmap& pixmap);
void updateVideoResolution(const QString& resolutionText);
void picRecvFinished();
private:
QJsonArray frontBoardOneClickTest; // 前板一键功能测试 JSON
QJsonArray frontBoardTest; // 前板单项测试 JSON
@ -71,12 +74,15 @@ private:
//QLabel* leftLens_m_imageLabel;
//QLabel* rightLens_m_imageLabel;
QLabel* videoLabel;
QLineEdit* VideoResolutionEdit;
QLabel* video_Label_back;
QLineEdit* VideoResolutionEdit;
QLineEdit* VideoResolutionEdit_back;
//QTextEdit* licenseHwInfoEdit;
QByteArray allRecvData; // 完整的一帧数据
int remain = 0;
int start_run = 0;
long dataLen = 0;
int isBackBoardOrAllBoard = 0;
FFmpegDecoder* ffmpegDecoder;
QByteArray* buffer;
QByteArray* picBuffer;
@ -84,15 +90,16 @@ private:
QMap<QString, QLineEdit*>* devInfoLineEdits;
QMap<int, QString> msgIdToCmdMap;
QSize labelSize;
bool isStartVideo = false;
// 如果接收十六进制数据,转为二进制
QByteArray hexStringToByteArray(const QString& hexString);
void showVideo(const QString& client, const QByteArray& valData);
void clearAllRecvData();
void handleCmd(int msg_id, const QString& client, QByteArray actual_data);
void handleFrontCmd(int msg_id, const QString& client, QByteArray actual_data);
void handleCmd(int msg_id, const QString& client, QByteArray actual_data, const QJsonArray& jsonArray, int itemJsonIndex);
void handleFrontCmd(int msg_id, const QString& client, QByteArray actual_data, const QJsonArray& jsonArray, int itemJsonIndex);
void handleDevInfo(int msg_id, const QString& client, QByteArray actual_data);
void handleBackCmd(int msg_id, const QString& client, QByteArray actual_data);
void handleBackCmd(int msg_id, const QString& client, QByteArray actual_data, const QJsonArray& jsonArray, int itemJsonIndex);
void initializeMsgIdToCmdMap();
void updateLineEdit(int msg_id, const QByteArray& actual_data);
void showPic(QSize labelSize, int lens_n,

View File

@ -27,13 +27,19 @@ MainWidget::MainWidget(QWidget* parent) :
multicastTimer(new QTimer(this))
#endif
{
leftLens_imageLabel = new QLabel(this);
rightLens_imageLabel = new QLabel(this);
videoLabel = new QLabel(this);
frontFuncConfigLineEdit = new QLineEdit(this);
backFuncConfigLineEdit = new QLineEdit(this);
licenseHwInfoEdit = new QTextEdit(this);
UuidHwInfoEdit = new QTextEdit(this);
leftLens_imageLabel = new QLabel(this);
rightLens_imageLabel = new QLabel(this);
leftLens_imageLabel_back = new QLabel(this);
rightLens_imageLabel_back = new QLabel(this);
leftLens_imageLabel_all = new QLabel(this);
rightLens_imageLabel_all = new QLabel(this);
videoLabel = new QLabel(this);
video_Label_back = new QLabel(this);
video_Label_all = new QLabel(this);
frontFuncConfigLineEdit = new QLineEdit(this);
backFuncConfigLineEdit = new QLineEdit(this);
licenseHwInfoEdit = new QTextEdit(this);
UuidHwInfoEdit = new QTextEdit(this);
setupUI();
// 打印线程池状态信息
@ -84,14 +90,7 @@ MainWidget::MainWidget(QWidget* parent) :
}
}
});
QThread* thread = new QThread(this);
#if TEST_TCP_MOVE_TO_MAIN
ClientHandler* handler = new ClientHandler(socket, frontBoardOneClickTest, frontBoardTest, frontBoardFuncConfig,
frontBoardDevInfoJson, frontBoardLicenseJson,
backBoardOneClickTest, backBoardTest, backBoardFuncConfig, backBoardDevInfoJson,
backBoardUuidJson, getPicJson, getVideoJson, clientId, isBackBoardOrAllBoard, nullptr);
#else
ClientHandler* handler = new ClientHandler(frontBoardOneClickTest, frontBoardTest, frontBoardFuncConfig,
frontBoardDevInfoJson, frontBoardLicenseJson,
backBoardOneClickTest, backBoardTest, backBoardFuncConfig, backBoardDevInfoJson,
@ -101,9 +100,9 @@ MainWidget::MainWidget(QWidget* parent) :
// 将 socket 移动到新的线程中
socket->moveToThread(thread);
// 将 socket 传递到 handler
handler->initialize(socket);
#endif
DataHandler* dataHandler = new DataHandler(videoLabel, VideoResolutionEdit, leftLens_imageLabel->size(), &devInfoLineEdits,
handler->initialize(socket);
DataHandler* dataHandler = new DataHandler(videoLabel, video_Label_back, VideoResolutionEdit, VideoResolutionEdit_back,
leftLens_imageLabel->size(), &devInfoLineEdits, isBackBoardOrAllBoard,
frontBoardOneClickTest, frontBoardTest, frontBoardFuncConfig,
frontBoardDevInfoJson, frontBoardLicenseJson,
backBoardOneClickTest, backBoardTest, backBoardFuncConfig, backBoardDevInfoJson,
@ -111,34 +110,8 @@ MainWidget::MainWidget(QWidget* parent) :
// 将 ClientHandler 和 DataHandler 移到线程池中的线程
handler->moveToThread(thread);
dataHandler->moveToThread(thread);
#if TEST_TCP_MOVE_TO_MAIN
// 将sendData信号连接到主线程中的槽上
connect(handler, &ClientHandler::sendData, this, [socket](const QByteArray& data, int isBoardType) {
/*socket->write(data);
socket->flush();*/
//qDebug() << "---------------------data.size():" << data.size();
QByteArray prefix;
QDataStream stream(&prefix, QIODevice::WriteOnly);
stream.setByteOrder(QDataStream::LittleEndian);
stream << quint32(0x55AA55AA);
if (isBoardType != 0) {
stream << quint16(0x0421);
}
else {
stream << quint16(0x0420);
}
stream << quint32(data.size());
prefix.append(data);
qDebug() << "Sending data:" << prefix.toHex();
socket->write(prefix);
socket->flush();
});
#else
connect(handler, &ClientHandler::sendData, handler, &ClientHandler::onSendData, Qt::QueuedConnection);
#endif
connect(handler, &ClientHandler::startTimeout, this, [this, clientId](int timeout) {
connect(handler, &ClientHandler::sendData, handler, &ClientHandler::onSendData, Qt::QueuedConnection);
connect(handler, &ClientHandler::startTimeout, this, [this, clientId](int timeout) {
this->onStartTimeout(clientId, timeout);
});
@ -146,13 +119,15 @@ MainWidget::MainWidget(QWidget* parent) :
clients_1[clientId] = handler;
clientThreads[clientId] = thread;
connect(handler, &ClientHandler::statusUpdated, this, &MainWidget::onStatusUpdated);
connect(handler, &ClientHandler::HandleInvalidOperate, this, &MainWidget::onHandleInvalidOperate);
connect(handler, &ClientHandler::clientDisconnected, this, &MainWidget::onClientDisconnected);
connect(handler, &ClientHandler::allItemsProcessed, this, &MainWidget::onAllItemsProcessed);
connect(handler, &ClientHandler::selectClientDisconnected, this, &MainWidget::onDisconnectClient);
dataHandlers[clientId] = dataHandler;
connect(handler, &ClientHandler::dataReceived, dataHandler, &DataHandler::handleData);
connect(dataHandler, &DataHandler::statusUpdated, this, &MainWidget::onStatusUpdated);
connect(handler, &ClientHandler::dataReceived, dataHandler, &DataHandler::handleData);
connect(dataHandler, &DataHandler::picRecvFinished, handler, &ClientHandler::onPicRecvFinished);
connect(dataHandler, &DataHandler::statusUpdated, this, &MainWidget::onStatusUpdated);
// 当线程结束时删除 handler
connect(thread, &QThread::finished, this, [=]() {
onThreadFinished(thread, handler, dataHandler);
@ -160,6 +135,9 @@ MainWidget::MainWidget(QWidget* parent) :
connect(dataHandler, &DataHandler::updateLicenseHwInfoEdit, this, [this](const QString& text) {
licenseHwInfoEdit->setPlainText(text);
});
connect(dataHandler, &DataHandler::updateUuidHwInfoEdit, this, [this](const QString& text) {
UuidHwInfoEdit->setPlainText(text);
});
connect(dataHandler, &DataHandler::updateLeftLensImage, leftLens_imageLabel, &QLabel::setPixmap);
connect(dataHandler, &DataHandler::updateRightLensImage, rightLens_imageLabel, &QLabel::setPixmap);
@ -181,6 +159,9 @@ MainWidget::MainWidget(QWidget* parent) :
clientReadTimers[clientId] = readTimer;
connect(handler, &ClientHandler::sendDataToSomeClient, this, &MainWidget::sendDataToClient);
if (connectedClientsCount == 1) {
handler->sendDevInfoItem();
}
}
});
@ -276,7 +257,7 @@ void MainWidget::onClientDisconnected(ClientHandler* handler)
int clientId = handler->getClientId();
qDebug() << " preVideoClientId :" << handler->preVideoClientId;
qDebug() << " clientId :" << clientId;
if (handler->preVideoClientId == clientId) {
if ((isBackBoardOrAllBoard != 0) || (handler->preVideoClientId == clientId)) {
qDebug() << "Current path: " << QDir::currentPath();
QString filePath = QDir::currentPath() + "/add1.h264";
if (QFile::exists(filePath)) {
@ -344,13 +325,13 @@ void MainWidget::updateServerButtonText()
}
}
// 设置 UI
void MainWidget::setupUI()
{
startServerButton = new QPushButton("开始监听\n(Start Listening...)", this);
// 左侧部分 UI 元素
startServerButton = new QPushButton(QString(START_LISTENING), this);
startServerButton->setFixedSize(190, 70);
sendAllButton = new QPushButton("一键功能测试", this);
sendAllButton = new QPushButton(QString(ONE_CLICKED_TEST), this);
sendAllButton->setFixedSize(190, 70);
sendAllButton->setEnabled(false);
@ -395,72 +376,41 @@ void MainWidget::setupUI()
leftContainer->setLayout(leftLayout);
leftContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// 前板
QGroupBox* frontDeviceInfoGroupBox = createFrontDeviceInfoGroupBox();
QGroupBox* frontLicenseGroupBox = createLicenseGroupBox();
QTabWidget* mainTabWidget = new QTabWidget(this);
QHBoxLayout* frontGroupBoxLayout = new QHBoxLayout;
frontGroupBoxLayout->addWidget(frontDeviceInfoGroupBox, 1);
frontGroupBoxLayout->addWidget(frontLicenseGroupBox, 1);
VideoResolutionEdit = new QLineEdit(this);
VideoResolutionEdit_back = new QLineEdit(this);
VideoResolutionEdit_all = new QLineEdit(this);
QTabWidget* frontTabWidget = new QTabWidget(this);
frontTabWidget->setFixedSize(900, 315);
QWidget* frontFunctionTestTab = createFunctionTestTab(frontBoardTest, "frontBoardTest");
QWidget* frontFunctionConfigTab = createFunctionConfigTab(frontBoardFuncConfig, "frontBoardFuncConfig");
frontTabWidget->addTab(frontFunctionTestTab, "前板测试项");
frontTabWidget->addTab(frontFunctionConfigTab, "前板配置项");
// 添加前板、后板、整机的布局
addDeviceAreaTab(mainTabWidget, QString(FRONT_BOARD_NAME),
createFrontDeviceInfoGroupBox(), createLicenseGroupBox(),
frontBoardTest, frontBoardFuncConfig, "frontBoardTest", "frontBoardFuncConfig",
QString(FRONT_TEST_ITEM), QString(FRONT_CONFID_ITEM), leftLens_imageLabel, rightLens_imageLabel,
videoLabel, VideoResolutionEdit);
QTabWidget* mainTabWidget = new QTabWidget(this);
QWidget* frontDevAreaTab = new QWidget(this);
QVBoxLayout* frontDevLayout = new QVBoxLayout(frontDevAreaTab);
frontDevLayout->addLayout(frontGroupBoxLayout);
frontDevLayout->addWidget(frontTabWidget, 2, Qt::AlignTop | Qt::AlignLeft);
mainTabWidget->addTab(frontDevAreaTab, "前 板");
addDeviceAreaTab(mainTabWidget, QString(BACK_BOARD_NAME),
createBackDeviceInfoGroupBox(), createBackConnectServerGroupBox(),
backBoardTest, backBoardFuncConfig, "backBoardTest", "backBoardFuncConfig",
QString(BACK_TEST_ITEM), QString(BACK_CONFID_ITEM), leftLens_imageLabel_back, rightLens_imageLabel_back,
video_Label_back, VideoResolutionEdit_back);
// 后板
QGroupBox* backDeviceInfoGroupBox1 = createBackDeviceInfoGroupBox();
QGroupBox* BackConnectServerGroupBox = createBackConnectServerGroupBox();
QHBoxLayout* backGroupBoxLayout = new QHBoxLayout;
backGroupBoxLayout->addWidget(backDeviceInfoGroupBox1, 1);
backGroupBoxLayout->addWidget(BackConnectServerGroupBox, 1);
QTabWidget* backTabWidget = new QTabWidget(this);
backTabWidget->setFixedSize(900, 315);
QWidget* backFunctionTestTab = createFunctionTestTab(backBoardTest, "backBoardTest");
QWidget* backFunctionConfigTab = createFunctionConfigTab(backBoardFuncConfig, "backBoardFuncConfig");
backTabWidget->addTab(backFunctionTestTab, "后板测试项");
backTabWidget->addTab(backFunctionConfigTab, "后板配置项");
QWidget* backDevAreaTab = new QWidget(this);
QVBoxLayout* backDevLayout = new QVBoxLayout(backDevAreaTab);
backDevLayout->addLayout(backGroupBoxLayout);
backDevLayout->addWidget(backTabWidget, 2, Qt::AlignTop | Qt::AlignLeft);
mainTabWidget->addTab(backDevAreaTab, "后 板");
// 整机
QWidget* allDevAreaTab = new QWidget(this);
QVBoxLayout* allDevLayout = new QVBoxLayout(allDevAreaTab);
mainTabWidget->addTab(allDevAreaTab, "整 机");
QTabWidget* tabWidget_media = new QTabWidget(this);
QWidget* imageDisplayTab = createImageDisplayTab();
QWidget* videoDisplayTab = createVideoDisplayTab();
tabWidget_media->addTab(imageDisplayTab, "图像显示区");
tabWidget_media->addTab(videoDisplayTab, "视频显示区");
addAllDeviceAreaTab(mainTabWidget, QString(ALL_BOARD_NAME), leftLens_imageLabel_all, rightLens_imageLabel_all, video_Label_all, VideoResolutionEdit_all);
// 右侧主布局
QVBoxLayout* rightVerticalLayout = new QVBoxLayout;
rightVerticalLayout->addWidget(mainTabWidget, 5);
rightVerticalLayout->addWidget(tabWidget_media, 4);
// 主布局
QHBoxLayout* mainLayout = new QHBoxLayout;
mainLayout->addWidget(leftContainer, 1, Qt::AlignTop | Qt::AlignLeft);
mainLayout->addLayout(rightVerticalLayout, 3);
setLayout(mainLayout);
setWindowTitle("SL100 工厂产测工具 - V0.0.5");
resize(1340, 900);
setWindowTitle(QString(TOOL_VERSION));
resize(SL100_FACTORY_TOOL_W, SL100_FACTORY_TOOL_H);
// 信号槽连接
connect(startServerButton, &QPushButton::clicked, this, &MainWidget::onStartServerClicked);
connect(sendAllButton, &QPushButton::clicked, this, &MainWidget::onSendAllClicked);
connect(statusListWidget, &QListWidget::itemChanged, this, &MainWidget::scrollToBottom);
@ -542,7 +492,7 @@ QString calculateSignature(const QMap<QString, QString>& params, const QString&
// 3. 构造 BaseString
//QString baseString = params["batch"] + params["label"] + params["model"] + params["request_id"] + params["timestamp"] + params["factory_id"];
QString baseString = "240830SL100LabelSL100" + request_id + timestamp + "TEST";
QString baseString = "1TEST_SL100_20240826SL100" + request_id + timestamp + "TEST";
qDebug() << "baseString:" << baseString;
// 4. 构造 stringToSign
@ -555,8 +505,8 @@ QString calculateSignature(const QMap<QString, QString>& params, const QString&
// 请求头
void prepareRequestHeaders(QNetworkRequest& request, const QString& sign, const QString& request_id) {
request.setRawHeader("factory_id", "TEST");
request.setRawHeader("label", "SL100Label");
request.setRawHeader("batch", QString::number(240830).toUtf8());
request.setRawHeader("label", "TEST_SL100_20240826");
request.setRawHeader("batch", QString::number(1).toUtf8());
request.setRawHeader("model", "SL100");
request.setRawHeader("timestamp", QString::number(QDateTime::currentSecsSinceEpoch()).toUtf8());
request.setRawHeader("request_id", request_id.toUtf8());
@ -598,7 +548,7 @@ void sendPostRequest(HttpClient* httpClient, const QUrl& url, const QMap<QString
// GET 获取 UUID
void MainWidget::FactoryToolSendGetUuidToHttpServer(const QString& mac_addr) {
QUrl url("http://admin.hassecurity.cn/v1/getUuid");
QMap<QString, QString> params = {
QMap<QString, QString> params = {
{"label", "TEST_SL100_20240826"},
{"model", "SL100"},
{"batch", "1"},
@ -780,6 +730,8 @@ void MainWidget::readJsonConfig()
backBoardDevInfoJson = readJson_backDevInfo();
backBoardUuidJson = readJson_backUuid();
factoryProductInfo = readJson_factoryProductInfo();
testJsonConfig = readJson_testConfig();
funcJsonConfig = readJson_funcConfig();
@ -989,26 +941,6 @@ void MainWidget::onLicenseButtonClicked()
}
}
else {
#if 0
if (jsonObject["lable"].toString() == "write_license") {
QString hwInfoText = licenseHwInfoEdit->toPlainText();
dataStr = hwInfoText.remove(","); // 去掉所有的逗号
QByteArray dataByteArray = QByteArray::fromHex(dataStr.toUtf8());
memcpy(hardware_info, dataByteArray.data(), qMin(dataByteArray.size(), PIX_HARDWARE_INFO_BYTES));
qDebug() << "hardware_info:" << QByteArray(reinterpret_cast<char*>(hardware_info), PIX_HARDWARE_INFO_BYTES).toHex();
licenseGenerate(hardware_info, license_info);
QString licenseInfoStr;
printf("License is\n");
for (int j = 0; j < PIX_LICENCE_BYTES; ++j) {
printf("0x%02x, ", license_info[j]);
licenseInfoStr.append(QString::asprintf("0x%02x, ", license_info[j]));
}
printf("\n");
licenseHwInfoEdit->setPlainText(licenseInfoStr);
dataStr = QByteArray(reinterpret_cast<char*>(license_info), PIX_LICENCE_BYTES).toHex();
qDebug() << "license_info:" << dataStr;
}
#else
if (jsonObject["lable"].toString() == "write_license") {
QString licenseInfoText = licenseHwInfoEdit->toPlainText();
qDebug() << "licenseInfoText:" << licenseInfoText;
@ -1025,7 +957,6 @@ void MainWidget::onLicenseButtonClicked()
dataStr = dataByteArray.toBase64();
qDebug() << "Base64 Encoded:" << dataStr;
}
#endif
for (ClientHandler* handler : clients) {
handler->sendLicenseItem(index, dataStr);
}
@ -1052,25 +983,75 @@ void MainWidget::onUuidButtonClicked()
QString sendToHttpServerDataStr = UuidHwInfoEdit->toPlainText();
qDebug() << "sendToHttpServerDataStr:" << sendToHttpServerDataStr;
// 测试随机生成8-12位字符串
sendToHttpServerDataStr = generateRandomRequestID(8, 13);
// sendToHttpServerDataStr = generateRandomRequestID(8, 13);
FactoryToolSendGetUuidToHttpServer(sendToHttpServerDataStr);
while (isRequestSuccessful == 0) {
QCoreApplication::processEvents(); // 防止阻塞UI线程
}
qDebug() << "isRequestSuccessful:" << isRequestSuccessful;
if (isRequestSuccessful == 2) {
UuidHwInfoEdit->setPlainText("服务器没有回复UUID和SN !!!");
isRequestSuccessful = 0;
return;
}
else if (isRequestSuccessful == 1) {
if (licenseDataArray.contains("uuid") && licenseDataArray.contains("sn")) {
QString backBoardUuid = licenseDataArray["uuid"].toString();
QString backBoardSn = licenseDataArray["sn"].toString();
QString displayText = QString("UUID:\n%1\nSN:\n%2").arg(backBoardUuid).arg(backBoardSn);
UuidHwInfoEdit->setPlainText(displayText);
qDebug() << "HTTP Server backBoardUuid is:" << backBoardUuid;
qDebug() << "HTTP Server backBoardSn is:" << backBoardSn;
isRequestSuccessful = 0;
return;
}
else {
qDebug() << "The UUID and SN are not found from the HTTP server!!!";
UuidHwInfoEdit->setPlainText("服务器没有回复UUID和SN !!!");
isRequestSuccessful = 0;
return;
}
}
}
else {
QString backBoardUuid = "";
QString backBoardSn = "";
if (jsonObject["lable"].toString() == "write_UUID_SN") {
QString UUIDAndSNInfoText = UuidHwInfoEdit->toPlainText();
QStringList lines = UUIDAndSNInfoText.split("\n");
bool isUuidSection = false;
bool isSnSection = false;
for (const QString& line : lines) {
QString trimmedLine = line.trimmed();
if (trimmedLine == "UUID:") {
isUuidSection = true;
isSnSection = false;
continue;
}
if (trimmedLine == "SN:") {
isUuidSection = false;
isSnSection = true;
continue;
}
if (isUuidSection) {
if (!backBoardUuid.isEmpty()) {
backBoardUuid += "\n";
}
backBoardUuid += trimmedLine;
}
if (isSnSection) {
if (!backBoardSn.isEmpty()) {
backBoardSn += "\n";
}
backBoardSn += trimmedLine;
}
}
qDebug() << "UuidHwInfoEdit backBoardUuid is:" << backBoardUuid;
qDebug() << "UuidHwInfoEdit backBoardSn is:" << backBoardSn;
}
qDebug() << "onUuidButtonClicked index:" << index;
for (ClientHandler* handler : clients) {
handler->sendUuidItem(index, "");
handler->sendUuidItem(index, backBoardUuid, backBoardSn);
}
}
}
@ -1191,7 +1172,7 @@ void MainWidget::onSendGetPicClicked()
}
else {
if (lastClickedGetPicCamIndex == -1) {
QListWidgetItem* listItem = new QListWidgetItem(QString("Please select IR or RGB lens to get image!!!"), statusListWidget);
QListWidgetItem* listItem = new QListWidgetItem(QString("Please select \"左边镜头\" or \"右边镜头\" to get image!!!"), statusListWidget);
listItem->setBackground(Qt::red);
}
else {
@ -1227,47 +1208,135 @@ void MainWidget::onSendGetVideoClicked()
{
if (connectedClientsCount) {
QPushButton* button = qobject_cast<QPushButton*>(sender());
int itemIndex = button->property("getVideoIndex").toInt();
if (itemIndex < 4) {
button->setStyleSheet("background-color: green;");
if (lastClickedGetVideoCamIndex != -1 && lastClickedGetVideoCamIndex != itemIndex) {
getVideoButtons[lastClickedGetVideoCamIndex]->setStyleSheet("");
if (lastClickedGetVideoDevIndex != -1) {
getVideoButtons[lastClickedGetVideoDevIndex - 2]->setStyleSheet("");
}
}
lastClickedGetVideoCamIndex = itemIndex;
}
else {
if (lastClickedGetVideoCamIndex == -1) {
QListWidgetItem* listItem = new QListWidgetItem(QString("Please select lens to get video!!!"), statusListWidget);
listItem->setBackground(Qt::red);
}
else {
if (itemIndex - 8 >= connectedClientsCount) {
QListWidgetItem* listItem = new QListWidgetItem(QString("This device is not connected !!!").arg(itemIndex - 6), statusListWidget);
listItem->setBackground(Qt::red);
}
else {
int itemIndex = -1;
if (button) {
if (button->property(FRONT_BOARD_VIDEO_BUTTON_INDEX_PROPERTY).isValid()) {
itemIndex = button->property(FRONT_BOARD_VIDEO_BUTTON_INDEX_PROPERTY).toInt();
if (itemIndex < 4) {
button->setStyleSheet("background-color: green;");
if (lastClickedGetVideoDevIndex != -1 && lastClickedGetVideoDevIndex != itemIndex) {
//qDebug() << "itemIndex:" << itemIndex;
getVideoButtons[lastClickedGetVideoDevIndex - 2]->setStyleSheet("");
}
lastClickedGetVideoDevIndex = itemIndex;
//QMutexLocker locker(&mutex);
for (ClientHandler* handler : clients) {
if (handler->getClientId() == handler->controlClientId) {
qDebug() << "lens number:" << lastClickedGetVideoCamIndex;
handler->sendGetVideoItem(itemIndex - 7, lastClickedGetVideoCamIndex);
break;
if (lastClickedGetVideoCamIndex != -1 && lastClickedGetVideoCamIndex != itemIndex) {
getVideoButtons[lastClickedGetVideoCamIndex]->setStyleSheet("");
if (lastClickedGetVideoDevIndex != -1) {
getVideoButtons[lastClickedGetVideoDevIndex - 2]->setStyleSheet("");
}
}
lastClickedGetVideoCamIndex = itemIndex;
}
else {
if (lastClickedGetVideoCamIndex == -1) {
QListWidgetItem* listItem = new QListWidgetItem(QString("Please select lens to get video!!!"), statusListWidget);
listItem->setBackground(Qt::red);
}
else {
if (itemIndex - 8 >= connectedClientsCount) {
QListWidgetItem* listItem = new QListWidgetItem(QString("This device is not connected !!!").arg(itemIndex - 6), statusListWidget);
listItem->setBackground(Qt::red);
}
else {
button->setStyleSheet("background-color: green;");
if (lastClickedGetVideoDevIndex != -1 && lastClickedGetVideoDevIndex != itemIndex) {
//qDebug() << "itemIndex:" << itemIndex;
getVideoButtons[lastClickedGetVideoDevIndex - 2]->setStyleSheet("");
}
lastClickedGetVideoDevIndex = itemIndex;
//QMutexLocker locker(&mutex);
for (ClientHandler* handler : clients) {
if ((isBackBoardOrAllBoard) || (handler->getClientId() == handler->controlClientId)) {
qDebug() << "lens number:" << lastClickedGetVideoCamIndex;
handler->sendGetVideoItem(itemIndex - 7, lastClickedGetVideoCamIndex);
break;
}
}
getVideoButtons[FOCUS_WINDOWS_BUTTON]->setEnabled(true);
}
}
getVideoButtons[FOCUS_WINDOWS_BUTTON]->setEnabled(true);
}
}
}
else if (button->property(BACK_BOARD_VIDEO_BUTTON_INDEX_PROPERTY).isValid()) {
itemIndex = button->property(BACK_BOARD_VIDEO_BUTTON_INDEX_PROPERTY).toInt();
if (itemIndex < 4) {
button->setStyleSheet("background-color: green;");
if (lastClickedGetVideoCamIndex != -1 && lastClickedGetVideoCamIndex != itemIndex) {
getBackVideoButtons[lastClickedGetVideoCamIndex]->setStyleSheet("");
if (lastClickedGetVideoDevIndex != -1) {
getBackVideoButtons[lastClickedGetVideoDevIndex - 2]->setStyleSheet("");
}
}
lastClickedGetVideoCamIndex = itemIndex;
}
else {
if (lastClickedGetVideoCamIndex == -1) {
QListWidgetItem* listItem = new QListWidgetItem(QString("Please select lens to get video!!!"), statusListWidget);
listItem->setBackground(Qt::red);
}
else {
if (itemIndex - 8 >= connectedClientsCount) {
QListWidgetItem* listItem = new QListWidgetItem(QString("This device is not connected !!!").arg(itemIndex - 6), statusListWidget);
listItem->setBackground(Qt::red);
}
else {
button->setStyleSheet("background-color: green;");
if (lastClickedGetVideoDevIndex != -1 && lastClickedGetVideoDevIndex != itemIndex) {
//qDebug() << "itemIndex:" << itemIndex;
getBackVideoButtons[lastClickedGetVideoDevIndex - 2]->setStyleSheet("");
}
lastClickedGetVideoDevIndex = itemIndex;
//QMutexLocker locker(&mutex);
for (ClientHandler* handler : clients) {
if ((isBackBoardOrAllBoard) || (handler->getClientId() == handler->controlClientId)) {
qDebug() << "lens number:" << lastClickedGetVideoCamIndex;
handler->sendGetVideoItem(itemIndex - 7, lastClickedGetVideoCamIndex);
break;
}
}
getBackVideoButtons[FOCUS_WINDOWS_BUTTON]->setEnabled(true);
}
}
}
}
else if (button->property(ALL_BOARD_VIDEO_BUTTON_INDEX_PROPERTY).isValid()) {
itemIndex = button->property(ALL_BOARD_VIDEO_BUTTON_INDEX_PROPERTY).toInt();
if (itemIndex < 4) {
button->setStyleSheet("background-color: green;");
if (lastClickedGetVideoCamIndex != -1 && lastClickedGetVideoCamIndex != itemIndex) {
getAllVideoButtons[lastClickedGetVideoCamIndex]->setStyleSheet("");
if (lastClickedGetVideoDevIndex != -1) {
getAllVideoButtons[lastClickedGetVideoDevIndex - 2]->setStyleSheet("");
}
}
lastClickedGetVideoCamIndex = itemIndex;
}
else {
if (lastClickedGetVideoCamIndex == -1) {
QListWidgetItem* listItem = new QListWidgetItem(QString("Please select lens to get video!!!"), statusListWidget);
listItem->setBackground(Qt::red);
}
else {
if (itemIndex - 8 >= connectedClientsCount) {
QListWidgetItem* listItem = new QListWidgetItem(QString("This device is not connected !!!").arg(itemIndex - 6), statusListWidget);
listItem->setBackground(Qt::red);
}
else {
button->setStyleSheet("background-color: green;");
if (lastClickedGetVideoDevIndex != -1 && lastClickedGetVideoDevIndex != itemIndex) {
//qDebug() << "itemIndex:" << itemIndex;
getAllVideoButtons[lastClickedGetVideoDevIndex - 2]->setStyleSheet("");
}
lastClickedGetVideoDevIndex = itemIndex;
//QMutexLocker locker(&mutex);
for (ClientHandler* handler : clients) {
if ((isBackBoardOrAllBoard) || (handler->getClientId() == handler->controlClientId)) {
qDebug() << "lens number:" << lastClickedGetVideoCamIndex;
handler->sendGetVideoItem(itemIndex - 7, lastClickedGetVideoCamIndex);
break;
}
}
getAllVideoButtons[FOCUS_WINDOWS_BUTTON]->setEnabled(true);
}
}
}
}
}
}
else {
QListWidgetItem* listItem = new QListWidgetItem(QString("No device is connected !!!"), statusListWidget);
@ -1311,8 +1380,11 @@ void MainWidget::onSendAllClicked()
// 重置索引
handler->resetCurrentItemIndex();
if (handler->getClientId() == handler->controlClientId) {
handler->sendNextItem();
//handler->sendDevInfoItem();
handler->sendNextItem(frontBoardOneClickTest);
break;
}
else if (isBackBoardOrAllBoard) {
handler->sendNextItem(backBoardOneClickTest);
break;
}
}
@ -1339,7 +1411,7 @@ void MainWidget::onSendFrontFuncItemClicked()
QPushButton* button = qobject_cast<QPushButton*>(sender());
int itemIndex = button->property("frontBoardFuncConfig").toInt();
for (ClientHandler* handler : clients) {
if (handler->getClientId() == handler->controlClientId) {
if ((isBackBoardOrAllBoard) || (handler->getClientId() == handler->controlClientId)) {
QString text = frontFuncConfigLineEdit->text();
qDebug() << "Text in frontFuncConfigLineEdit:" << text;
handler->sendFrontFuncItem(itemIndex, text);
@ -1381,7 +1453,7 @@ void MainWidget::onSendFrontItemClicked()
QPushButton* button = qobject_cast<QPushButton*>(sender());
int itemIndex = button->property("frontBoardTest").toInt();
for (ClientHandler* handler : clients) {
if (handler->getClientId() == handler->controlClientId) {
if ((isBackBoardOrAllBoard) || (handler->getClientId() == handler->controlClientId)) {
handler->sendFrontItem(itemIndex);
break;
}
@ -1412,50 +1484,18 @@ void MainWidget::onSendBackItemClicked()
}
}
// 处理状态更新信号
void MainWidget::onStatusUpdated(const QString& client, int itemIndex, int FuncItemIndex,
bool success, const QString& itemData, const QString& funcItemData,
const QJsonArray& jsonArray, int itemJsonIndex)
void MainWidget::onStatusUpdated(const QString& client, bool success, const QJsonArray& jsonArray, int itemJsonIndex)
{
int clientId = -1;
QString label;
// 遍历所有的 ClientHandler找到匹配的 client
for (ClientHandler* handler : clients) {
if (handler->getClientAddress() == client) {
clientId = handler->getClientId();
QString lable = handler->getCurrentItemLable();
lable = handler->getCurrentFuncItemLable();
break;
}
else
{
//qDebug() << "" << __FUNCTION__ << "handler->getClientAddress() != client" ;
}
}
//qDebug() << "itemIndex :" << itemIndex;
//qDebug() << "FuncItemIndex:" << FuncItemIndex;
//if (itemIndex > 0) {
// QListWidgetItem* listItem = new QListWidgetItem(QString("device ID: %1 - Item %2: %3 ---> %4")
// .arg(clientId)
// .arg(itemIndex)
// .arg(itemData) // data 字段
// .arg(success ? "OK" : "NG"), statusListWidget);
// listItem->setBackground(success ? Qt::green : Qt::red);
// statusListWidget->addItem(listItem);
//}
//else if (FuncItemIndex > 0) {
// QListWidgetItem* listItem = new QListWidgetItem(QString("device ID: %1 - funcItem %2: %3 ---> %4")
// .arg(clientId)
// .arg(FuncItemIndex)
// .arg(funcItemData) // data 字段
// .arg(success ? "OK" : "NG"), statusListWidget);
// listItem->setBackground(success ? Qt::green : Qt::red);
// statusListWidget->addItem(listItem);
//}
}
}
qDebug() << "itemJsonIndex :" << itemJsonIndex;
if (itemJsonIndex >= 0 && itemJsonIndex < jsonArray.size()) {
QJsonObject jsonObject = jsonArray.at(itemJsonIndex).toObject();
@ -1467,7 +1507,7 @@ void MainWidget::onStatusUpdated(const QString& client, int itemIndex, int FuncI
QListWidgetItem* listItem = new QListWidgetItem(QString("device ID: %1 - Item %2: %3 ---> %4")
.arg(clientId)
.arg(itemJsonIndex + 1)
.arg(label) // data 字段
.arg(label)
.arg(success ? "OK" : "NG"), statusListWidget);
listItem->setBackground(success ? Qt::green : Qt::red);
statusListWidget->addItem(listItem);
@ -1504,3 +1544,12 @@ void MainWidget::onAllItemsProcessed(const QString& client, int itemsProcessedCo
statusListWidget->scrollToBottom();
}
void MainWidget::onHandleInvalidOperate(const QString& text)
{
QListWidgetItem* listItem = new QListWidgetItem(QString("%1")
.arg(text), statusListWidget);
listItem->setBackground(Qt::red);
statusListWidget->addItem(listItem);
statusListWidget->scrollToBottom();
}

View File

@ -44,6 +44,7 @@
#include <QMessageAuthenticationCode>
#include <QCoreApplication>
#include "./UI_Widget/UI_Name.h"
#include "../Json/readJsonFile.h"
#include "../RecvDataHandler/RecvDataHandler.h"
#include "../LicenseGenerate/LicenseGenerate.h"
@ -64,6 +65,9 @@
#define START_MDNS 1
#define FOCUS_WINDOWS_BUTTON 4 // 大窗口播放视频的按键编号
#define TCP_CONNECT_PORT 12412 // TCP监听的端口
#define GET_PIC_DATA_SIZE (480 * 640 * 1.5)
#define NEW_MAP 1
class MainWidget : public QWidget
{
@ -105,9 +109,7 @@ private slots:
// 处理数据接收信号
//void onDataReceived(const QString& client, const QByteArray& data);
// 处理状态更新信号
void onStatusUpdated(const QString& client, int itemIndex, int funcItemIndex,
bool success, const QString& itemData, const QString& funcItemData,
const QJsonArray& jsonArray, int itemJsonIndex);
void onStatusUpdated(const QString& client, bool success, const QJsonArray& jsonArray, int itemJsonIndex);
// 处理所有项目处理完毕信号
void onAllItemsProcessed(const QString& client, int itemsProcessedCount);
// 处理客户端断开连接
@ -138,18 +140,34 @@ private:
void readJsonConfig();
// 设置 UI
void setupUI();
#if NEW_MAP
void addDeviceAreaTab(QTabWidget* mainTabWidget, const QString& tabName,
QGroupBox* deviceInfoGroupBox, QGroupBox* licenseGroupBox,
const QJsonArray& boardTest, const QJsonArray& boardFuncConfig,
const QString& boardTestName, const QString& boardFuncConfigName,
const QString& boardTestTitle, const QString& boardConfigTitle,
QLabel* leftLensLabel, QLabel* rightLensLabel, QLabel* videoLabel,
QLineEdit* VideoResolutionEdit_type);
void addAllDeviceAreaTab(QTabWidget* mainTabWidget, const QString& tabName,
QLabel* leftLensLabel, QLabel* rightLensLabel, QLabel* videoLabel,
QLineEdit* VideoResolutionEdit_type);
QTabWidget* createMediaTabWidget(QLabel* leftLensLabel, QLabel* rightLensLabel, QLabel* videoLabel,
QLineEdit* VideoResolutionEdit_type, const QString& tabName);
#endif
QGroupBox* createLicenseGroupBox();
QGroupBox* createFrontDeviceInfoGroupBox();
QGroupBox* createBackDeviceInfoGroupBox();
QWidget* createFunctionTestTab(const QJsonArray& BoardFuncTest, const QString& propertyName);
QWidget* createFunctionConfigTab(const QJsonArray& BoardFuncConfig, const QString& propertyName);
QWidget* createImageDisplayTab();
QWidget* createVideoDisplayTab();
QWidget* createImageDisplayTab(QLabel* leftLensLabel, QLabel* rightLensLabel);
QWidget* createVideoDisplayTab(QLabel* videoLabel, QLineEdit* VideoResolutionEdit_type, const QString& tabName);
QGroupBox* createBackConnectServerGroupBox();
// 保存日志到文件
void saveStatusListToFile(const QString& filePath);
// 用于更新按键文本的函数
void updateServerButtonText();
void onHandleInvalidOperate(const QString& text);
void onDisconnectClient(int clientId);
void setupTimerForThreadPoolInfo();
void sendDataToClient(int clientId, const QByteArray& data);
@ -172,6 +190,7 @@ private:
QJsonArray backBoardFuncConfig; // 后板功能配置参数 JSON
QJsonArray backBoardDevInfoJson; // 后板设备信息参数 JSON
QJsonArray backBoardUuidJson; // 后板UUID JSON
QJsonArray factoryProductInfo; // 整机:工厂生产信息
QJsonArray testJsonConfig; // 功能测试区 JSON 配置
QJsonArray funcJsonConfig; // 功能配置区 JSON 配置
QJsonArray getDevInfoJson; // 获取设备信息 JSON 配置
@ -199,19 +218,30 @@ private:
QVector<QPushButton*> funcItemButtons; // 功能配置项目按键集合
QVector<QPushButton*> getPicButtons; // 保存两个取图的摄像头的按键的指针
QVector<QPushButton*> getVideoButtons; // 保存拉视频设备的按键的指针
QVector<QPushButton*> getBackVideoButtons;
QVector<QPushButton*> getAllVideoButtons;
QList<ClientHandler*> clients; // 客户端处理器集合
QMap<int, QTimer*> clientTimers; // 每个客户端的定时器
QMap<QString, QLineEdit*> devInfoLineEdits;// msg_id 和对应的 QLineEdit 的映射关系
QMap<QString, QLineEdit*> productInfoLineEdits;
QCheckBox* saveCheckBox; // 保存文件复选框
QPushButton* selectFileButton; // Save Log 按键
QPushButton* clearLogButton; // clear Log 按键
QLineEdit* filePathLineEdit; // 文件路径显示
QLineEdit* VideoResolutionEdit; // 视频分辨率显示
QLineEdit* VideoResolutionEdit_back; // 视频分辨率显示
QLineEdit* VideoResolutionEdit_all; // 视频分辨率显示
//QLineEdit* frameRateEdit; // 视频帧率显示
QLabel* leftLens_imageLabel; // 左边镜头图像显示
QLabel* rightLens_imageLabel; // 右边镜头图像显示
QLabel* videoLabel; // 视频显示
QLabel* leftLens_imageLabel; // 前板左边镜头图像显示
QLabel* rightLens_imageLabel; // 前板右边镜头图像显示
QLabel* leftLens_imageLabel_back; // 后板左边镜头图像显示
QLabel* rightLens_imageLabel_back; // 后板右边镜头图像显示
QLabel* leftLens_imageLabel_all; // 整机左边镜头图像显示
QLabel* rightLens_imageLabel_all; // 整机右边镜头图像显示
QLabel* videoLabel; // 前板视频显示
QLabel* video_Label_back; // 后板视频显示
QLabel* video_Label_all; // 整机视频显示
QLineEdit* frontFuncConfigLineEdit; // 前板功能配置编辑框
QLineEdit* backFuncConfigLineEdit; // 后板功能配置编辑框
QTextEdit* licenseHwInfoEdit; // 获取license的硬件信息

View File

@ -0,0 +1,42 @@
// UI_Name.h
#ifndef UI_NAME_H
#define UI_NAME_H
#define SL100_FACTORY_TOOL_W 1340
#define SL100_FACTORY_TOOL_H 900
#define START_LISTENING "开始监听\n(Start Listening...)"
#define ONE_CLICKED_TEST "一键功能测试"
#define TOOL_VERSION "SL100 工厂产测工具 - V0.0.7"
#define FRONT_BOARD_NAME "前 板"
#define BACK_BOARD_NAME "后 板"
#define ALL_BOARD_NAME "整 机"
#define FRONT_BOARD_TEST "前板测试项"
#define IMAGE_DISPLAYAREA "图像显示区"
#define VIDEO_DISPLAYAREA "视频显示区"
#define RESOLUTION_EDIT "分辨率:"
#define LEFT_LENS "左边镜头"
#define RIGHT_LENS "右边镜头"
#define CAT_EYE_LENS_RGB "猫眼镜头(RGB)"
#define CAT_EYE_LENS_IR "猫眼镜头(IR)"
#define BIG_WINDOW_PRE_VIDEO "大窗口播放视频"
#define IMAGE_DISPLAY_TAB "图像显示区"
#define VIDEO_DISPLAY_TAB "视频显示区"
#define INPUT_CONFIG_PARA "请输入配置参数..."
#define FRONT_TEST_ITEM "前板测试项"
#define FRONT_CONFID_ITEM "前板配置项"
#define FRONT_DEVICE_INFO "前板设备信息"
#define FRONT_TUYU_LICENSE "算法 license"
#define BACK_TEST_ITEM "后板测试项"
#define BACK_CONFID_ITEM "后板配置项"
#define BACK_GET_UUID_SN "后板获取 UUID/SN"
#define BACK_DEVICE_INFO "后板设备信息"
#define ALL_BOARD "整机设备信息"
#define ALL_PRODUCT_INFO "工厂生产信息"
#define FRONT_BOARD_VIDEO_BUTTON_INDEX_PROPERTY "getVideoIndex"
#define BACK_BOARD_VIDEO_BUTTON_INDEX_PROPERTY "BackGetVideoIndex"
#define ALL_BOARD_VIDEO_BUTTON_INDEX_PROPERTY "AllGetVideoIndex"
#endif

View File

@ -2,7 +2,7 @@
QGroupBox* MainWidget::createLicenseGroupBox()
{
QGroupBox* groupBox = new QGroupBox("算法 license", this);
QGroupBox* groupBox = new QGroupBox(QString(FRONT_TUYU_LICENSE), this);
QHBoxLayout* buttonRowLayout = new QHBoxLayout;
for (int i = 0; i < frontBoardLicenseJson.size(); ++i) {
@ -29,9 +29,8 @@ QGroupBox* MainWidget::createLicenseGroupBox()
QGroupBox* MainWidget::createFrontDeviceInfoGroupBox()
{
QGroupBox* frontDeviceInfoGroupBox = new QGroupBox("前板设备信息", this);
QGroupBox* frontDeviceInfoGroupBox = new QGroupBox(QString(FRONT_DEVICE_INFO), this);
QFormLayout* formLayout = new QFormLayout(frontDeviceInfoGroupBox);
for (const QJsonValue& value : frontBoardDevInfoJson) {
QJsonObject item = value.toObject();
QString label = item["lable"].toString();
@ -43,19 +42,17 @@ QGroupBox* MainWidget::createFrontDeviceInfoGroupBox()
formLayout->addRow(itemLabel, itemLineEdit);
devInfoLineEdits[cmd] = itemLineEdit;
}
return frontDeviceInfoGroupBox;
}
QGroupBox* MainWidget::createBackDeviceInfoGroupBox()
{
QGroupBox* backDeviceInfoGroupBox = new QGroupBox("后板设备信息", this);
QGroupBox* backDeviceInfoGroupBox = new QGroupBox(QString(BACK_DEVICE_INFO), this);
QFormLayout* formLayout = new QFormLayout(backDeviceInfoGroupBox);
for (const QJsonValue& value : backBoardDevInfoJson) {
QJsonObject item = value.toObject();
QString label = item["lable"].toString();
QString cmd = item["cmd"].toString();
QJsonObject item = value.toObject();
QString label = item["lable"].toString();
QString cmd = item["cmd"].toString();
QLabel* itemLabel = new QLabel(label, this);
QLineEdit* itemLineEdit = new QLineEdit(this);
itemLineEdit->setReadOnly(true);
@ -63,13 +60,12 @@ QGroupBox* MainWidget::createBackDeviceInfoGroupBox()
formLayout->addRow(itemLabel, itemLineEdit);
devInfoLineEdits[cmd] = itemLineEdit;
}
return backDeviceInfoGroupBox;
}
QGroupBox* MainWidget::createBackConnectServerGroupBox()
{
QGroupBox* BackConnectServerGroupBox = new QGroupBox("后板获取UUID", this);
QGroupBox* BackConnectServerGroupBox = new QGroupBox(QString(BACK_GET_UUID_SN), this);
QHBoxLayout* frontDeviceInfoLayout = new QHBoxLayout;
for (int i = 0; i < backBoardUuidJson.size(); ++i) {
@ -141,11 +137,11 @@ QWidget* MainWidget::createFunctionConfigTab(const QJsonArray& BoardFuncConfig,
QWidget* functionConfigTab = new QWidget(this);
QVBoxLayout* functionConfigLayout = new QVBoxLayout(functionConfigTab);
if (propertyName == "frontBoardFuncConfig") {
frontFuncConfigLineEdit->setPlaceholderText("请输入配置参数...");
frontFuncConfigLineEdit->setPlaceholderText(QString(INPUT_CONFIG_PARA));
functionConfigLayout->addWidget(frontFuncConfigLineEdit);
}
else if (propertyName == "backBoardFuncConfig") {
backFuncConfigLineEdit->setPlaceholderText("请输入配置参数...");
backFuncConfigLineEdit->setPlaceholderText(QString(INPUT_CONFIG_PARA));
functionConfigLayout->addWidget(backFuncConfigLineEdit);
}
@ -186,7 +182,7 @@ QWidget* MainWidget::createFunctionConfigTab(const QJsonArray& BoardFuncConfig,
return functionConfigTab;
}
QWidget* MainWidget::createImageDisplayTab()
QWidget* MainWidget::createImageDisplayTab(QLabel* leftLensLabel, QLabel* rightLensLabel)
{
QWidget* imageDisplayTab = new QWidget(this);
QVBoxLayout* imageDisplayLayout = new QVBoxLayout(imageDisplayTab);
@ -197,7 +193,7 @@ QWidget* MainWidget::createImageDisplayTab()
for (int j = 0; j < 2; ++j) {
QPushButton* button;
if (i == 0 && j == 0) {
button = new QPushButton(QString("IR"), this);
button = new QPushButton(QString(LEFT_LENS), this);
button->setFixedSize(73, 50);
imageButtonsRowLayout->addWidget(button);
button->setProperty("getPicIndex", i * 2 + j);
@ -206,7 +202,7 @@ QWidget* MainWidget::createImageDisplayTab()
continue;
}
else if (i == 0 && j == 1) {
button = new QPushButton(QString("RGB"), this);
button = new QPushButton(QString(RIGHT_LENS), this);
button->setFixedSize(73, 50);
imageButtonsRowLayout->addWidget(button);
button->setProperty("getPicIndex", i * 2 + j);
@ -215,7 +211,7 @@ QWidget* MainWidget::createImageDisplayTab()
continue;
}
button = new QPushButton(QString("Device %1").arg(i * 2 + j - 1), this);
button = new QPushButton(QString("Device %1\n取图").arg(i * 2 + j - 1), this);
button->setFixedSize(73, 50);
imageButtonsRowLayout->addWidget(button);
button->setProperty("getPicIndex", i * 2 + j);
@ -226,10 +222,12 @@ QWidget* MainWidget::createImageDisplayTab()
}
QHBoxLayout* lensesLayout = new QHBoxLayout;
leftLens_imageLabel = new QLabel(this);
rightLens_imageLabel = new QLabel(this);
lensesLayout->addWidget(leftLens_imageLabel);
lensesLayout->addWidget(rightLens_imageLabel);
//leftLens_imageLabel = new QLabel(this);
//rightLens_imageLabel = new QLabel(this);
//lensesLayout->addWidget(leftLens_imageLabel);
//lensesLayout->addWidget(rightLens_imageLabel);
lensesLayout->addWidget(leftLensLabel);
lensesLayout->addWidget(rightLensLabel);
QHBoxLayout* imageAndButtonsLayout = new QHBoxLayout;
imageAndButtonsLayout->addLayout(imageButtonsColumnLayout, 1);
@ -239,12 +237,23 @@ QWidget* MainWidget::createImageDisplayTab()
return imageDisplayTab;
}
QWidget* MainWidget::createVideoDisplayTab()
QWidget* MainWidget::createVideoDisplayTab(QLabel* video_Label, QLineEdit* VideoResolutionEdit_type, const QString& tabName)
{
QWidget* videoDisplayTab = new QWidget(this);
QWidget* videoDisplayTab = new QWidget(this);
QVBoxLayout* videoDisplayLayout = new QVBoxLayout(videoDisplayTab);
QVBoxLayout* videoButtonsColumnLayout = new QVBoxLayout;
const char* videoIndexProperty;
if (tabName == QString(FRONT_BOARD_NAME)) {
videoIndexProperty = FRONT_BOARD_VIDEO_BUTTON_INDEX_PROPERTY;
}
else if (tabName == QString(BACK_BOARD_NAME)) {
videoIndexProperty = BACK_BOARD_VIDEO_BUTTON_INDEX_PROPERTY;
}
else if(tabName == QString(ALL_BOARD_NAME)) {
videoIndexProperty = ALL_BOARD_VIDEO_BUTTON_INDEX_PROPERTY;
}
for (int i = 0; i < 6; ++i) {
QHBoxLayout* videoButtonsRowLayout = new QHBoxLayout;
@ -252,52 +261,92 @@ QWidget* MainWidget::createVideoDisplayTab()
QPushButton* button;
if (i == 0 && j == 0) {
button = new QPushButton(QString("猫眼镜头(IR)"), this);
button = new QPushButton(QString(CAT_EYE_LENS_IR), this);
button->setFixedSize(110, 50);
videoButtonsRowLayout->addWidget(button);
button->setProperty("getVideoIndex", i * 2 + j);
button->setProperty(videoIndexProperty, i * 2 + j);
connect(button, &QPushButton::clicked, this, &MainWidget::onSendGetVideoClicked);
getVideoButtons.append(button);
if (tabName == QString(FRONT_BOARD_NAME)) {
getVideoButtons.append(button);
}
else if (tabName == QString(BACK_BOARD_NAME)) {
getBackVideoButtons.append(button);
}
else if (tabName == QString(ALL_BOARD_NAME)) {
getAllVideoButtons.append(button);
}
continue;
}
else if (i == 0 && j == 1) {
button = new QPushButton(QString("猫眼镜头(RGB)"), this);
button = new QPushButton(QString(CAT_EYE_LENS_RGB), this);
button->setFixedSize(110, 50);
videoButtonsRowLayout->addWidget(button);
button->setProperty("getVideoIndex", i * 2 + j);
button->setProperty(videoIndexProperty, i * 2 + j);
connect(button, &QPushButton::clicked, this, &MainWidget::onSendGetVideoClicked);
getVideoButtons.append(button);
if (tabName == QString(FRONT_BOARD_NAME)) {
getVideoButtons.append(button);
}
else if (tabName == QString(BACK_BOARD_NAME)) {
getBackVideoButtons.append(button);
}
else if (tabName == QString(ALL_BOARD_NAME)) {
getAllVideoButtons.append(button);
}
continue;
}
if (i == 1 && j == 0) {
button = new QPushButton(QString("左边镜头"), this);
button->setFixedSize(110, 50);
videoButtonsRowLayout->addWidget(button);
button->setProperty("getVideoIndex", i * 2 + j);
connect(button, &QPushButton::clicked, this, &MainWidget::onSendGetVideoClicked);
getVideoButtons.append(button);
continue;
if (tabName != QString(BACK_BOARD_NAME)) {
if (i == 1 && j == 0) {
button = new QPushButton(QString(LEFT_LENS), this);
button->setFixedSize(110, 50);
videoButtonsRowLayout->addWidget(button);
button->setProperty(videoIndexProperty, i * 2 + j);
connect(button, &QPushButton::clicked, this, &MainWidget::onSendGetVideoClicked);
if (tabName == QString(FRONT_BOARD_NAME)) {
getVideoButtons.append(button);
}
else if (tabName == QString(BACK_BOARD_NAME)) {
getBackVideoButtons.append(button);
}
else if (tabName == QString(ALL_BOARD_NAME)) {
getAllVideoButtons.append(button);
}
continue;
}
else if (i == 1 && j == 1) {
button = new QPushButton(QString(RIGHT_LENS), this);
button->setFixedSize(110, 50);
videoButtonsRowLayout->addWidget(button);
button->setProperty(videoIndexProperty, i * 2 + j);
connect(button, &QPushButton::clicked, this, &MainWidget::onSendGetVideoClicked);
if (tabName == QString(FRONT_BOARD_NAME)) {
getVideoButtons.append(button);
}
else if (tabName == QString(BACK_BOARD_NAME)) {
getBackVideoButtons.append(button);
}
else if (tabName == QString(ALL_BOARD_NAME)) {
getAllVideoButtons.append(button);
}
continue;
}
}
else if (i == 1 && j == 1) {
button = new QPushButton(QString("右边镜头"), this);
button->setFixedSize(110, 50);
videoButtonsRowLayout->addWidget(button);
button->setProperty("getVideoIndex", i * 2 + j);
connect(button, &QPushButton::clicked, this, &MainWidget::onSendGetVideoClicked);
getVideoButtons.append(button);
continue;
}
if (i == 2 && j == 0) {
button = new QPushButton(QString("大窗口播放视频"), this);
button = new QPushButton(QString(BIG_WINDOW_PRE_VIDEO), this);
button->setFixedSize(224, 50);
button->setEnabled(false);
videoButtonsRowLayout->addWidget(button);
button->setProperty("getVideoIndex", i * 2 + j);
button->setProperty(videoIndexProperty, i * 2 + j);
connect(button, &QPushButton::clicked, this, &MainWidget::onOpenFocusWindowClicked);
getVideoButtons.append(button);
break; // 跳出内层循环,只添加一个按键
if (tabName == QString(FRONT_BOARD_NAME)) {
getVideoButtons.append(button);
}
else if (tabName == QString(BACK_BOARD_NAME)) {
getBackVideoButtons.append(button);
}
else if (tabName == QString(ALL_BOARD_NAME)) {
getAllVideoButtons.append(button);
}
break;
}
if (i >= 3 && i <= 5) {
@ -312,28 +361,30 @@ QWidget* MainWidget::createVideoDisplayTab()
button->setFixedSize(110, 50);
videoButtonsRowLayout->addWidget(button);
button->setProperty("getVideoIndex", i * 2 + j + 1);
button->setProperty(videoIndexProperty, i * 2 + j + 1);
connect(button, &QPushButton::clicked, this, &MainWidget::onSendGetVideoClicked);
getVideoButtons.append(button);
if (tabName == QString(FRONT_BOARD_NAME)) {
getVideoButtons.append(button);
}
else if (tabName == QString(BACK_BOARD_NAME)) {
getBackVideoButtons.append(button);
}
else if (tabName == QString(ALL_BOARD_NAME)) {
getAllVideoButtons.append(button);
}
}
videoButtonsColumnLayout->addLayout(videoButtonsRowLayout);
}
QHBoxLayout* videoAndButtonsLayout = new QHBoxLayout;
QFormLayout* formLayout = new QFormLayout;
QLabel* VideoResolution = new QLabel("分辨率:");
VideoResolutionEdit = new QLineEdit;
VideoResolutionEdit->setFixedWidth(120);
formLayout->addRow(VideoResolution, VideoResolutionEdit);
/*QLabel* frameRate = new QLabel("帧率:");
frameRateEdit = new QLineEdit;
frameRateEdit->setFixedWidth(120);
formLayout->addRow(frameRate, frameRateEdit);*/
videoLabel = new QLabel(this);
videoLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QLabel* VideoResolution = new QLabel(QString(RESOLUTION_EDIT));
VideoResolutionEdit_type->setFixedWidth(120);
formLayout->addRow(VideoResolution, VideoResolutionEdit_type);
video_Label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
videoAndButtonsLayout->addLayout(videoButtonsColumnLayout);
videoAndButtonsLayout->addLayout(formLayout);
videoAndButtonsLayout->addWidget(videoLabel);
videoAndButtonsLayout->addWidget(video_Label);
videoAndButtonsLayout->setStretch(0, 1);
videoAndButtonsLayout->setStretch(1, 1);
videoAndButtonsLayout->setStretch(2, 1);
@ -342,4 +393,79 @@ QWidget* MainWidget::createVideoDisplayTab()
return videoDisplayTab;
}
// 创建设备区域布局(前板或后板)
void MainWidget::addDeviceAreaTab(QTabWidget* mainTabWidget, const QString& tabName,
QGroupBox* deviceInfoGroupBox, QGroupBox* licenseGroupBox,
const QJsonArray& boardTest, const QJsonArray& boardFuncConfig,
const QString& boardTestName, const QString& boardFuncConfigName,
const QString& boardTestTitle, const QString& boardConfigTitle,
QLabel* leftLensLabel, QLabel* rightLensLabel, QLabel* video_Label,
QLineEdit* VideoResolutionEdit_type)
{
QHBoxLayout* groupBoxLayout = new QHBoxLayout;
groupBoxLayout->addWidget(deviceInfoGroupBox, 1);
groupBoxLayout->addWidget(licenseGroupBox, 1);
QTabWidget* boardTabWidget = new QTabWidget(this);
boardTabWidget->setFixedSize(900, 315);
QWidget* functionTestTab = createFunctionTestTab(boardTest, boardTestName);
QWidget* functionConfigTab = createFunctionConfigTab(boardFuncConfig, boardFuncConfigName);
boardTabWidget->addTab(functionTestTab, boardTestTitle);
boardTabWidget->addTab(functionConfigTab, boardConfigTitle);
QTabWidget* mediaTabWidget = createMediaTabWidget(leftLensLabel, rightLensLabel, video_Label, VideoResolutionEdit_type, tabName);
QWidget* devAreaTab = new QWidget(this);
QVBoxLayout* devLayout = new QVBoxLayout(devAreaTab);
devLayout->addLayout(groupBoxLayout);
devLayout->addWidget(boardTabWidget, 2, Qt::AlignTop | Qt::AlignLeft);
devLayout->addWidget(mediaTabWidget, 3);
mainTabWidget->addTab(devAreaTab, tabName);
}
// 创建整机区域布局
void MainWidget::addAllDeviceAreaTab(QTabWidget* mainTabWidget, const QString& tabName,
QLabel* leftLensLabel, QLabel* rightLensLabel, QLabel* video_Label,
QLineEdit* VideoResolutionEdit_type)
{
QHBoxLayout* groupBoxLayout = new QHBoxLayout;
QGroupBox* allDeviceInfoGroupBox = new QGroupBox(QString(ALL_BOARD), this);
QGroupBox* allProductInfoGroupBox = new QGroupBox(QString(ALL_PRODUCT_INFO), this);
QFormLayout* formLayout = new QFormLayout(allProductInfoGroupBox);
for (const QJsonValue& value : factoryProductInfo) {
QJsonObject item = value.toObject();
QString label = item["lable"].toString();
QString cmd = item["cmd"].toString();
QLabel* itemLabel = new QLabel(label, this);
QLineEdit* itemLineEdit = new QLineEdit(this);
itemLineEdit->setReadOnly(false);
formLayout->addRow(itemLabel, itemLineEdit);
productInfoLineEdits[cmd] = itemLineEdit;
}
groupBoxLayout->addWidget(allProductInfoGroupBox, 1);
groupBoxLayout->addWidget(allDeviceInfoGroupBox, 1);
QTabWidget* mediaTabWidget = createMediaTabWidget(leftLensLabel, rightLensLabel, video_Label, VideoResolutionEdit_type, tabName);
QWidget* allDevAreaTab = new QWidget(this);
QVBoxLayout* allDevLayout = new QVBoxLayout(allDevAreaTab);
allDevLayout->addLayout(groupBoxLayout, 5);
allDevLayout->addWidget(mediaTabWidget, 3);
mainTabWidget->addTab(allDevAreaTab, tabName);
}
// 创建媒体显示区的 tabWidget
QTabWidget* MainWidget::createMediaTabWidget(QLabel* leftLensLabel, QLabel* rightLensLabel, QLabel* video_Label,
QLineEdit* VideoResolutionEdit_type, const QString& tabName)
{
QTabWidget* tabWidget_media = new QTabWidget(this);
if (tabName != QString(BACK_BOARD_NAME)){
QWidget* imageDisplayTab = createImageDisplayTab(leftLensLabel, rightLensLabel);
tabWidget_media->addTab(imageDisplayTab, IMAGE_DISPLAY_TAB);
}
QWidget* videoDisplayTab = createVideoDisplayTab(video_Label, VideoResolutionEdit_type, tabName);
tabWidget_media->addTab(videoDisplayTab, VIDEO_DISPLAY_TAB);
return tabWidget_media;
}

View File

@ -0,0 +1,34 @@
device ID: 1 - Item 2: 停止视频 ---> OK
device ID: 1 - Item 2: 停止视频 ---> OK
device ID: 1 - Item 2: 停止视频 ---> OK
device ID: 1 - Item 2: 停止视频 ---> OK
device ID: 1 - Item 1: 人脸单角度注册 ---> NG
device ID: 1 - Item 23: IR灯关 ---> OK
device ID: 1 - Item 24: 串口测试 ---> NG
device ID: 1 - Item 1: get_hw_info ---> OK
device ID: 1 - Item 1: 人脸单角度注册 ---> NG
device ID: 1 - Item 2: 人脸多角度注册 ---> NG
device ID: 1 - Item 3: 掌静脉注册 ---> NG
device ID: 1 - Item 4: 人脸识别 ---> NG
device ID: 1 - Item 5: 掌静脉识别 ---> NG
device ID: 1 - Item 6: 删除用户 ---> NG
device ID: 1 - Item 7: 删除所有用户 ---> NG
device ID: 1 - Item 8: 获取用户 ---> NG
device ID: 1 - Item 9: 获取所有用户 ---> NG
device ID: 1 - Item 10: 密码注册 ---> NG
device ID: 1 - Item 11: 图片注册 ---> NG
device ID: 1 - Item 12: 左边镜头取图 ---> OK
device ID: 1 - Item 13: 右边镜头取图 ---> OK
device ID: 1 - Item 14: 前触摸屏测试 ---> NG
device ID: 1 - Item 15: MIC测试 ---> NG
device ID: 1 - Item 16: SPK测试 ---> NG
device ID: 1 - Item 17: 雷达测试 ---> NG
device ID: 1 - Item 18: NFC测试 ---> NG
device ID: 1 - Item 19: 防撬开关 ---> NG
device ID: 1 - Item 20: 光敏测试 ---> NG
device ID: 1 - Item 21: 前屏背光测试 ---> NG
device ID: 1 - Item 22: IR灯开 ---> OK
device ID: 1 - Item 23: IR灯关 ---> OK
device ID: 1 - Item 24: 串口测试 ---> NG
device ID: 1 - Item 25: PIR测试 ---> NG
device ID:-1 ---> All 25 items test completed !!!

View File

@ -0,0 +1,18 @@
device ID: 1 - Item 1: V851测试SPK ---> NG
device ID: 1 - Item 2: 806测试SPK ---> NG
device ID: 1 - Item 3: MIC测试 ---> NG
device ID: 1 - Item 4: 开锁测试 ---> NG
device ID: 1 - Item 5: 关锁测试 ---> NG
device ID: 1 - Item 6: 开锁按键测试 ---> NG
device ID: 1 - Item 7: 关锁按键测试 ---> NG
device ID: 1 - Item 8: 猫眼按键测试 ---> NG
device ID: 1 - Item 9: 后屏背光测试 ---> NG
device ID: 1 - Item 10: 后触摸屏测试 ---> NG
device ID: 1 - Item 11: 开猫眼测试 ---> NG
device ID: 1 - Item 12: 串口测试 ---> NG
device ID: 1 - Item 13: 开启视频 ---> NG
device ID: 1 - Item 14: 关闭视频 ---> NG
device ID: 1 - Item 15: wifi信号测试 ---> NG
device ID: 1 - Item 16: 进入配网测试 ---> NG
device ID: 1 - Item 17: 联网测试 ---> NG
device ID:-1 ---> All 17 items test completed !!!

View File

@ -0,0 +1,26 @@
device ID: 1 - Item 1: 人脸单角度注册 ---> NG
device ID: 1 - Item 2: 人脸多角度注册 ---> NG
device ID: 1 - Item 3: 掌静脉注册 ---> NG
device ID: 1 - Item 4: 人脸识别 ---> NG
device ID: 1 - Item 5: 掌静脉识别 ---> NG
device ID: 1 - Item 6: 删除用户 ---> NG
device ID: 1 - Item 7: 删除所有用户 ---> NG
device ID: 1 - Item 8: 获取用户 ---> NG
device ID: 1 - Item 9: 获取所有用户 ---> NG
device ID: 1 - Item 10: 密码注册 ---> NG
device ID: 1 - Item 11: 图片注册 ---> NG
device ID: 1 - Item 12: 左边镜头取图 ---> OK
device ID: 1 - Item 13: 右边镜头取图 ---> OK
device ID: 1 - Item 14: 前触摸屏测试 ---> NG
device ID: 1 - Item 15: MIC测试 ---> NG
device ID: 1 - Item 16: SPK测试 ---> NG
device ID: 1 - Item 17: 雷达测试 ---> NG
device ID: 1 - Item 18: NFC测试 ---> NG
device ID: 1 - Item 19: 防撬开关 ---> NG
device ID: 1 - Item 20: 光敏测试 ---> NG
device ID: 1 - Item 21: 前屏背光测试 ---> NG
device ID: 1 - Item 22: IR灯开 ---> OK
device ID: 1 - Item 23: IR灯关 ---> OK
device ID: 1 - Item 24: 串口测试 ---> NG
device ID: 1 - Item 25: PIR测试 ---> NG
device ID:-1 ---> All 25 items test completed !!!

View File

@ -0,0 +1,26 @@
device ID: 1 - Item 1: 人脸单角度注册 ---> NG
device ID: 1 - Item 2: 人脸多角度注册 ---> NG
device ID: 1 - Item 3: 掌静脉注册 ---> NG
device ID: 1 - Item 4: 人脸识别 ---> NG
device ID: 1 - Item 5: 掌静脉识别 ---> NG
device ID: 1 - Item 6: 删除用户 ---> NG
device ID: 1 - Item 7: 删除所有用户 ---> NG
device ID: 1 - Item 8: 获取用户 ---> NG
device ID: 1 - Item 9: 获取所有用户 ---> NG
device ID: 1 - Item 10: 密码注册 ---> NG
device ID: 1 - Item 11: 图片注册 ---> NG
device ID: 1 - Item 12: 左边镜头取图 ---> OK
device ID: 1 - Item 13: 右边镜头取图 ---> OK
device ID: 1 - Item 14: 前触摸屏测试 ---> NG
device ID: 1 - Item 15: MIC测试 ---> NG
device ID: 1 - Item 16: SPK测试 ---> NG
device ID: 1 - Item 17: 雷达测试 ---> NG
device ID: 1 - Item 18: NFC测试 ---> NG
device ID: 1 - Item 19: 防撬开关 ---> NG
device ID: 1 - Item 20: 光敏测试 ---> NG
device ID: 1 - Item 21: 前屏背光测试 ---> NG
device ID: 1 - Item 22: IR灯开 ---> OK
device ID: 1 - Item 23: IR灯关 ---> OK
device ID: 1 - Item 24: 串口测试 ---> NG
device ID: 1 - Item 25: PIR测试 ---> NG
device ID:-1 ---> All 25 items test completed !!!

View File

@ -0,0 +1,6 @@
device ID: 1 - Item 1: 前板V851版本: ---> NG
device ID: 1 - Item 2: 前板MCU版本: ---> NG
device ID: 1 - Item 3: 前板硬件版本: ---> NG
device ID: 1 - Item 4: 算法版本: ---> NG
device ID: 1 - Item 5: SN号: ---> NG
device ID:-1 ---> All 5 items test completed !!!

View File

@ -0,0 +1,4 @@
device ID: 1 - Item 1: 后板V851版本: ---> NG
device ID: 1 - Item 2: 后板806版本: ---> NG
device ID: 1 - Item 3: 后板硬件版本: ---> NG
device ID:-1 ---> All 3 items test completed !!!

View File

@ -0,0 +1,4 @@
device ID: 1 - Item 1: 后板V851版本: ---> NG
device ID: 1 - Item 2: 后板806版本: ---> NG
device ID: 1 - Item 3: 后板硬件版本: ---> NG
device ID:-1 ---> All 3 items test completed !!!

View File

@ -0,0 +1,4 @@
device ID: 1 - Item 1: 后板V851版本: ---> NG
device ID: 1 - Item 2: 后板806版本: ---> NG
device ID: 1 - Item 3: 后板硬件版本: ---> NG
device ID:-1 ---> All 3 items test completed !!!

View File

@ -0,0 +1,6 @@
device ID: 1 - Item 1: 前板V851版本: ---> NG
device ID: 1 - Item 2: 前板MCU版本: ---> NG
device ID: 1 - Item 3: 前板硬件版本: ---> NG
device ID: 1 - Item 4: 算法版本: ---> NG
device ID: 1 - Item 5: SN号: ---> NG
device ID:-1 ---> All 5 items test completed !!!

View File

@ -0,0 +1,6 @@
device ID: 1 - Item 1: 前板V851版本: ---> NG
device ID: 1 - Item 2: 前板MCU版本: ---> NG
device ID: 1 - Item 3: 前板硬件版本: ---> NG
device ID: 1 - Item 4: 算法版本: ---> NG
device ID: 1 - Item 5: SN号: ---> NG
device ID:-1 ---> All 5 items test completed !!!

View File

@ -0,0 +1,6 @@
device ID: 1 - Item 1: 前板V851版本: ---> NG
device ID: 1 - Item 2: 前板MCU版本: ---> NG
device ID: 1 - Item 3: 前板硬件版本: ---> NG
device ID: 1 - Item 4: 算法版本: ---> NG
device ID: 1 - Item 5: SN号: ---> NG
device ID:-1 ---> All 5 items test completed !!!

View File

@ -0,0 +1,32 @@
device ID: 1 - Item 1: 前板V851版本: ---> NG
device ID: 1 - Item 2: 前板MCU版本: ---> NG
device ID: 1 - Item 3: 前板硬件版本: ---> NG
device ID: 1 - Item 4: 算法版本: ---> NG
device ID: 1 - Item 5: SN号: ---> NG
device ID:-1 ---> All 5 items test completed !!!
device ID: 1 - Item 1: 人脸单角度注册 ---> NG
device ID: 1 - Item 2: 人脸多角度注册 ---> NG
device ID: 1 - Item 3: 掌静脉注册 ---> NG
device ID: 1 - Item 4: 人脸识别 ---> NG
device ID: 1 - Item 5: 掌静脉识别 ---> NG
device ID: 1 - Item 6: 删除用户 ---> NG
device ID: 1 - Item 7: 删除所有用户 ---> NG
device ID: 1 - Item 8: 获取用户 ---> NG
device ID: 1 - Item 9: 获取所有用户 ---> NG
device ID: 1 - Item 10: 密码注册 ---> NG
device ID: 1 - Item 11: 图片注册 ---> NG
device ID: 1 - Item 12: 左边镜头取图 ---> OK
device ID: 1 - Item 13: 右边镜头取图 ---> OK
device ID: 1 - Item 14: 前触摸屏测试 ---> NG
device ID: 1 - Item 15: MIC测试 ---> NG
device ID: 1 - Item 16: SPK测试 ---> NG
device ID: 1 - Item 17: 雷达测试 ---> NG
device ID: 1 - Item 18: NFC测试 ---> NG
device ID: 1 - Item 19: 防撬开关 ---> NG
device ID: 1 - Item 20: 光敏测试 ---> NG
device ID: 1 - Item 21: 前屏背光测试 ---> NG
device ID: 1 - Item 22: IR灯开 ---> OK
device ID: 1 - Item 23: IR灯关 ---> OK
device ID: 1 - Item 24: 串口测试 ---> NG
device ID: 1 - Item 25: PIR测试 ---> NG
device ID:-1 ---> All 25 items test completed !!!

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Some files were not shown because too many files have changed in this diff Show More