Commit 0110e48a by 郭峰

Merge branch 'feature/mqtt-feature' into 'release'

修复ping命令进程生命周期问题最近内联

See merge request !9
parents ad174f19 ed7719b4
...@@ -53,7 +53,7 @@ vides_data::response* HttpService::httpPostDeviceStatus(vides_data::requestDevic ...@@ -53,7 +53,7 @@ vides_data::response* HttpService::httpPostDeviceStatus(vides_data::requestDevic
resp->code = map["code"].toInt(); resp->code = map["code"].toInt();
resp->msg = map["message"].toString(); resp->msg = map["message"].toString();
} else { } else {
qDebug() << "httpPostDeviceStatus" << m_httpClient.errorCode(); qInfo() << "httpPostDeviceStatus" << m_httpClient.errorCode();
resp->code = 2; resp->code = 2;
resp->msg = m_httpClient.errorString(); resp->msg = m_httpClient.errorString();
} }
...@@ -86,7 +86,7 @@ vides_data::response* HttpService::httpPostRecord(int id,int recongnition_type,Q ...@@ -86,7 +86,7 @@ vides_data::response* HttpService::httpPostRecord(int id,int recongnition_type,Q
resp->code=map["code"].toInt(); resp->code=map["code"].toInt();
resp->msg=map["message"].toString(); resp->msg=map["message"].toString();
}else{ }else{
qDebug()<<m_httpClient.errorCode(); qInfo()<<m_httpClient.errorCode();
resp->code=2; resp->code=2;
resp->msg=OPERATION_FAILED; resp->msg=OPERATION_FAILED;
} }
...@@ -159,7 +159,7 @@ vides_data::response *HttpService::httpFindCameras(QString &serialNumber,vides_d ...@@ -159,7 +159,7 @@ vides_data::response *HttpService::httpFindCameras(QString &serialNumber,vides_d
} }
resp->msg=map["message"].toString(); resp->msg=map["message"].toString();
}else{ }else{
qDebug()<<m_httpClient.errorCode(); qInfo()<<m_httpClient.errorCode();
resp->code=2; resp->code=2;
resp->msg=OPERATION_FAILED; resp->msg=OPERATION_FAILED;
} }
...@@ -244,8 +244,8 @@ vides_data::response *HttpService::httpLicensePlateRecognition(vides_data::reque ...@@ -244,8 +244,8 @@ vides_data::response *HttpService::httpLicensePlateRecognition(vides_data::reque
// 将 res 添加到结果列表或进行其他操作 // 将 res 添加到结果列表或进行其他操作
} }
}else{ }else{
qDebug()<<"httpLicensePlateRecognition"<<m_httpClient.errorCode(); qInfo()<<"httpLicensePlateRecognition"<<m_httpClient.errorCode();
qDebug()<<"httpLicensePlateRecognition msg"<<m_httpClient.errorString(); qInfo()<<"httpLicensePlateRecognition msg"<<m_httpClient.errorString();
resp->code=2; resp->code=2;
resp->msg=m_httpClient.errorCode(); resp->msg=m_httpClient.errorCode();
...@@ -282,7 +282,7 @@ vides_data::response* HttpService::httpFindFaceReconition(QString &serialNumber, ...@@ -282,7 +282,7 @@ vides_data::response* HttpService::httpFindFaceReconition(QString &serialNumber,
} }
resp->msg=map["message"].toString(); resp->msg=map["message"].toString();
}else{ }else{
qDebug()<<m_httpClient.errorCode(); qInfo()<<m_httpClient.errorCode();
resp->code=2; resp->code=2;
resp->msg=OPERATION_FAILED; resp->msg=OPERATION_FAILED;
} }
...@@ -313,8 +313,8 @@ vides_data::response *HttpService::httpPostUniforms(QByteArray &img,QString &id, ...@@ -313,8 +313,8 @@ vides_data::response *HttpService::httpPostUniforms(QByteArray &img,QString &id,
resp->code=map["code"].toInt(); resp->code=map["code"].toInt();
resp->msg=map["message"].toString(); resp->msg=map["message"].toString();
}else{ }else{
qDebug()<<m_httpClient.errorCode(); qInfo()<<m_httpClient.errorCode();
qDebug()<<"httpPostUniforms"<<m_httpClient.errorString(); qInfo()<<"httpPostUniforms"<<m_httpClient.errorString();
resp->code=2; resp->code=2;
resp->msg=m_httpClient.errorCode(); resp->msg=m_httpClient.errorCode();
} }
...@@ -354,10 +354,10 @@ vides_data::response *HttpService::httpPostFacePopulation(QByteArray &img,int &h ...@@ -354,10 +354,10 @@ vides_data::response *HttpService::httpPostFacePopulation(QByteArray &img,int &h
resp->code=map["code"].toInt(); resp->code=map["code"].toInt();
resp->msg=map["message"].toString(); resp->msg=map["message"].toString();
}else{ }else{
qDebug()<<"httpPostFacePopulation===>"; qInfo()<<"httpPostFacePopulation===>";
qDebug()<<m_httpClient.errorCode(); qInfo()<<m_httpClient.errorCode();
qDebug()<<m_httpClient.errorString(); qInfo()<<m_httpClient.errorString();
qDebug()<<"httpPostFacePopulation===>end"; qInfo()<<"httpPostFacePopulation===>end";
resp->code=2; resp->code=2;
resp->msg=m_httpClient.errorCode(); resp->msg=m_httpClient.errorCode();
...@@ -367,7 +367,7 @@ vides_data::response *HttpService::httpPostFacePopulation(QByteArray &img,int &h ...@@ -367,7 +367,7 @@ vides_data::response *HttpService::httpPostFacePopulation(QByteArray &img,int &h
vides_data::response *HttpService::httpPostFaceReconition(vides_data::requestFaceReconition & faceReconition){ vides_data::response *HttpService::httpPostFaceReconition(vides_data::requestFaceReconition & faceReconition){
httpUrl.append("/api/v1.0/recongnition/face"); httpUrl.append("/api/v1.0/recongnition/face");
qDebug()<<"httpPostFaceReconition"<<httpUrl; qInfo()<<"httpPostFaceReconition"<<httpUrl;
QJsonObject json; QJsonObject json;
json.insert("id",QJsonValue::fromVariant(faceReconition.id.toInt())); json.insert("id",QJsonValue::fromVariant(faceReconition.id.toInt()));
json.insert("img", QJsonValue::fromVariant(faceReconition.img)); json.insert("img", QJsonValue::fromVariant(faceReconition.img));
...@@ -447,7 +447,7 @@ vides_data::response*HttpService::httpFindGb28181Config(QString &serialNumber){ ...@@ -447,7 +447,7 @@ vides_data::response*HttpService::httpFindGb28181Config(QString &serialNumber){
resp->data=response; resp->data=response;
resp->msg=map["message"].toString(); resp->msg=map["message"].toString();
}else{ }else{
qDebug()<<m_httpClient.errorCode(); qInfo()<<m_httpClient.errorCode();
resp->code=2; resp->code=2;
resp->msg=m_httpClient.errorString(); resp->msg=m_httpClient.errorString();
} }
...@@ -559,7 +559,7 @@ vides_data::response *HttpService::httpDeviceConfig(const QString &serialNumber, ...@@ -559,7 +559,7 @@ vides_data::response *HttpService::httpDeviceConfig(const QString &serialNumber,
resp->msg=map["message"].toString(); resp->msg=map["message"].toString();
}else{ }else{
qDebug()<<m_httpClient.errorCode(); qInfo()<<m_httpClient.errorCode();
resp->code=2; resp->code=2;
resp->msg=m_httpClient.errorString(); resp->msg=m_httpClient.errorString();
} }
...@@ -594,7 +594,7 @@ vides_data::response*HttpService::httpFindStream(QString &serialNumber){ ...@@ -594,7 +594,7 @@ vides_data::response*HttpService::httpFindStream(QString &serialNumber){
resp->msg=map["message"].toString(); resp->msg=map["message"].toString();
}else{ }else{
qDebug()<<m_httpClient.errorCode(); qInfo()<<m_httpClient.errorCode();
resp->code=2; resp->code=2;
resp->msg=OPERATION_FAILED; resp->msg=OPERATION_FAILED;
} }
...@@ -618,8 +618,8 @@ vides_data::response *HttpService::httpDownload( const QString &filePath,QString ...@@ -618,8 +618,8 @@ vides_data::response *HttpService::httpDownload( const QString &filePath,QString
resp->code=map["code"].toInt(); resp->code=map["code"].toInt();
resp->msg=map["message"].toString(); resp->msg=map["message"].toString();
}else{ }else{
qDebug()<<m_httpClient.errorCode(); qInfo()<<m_httpClient.errorCode();
qDebug()<<m_httpClient.errorCode(); qInfo()<<m_httpClient.errorCode();
resp->code=2; resp->code=2;
resp->msg=OPERATION_FAILED; resp->msg=OPERATION_FAILED;
...@@ -642,7 +642,7 @@ vides_data::response*HttpService::httpUploadFile(const QString &filePath,QString ...@@ -642,7 +642,7 @@ vides_data::response*HttpService::httpUploadFile(const QString &filePath,QString
resp->code=map["code"].toInt(); resp->code=map["code"].toInt();
resp->msg=map["message"].toString(); resp->msg=map["message"].toString();
}else{ }else{
qDebug()<<m_httpClient.errorCode(); qInfo()<<m_httpClient.errorCode();
resp->code=2; resp->code=2;
resp->msg=OPERATION_FAILED; resp->msg=OPERATION_FAILED;
} }
......
...@@ -87,7 +87,7 @@ bool HttpClient::downloadFile(QNetworkRequest request, const QString &filePath, ...@@ -87,7 +87,7 @@ bool HttpClient::downloadFile(QNetworkRequest request, const QString &filePath,
QFile file(filePa); QFile file(filePa);
if (!file.open(QIODevice::WriteOnly)) { if (!file.open(QIODevice::WriteOnly)) {
qDebug() << "Failed to open file for writing"; qInfo() << "Failed to open file for writing";
reply->deleteLater(); // 确保释放网络回复资源 reply->deleteLater(); // 确保释放网络回复资源
return false; return false;
} }
...@@ -98,7 +98,7 @@ bool HttpClient::downloadFile(QNetworkRequest request, const QString &filePath, ...@@ -98,7 +98,7 @@ bool HttpClient::downloadFile(QNetworkRequest request, const QString &filePath,
QObject::connect(reply, &QNetworkReply::finished, [&, reply]() { QObject::connect(reply, &QNetworkReply::finished, [&, reply]() {
if (reply->error() != QNetworkReply::NoError) { if (reply->error() != QNetworkReply::NoError) {
qDebug() << "Download failed:" << reply->errorString(); qInfo() << "Download failed:" << reply->errorString();
file.remove(); // 删除不完整的文件 file.remove(); // 删除不完整的文件
} else { } else {
success = true; success = true;
...@@ -120,15 +120,15 @@ bool HttpClient::uploadFile(QNetworkRequest request,const QString& accessKeyId, ...@@ -120,15 +120,15 @@ bool HttpClient::uploadFile(QNetworkRequest request,const QString& accessKeyId,
bool success = false; bool success = false;
QFile *file = new QFile(filePath, this); QFile *file = new QFile(filePath, this);
qDebug() << "filePath"<<filePath; qInfo() << "filePath"<<filePath;
if (!file->open(QIODevice::ReadOnly)) { if (!file->open(QIODevice::ReadOnly)) {
qDebug() << "uploadFile Failed to open file for reading"; qInfo() << "uploadFile Failed to open file for reading";
return false; return false;
} }
QByteArray fileData = file->readAll(); QByteArray fileData = file->readAll();
if(fileData.isEmpty()){ if(fileData.isEmpty()){
qDebug() << "uploadFile = file.readAll()"; qInfo() << "uploadFile = file.readAll()";
return false; return false;
} }
...@@ -167,11 +167,11 @@ bool HttpClient::uploadFile(QNetworkRequest request,const QString& accessKeyId, ...@@ -167,11 +167,11 @@ bool HttpClient::uploadFile(QNetworkRequest request,const QString& accessKeyId,
QEventLoop loop; QEventLoop loop;
connect(reply, &QNetworkReply::finished, this, [reply, file,&loop, &success]() { connect(reply, &QNetworkReply::finished, this, [reply, file,&loop, &success]() {
if (reply->error() == QNetworkReply::NoError) { if (reply->error() == QNetworkReply::NoError) {
qDebug() << "Upload successful!"; qInfo() << "Upload successful!";
file->remove(); file->remove();
success=true; success=true;
} else { } else {
qDebug() << "Upload failed:" << reply->errorString(); qInfo() << "Upload failed:" << reply->errorString();
} }
file->close(); file->close();
file->deleteLater(); file->deleteLater();
......
...@@ -66,9 +66,9 @@ void HumanDetection::draw_human_on_image(const cv::Mat& image, const TCV_ObjectL ...@@ -66,9 +66,9 @@ void HumanDetection::draw_human_on_image(const cv::Mat& image, const TCV_ObjectL
bool success = cv::imwrite(fileName.toStdString(), image); bool success = cv::imwrite(fileName.toStdString(), image);
if (success) { if (success) {
qDebug() << "车型图片已成功保存至:" << fileName; qInfo() << "车型图片已成功保存至:" << fileName;
} else { } else {
qDebug() << "图片保存失败!"; qInfo() << "图片保存失败!";
} }
} }
......
...@@ -82,7 +82,7 @@ void LicensePlateRecognition::oldLicensePlateNumber(const cv::Mat &source,const ...@@ -82,7 +82,7 @@ void LicensePlateRecognition::oldLicensePlateNumber(const cv::Mat &source,const
} else { } else {
type = types[results.plates[i].type]; type = types[results.plates[i].type];
} }
qDebug()<<QString("车牌号:%1").arg(results.plates[i].code); qInfo()<<QString("车牌号:%1").arg(results.plates[i].code);
QString plateResult = QString("第%1个,%2,车牌号:%3,置信度:%4,左上角点x坐标:%5,左上角点y坐标:%6,右下角点x坐标:%7,右下角点y坐标:%8") QString plateResult = QString("第%1个,%2,车牌号:%3,置信度:%4,左上角点x坐标:%5,左上角点y坐标:%6,右下角点x坐标:%7,右下角点y坐标:%8")
.arg(i + 1).arg(type.c_str()).arg(results.plates[i].code) .arg(i + 1).arg(type.c_str()).arg(results.plates[i].code)
.arg(results.plates[i].text_confidence).arg(results.plates[i].x1, 0, 'Q', 4) .arg(results.plates[i].text_confidence).arg(results.plates[i].x1, 0, 'Q', 4)
...@@ -168,7 +168,7 @@ void LicensePlateRecognition::licensePlateNumber(const cv::Mat &source, QString ...@@ -168,7 +168,7 @@ void LicensePlateRecognition::licensePlateNumber(const cv::Mat &source, QString
newPlate.new_color=QString::fromStdString(type); newPlate.new_color=QString::fromStdString(type);
QString car_nuber=QString::fromUtf8(results.plates[i].code); QString car_nuber=QString::fromUtf8(results.plates[i].code);
replaceWith1And0(car_nuber); replaceWith1And0(car_nuber);
qDebug()<<"I O (i o)大小写替换为 1 0结果:==>"<<car_nuber; qInfo()<<"I O (i o)大小写替换为 1 0结果:==>"<<car_nuber;
newPlate.new_plate=car_nuber; newPlate.new_plate=car_nuber;
newPlate.text_confidence=results.plates[i].text_confidence; newPlate.text_confidence=results.plates[i].text_confidence;
vides_data::ParkingArea area; vides_data::ParkingArea area;
......
...@@ -38,7 +38,7 @@ LogHandlerPrivate::LogHandlerPrivate() { ...@@ -38,7 +38,7 @@ LogHandlerPrivate::LogHandlerPrivate() {
flushLogFileTimer.setInterval(1000); // TODO: 可从配置文件读取 flushLogFileTimer.setInterval(1000); // TODO: 可从配置文件读取
flushLogFileTimer.start(); flushLogFileTimer.start();
QObject::connect(&flushLogFileTimer, &QTimer::timeout, [] { QObject::connect(&flushLogFileTimer, &QTimer::timeout, [] {
// qDebug() << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"); // 测试不停的写入内容到日志文件 // qInfo() << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"); // 测试不停的写入内容到日志文件
QMutexLocker locker(&LogHandlerPrivate::logMutex); QMutexLocker locker(&LogHandlerPrivate::logMutex);
if (nullptr != logOut) { if (nullptr != logOut) {
logOut->flush(); logOut->flush();
......
...@@ -82,7 +82,7 @@ int MediaFaceImage::SdkSearchDevicesSyn(std::map<QString, vides_data::localDevic ...@@ -82,7 +82,7 @@ int MediaFaceImage::SdkSearchDevicesSyn(std::map<QString, vides_data::localDevic
printf("nCount:%d\r\n", nActualCount); printf("nCount:%d\r\n", nActualCount);
if (nActualCount <= 0) if (nActualCount <= 0)
{ {
qDebug() << QString("Search no Device"); qInfo() << QString("Search no Device");
delete[] pRet; delete[] pRet;
return -1; return -1;
} }
...@@ -91,7 +91,7 @@ int MediaFaceImage::SdkSearchDevicesSyn(std::map<QString, vides_data::localDevic ...@@ -91,7 +91,7 @@ int MediaFaceImage::SdkSearchDevicesSyn(std::map<QString, vides_data::localDevic
{ {
for (int i = 0; i < nActualCount; i++) for (int i = 0; i < nActualCount; i++)
{ {
qDebug() << QString("[%1][IP:%2.%3.%4.%5][SN:%6][Mac:%7]") qInfo() << QString("[%1][IP:%2.%3.%4.%5][SN:%6][Mac:%7]")
.arg(i) .arg(i)
.arg(pRet[i].HostIP.c[0]) .arg(pRet[i].HostIP.c[0])
.arg(pRet[i].HostIP.c[1]) .arg(pRet[i].HostIP.c[1])
...@@ -139,7 +139,7 @@ int MediaFaceImage::SdkInit(QString &szConfigPath, QString &szTempPath) { ...@@ -139,7 +139,7 @@ int MediaFaceImage::SdkInit(QString &szConfigPath, QString &szTempPath) {
void MediaFaceImage::ParserImageData(const unsigned char* pData, int nDataLen, char* pJpg, int* nJpgLen, char* pJson) void MediaFaceImage::ParserImageData(const unsigned char* pData, int nDataLen, char* pJpg, int* nJpgLen, char* pJson)
{ {
quint32 nPicLen = static_cast<quint32>(pData[0]) | (static_cast<quint32>(pData[1]) << 8) | (static_cast<quint32>(pData[2]) << 16) | (static_cast<quint32>(pData[3]) << 24); quint32 nPicLen = static_cast<quint32>(pData[0]) | (static_cast<quint32>(pData[1]) << 8) | (static_cast<quint32>(pData[2]) << 16) | (static_cast<quint32>(pData[3]) << 24);
qDebug() << "nPicLen =" << nPicLen; qInfo() << "nPicLen =" << nPicLen;
*nJpgLen = static_cast<int>(nPicLen); *nJpgLen = static_cast<int>(nPicLen);
memcpy(pJpg, (pData + 32), *nJpgLen); memcpy(pJpg, (pData + 32), *nJpgLen);
const unsigned char* pInfoHead = nullptr; const unsigned char* pInfoHead = nullptr;
......
...@@ -391,7 +391,7 @@ inline QString getDefaultGateway() { ...@@ -391,7 +391,7 @@ inline QString getDefaultGateway() {
return gateway; return gateway;
} }
bool pingAddress(const QString &address) { inline bool pingAddress(const QString &address) {
QProcess process; QProcess process;
QString program = "ping"; QString program = "ping";
QStringList arguments; QStringList arguments;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment