1.更新MDNS广播的服务类型命名规范,防止出现多设备打开找不到MDNS的广播的问题 2.更新区分前后板的TAG
This commit is contained in:
@@ -9,7 +9,7 @@ ClientHandler::ClientHandler(QTcpSocket* socket,
|
||||
QJsonArray frontBoardDevInfoJson, QJsonArray frontBoardLicenseJson,
|
||||
QJsonArray backBoardOneClickTest, QJsonArray backBoardTest, QJsonArray backBoardFuncConfig,
|
||||
QJsonArray backBoardDevInfoJson, QJsonArray backBoardUuidJson,
|
||||
QJsonArray getPicJson, QJsonArray getVideoJson, int clientId, QObject* parent)
|
||||
QJsonArray getPicJson, QJsonArray getVideoJson, int clientId, int isBackBoardOrAllBoard, QObject* parent)
|
||||
: QObject(parent), socket(socket),
|
||||
frontBoardOneClickTest(frontBoardOneClickTest), frontBoardTest(frontBoardTest),
|
||||
frontBoardFuncConfig(frontBoardFuncConfig), frontBoardDevInfoJson(frontBoardDevInfoJson),
|
||||
@@ -17,7 +17,7 @@ ClientHandler::ClientHandler(QTcpSocket* socket,
|
||||
backBoardOneClickTest(backBoardOneClickTest), backBoardTest(backBoardTest),
|
||||
backBoardFuncConfig(backBoardFuncConfig), backBoardDevInfoJson(backBoardDevInfoJson),
|
||||
backBoardUuidJson(backBoardUuidJson), getPicJson(getPicJson), getVideoJson(getVideoJson),
|
||||
currentItemIndex(0), clientId(clientId),
|
||||
currentItemIndex(0), clientId(clientId), isBackBoardOrAllBoard(isBackBoardOrAllBoard),
|
||||
isManualSend(false), isSingleSend(false), isClickedSend(false), size(0),
|
||||
isFirstDataReceived(true), processDataFunction(nullptr),
|
||||
isDataStuck(false), dataProcessingActive(false), isRecvVideoData(true),
|
||||
@@ -35,6 +35,37 @@ ClientHandler::~ClientHandler() {
|
||||
qDebug() << "ClientHandler destroyed for clientId:" << clientId;
|
||||
}
|
||||
|
||||
// 实现 QRunnable 的 run 函数,在线程池中执行
|
||||
void ClientHandler::run()
|
||||
{
|
||||
start();
|
||||
}
|
||||
|
||||
// 重置索引
|
||||
void ClientHandler::resetCurrentItemIndex()
|
||||
{
|
||||
currentItemIndex = 0;
|
||||
currentFuncItemIndex = 0;
|
||||
itemsProcessedCount = 0;
|
||||
emit startTimeout(0);
|
||||
}
|
||||
|
||||
// 开始处理客户端
|
||||
void ClientHandler::start()
|
||||
{
|
||||
resetCurrentItemIndex(); // 初始化计数器和索引
|
||||
sendNextItem();
|
||||
}
|
||||
|
||||
// 处理客户端断开连接
|
||||
void ClientHandler::onDisconnected() {
|
||||
qDebug() << ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
|
||||
qDebug() << "> A device is disconnected. ID:" << clientId;
|
||||
qDebug() << ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
|
||||
emit clientDisconnected(this);
|
||||
socket->deleteLater();
|
||||
}
|
||||
|
||||
void ClientHandler::startReadVideoDataTimer(int client_Id)
|
||||
{
|
||||
//emit startReadTimer(clientId);
|
||||
@@ -94,31 +125,9 @@ QString ClientHandler::getClientAddress() const
|
||||
return socket->peerAddress().toString() + ":" + QString::number(socket->peerPort());
|
||||
}
|
||||
|
||||
// 实现 QRunnable 的 run 函数,在线程池中执行
|
||||
void ClientHandler::run()
|
||||
{
|
||||
start();
|
||||
}
|
||||
|
||||
// 重置索引
|
||||
void ClientHandler::resetCurrentItemIndex()
|
||||
{
|
||||
currentItemIndex = 0;
|
||||
currentFuncItemIndex = 0;
|
||||
itemsProcessedCount = 0;
|
||||
emit startTimeout(0);
|
||||
}
|
||||
|
||||
// 开始处理客户端
|
||||
void ClientHandler::start()
|
||||
{
|
||||
resetCurrentItemIndex(); // 初始化计数器和索引
|
||||
sendNextItem();
|
||||
}
|
||||
|
||||
void ClientHandler::sendDataToClient(const QByteArray& data)
|
||||
{
|
||||
emit sendData(data);
|
||||
emit sendData(data, isBackBoardOrAllBoard);
|
||||
}
|
||||
|
||||
void ClientHandler::sendJsonItem(const QJsonArray& jsonArray, int itemIndex, const QString text, const QString& itemType)
|
||||
@@ -470,6 +479,8 @@ bool ClientHandler::RNDISFirstData(QByteArray& data) {
|
||||
setThreadPriority(QThread::LowPriority);
|
||||
socket->setReadBufferSize(20 * 1024);
|
||||
controlClientId = clientId;
|
||||
// 前板有设备连接自动发送获取设备信息
|
||||
//sendDevInfoItem();
|
||||
break;
|
||||
default:
|
||||
qWarning() << "Unhandled client type:" << clientType;
|
||||
@@ -671,15 +682,6 @@ void ClientHandler::processPendingData()
|
||||
}
|
||||
}
|
||||
|
||||
// 处理客户端断开连接
|
||||
void ClientHandler::onDisconnected() {
|
||||
qDebug() << ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
|
||||
qDebug() << "> A device is disconnected. ID:" << clientId;
|
||||
qDebug() << ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
|
||||
emit clientDisconnected(this);
|
||||
socket->deleteLater();
|
||||
}
|
||||
|
||||
// 处理超时
|
||||
void ClientHandler::onTimeout()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user