fix(media): fix backboard camera display and mdns connection."
This commit is contained in:
@@ -1756,6 +1756,34 @@ void MainWidget::saveStatusListToFile(const QString& filePath)
|
||||
file.close();
|
||||
}
|
||||
|
||||
void MainWidget::saveDeviceInfoToFile(const QString& filePath, const QString& info)
|
||||
{
|
||||
QString actualFilePath = filePath;
|
||||
if (actualFilePath.isEmpty()) {
|
||||
QString defaultDirPath = QDir::currentPath() + "/TestLog";
|
||||
QDir dir(defaultDirPath);
|
||||
if (!dir.exists()) {
|
||||
if (!dir.mkpath(defaultDirPath)) {
|
||||
qWarning() << "Failed to create directory:" << defaultDirPath;
|
||||
return;
|
||||
}
|
||||
}
|
||||
//QString currentTime = QDateTime::currentDateTime().toString("yyyyMMdd_HHmmss");
|
||||
QString currentTime = QDateTime::currentDateTime().toString("yyyyMMdd");
|
||||
actualFilePath = defaultDirPath + "/device_info_" + currentTime + ".txt";
|
||||
}
|
||||
|
||||
QFile file(actualFilePath);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
qWarning() << "Failed to open file:" << actualFilePath;
|
||||
return;
|
||||
}
|
||||
|
||||
QTextStream out(&file);
|
||||
out << info;
|
||||
file.close();
|
||||
}
|
||||
|
||||
void MainWidget::onCheckSerialRecvStatus() {
|
||||
|
||||
}
|
||||
@@ -2087,6 +2115,7 @@ void MainWidget::onUuidButtonClicked()
|
||||
UuidHwInfoEdit->setPlainText(displayText);
|
||||
qDebug() << "HTTP Server backBoardUuid is:" << backBoardUuid;
|
||||
qDebug() << "HTTP Server backBoardSn is:" << backBoardSn;
|
||||
saveDeviceInfoToFile(filePathLineEdit->text(), QString("MAC:") + cur_mac_addr + displayText);
|
||||
isRequestSuccessful = 0;
|
||||
return;
|
||||
}
|
||||
@@ -2412,7 +2441,7 @@ void MainWidget::onOpenFocusWindowClicked()
|
||||
QPushButton* button = qobject_cast<QPushButton*>(sender());
|
||||
if (button) {
|
||||
int itemIndex = button->property("getVideoIndex").toInt();
|
||||
qDebug() << "New Button clicked with itemIndex:" << itemIndex;
|
||||
qDebug() << "New Button clicked with itemIndex:" << itemIndex << " bord_id: " << isBackBoardOrAllBoard;
|
||||
if (itemIndex == FOCUS_WINDOWS_BUTTON) {
|
||||
if (isBackBoardOrAllBoard) {
|
||||
for (ClientHandler* handler : clients) {
|
||||
@@ -2652,14 +2681,18 @@ void MainWidget::onSendBackItemClicked()
|
||||
{
|
||||
qDebug() << "onSendBackItemClicked";
|
||||
if (connectedClientsCount) {
|
||||
qDebug() << "onSendBackItemClicked -- start 000";
|
||||
if (isBackBoardOrAllBoard == 0) {
|
||||
onHandleInvalidOperate("当前连接的是前板,请勿操作后板或整机页面的按键!!!");
|
||||
return;
|
||||
}
|
||||
qDebug() << "onSendBackItemClicked -- start 111";
|
||||
QPushButton* button = qobject_cast<QPushButton*>(sender());
|
||||
int itemIndex = button->property("backBoardTest").toInt();
|
||||
for (ClientHandler* handler : clients) {
|
||||
qDebug() << "onSendBackItemClicked -- start 222";
|
||||
if (isReplyOrTimeout && ((isBackBoardOrAllBoard) || (handler->getClientId() == handler->controlClientId))) {
|
||||
qDebug() << "onSendBackItemClicked -- start 333";
|
||||
handler->sendBackItem(itemIndex);
|
||||
isReplyOrTimeout = false;
|
||||
break;
|
||||
|
||||
@@ -212,6 +212,8 @@ private:
|
||||
QGroupBox* createBackConnectServerGroupBox();
|
||||
// 保存日志到文件
|
||||
void saveStatusListToFile(const QString& filePath);
|
||||
// 保存服务器获取的信息
|
||||
void saveDeviceInfoToFile(const QString& filePath, const QString& info);
|
||||
// 用于更新按键文本的函数
|
||||
void updateServerButtonText();
|
||||
void updateGetVideoButtonState(int state, int connectedDevices, const QVector<QPushButton*>& buttons);
|
||||
|
||||
@@ -150,9 +150,9 @@ void SerialPortHandler::onSendHeartBeatData(const QByteArray& data, bool heartBe
|
||||
serialPort->flush(); // 确保数据立即发送
|
||||
}
|
||||
else {
|
||||
qDebug() << "Serial port is not open!";
|
||||
//qDebug() << "Serial port is not open!";
|
||||
}
|
||||
qDebug() << "当前时间:" << QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss.zzz");
|
||||
//qDebug() << "当前时间:" << QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss.zzz");
|
||||
}
|
||||
|
||||
void readBmpFile_1(const QString& filePath) {
|
||||
@@ -370,7 +370,7 @@ void SerialPortHandler::updateAvailablePorts() {
|
||||
QStringList currentPorts;
|
||||
foreach(const QSerialPortInfo & info, QSerialPortInfo::availablePorts()) {
|
||||
currentPorts.append(info.portName());
|
||||
qDebug() << "info.portName(): " << info.portName();
|
||||
//qDebug() << "info.portName(): " << info.portName();
|
||||
}
|
||||
|
||||
//qDebug() << "Available ports: " << currentPorts;
|
||||
@@ -550,16 +550,32 @@ void SerialPortHandler::sendJsonItem(const QJsonArray& jsonArray, int itemIndex,
|
||||
QJsonObject tempItem = jsonArray[itemIndex].toObject();
|
||||
if (tempItem["cmd"] == "VIDEO_TEST") {
|
||||
if (tempItem["val"] == 0) {
|
||||
#if 0
|
||||
isSingleSend = false;
|
||||
isClickedSend = false;
|
||||
isRecvVideoData = true;
|
||||
isStartVideo = true;
|
||||
//startReadVideoDataTimer(isBackBoardOrAllBoard);
|
||||
#endif
|
||||
isRecvVideoData = false;
|
||||
isStartVideo = false;
|
||||
}
|
||||
else if (tempItem["val"] == 1) {
|
||||
#if 0
|
||||
isRecvVideoData = false;
|
||||
isStartVideo = false;
|
||||
//stopReadVideoDataTimer(isBackBoardOrAllBoard);
|
||||
#endif
|
||||
isSingleSend = false;
|
||||
isClickedSend = false;
|
||||
isRecvVideoData = true;
|
||||
isStartVideo = true;
|
||||
}
|
||||
else if (tempItem["val"] == 2) {
|
||||
isSingleSend = false;
|
||||
isClickedSend = false;
|
||||
isRecvVideoData = true;
|
||||
isStartVideo = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include "crc32.h"
|
||||
#include <stdio.h>
|
||||
|
||||
static const unsigned int crc_table[256] = {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef _crc32_h_
|
||||
#ifndef _crc32_h_
|
||||
#define _crc32_h_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct BMPHeader {
|
||||
char bfType[2];
|
||||
@@ -21,17 +23,17 @@ struct BMPHeader {
|
||||
uint32_t biClrImportant;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
unsigned int crc32(unsigned int crc, const void *buf, size_t len);
|
||||
void crc32init(unsigned int *crc);
|
||||
void crc32update(unsigned int *crc, const void * b, size_t len);
|
||||
void crc32final(unsigned int *crc);
|
||||
unsigned int crcsimple(const void *buf, size_t len);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
unsigned int crc32(unsigned int crc, const void *buf, size_t len);
|
||||
void crc32init(unsigned int *crc);
|
||||
void crc32update(unsigned int *crc, const void * b, size_t len);
|
||||
void crc32final(unsigned int *crc);
|
||||
unsigned int crcsimple(const void *buf, size_t len);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -47,7 +47,7 @@ UI_config loadUIConfig(const QString& filePath)
|
||||
config.SL100_FACTORY_TOOL_W = settings.value("Window/width", "1340").toInt();
|
||||
config.SL100_FACTORY_TOOL_H = settings.value("Window/height", "900").toInt();
|
||||
config.LOG_LEVEL = settings.value("LogLevel/log_level", "2").toInt();
|
||||
config.TOOL_VERSION = settings.value("Labels/tool_version", "SL100 工厂产测工具 - V0.0.18");
|
||||
config.TOOL_VERSION = settings.value("Labels/tool_version", "SL100 工厂产测工具 - V0.0.19");
|
||||
config.START_LISTENING = settings.value("Labels/start_listening", "开始监听\n(Start Listening...)");
|
||||
config.ONE_CLICKED_TEST = settings.value("Labels/one_clicked_test", "一键功能测试");
|
||||
config.SELECT_MDSN_IP = settings.value("Labels/select_mdns_ip", "Select MDns IP:");
|
||||
@@ -94,7 +94,7 @@ UI_config loadUIConfig(const QString& filePath)
|
||||
config.THIS_DEV_DISCONNECT = settings.value("Labels/this_device_disconnect", "This device is not connected !!!");
|
||||
config.PLEASE_SELECT_IMG_LENS = settings.value("Labels/please_select_img_lens", "Please select \"左边镜头\" or \"右边镜头\" to get image!!!");
|
||||
config.PLEASE_SELECT_VID_LENS = settings.value("Labels/please_select_vid_lens", "Please select lens to get video!!!");
|
||||
config.MDNS_HOSE_NAME = settings.value("Labels/mdns_host_name", "SL100-FactoryTool-Mdns");
|
||||
config.MDNS_HOSE_NAME = settings.value("Labels/mdns_host_name", "sl100");
|
||||
config.MDNS_SERVICE_NAME = settings.value("Labels/mdns_service_name", "_myservice._tcp.local.");
|
||||
quint16 port = settings.value("Labels/tcp_connect_port", "12412").toUInt();
|
||||
config.TCP_CONNECT_PORT = (port > 0 && port <= 65535) ? port : 12412; // 防止异常值
|
||||
|
||||
Reference in New Issue
Block a user