Commit 22c70dd0 by 郭峰

Merge branch 'release' into 'master'

Release河道master

See merge request !25
parents 6d4d10ba 27ead076
...@@ -49,10 +49,11 @@ void AlgorithmTaskManage::initHumanDetectionManage(const QString &modelPaths, ...@@ -49,10 +49,11 @@ void AlgorithmTaskManage::initHumanDetectionManage(const QString &modelPaths,
humanDetections.emplace_back(human); humanDetections.emplace_back(human);
} }
} }
void AlgorithmTaskManage::initLicensePlateManage(const QString &modelPaths, void AlgorithmTaskManage::initLicensePlateManage(const QString &modelPaths,bool is_high,int maxNum,bool useHalf,
float carConfidence){ float boxThreshold,float nmsThreshold,float recThreshold){
for (int i = 0; i < licensePlateLen; ++i) { for (int i = 0; i < licensePlateLen; ++i) {
LicensePlateRecognition* licensePlateRecognition=new LicensePlateRecognition(modelPaths,carConfidence); LicensePlateRecognition* licensePlateRecognition=new LicensePlateRecognition(
modelPaths,is_high,maxNum,useHalf,boxThreshold,nmsThreshold,recThreshold);
licensePlateRecognitions.emplace_back(licensePlateRecognition); licensePlateRecognitions.emplace_back(licensePlateRecognition);
} }
...@@ -95,27 +96,38 @@ AlgorithmTaskManage::~AlgorithmTaskManage(){ ...@@ -95,27 +96,38 @@ AlgorithmTaskManage::~AlgorithmTaskManage(){
} }
} }
void AlgorithmTaskManage::releaseResources( void AlgorithmTaskManage::releaseResources(const vides_data::DetectionParams& params) {
int newHumanDetectionLen, int newLicensePlateLen, int newFaceLen,const QString &odelPaths,
float humanCarShapeConfidence,
int uniformColor,
float licensePlateCarConfidence,
std::map<QString,QString>& faceMaps,
int numberFaces,
float faceConfidence,
__uint8_t algorithmPermissions) {
Common & instance = Common::getInstance(); Common & instance = Common::getInstance();
isShuttingDown.store(true, std::memory_order_release); isShuttingDown.store(true, std::memory_order_release);
ScopeSemaphoreExit guard([this]() { ScopeSemaphoreExit guard([this]() {
isShuttingDown.store(false, std::memory_order_release); isShuttingDown.store(false, std::memory_order_release);
}); });
__uint8_t algorithmPermissions = params.algorithmPermissions;
qInfo()<<"修改参数:releaseResources "<<algorithmPermissions; qInfo()<<"修改参数:releaseResources "<<algorithmPermissions;
int newHumanDetectionLen = params.newHumanDetectionLen;
int newLicensePlateLen = params.newLicensePlateLen;
int newFaceLen = params.newFaceLen;
QString modelPath = params.modelPaths;
float humanCarShapeConfidence = params.humanCarShapeConfidence;
int uniformColor = params.uniformColor;
std::map<QString, QString> faceMaps = params.faceMaps;
int numberFaces = params.numberFaces;
float faceConfidence = params.faceConfidence;
bool high = params.isHigh;
int maxNum = params.maxNum;
bool useHalf = params.useHalf;
float boxThreshold = params.boxConfThreshold;
float nmsThreshold = params.nmsThreshold;
float recThreshold = params.recConfidenceThreshold;
// 穿工服算法参数更新 // 穿工服算法参数更新
if ((algorithmPermissions & 0x01 << 2) != 0) { if ((algorithmPermissions & 0x01 << 2) != 0) {
resetSemaphoreAndClearObjects(instance,semaphore, humanDetections, humanDetectionLen); resetSemaphoreAndClearObjects(instance,semaphore, humanDetections, humanDetectionLen);
initialize(newHumanDetectionLen, newLicensePlateLen, newFaceLen, false, 0x00); initialize(newHumanDetectionLen, newLicensePlateLen, newFaceLen, false, 0x00);
initHumanDetectionManage(odelPaths, humanCarShapeConfidence, uniformColor); initHumanDetectionManage(modelPath, humanCarShapeConfidence, uniformColor);
} }
// 人脸算法参数更新 // 人脸算法参数更新
...@@ -129,7 +141,7 @@ void AlgorithmTaskManage::releaseResources( ...@@ -129,7 +141,7 @@ void AlgorithmTaskManage::releaseResources(
if ((algorithmPermissions & 0x01) != 0) { if ((algorithmPermissions & 0x01) != 0) {
resetSemaphoreAndClearObjects(instance,plateSemaphore, licensePlateRecognitions, licensePlateLen); resetSemaphoreAndClearObjects(instance,plateSemaphore, licensePlateRecognitions, licensePlateLen);
initialize(newHumanDetectionLen, newLicensePlateLen, newFaceLen, false, 0x01); initialize(newHumanDetectionLen, newLicensePlateLen, newFaceLen, false, 0x01);
initLicensePlateManage(odelPaths, licensePlateCarConfidence); initLicensePlateManage(modelPath,high,maxNum,useHalf,boxThreshold,nmsThreshold,recThreshold);
} }
} }
......
...@@ -28,8 +28,8 @@ public: ...@@ -28,8 +28,8 @@ public:
void initHumanDetectionManage(const QString &modelPaths, void initHumanDetectionManage(const QString &modelPaths,
float carShapeConfidence,int &uniformColor); float carShapeConfidence,int &uniformColor);
void initLicensePlateManage(const QString &modelPaths, void initLicensePlateManage(const QString &modelPaths,bool is_high,int maxNum,bool useHalf,
float carConfidence); float boxThreshold,float nmsThreshold,float recThreshold);
void modifyImageFeature(std::map<QString,QString>&maps,int numberFaces,float confidence,bool isNull); void modifyImageFeature(std::map<QString,QString>&maps,int numberFaces,float confidence,bool isNull);
void initFaceReconitionHandle(std::map<QString,QString>&maps,int numberFaces,float confidence); void initFaceReconitionHandle(std::map<QString,QString>&maps,int numberFaces,float confidence);
...@@ -37,14 +37,7 @@ public: ...@@ -37,14 +37,7 @@ public:
void *schedulingAlgorithm(int scheType); void *schedulingAlgorithm(int scheType);
void releaseResources(int newHumanDetectionLen, int newLicensePlateLen, int newFaceLen, const QString &odelPaths, void releaseResources(const vides_data::DetectionParams& params);
float humanCarShapeConfidence,
int uniformColor,
float licensePlateCarConfidence,
std::map<QString,QString>& faceMaps,
int numberFaces,
float faceConfidence,
__uint8_t algorithmPermissions);
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -23,20 +23,20 @@ CameraHandle::CameraHandle(QString &url, QString &httpUrl, QString &sSn, int &ch ...@@ -23,20 +23,20 @@ CameraHandle::CameraHandle(QString &url, QString &httpUrl, QString &sSn, int &ch
devConfig(devConfig) devConfig(devConfig)
{ {
connect(this, SIGNAL(afterDownloadFile(int,int,QString)), this, SLOT(pushRecordToCloud(int,int,QString)),Qt::QueuedConnection); connect(this, SIGNAL(afterDownloadFile(int,int,QString)), this, SLOT(pushRecordToCloud(int,int,QString)),Qt::QueuedConnection);
faceMapWorker.setX(0); faceMapWorker.setX(0);
faceMapWorker.setY(0); faceMapWorker.setY(0);
} }
CameraHandle::~CameraHandle() { CameraHandle::~CameraHandle() {
semaphore.acquire(); semaphore.acquire();
Common & instace= Common::getInstance(); Common & instace= Common::getInstance();
dev_snap_syn_timer->stop(); dev_snap_syn_timer->stop();
ScopeSemaphoreExit guard([this]() { ScopeSemaphoreExit guard([this]() {
semaphore.release(); // 释放信号量 semaphore.release(); // 释放信号量
}); });
...@@ -143,7 +143,7 @@ int XNetSDK_MediaCallBack(XSDK_HANDLE hMedia, int nDataType, int nDataLen, int n ...@@ -143,7 +143,7 @@ int XNetSDK_MediaCallBack(XSDK_HANDLE hMedia, int nDataType, int nDataLen, int n
if (EXCMD_DOWNLOAD_DATA == nDataType) if (EXCMD_DOWNLOAD_DATA == nDataType)
{ {
qDebug()<<"EXCMD_DOWNLOAD_DATA"<<nDataType; qInfo()<<"EXCMD_DOWNLOAD_DATA"<<nDataType;
/*if (g_hRecordDownload > 0 && g_hRecordDownload == hMedia) /*if (g_hRecordDownload > 0 && g_hRecordDownload == hMedia)
{ {
...@@ -197,9 +197,9 @@ int XNetSDK_MediaCallBack(XSDK_HANDLE hMedia, int nDataType, int nDataLen, int n ...@@ -197,9 +197,9 @@ int XNetSDK_MediaCallBack(XSDK_HANDLE hMedia, int nDataType, int nDataLen, int n
// 等待 ffmpeg 进程结束 // 等待 ffmpeg 进程结束
if (ffmpegProcess.waitForFinished(20000)) { if (ffmpegProcess.waitForFinished(20000)) {
//QFile::remove(dName); //QFile::remove(dName);
qDebug() << "ffmpeg process finished successfully."; qInfo() << "ffmpeg process finished successfully.";
} else { } else {
qDebug() << "Error: ffmpeg process did not finish."; qInfo() << "Error: ffmpeg process did not finish.";
} }
// 销毁 QProcess 对象 // 销毁 QProcess 对象
...@@ -252,7 +252,7 @@ void CameraHandle::cameraParameterUpdate(vides_data::responseConfig &cloudConfig ...@@ -252,7 +252,7 @@ void CameraHandle::cameraParameterUpdate(vides_data::responseConfig &cloudConfig
forMat=true; forMat=true;
} }
if(forMat){ if(forMat){
deviceReboot(true); deviceReboot();
} }
if(devConfig.camera.updateAt!=cloudConfig.camera.updateAt){ if(devConfig.camera.updateAt!=cloudConfig.camera.updateAt){
if(devConfig.camera.username!=cloudConfig.camera.username || if(devConfig.camera.username!=cloudConfig.camera.username ||
...@@ -293,7 +293,7 @@ void CameraHandle::sdkRealTimeDevSnapSyn(int hDevice) { ...@@ -293,7 +293,7 @@ void CameraHandle::sdkRealTimeDevSnapSyn(int hDevice) {
auto taskSyn = [this, hDevice]() { auto taskSyn = [this, hDevice]() {
sdkDevSnapSyn(hDevice, this->channel); sdkDevSnapSyn(hDevice, this->channel);
}; };
if (threadPool->activeThreadCount() >= threadPool->maxThreadCount()) { if (threadPool->activeThreadCount() >= threadPool->maxThreadCount()) {
qInfo() << "任务积压,跳过本次执行"; qInfo() << "任务积压,跳过本次执行";
return; return;
...@@ -354,7 +354,7 @@ void CameraHandle::sdkDownloadFileByTime(XSDK_HANDLE hDevice,int id, ...@@ -354,7 +354,7 @@ void CameraHandle::sdkDownloadFileByTime(XSDK_HANDLE hDevice,int id,
//param.result = sdkInitCallback; // 结果回调(必填) //param.result = sdkInitCallback; // 结果回调(必填)
SMsgReceiver sms(nullptr,XNetSDK_MediaCallBack,this); SMsgReceiver sms(nullptr,XNetSDK_MediaCallBack,this);
param.result=sms; param.result=sms;
qDebug() << "XSDK_MediaRecordDownload hDevice:"<<this->hDevice; qInfo() << "XSDK_MediaRecordDownload hDevice:"<<this->hDevice;
this->mediaHandle = XSDK_MediaRecordDownload(this->hDevice, &param, 0, 4000); this->mediaHandle = XSDK_MediaRecordDownload(this->hDevice, &param, 0, 4000);
if ( this->mediaHandle < 0) if ( this->mediaHandle < 0)
...@@ -367,7 +367,6 @@ void CameraHandle::sdkDownloadFileByTime(XSDK_HANDLE hDevice,int id, ...@@ -367,7 +367,6 @@ void CameraHandle::sdkDownloadFileByTime(XSDK_HANDLE hDevice,int id,
} }
int CameraHandle::callbackFunction(XSDK_HANDLE hObject, QString &szString) { int CameraHandle::callbackFunction(XSDK_HANDLE hObject, QString &szString) {
if (!semaphore.tryAcquire()) { if (!semaphore.tryAcquire()) {
qInfo() <<sSn<<"sdkDevSnapSyn:正在执行线程"; qInfo() <<sSn<<"sdkDevSnapSyn:正在执行线程";
return -1; return -1;
...@@ -391,7 +390,7 @@ int CameraHandle::callbackFunction(XSDK_HANDLE hObject, QString &szString) { ...@@ -391,7 +390,7 @@ int CameraHandle::callbackFunction(XSDK_HANDLE hObject, QString &szString) {
} }
else else
{ {
qDebug() << "OnDevAlarmCallback[Dev:" << hObject << "][Event:" << szString << "]"; qInfo() << "OnDevAlarmCallback[Dev:" << hObject << "][Event:" << szString << "]";
} }
cv::Mat image; cv::Mat image;
MediaFaceImage* mediaFaceImage= MediaFaceImage::getInstance(); MediaFaceImage* mediaFaceImage= MediaFaceImage::getInstance();
...@@ -412,7 +411,7 @@ int CameraHandle::callbackFunction(XSDK_HANDLE hObject, QString &szString) { ...@@ -412,7 +411,7 @@ int CameraHandle::callbackFunction(XSDK_HANDLE hObject, QString &szString) {
} }
void CameraHandle::sdkDevSnapSyn(XSDK_HANDLE hDevice, int nChannel){ void CameraHandle::sdkDevSnapSyn(XSDK_HANDLE hDevice, int nChannel){
if(hDevice<=0){ if(hDevice<=0){
qInfo() << "相机断线"; qInfo() << "相机断线";
return; return;
...@@ -430,17 +429,20 @@ void CameraHandle::sdkDevSnapSyn(XSDK_HANDLE hDevice, int nChannel){ ...@@ -430,17 +429,20 @@ void CameraHandle::sdkDevSnapSyn(XSDK_HANDLE hDevice, int nChannel){
int ret=mediaFaceImage->FaceImageCallBack(hDevice,nChannel, image); int ret=mediaFaceImage->FaceImageCallBack(hDevice,nChannel, image);
if (ret < 0) { if (ret < 0) {
offlineCount++; // 累加计数器 offlineCount++; // 累加计数器
qDebug() << "offlineCount: " << loginParam->sDevId<<offlineCount; qInfo() << "offlineCount: " << loginParam->sDevId<<offlineCount;
if (offlineCount >= 3) { // 判断是否连续3次返回0 if (offlineCount >= 3) { // 判断是否连续3次返回0
qInfo() << "设备离线"; qInfo() << "设备离线";
QString ip=QString::fromUtf8(loginParam->sDevId); QString ip=QString::fromUtf8(loginParam->sDevId);
bool is_ping=vides_data::pingAddress(ip); bool is_ping=vides_data::pingAddress(ip);
if(!is_ping){ qInfo() << "ping 的结果"<<is_ping;
deviceReboot(false);
if(is_ping){
deviceReboot();
}else { }else {
deviceReboot(true); QString ip=QString::fromUtf8(loginParam->sDevId);
MainWindow::sp_this->clearOfflineCameraHandle(ip,loginParam->nDevPort);
} }
// 执行离线处理逻辑 // 执行离线处理逻辑
// TODO: 可以在此处更新设备状态、发送告警通知等 // TODO: 可以在此处更新设备状态、发送告警通知等
...@@ -587,6 +589,10 @@ void CameraHandle::updateImage(const cv::Mat & frame,qint64 currentTime){ ...@@ -587,6 +589,10 @@ void CameraHandle::updateImage(const cv::Mat & frame,qint64 currentTime){
std::map<QString,vides_data::requestFaceReconition> mapFaces; std::map<QString,vides_data::requestFaceReconition> mapFaces;
ScopeSemaphoreExit guard([this]() {
faceCount.fetch_add(1, std::memory_order_relaxed);
});
QByteArray imgs; QByteArray imgs;
this->matToBase64(frame, imgs); this->matToBase64(frame, imgs);
...@@ -595,93 +601,124 @@ void CameraHandle::updateImage(const cv::Mat & frame,qint64 currentTime){ ...@@ -595,93 +601,124 @@ void CameraHandle::updateImage(const cv::Mat & frame,qint64 currentTime){
int faSize =0; int faSize =0;
std::vector<vides_data::ParkingArea> currentPlates; std::vector<vides_data::ParkingArea> currentPlates;
int uniforms=0x00; int uniforms=0x00;
qInfo()<<"updateImage"<<algorithmPermissions;
std::map<int,int>resMap; std::map<int,int>resMap;
if ((algorithmPermissions & 0x01<<3) != 0) {
//穿工服算法 //穿工服算法
if ((algorithmPermissions & 0x01<<2) != 0) { if ((algorithmPermissions & 0x01<<2) != 0) {
uniforms=algorithmTaskManage.executeFindHuManCar(frame,0x02,currentPlates,resMap,sSn,heightReference); uniforms=algorithmTaskManage.executeFindHuManCar(frame,0x02,currentPlates,resMap,sSn,heightReference);
if(resMap.size()>0x00){ if(resMap.size()>0x00){
faSize=resMap.at(0x00); faSize=resMap.at(0x00);
uniforms=resMap.at(0x02); uniforms=resMap.at(0x02);
}
}else{
//人形
uniforms=algorithmTaskManage.executeFindHuManCar(frame,0x00,currentPlates,resMap,sSn,heightReference);
if(resMap.size()>0x00){
faSize=resMap.at(0x00);
uniforms=faSize;
}
}
if(uniforms==-2 || faSize==-2){
qInfo() << "没有可用的HumanDetection对象可以调度";
return ;
}
QPoint point_info(faSize,uniforms);
if(isChanged(point_info,faceMapWorker)){
if(faceCount.load(std::memory_order_relaxed)%face_frequency==0){
int worker=0x00;
if ((algorithmPermissions & 0x01<<2) != 0) {
worker = (faSize - uniforms > 0) ? (faSize - uniforms) : 0;
} }
qInfo()<<"工作人数==>"<<worker; }else{
vides_data::response* resp=httpService.httpPostFacePopulation(imgs,faSize,worker,sSn,currentTime); //人形
if (resp->code!= 0) { uniforms=algorithmTaskManage.executeFindHuManCar(frame,0x00,currentPlates,resMap,sSn,heightReference);
qInfo()<<"人数变化推送信息推送失败"; if(resMap.size()>0x00){
faSize=resMap.at(0x00);
uniforms=faSize;
} }
instace.deleteObj(resp);
faceMapWorker.setX(faSize);
faceMapWorker.setY(uniforms);
} }
} if(uniforms==-2 || faSize==-2){
qInfo() << "没有可用的HumanDetection对象可以调度";
if(faSize>0 && (algorithmPermissions & 0x01<<1) != 0){ return ;
std::list<vides_data::faceRecognitionResult>faces; }
algorithmTaskManage.executeFindDoesItExistEmployee(frame,faces,sSn); QPoint point_info(faSize,uniforms);
if (faces.size()>0) { if(isChanged(point_info,faceMapWorker)){
for(auto face:faces){ if(faceCount.load(std::memory_order_relaxed)%face_frequency==0){
vides_data::requestFaceReconition faceReconition; int worker=0x00;
faceReconition.id = face.id; if ((algorithmPermissions & 0x01<<2) != 0) {
faceReconition.img = imgs; worker = (faSize - uniforms > 0) ? (faSize - uniforms) : 0;
faceReconition.sn = sSn; }
faceReconition.time = currentTime; qInfo()<<"工作人数==>"<<worker;
faceReconition.area.top_left_corner_x=face.x; vides_data::response* resp=httpService.httpPostFacePopulation(imgs,faSize,worker,sSn,currentTime);
faceReconition.area.top_left_corner_y=face.y;
faceReconition.area.bottom_right_corner_x= face.x + face.width;
faceReconition.area.bottom_right_corner_y= face.y + face.height;
faceReconition.area.bottom_left_corner_x = face.x;
faceReconition.area.bottom_left_corner_y = face.y + face.height;
faceReconition.area.top_right_corner_x = face.x + face.width;
faceReconition.area.top_right_corner_y = face.y;
httpService.setHttpUrl(httpUrl);
vides_data::response* resp = httpService.httpPostFaceReconition(faceReconition);
mapFaces.insert(std::make_pair( face.id, faceReconition));
if (resp->code!= 0) { if (resp->code!= 0) {
qInfo()<<"识别人code"<<resp->code; if(resp->msg=="TimeoutError") {
qInfo()<<"识别人msg"<<resp->msg; QByteArray num_imgs;
qInfo()<<"识别人脸信息推送失败"<<face.id; httpService.setHttpUrl(httpUrl);
vides_data::response* img_resp = httpService.httpPostFacePopulation(num_imgs,faSize,worker,sSn,currentTime);
if (img_resp->code != 0) {
qInfo()<<"不加图片人数变化推送信息推送失败";
}
instace.deleteObj(img_resp);
}
} }
instace.deleteObj(resp); instace.deleteObj(resp);
faceMapWorker.setX(faSize);
faceMapWorker.setY(uniforms);
} }
} }
}
if(faSize>0 && (algorithmPermissions & 0x01<<1) != 0){
if ((algorithmPermissions & 0x01<<2) != 0) { std::list<vides_data::faceRecognitionResult>faces;
if(uniforms>0 ){ algorithmTaskManage.executeFindDoesItExistEmployee(frame,faces,sSn);
//未穿工服的人数 if (faces.size()>0) {
std::list<QString> outUniforms; for(auto face:faces){
faceUniformOverlap(mapFaces,currentPlates,outUniforms); vides_data::requestFaceReconition faceReconition;
for(auto strUniform:outUniforms){ faceReconition.id = face.id;
httpService.setHttpUrl(httpUrl); faceReconition.img = imgs;
vides_data::response* resp=httpService.httpPostUniforms(imgs,strUniform, sSn,currentTime); faceReconition.sn = sSn;
if (resp->code!= 0) { faceReconition.time = currentTime;
qInfo()<<"推送未穿工服人数失败"; faceReconition.area.top_left_corner_x=face.x;
faceReconition.area.top_left_corner_y=face.y;
faceReconition.area.bottom_right_corner_x= face.x + face.width;
faceReconition.area.bottom_right_corner_y= face.y + face.height;
faceReconition.area.bottom_left_corner_x = face.x;
faceReconition.area.bottom_left_corner_y = face.y + face.height;
faceReconition.area.top_right_corner_x = face.x + face.width;
faceReconition.area.top_right_corner_y = face.y;
httpService.setHttpUrl(httpUrl);
vides_data::response* resp = httpService.httpPostFaceReconition(faceReconition);
mapFaces.insert(std::make_pair( face.id, faceReconition));
if (resp->code!= 0) {
if(resp->msg=="TimeoutError") {
faceReconition.img.clear();
httpService.setHttpUrl(httpUrl);
vides_data::response* img_resp = httpService.httpPostFaceReconition(faceReconition);
if (img_resp->code != 0) {
qInfo()<<"不加图片人脸信息推送失败";
qInfo()<<"不加图片识别人code"<<resp->code;
qInfo()<<"不加图片识别人msg"<<resp->msg;
qInfo()<<"不加图片识别人脸信息推送失败"<<face.id;
}
instace.deleteObj(img_resp);
}
}
instace.deleteObj(resp);
} }
instace.deleteObj(resp);
} }
} }
if ((algorithmPermissions & 0x01<<2) != 0) {
if(uniforms>0 ){
//未穿工服的人数
std::list<QString> outUniforms;
faceUniformOverlap(mapFaces,currentPlates,outUniforms);
for(auto strUniform:outUniforms){
httpService.setHttpUrl(httpUrl);
vides_data::response* resp=httpService.httpPostUniforms(imgs,strUniform, sSn,currentTime);
if (resp->code!= 0) {
if(resp->msg=="TimeoutError") {
QByteArray num_imgs;
httpService.setHttpUrl(httpUrl);
vides_data::response* img_resp=httpService.httpPostUniforms(num_imgs,strUniform, sSn,currentTime);
if (img_resp->code != 0) {
qInfo()<<"不加图片推送未穿工服人数失败";
}
instace.deleteObj(img_resp);
}
}
instace.deleteObj(resp);
}
}
}
}else{
qInfo()<<"人形识别算法关闭,只有车牌算法了";
} }
//关闭车牌识别 //关闭车牌识别
if ((algorithmPermissions & 0x01) == 0) { if ((algorithmPermissions & 0x01) == 0) {
...@@ -739,7 +776,6 @@ void CameraHandle::updateImage(const cv::Mat & frame,qint64 currentTime){ ...@@ -739,7 +776,6 @@ void CameraHandle::updateImage(const cv::Mat & frame,qint64 currentTime){
} }
} }
faceCount.fetch_add(1, std::memory_order_relaxed);
for (auto it = areaMat.begin(); it != areaMat.end(); ++it) { for (auto it = areaMat.begin(); it != areaMat.end(); ++it) {
int key = it->first; int key = it->first;
cv::Mat areaMat = it->second; cv::Mat areaMat = it->second;
...@@ -850,10 +886,7 @@ void CameraHandle::updateImage(const cv::Mat & frame,qint64 currentTime){ ...@@ -850,10 +886,7 @@ void CameraHandle::updateImage(const cv::Mat & frame,qint64 currentTime){
qInfo()<<QString("sn:%1 =>识别的车牌号是:%2").arg(sSn).arg(var.new_plate); qInfo()<<QString("sn:%1 =>识别的车牌号是:%2").arg(sSn).arg(var.new_plate);
} }
licensePlateRecognitionResults(newPlate); licensePlateRecognitionResults(newPlate);
} }
} }
void CameraHandle::findIp(QString &ip){ void CameraHandle::findIp(QString &ip){
ip=QString::fromStdString(loginParam->sDevId); ip=QString::fromStdString(loginParam->sDevId);
...@@ -902,12 +935,23 @@ void CameraHandle::licensePlateRecognitionResults(vides_data::requestLicensePlat ...@@ -902,12 +935,23 @@ void CameraHandle::licensePlateRecognitionResults(vides_data::requestLicensePlat
vides_data::response* resp = httpService.httpLicensePlateRecognition(location, result); vides_data::response* resp = httpService.httpLicensePlateRecognition(location, result);
if (resp->code != 0) { if (resp->code != 0) {
qInfo()<<"licensePlateRecognitionResults:车牌识别结果失败"; if(resp->msg=="TimeoutError") {
// 在达到最大重试次数且仍然没有成功的情况下执行相应的处理逻辑 for (auto& plate : location.plates) {
plate.img.clear();
}
httpService.setHttpUrl(httpUrl);
vides_data::response* img_resp = httpService.httpLicensePlateRecognition(location, result);
if (img_resp->code != 0) {
qInfo()<<"车牌不加图片上传失败";
}
instace.deleteObj(img_resp);
}else{
qInfo()<<"licensePlateRecognitionResults:车牌识别结果失败";
// 在达到最大重试次数且仍然没有成功的情况下执行相应的处理逻辑
}
} }
instace.deleteObj(resp); instace.deleteObj(resp);
} }
void CameraHandle::printWifi(XSDK_HANDLE hDevice,XSDK_CFG::NetWork_Wifi &cfg){ void CameraHandle::printWifi(XSDK_HANDLE hDevice,XSDK_CFG::NetWork_Wifi &cfg){
char szOutBuffer[4000] = { 0 }; char szOutBuffer[4000] = { 0 };
...@@ -915,7 +959,7 @@ void CameraHandle::printWifi(XSDK_HANDLE hDevice,XSDK_CFG::NetWork_Wifi &cfg){ ...@@ -915,7 +959,7 @@ void CameraHandle::printWifi(XSDK_HANDLE hDevice,XSDK_CFG::NetWork_Wifi &cfg){
// 获取并解析配置 // 获取并解析配置
int nResult = XSDK_DevGetSysConfigSyn(hDevice, JK_NetWork_Wifi, szOutBuffer, &nInOutSize, 3000, EXCMD_CONFIG_GET); int nResult = XSDK_DevGetSysConfigSyn(hDevice, JK_NetWork_Wifi, szOutBuffer, &nInOutSize, 3000, EXCMD_CONFIG_GET);
qDebug()<<szOutBuffer; qInfo()<<szOutBuffer;
if (nResult >= 0) { if (nResult >= 0) {
cfg.Parse(szOutBuffer); cfg.Parse(szOutBuffer);
...@@ -947,7 +991,7 @@ void CameraHandle::sdkWifi(QString &pwd,QString &ssid){ ...@@ -947,7 +991,7 @@ void CameraHandle::sdkWifi(QString &pwd,QString &ssid){
qInfo() << "修改wifi失败"; qInfo() << "修改wifi失败";
} }
deviceReboot(false); deviceReboot();
} }
void CameraHandle::sdkDevSystemTimeZoneSyn(QString &time){ void CameraHandle::sdkDevSystemTimeZoneSyn(QString &time){
...@@ -970,7 +1014,7 @@ void CameraHandle::sdkDevSystemTimeZoneSyn(QString &time){ ...@@ -970,7 +1014,7 @@ void CameraHandle::sdkDevSystemTimeZoneSyn(QString &time){
//录像设置 //录像设置
void CameraHandle::sdkRecordCfg(const char * recordJson){ void CameraHandle::sdkRecordCfg(const char * recordJson){
qDebug()<<recordJson; qInfo()<<recordJson;
char szOutBuffer[512] = { 0 }; char szOutBuffer[512] = { 0 };
int nLen = sizeof(szOutBuffer);; int nLen = sizeof(szOutBuffer);;
int res=XSDK_DevSetSysConfigSyn(hDevice,JK_Record,recordJson,strlen(recordJson),szOutBuffer,&nLen,3000,EXCMD_CONFIG_SET); int res=XSDK_DevSetSysConfigSyn(hDevice,JK_Record,recordJson,strlen(recordJson),szOutBuffer,&nLen,3000,EXCMD_CONFIG_SET);
...@@ -987,6 +1031,22 @@ void CameraHandle::sdkEncodeCfg(const char* pCfg){ ...@@ -987,6 +1031,22 @@ void CameraHandle::sdkEncodeCfg(const char* pCfg){
qInfo() << "sdkEncodeCfg 配置编码设置->修改失败"<<res; qInfo() << "sdkEncodeCfg 配置编码设置->修改失败"<<res;
} }
} }
int CameraHandle::updateSdkDevStatus(bool status){
char szOutBuffer[40960]={ 0 };
int nInOutSize = sizeof(szOutBuffer);
int res= XSDK_DevGetSysConfigSyn(hDevice,JK_NetWork_SPVMN,szOutBuffer,&nInOutSize,4000,EXCMD_CONFIG_GET);
if(res<0){
qInfo() << sSn<<"GB28181可远程开关"<<res;
return 0 ;
}
XSDK_CFG::NetWork_SPVMN config;
config.Parse(szOutBuffer);
config.bCsEnable.SetValue(status);
const char* pCfg = config.ToString();
sdkDevSpvMn(pCfg);
return res;
}
void CameraHandle::updateSdkDevSpvMn(vides_data::responseGb28181 *gb28181){ void CameraHandle::updateSdkDevSpvMn(vides_data::responseGb28181 *gb28181){
char szOutBuffer[40960]={ 0 }; char szOutBuffer[40960]={ 0 };
int nInOutSize = sizeof(szOutBuffer); int nInOutSize = sizeof(szOutBuffer);
...@@ -1073,7 +1133,7 @@ void CameraHandle::sdkDevSpvMn(const char *spvMn){ ...@@ -1073,7 +1133,7 @@ void CameraHandle::sdkDevSpvMn(const char *spvMn){
qInfo() << "sdkDevSpvMn 28181->修改失败"<<res; qInfo() << "sdkDevSpvMn 28181->修改失败"<<res;
} }
} }
void CameraHandle::deviceReboot(bool isCloseHandle){ int CameraHandle::deviceReboot(){
int nRet=0; int nRet=0;
XSDK_CFG::OPMachine cfg; XSDK_CFG::OPMachine cfg;
cfg.Action.SetValue("Reboot"); cfg.Action.SetValue("Reboot");
...@@ -1082,16 +1142,32 @@ void CameraHandle::deviceReboot(bool isCloseHandle){ ...@@ -1082,16 +1142,32 @@ void CameraHandle::deviceReboot(bool isCloseHandle){
nRet = XSDK_DevSetSysConfig(hDevice, JK_OPMachine, pCfg, strlen(pCfg), 1, 3000, EXCMD_SYSMANAGER_REQ); nRet = XSDK_DevSetSysConfig(hDevice, JK_OPMachine, pCfg, strlen(pCfg), 1, 3000, EXCMD_SYSMANAGER_REQ);
if(nRet<0){ if(nRet<0){
qInfo() << sSn<<"重启相机失败"<<nRet; qInfo() << sSn<<"重启相机失败"<<nRet;
return ; return 0 ;
} }
if(isCloseHandle){
return ;
}
QString ip=QString::fromUtf8(loginParam->sDevId); QString ip=QString::fromUtf8(loginParam->sDevId);
MainWindow::sp_this->clearOfflineCameraHandle(ip,loginParam->nDevPort); MainWindow::sp_this->clearOfflineCameraHandle(ip,loginParam->nDevPort);
return nRet;
} }
int CameraHandle::deviceShutdown()
{
int nRet = 0;
XSDK_CFG::OPMachine cfg;
cfg.Action.SetValue("Shutdown");
const char* pCfg = cfg.ToString();
nRet = XSDK_DevSetSysConfig(hDevice, JK_OPMachine, pCfg, strlen(pCfg), 1, 3000, EXCMD_SYSMANAGER_REQ);
if(nRet<0){
qInfo() << sSn<<"设备关机失败"<<nRet;
return 0;
}
QString ip=QString::fromUtf8(loginParam->sDevId);
MainWindow::sp_this->clearOfflineCameraHandle(ip,loginParam->nDevPort);
return nRet;
}
bool CameraHandle::polygonsOverlap( ParkingSpaceInfo &poly1, ParkingSpaceInfo &poly2) { bool CameraHandle::polygonsOverlap( ParkingSpaceInfo &poly1, ParkingSpaceInfo &poly2) {
QPolygonF realPolygon; QPolygonF realPolygon;
......
...@@ -97,10 +97,14 @@ public: ...@@ -97,10 +97,14 @@ public:
void sdkEncodeCfg(const char *enCode); void sdkEncodeCfg(const char *enCode);
//28181更新 //28181更新
void sdkDevSpvMn(const char* spvMn); void sdkDevSpvMn(const char* spvMn);
//gb218开启
int updateSdkDevStatus(bool status);
void updateSdkDevSpvMn(vides_data::responseGb28181 *gb28181); void updateSdkDevSpvMn(vides_data::responseGb28181 *gb28181);
//重启设备 //重启设备
void deviceReboot(bool isCloseHandle ); int deviceReboot();
//设备关机
int deviceShutdown();
//获取固件版本 //获取固件版本
void findFirmwareVersion(QString &firmwareVersion); void findFirmwareVersion(QString &firmwareVersion);
......
...@@ -37,7 +37,7 @@ cv::Mat FaceReconitionHandle::loadImage(const QString &path) { ...@@ -37,7 +37,7 @@ cv::Mat FaceReconitionHandle::loadImage(const QString &path) {
std::string stdPath = path.toStdString(); std::string stdPath = path.toStdString();
cv::Mat image = cv::imread(stdPath, cv::IMREAD_COLOR); cv::Mat image = cv::imread(stdPath, cv::IMREAD_COLOR);
if (!image.empty()) { if (!image.empty()) {
qDebug() << "图像以OpenCV成功加载。"; qInfo() << "图像以OpenCV成功加载。";
return image; return image;
} }
...@@ -151,7 +151,7 @@ void FaceReconitionHandle::featureRemove(){ ...@@ -151,7 +151,7 @@ void FaceReconitionHandle::featureRemove(){
if(customIds.size()>0){ if(customIds.size()>0){
for(auto customId:customIds){ for(auto customId:customIds){
HResult ret= HF_FeaturesGroupFeatureRemove(ctxHandle,customId); HResult ret= HF_FeaturesGroupFeatureRemove(ctxHandle,customId);
qDebug()<<"ret:featureRemove "<<ret; qInfo()<<"ret:featureRemove "<<ret;
} }
setImageChanged(false); setImageChanged(false);
} }
...@@ -180,10 +180,10 @@ cv::Mat FaceReconitionHandle::loadImageFromByteStream(const QString& filePath) { ...@@ -180,10 +180,10 @@ cv::Mat FaceReconitionHandle::loadImageFromByteStream(const QString& filePath) {
} }
return mat; return mat;
} catch (const CImgException& e) { } catch (const CImgException& e) {
qDebug() << "CImg Error: " << e.what(); qInfo() << "CImg Error: " << e.what();
return cv::Mat();; return cv::Mat();;
} catch (const cv::Exception& e) { } catch (const cv::Exception& e) {
qDebug() << "OpenCV Error: " << e.what(); qInfo() << "OpenCV Error: " << e.what();
return cv::Mat(); ; return cv::Mat(); ;
} }
...@@ -218,7 +218,7 @@ void FaceReconitionHandle::doesItExistEmployee(const cv::Mat &source,std::list<v ...@@ -218,7 +218,7 @@ void FaceReconitionHandle::doesItExistEmployee(const cv::Mat &source,std::list<v
HF_FaceContextRunFaceTrack(ctxHandle, imageSteamHandle, &multipleFaceData); HF_FaceContextRunFaceTrack(ctxHandle, imageSteamHandle, &multipleFaceData);
if (multipleFaceData.detectedNum <= 0) { if (multipleFaceData.detectedNum <= 0) {
qDebug()<<QString("search 未检测到人脸"); qInfo()<<QString("search 未检测到人脸");
return ; return ;
} }
...@@ -227,11 +227,11 @@ void FaceReconitionHandle::doesItExistEmployee(const cv::Mat &source,std::list<v ...@@ -227,11 +227,11 @@ void FaceReconitionHandle::doesItExistEmployee(const cv::Mat &source,std::list<v
HInt32 featureNum; HInt32 featureNum;
HF_GetFeatureLength(ctxHandle, &featureNum); HF_GetFeatureLength(ctxHandle, &featureNum);
for(int j=0;j< multipleFaceData.detectedNum; ++j){ for(int j=0;j< multipleFaceData.detectedNum; ++j){
qDebug()<<QString("doesItExistEmployee==>面部索引: %1").arg(j); qInfo()<<QString("doesItExistEmployee==>面部索引: %1").arg(j);
std::vector<float> newfeature(featureNum,0.0f); std::vector<float> newfeature(featureNum,0.0f);
ret = HF_FaceFeatureExtractCpy(ctxHandle, imageSteamHandle, multipleFaceData.tokens[j], newfeature.data()); ret = HF_FaceFeatureExtractCpy(ctxHandle, imageSteamHandle, multipleFaceData.tokens[j], newfeature.data());
if(ret != HSUCCEED) { if(ret != HSUCCEED) {
qDebug()<<QString("特征提取出错: %1").arg(ret); qInfo()<<QString("特征提取出错: %1").arg(ret);
HF_ReleaseImageStream(imageSteamHandle); HF_ReleaseImageStream(imageSteamHandle);
return ; return ;
} }
...@@ -252,9 +252,9 @@ void FaceReconitionHandle::doesItExistEmployee(const cv::Mat &source,std::list<v ...@@ -252,9 +252,9 @@ void FaceReconitionHandle::doesItExistEmployee(const cv::Mat &source,std::list<v
return ; return ;
} }
qDebug()<<QString("搜索置信度: %1").arg(confidence); qInfo()<<QString("搜索置信度: %1").arg(confidence);
qDebug()<<QString("匹配到的tag: %1").arg(searchIdentity.tag); qInfo()<<QString("匹配到的tag: %1").arg(searchIdentity.tag);
qDebug()<<QString("匹配到的customId: %1").arg(searchIdentity.customId); qInfo()<<QString("匹配到的customId: %1").arg(searchIdentity.customId);
// Face Pipeline // Face Pipeline
//printf("人脸特征数量: %d", faceNum); //printf("人脸特征数量: %d", faceNum);
if (confidence > configConfidence) { if (confidence > configConfidence) {
......
File mode changed from 100644 to 100755
...@@ -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,11 +244,11 @@ vides_data::response *HttpService::httpLicensePlateRecognition(vides_data::reque ...@@ -244,11 +244,11 @@ 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.errorString(); resp->msg=m_httpClient.errorCode();
} }
return resp; return resp;
} }
...@@ -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,10 +313,10 @@ vides_data::response *HttpService::httpPostUniforms(QByteArray &img,QString &id, ...@@ -313,10 +313,10 @@ 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=OPERATION_FAILED; resp->msg=m_httpClient.errorCode();
} }
return resp; return resp;
} }
...@@ -354,20 +354,20 @@ vides_data::response *HttpService::httpPostFacePopulation(QByteArray &img,int &h ...@@ -354,20 +354,20 @@ 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=OPERATION_FAILED; resp->msg=m_httpClient.errorCode();
} }
return resp; return resp;
} }
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));
...@@ -408,7 +408,7 @@ vides_data::response *HttpService::httpPostFaceReconition(vides_data::requestFac ...@@ -408,7 +408,7 @@ vides_data::response *HttpService::httpPostFaceReconition(vides_data::requestFac
resp->msg=map["message"].toString(); resp->msg=map["message"].toString();
}else{ }else{
resp->code=2; resp->code=2;
resp->msg=m_httpClient.errorString(); resp->msg=m_httpClient.errorCode();
//resp->msg=OPERATION_FAILED; //resp->msg=OPERATION_FAILED;
} }
return resp; return resp;
...@@ -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();
} }
...@@ -518,13 +518,18 @@ vides_data::response *HttpService::httpDeviceConfig(const QString &serialNumber, ...@@ -518,13 +518,18 @@ vides_data::response *HttpService::httpDeviceConfig(const QString &serialNumber,
// 解析 licensePlateConfig // 解析 licensePlateConfig
QJsonObject licensePlateConfigObj = dataObj["licensePlateConfig"].toObject(); QJsonObject licensePlateConfigObj = dataObj["licensePlateConfig"].toObject();
config.licensePlateConfig.isOn = licensePlateConfigObj["isOn"].toBool(); config.licensePlateConfig.isOn = licensePlateConfigObj["isOn"].toBool();
config.licensePlateConfig.carConfidence = licensePlateConfigObj["carConfidence"].toVariant().toFloat(); config.licensePlateConfig.recConfidenceThreshold = licensePlateConfigObj["recConfidenceThreshold"].toVariant().toFloat();
config.licensePlateConfig.carConfidenceMax = licensePlateConfigObj["carConfidenceMax"].toVariant().toFloat(); config.licensePlateConfig.carConfidenceMax = licensePlateConfigObj["carConfidenceMax"].toVariant().toFloat();
config.licensePlateConfig.carConfidenceMin = licensePlateConfigObj["carConfidenceMin"].toVariant().toFloat(); config.licensePlateConfig.carConfidenceMin = licensePlateConfigObj["carConfidenceMin"].toVariant().toFloat();
config.licensePlateConfig.licensePlateLen=licensePlateConfigObj["licensePlateLen"].toInt(); config.licensePlateConfig.licensePlateLen=licensePlateConfigObj["licensePlateLen"].toInt();
config.licensePlateConfig.updateAt = licensePlateConfigObj["updateAt"].toVariant().toULongLong(); config.licensePlateConfig.updateAt = licensePlateConfigObj["updateAt"].toVariant().toULongLong();
config.licensePlateConfig.maxNum=licensePlateConfigObj["maxNum"].toInt();
config.licensePlateConfig.useHalf=licensePlateConfigObj["useHalf"].toBool();
config.licensePlateConfig.boxConfThreshold = licensePlateConfigObj["boxConfThreshold"].toVariant().toFloat();
config.licensePlateConfig.nmsThreshold = licensePlateConfigObj["nmsThreshold"].toVariant().toFloat();
config.licensePlateConfig.isHigh=licensePlateConfigObj["isHigh"].toBool();
// 解析 uniformConfig // 解析 uniformConfig
QJsonObject uniformConfigObj = dataObj["uniformConfig"].toObject(); QJsonObject uniformConfigObj = dataObj["uniformConfig"].toObject();
...@@ -533,7 +538,10 @@ vides_data::response *HttpService::httpDeviceConfig(const QString &serialNumber, ...@@ -533,7 +538,10 @@ vides_data::response *HttpService::httpDeviceConfig(const QString &serialNumber,
config.uniformConfig.humanDetectionLen = uniformConfigObj["humanDetectionLen"].toInt(); config.uniformConfig.humanDetectionLen = uniformConfigObj["humanDetectionLen"].toInt();
config.uniformConfig.updateAt = uniformConfigObj["updateAt"].toVariant().toULongLong(); config.uniformConfig.updateAt = uniformConfigObj["updateAt"].toVariant().toULongLong();
config.uniformConfig.carShapeConfidence = uniformConfigObj["carShapeConfidence"].toVariant().toFloat(); config.uniformConfig.carShapeConfidence = uniformConfigObj["carShapeConfidence"].toVariant().toFloat();
//解析 humanConfig
QJsonObject humanConfigObj = dataObj["humanConfig"].toObject();
config.humanConfig.isOn=humanConfigObj["isOn"].toBool();
config.humanConfig.updateAt = humanConfigObj["updateAt"].toVariant().toULongLong();
// 解析 devicesConfig // 解析 devicesConfig
QJsonObject devicesConfigObj = dataObj["camera"].toObject(); QJsonObject devicesConfigObj = dataObj["camera"].toObject();
...@@ -547,16 +555,19 @@ vides_data::response *HttpService::httpDeviceConfig(const QString &serialNumber, ...@@ -547,16 +555,19 @@ vides_data::response *HttpService::httpDeviceConfig(const QString &serialNumber,
//解析mqttConfig //解析mqttConfig
QJsonObject mqttConfigObj = dataObj["mqttConfig"].toObject(); QJsonObject mqttConfigObj = dataObj["mqttConfig"].toObject();
config.mqttConfig.address=mqttConfigObj["address"].toString(); config.mqttConfig.address=mqttConfigObj["address"].toString();
config.mqttConfig.clientId=mqttConfigObj["clientId"].toString();
config.mqttConfig.qos=mqttConfigObj["qos"].toInt(); config.mqttConfig.qos=mqttConfigObj["qos"].toInt();
config.mqttConfig.timeout = mqttConfigObj["timeout"].toVariant().toULongLong(); config.mqttConfig.timeout = mqttConfigObj["timeout"].toVariant().toULongLong();
config.mqttConfig.topic=mqttConfigObj["topic"].toString();
config.mqttConfig.username=mqttConfigObj["username"].toString(); config.mqttConfig.username=mqttConfigObj["username"].toString();
config.mqttConfig.password=mqttConfigObj["password"].toString(); config.mqttConfig.password=mqttConfigObj["password"].toString();
config.mqttConfig.updateAt=mqttConfigObj["updateAt"].toVariant().toULongLong();
resp->msg=map["message"].toString(); resp->msg=map["message"].toString();
}else{ }else{
qDebug()<<m_httpClient.errorCode(); qInfo()<<"httpDeviceConfig;";
qInfo()<<m_httpClient.errorCode();
qInfo()<<m_httpClient.errorString();
resp->code=2; resp->code=2;
resp->msg=m_httpClient.errorString(); resp->msg=m_httpClient.errorString();
} }
...@@ -591,7 +602,7 @@ vides_data::response*HttpService::httpFindStream(QString &serialNumber){ ...@@ -591,7 +602,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;
} }
...@@ -615,8 +626,8 @@ vides_data::response *HttpService::httpDownload( const QString &filePath,QString ...@@ -615,8 +626,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;
...@@ -639,7 +650,7 @@ vides_data::response*HttpService::httpUploadFile(const QString &filePath,QString ...@@ -639,7 +650,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() << "图片保存失败!";
} }
} }
......
...@@ -4,18 +4,23 @@ ...@@ -4,18 +4,23 @@
LicensePlateRecognition::LicensePlateRecognition(const QString &modelPaths, float carConfidence) { LicensePlateRecognition::LicensePlateRecognition(const QString &modelPaths,bool is_high,int maxNum,
bool useHalf,float boxThreshold,float nmsThreshold,float recThreshold) {
HLPR_ContextConfiguration configuration = {0}; HLPR_ContextConfiguration configuration = {0};
QByteArray && by_mpath=modelPaths.toUtf8(); QByteArray && by_mpath=modelPaths.toUtf8();
char* m_path=by_mpath.data(); char* m_path=by_mpath.data();
configuration.models_path = m_path; configuration.models_path = m_path;
configuration.max_num = 5; configuration.max_num = maxNum;
configuration.det_level = DETECT_LEVEL_LOW; if(is_high){
configuration.use_half = false; configuration.det_level = DETECT_LEVEL_HIGH;
configuration.nms_threshold = 0.5f; }else{
configuration.rec_confidence_threshold = carConfidence; configuration.det_level = DETECT_LEVEL_LOW;
configuration.box_conf_threshold = 0.30f; }
configuration.use_half = useHalf;
configuration.nms_threshold =nmsThreshold;
configuration.rec_confidence_threshold = recThreshold;
configuration.box_conf_threshold = boxThreshold;
configuration.threads = 1; configuration.threads = 1;
ctx = HLPR_CreateContext(&configuration); ctx = HLPR_CreateContext(&configuration);
} }
...@@ -77,7 +82,7 @@ void LicensePlateRecognition::oldLicensePlateNumber(const cv::Mat &source,const ...@@ -77,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)
...@@ -163,7 +168,7 @@ void LicensePlateRecognition::licensePlateNumber(const cv::Mat &source, QString ...@@ -163,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;
......
...@@ -29,7 +29,9 @@ public: ...@@ -29,7 +29,9 @@ public:
void replaceWith1And0( QString &code); void replaceWith1And0( QString &code);
LicensePlateRecognition(const QString &modelPaths,float carConfidence); LicensePlateRecognition(const QString &modelPaths,bool is_high,int maxNum,
bool useHalf,float boxThreshold,float nmsThreshold,float recThreshold
);
LicensePlateRecognition(); LicensePlateRecognition();
......
...@@ -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;
......
#include "MqttSubscriber.h" #include "MqttSubscriber.h"
#include "mainwindow.h"
#include "CameraHandle.h"
#include "HttpService.h" // 确保包含 HttpService 头文件
#include <QTimer>
MqttSubscriber* MqttSubscriber::instance = nullptr; MqttSubscriber* MqttSubscriber::instance = nullptr;
MqttSubscriber* MqttSubscriber::getInstance(vides_data::MqttConfig& config, QObject* parent) { MqttSubscriber* MqttSubscriber::getInstance(QObject* parent) {
if (!instance) { if (!instance) {
instance = new MqttSubscriber(config, parent); instance = new MqttSubscriber(parent);
} }
return instance; return instance;
} }
MqttSubscriber::MqttSubscriber(vides_data::MqttConfig& config, QObject* parent) void MqttSubscriber::init(vides_data::MqttConfig &config, QString &httpUrl, QString &serialNumber) {
: QObject(parent), config(config) { // 如果客户端已存在,先断开连接再销毁
if (client != nullptr) {
if (MQTTAsync_isConnected(client)) {
// 断开连接
MQTTAsync_disconnectOptions disc_opts = MQTTAsync_disconnectOptions_initializer;
int rc = MQTTAsync_disconnect(client, &disc_opts);
if (rc != MQTTASYNC_SUCCESS) {
qInfo() << "客户端断开连接失败,返回编码" << rc;
}
}
QByteArray bAddress = config.address.toUtf8(); // 销毁现有的MQTT客户端
char* cAddress=bAddress.data(); MQTTAsync_destroy(&client);
client = nullptr; // 重置客户端指针
}
// 保存配置信息
this->config = config;
this->httpUrl = httpUrl;
this->serialNumber = serialNumber;
// 初始化新的MQTT客户端
QByteArray bAddress = config.address.toUtf8();
char* cAddress = bAddress.data();
QByteArray bClientId = config.clientId.toUtf8(); QByteArray bClientId = config.clientId.toUtf8();
char* cClientId=bClientId.data(); char* cClientId = bClientId.data();
int rc = MQTTAsync_create(&client, cAddress, cClientId, MQTTCLIENT_PERSISTENCE_NONE, nullptr);
if (rc != MQTTASYNC_SUCCESS) {
qInfo() << "MQTT客户端创建失败,返回编码" << rc;
return;
}
MQTTAsync_create(&client,cAddress,cClientId, MQTTCLIENT_PERSISTENCE_NONE, nullptr); // 设置回调函数
MQTTAsync_setCallbacks(client, this, [](void* context, char* cause) { MQTTAsync_setCallbacks(client, this, [](void* context, char* cause) {
static_cast<MqttSubscriber*>(context)->connectionLost(cause); static_cast<MqttSubscriber*>(context)->connectionLost(cause);
}, [](void* context, char* topicName, int topicLen, MQTTAsync_message* m) { }, [](void* context, char* topicName, int topicLen, MQTTAsync_message* m) {
...@@ -27,22 +55,38 @@ MqttSubscriber::MqttSubscriber(vides_data::MqttConfig& config, QObject* parent) ...@@ -27,22 +55,38 @@ MqttSubscriber::MqttSubscriber(vides_data::MqttConfig& config, QObject* parent)
}, nullptr); }, nullptr);
} }
MqttSubscriber::MqttSubscriber(QObject* parent)
: QObject(parent), retryTimer(new QTimer(this)), client(nullptr) {
// 连接信号和槽
connect(this, &MqttSubscriber::connectionLostSignal, this, &MqttSubscriber::reconnectAndFetchConfig, Qt::QueuedConnection);
retryTimer->setInterval(10000); // 设置重试间隔为10秒
retryTimer->setSingleShot(true); // 单次触发
connect(retryTimer, &QTimer::timeout, this, &MqttSubscriber::reconnectAndFetchConfig, Qt::QueuedConnection);
}
MqttSubscriber::~MqttSubscriber() { MqttSubscriber::~MqttSubscriber() {
MQTTAsync_destroy(&client); if (client != nullptr) {
MQTTAsync_destroy(&client);
client = nullptr;
}
instance = nullptr; instance = nullptr;
} }
void MqttSubscriber::start() { void MqttSubscriber::start() {
// 确保定时器停止
retryTimer->stop();
// 设置连接选项
MQTTAsync_connectOptions conn_opts = MQTTAsync_connectOptions_initializer; MQTTAsync_connectOptions conn_opts = MQTTAsync_connectOptions_initializer;
conn_opts.keepAliveInterval = 20; conn_opts.keepAliveInterval = 20;
conn_opts.cleansession = 1; conn_opts.cleansession = 1;
QByteArray bUsername = config.username.toUtf8(); QByteArray bUsername = config.username.toUtf8();
char* cUsername=bUsername.data(); char* cUsername = bUsername.data();
QByteArray bPassword = config.password.toUtf8(); QByteArray bPassword = config.password.toUtf8();
char* cPassword=bPassword.data(); char* cPassword = bPassword.data();
conn_opts.username = cUsername; conn_opts.username = cUsername;
conn_opts.password = cPassword; conn_opts.password = cPassword;
...@@ -54,13 +98,16 @@ void MqttSubscriber::start() { ...@@ -54,13 +98,16 @@ void MqttSubscriber::start() {
}; };
conn_opts.context = this; conn_opts.context = this;
// 启动连接
int rc; int rc;
if ((rc = MQTTAsync_connect(client, &conn_opts)) != MQTTASYNC_SUCCESS) { if ((rc = MQTTAsync_connect(client, &conn_opts)) != MQTTASYNC_SUCCESS) {
qInfo() << "启动连接失败,返回编码" << rc; qInfo() << "启动连接失败,返回编码" << rc;
} }
} }
void MqttSubscriber::onConnect(MQTTAsync_successData* response) { void MqttSubscriber::onConnect(MQTTAsync_successData* response) {
retryTimer->stop();
MQTTAsync_responseOptions opts = MQTTAsync_responseOptions_initializer; MQTTAsync_responseOptions opts = MQTTAsync_responseOptions_initializer;
opts.onSuccess = [](void* context, MQTTAsync_successData* response) { opts.onSuccess = [](void* context, MQTTAsync_successData* response) {
static_cast<MqttSubscriber*>(context)->onSubscribe(response); static_cast<MqttSubscriber*>(context)->onSubscribe(response);
...@@ -71,19 +118,45 @@ void MqttSubscriber::onConnect(MQTTAsync_successData* response) { ...@@ -71,19 +118,45 @@ void MqttSubscriber::onConnect(MQTTAsync_successData* response) {
opts.context = this; opts.context = this;
QByteArray bTopic = config.topic.toUtf8(); QByteArray bTopic = config.topic.toUtf8();
char* cTopic=bTopic.data(); char* cTopic = bTopic.data();
int rc; int rc;
if ((rc = MQTTAsync_subscribe(client, cTopic, config.qos, &opts)) != MQTTASYNC_SUCCESS) { if ((rc = MQTTAsync_subscribe(client, cTopic, config.qos, &opts)) != MQTTASYNC_SUCCESS) {
qInfo() << "启动订阅失败,返回编码" << rc<<response->token; qInfo() << "启动订阅失败,返回编码" << rc << response->token;
}
}
void MqttSubscriber::reconnectAndFetchConfig() {
qInfo() << "重新连接并获取配置";
Common& instace = Common::getInstance();
vides_data::responseConfig re_config;
// 使用 HttpService 从远程云端拉取配置
HttpService httpService(httpUrl); // 替换为实际的远程URL
vides_data::response* res = httpService.httpDeviceConfig(serialNumber, re_config);
if (res->code == 0) {
instace.deleteObj(res);
re_config.mqttConfig.clientId = serialNumber;
QString topic = QStringLiteral("/thingshub/%1/device/reply").arg(serialNumber);
re_config.mqttConfig.topic = topic;
this->config = re_config.mqttConfig;
this->init(re_config.mqttConfig, httpUrl, serialNumber);
this->start();
} else {
qInfo() << "配置拉取失败,等待10秒后重试";
instace.deleteObj(res);
QMetaObject::invokeMethod(retryTimer, "start", Qt::QueuedConnection);
} }
} }
void MqttSubscriber::onConnectFailure(MQTTAsync_failureData* response) { void MqttSubscriber::onConnectFailure(MQTTAsync_failureData* response) {
qInfo() << "连接失败, rc" << (response ? response->code : -1); qInfo() << "连接失败, rc" << (response ? response->code : -1);
retryTimer->stop(); // 确保定时器在启动前被停止
// 确保定时器在主线程启动
QMetaObject::invokeMethod(retryTimer, "start", Qt::QueuedConnection);
} }
void MqttSubscriber::onSubscribe(MQTTAsync_successData* response) { void MqttSubscriber::onSubscribe(MQTTAsync_successData* response) {
qInfo() << "订阅成功"<<response->token; qInfo() << "订阅成功" << response->token;
} }
void MqttSubscriber::onSubscribeFailure(MQTTAsync_failureData* response) { void MqttSubscriber::onSubscribeFailure(MQTTAsync_failureData* response) {
...@@ -95,28 +168,67 @@ void MqttSubscriber::connectionLost(char* cause) { ...@@ -95,28 +168,67 @@ void MqttSubscriber::connectionLost(char* cause) {
if (cause) { if (cause) {
qInfo() << "Cause:" << cause; qInfo() << "Cause:" << cause;
} }
emit connectionLostSignal(); // 发出连接丢失信号
} }
int MqttSubscriber::messageArrived(char* topicName, int topicLen, MQTTAsync_message* m) { int MqttSubscriber::messageArrived(char* topicName, int topicLen, MQTTAsync_message* m) {
QString topic(topicName); QString topic(topicName);
QString payload = QString::fromUtf8(reinterpret_cast<const char*>(m->payload), m->payloadlen); QString payload = QString::fromUtf8(reinterpret_cast<const char*>(m->payload), m->payloadlen);
qInfo() << "Message arrived"; vides_data::responseMqttData response;
qInfo() << "Topic:" << topic; QJsonDocument jsonDoc = QJsonDocument::fromJson(payload.toUtf8());
qInfo() << "Payload:" << payload; if (!jsonDoc.isNull() && jsonDoc.isObject()) {
qInfo()<<"topicLen"<<topicLen; QJsonObject jsonObj = jsonDoc.object();
response.msg_type = jsonObj["msg_type"].toInt();
response.sn = jsonObj["sn"].toString();
response.uniq = jsonObj["uniq"].toString();
} else {
qInfo() << "Failed to parse JSON payload";
}
int res = -2;
CameraHandle* cameraHandle = MainWindow::sp_this->findHandle(response.sn);
if (cameraHandle == nullptr) {
qInfo() << "不存在该相机";
res = -1;
} else {
if (response.msg_type == 2) {
res = cameraHandle->deviceShutdown();
} else if (response.msg_type == 3) {
res = cameraHandle->deviceReboot();
} else if (response.msg_type == 4) {
res = cameraHandle->updateSdkDevStatus(true);
} else if (response.msg_type == 5) {
res = cameraHandle->updateSdkDevStatus(false);
}
}
vides_data::requestMqttData request;
request.code = (res >= 0) ? 0 : 0x01;
request.uniq = response.uniq;
request.sn = response.sn;
sendSubscriptionConfirmation(request);
MQTTAsync_freeMessage(&m); MQTTAsync_freeMessage(&m);
MQTTAsync_free(topicName); MQTTAsync_free(topicName);
return 1; return 1;
} }
void MqttSubscriber::sendSubscriptionConfirmation(const std::string& messageId) { void MqttSubscriber::sendSubscriptionConfirmation(const vides_data::requestMqttData& response) {
std::string confirmationTopic = "confirmation/subscription"; QString responseTopic = "/thingshub/" + response.sn + "/device/post";
std::string confirmationMessage = "Subscription confirmed with message ID: " + messageId; QByteArray bResponseTopic = responseTopic.toUtf8();
char* cResponseTopic = bResponseTopic.data();
qInfo() << "sendSubscriptionConfirmation" << cResponseTopic;
QJsonObject json;
json["code"] = response.code;
json["uniq"] = response.uniq;
QJsonDocument jsonDoc(json);
QByteArray payload = jsonDoc.toJson(QJsonDocument::Compact);
MQTTAsync_message pubmsg = MQTTAsync_message_initializer; MQTTAsync_message pubmsg = MQTTAsync_message_initializer;
pubmsg.payload = const_cast<char*>(confirmationMessage.c_str());
pubmsg.payloadlen = confirmationMessage.length(); pubmsg.payload = const_cast<char*>(payload.data());
pubmsg.payloadlen = payload.size();
pubmsg.qos = config.qos; pubmsg.qos = config.qos;
pubmsg.retained = 0; pubmsg.retained = 0;
...@@ -130,13 +242,13 @@ void MqttSubscriber::sendSubscriptionConfirmation(const std::string& messageId) ...@@ -130,13 +242,13 @@ void MqttSubscriber::sendSubscriptionConfirmation(const std::string& messageId)
opts.context = this; opts.context = this;
int rc; int rc;
if ((rc = MQTTAsync_sendMessage(client, confirmationTopic.c_str(), &pubmsg, &opts)) != MQTTASYNC_SUCCESS) { if ((rc = MQTTAsync_sendMessage(client, cResponseTopic, &pubmsg, &opts)) != MQTTASYNC_SUCCESS) {
qInfo() << "发送消息失败,返回编码" << rc; qInfo() << "发送消息失败,返回编码" << rc;
} }
} }
void MqttSubscriber::onPublishSuccess(MQTTAsync_successData* response) { void MqttSubscriber::onPublishSuccess(MQTTAsync_successData* response) {
qInfo() << "消息已成功发布"<<response->token; qInfo() << "消息已成功发布" << response->token;
} }
void MqttSubscriber::onPublishFailure(MQTTAsync_failureData* response) { void MqttSubscriber::onPublishFailure(MQTTAsync_failureData* response) {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define MQTTSUBSCRIBER_H #define MQTTSUBSCRIBER_H
#include <MQTTClient.h> #include <MQTTClient.h>
#include <MQTTAsync.h> #include <MQTTAsync.h>
#include <QTimer>
#include <QObject> #include <QObject>
#include "VidesData.h" #include "VidesData.h"
...@@ -9,15 +10,25 @@ class MqttSubscriber : public QObject ...@@ -9,15 +10,25 @@ class MqttSubscriber : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
static MqttSubscriber* getInstance(vides_data::MqttConfig& config, QObject* parent = nullptr); ~MqttSubscriber(); static MqttSubscriber* getInstance( QObject* parent = nullptr); ~MqttSubscriber();
void init(vides_data:: MqttConfig& config,QString &httpUrl,QString &serialNumber);
void start(); void start();
signals:
void connectionLostSignal();
private slots:
void reconnectAndFetchConfig();
private: private:
MqttSubscriber(vides_data:: MqttConfig& config, QObject* parent = nullptr); MqttSubscriber(QObject* parent = nullptr);
MqttSubscriber(const MqttSubscriber&) = delete; MqttSubscriber() = delete;
MqttSubscriber& operator=(const MqttSubscriber&) = delete; MqttSubscriber& operator=(const MqttSubscriber&) = delete;
QTimer *retryTimer;
MQTTAsync client; MQTTAsync client;
QString httpUrl;
QString serialNumber;
vides_data::MqttConfig config; vides_data::MqttConfig config;
...@@ -34,7 +45,7 @@ private: ...@@ -34,7 +45,7 @@ private:
void onPublishSuccess(MQTTAsync_successData* response); void onPublishSuccess(MQTTAsync_successData* response);
void onPublishFailure(MQTTAsync_failureData* response); void onPublishFailure(MQTTAsync_failureData* response);
void sendSubscriptionConfirmation(const std::string& messageId); void sendSubscriptionConfirmation(const vides_data::requestMqttData& response);
static MqttSubscriber* instance; static MqttSubscriber* instance;
}; };
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -258,14 +258,19 @@ struct FaceConfig { ...@@ -258,14 +258,19 @@ struct FaceConfig {
struct LicensePlateConfig { struct LicensePlateConfig {
bool isOn; bool isOn;
float carConfidence;
float carConfidenceMax; float carConfidenceMax;
float carConfidenceMin; float carConfidenceMin;
int licensePlateLen; int licensePlateLen;
quint64 updateAt; quint64 updateAt;
int maxNum; ///< 识别最大数量
bool useHalf; ///< 是否使用半精度推理模式
float boxConfThreshold; ///< 检测框阈值
float nmsThreshold; ///< 非极大值抑制阈值
float recConfidenceThreshold; ///< 识别置信度阈值
bool isHigh;
}; };
struct UniformConfig { struct UniformConfig {
bool isOn; bool isOn;
int uniformColor; int uniformColor;
...@@ -274,6 +279,12 @@ struct UniformConfig { ...@@ -274,6 +279,12 @@ struct UniformConfig {
quint64 updateAt; quint64 updateAt;
}; };
struct HumanConfig{
bool isOn;
int humanDetectionLen;
quint64 updateAt;
};
struct MqttConfig { struct MqttConfig {
QString address; QString address;
QString clientId; QString clientId;
...@@ -282,6 +293,7 @@ struct MqttConfig { ...@@ -282,6 +293,7 @@ struct MqttConfig {
QString topic; QString topic;
QString username; QString username;
QString password; QString password;
quint64 updateAt;
}; };
struct responseConfig { struct responseConfig {
...@@ -293,15 +305,38 @@ struct responseConfig { ...@@ -293,15 +305,38 @@ struct responseConfig {
UniformConfig uniformConfig; UniformConfig uniformConfig;
Camera camera; Camera camera;
MqttConfig mqttConfig; MqttConfig mqttConfig;
};
struct Devices{ HumanConfig humanConfig;
QString id;
QString state;
}; };
struct responseMqttData{ struct responseMqttData{
uint8_t msg_type; uint8_t msg_type;
std::list<Devices>devices; QString sn;
QString uniq;
};
struct requestMqttData{
QString sn;
int code;
QString uniq;
};
struct DetectionParams {
int newHumanDetectionLen;
int newLicensePlateLen;
int newFaceLen;
QString modelPaths;
float humanCarShapeConfidence;
int uniformColor;
std::map<QString, QString> faceMaps;
int numberFaces;
float faceConfidence;
__uint8_t algorithmPermissions;
bool isHigh;
int maxNum; ///< 识别最大数量
bool useHalf; ///< 是否使用半精度推理模式
float boxConfThreshold; ///< 检测框阈值
float nmsThreshold; ///< 非极大值抑制阈值
float recConfidenceThreshold; ///< 识别置信度阈值
}; };
inline bool isVirtualMachine() inline bool isVirtualMachine()
...@@ -381,21 +416,28 @@ inline bool pingAddress(const QString &address) { ...@@ -381,21 +416,28 @@ inline bool pingAddress(const QString &address) {
return false; return false;
} }
if (!process.waitForFinished(1000)) { // 使用较长的超时值,确保进程有足够时间完成
if (!process.waitForFinished(3000)) {
process.kill(); // 如果超时,强制终止进程
return false; return false;
} }
QString output(process.readAllStandardOutput()); QString output(process.readAllStandardOutput());
// 此处可以使用更复杂的逻辑来解析 Ping 输出 // 简单的 Ping 成功检查逻辑
#ifdef Q_OS_WIN
return output.contains("TTL=");
#else
return output.contains("1 packets transmitted, 1 received"); return output.contains("1 packets transmitted, 1 received");
#endif
} }
inline int GetCpuIdByAsm_arm(char* cpu_id) inline int GetCpuIdByAsm_arm(char* cpu_id)
{ {
FILE *fp = fopen("/proc/cpuinfo", "r"); FILE *fp = fopen("/proc/cpuinfo", "r");
if(nullptr == fp) if(nullptr == fp)
{ {
qDebug()<<"failed to open cpuinfo"; qInfo()<<"failed to open cpuinfo";
return -1; return -1;
} }
...@@ -431,7 +473,7 @@ inline int GetCpuIdByAsm_arm(char* cpu_id) ...@@ -431,7 +473,7 @@ inline int GetCpuIdByAsm_arm(char* cpu_id)
inline QString getCpuSerialNumber() { inline QString getCpuSerialNumber() {
QFile file("/proc/cpuinfo"); QFile file("/proc/cpuinfo");
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
qDebug() << "无法打开 /proc/cpuinfo 文件"; qInfo() << "无法打开 /proc/cpuinfo 文件";
return QString(); return QString();
} }
QTextStream in(&file); QTextStream in(&file);
......
File added
...@@ -12,8 +12,7 @@ TEMPLATE = app ...@@ -12,8 +12,7 @@ TEMPLATE = app
# depend on your compiler). Please consult the documentation of the # depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it. # deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_DEPRECATED_WARNINGS
DEFINES += APP_VERSION=\\\"1.3.0\\\" DEFINES += APP_VERSION=\\\"1.3.2\\\"
QMAKE_LIBDIR += /usr/local/lib QMAKE_LIBDIR += /usr/local/lib
...@@ -25,6 +24,9 @@ INCLUDEPATH+=/usr/local/include/human ...@@ -25,6 +24,9 @@ INCLUDEPATH+=/usr/local/include/human
INCLUDEPATH+=/usr/local/include/CImg INCLUDEPATH+=/usr/local/include/CImg
INCLUDEPATH+=/usr/local/include/mqtt INCLUDEPATH+=/usr/local/include/mqtt
# 禁用所有警告
QMAKE_CXXFLAGS += -w
#unix:contains(QMAKE_HOST.arch, x86_64) { #unix:contains(QMAKE_HOST.arch, x86_64) {
# QMAKE_LIBDIR += /home/mark/Public/x86_opencv/lib # QMAKE_LIBDIR += /home/mark/Public/x86_opencv/lib
#} #}
...@@ -123,13 +125,12 @@ HEADERS += \ ...@@ -123,13 +125,12 @@ HEADERS += \
BaseAlgorithm.h \ BaseAlgorithm.h \
MqttSubscriber.h MqttSubscriber.h
#FORMS += \
# mainwindow.ui
# Default rules for deployment. # Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target !isEmpty(target.path): INSTALLS += target
RESOURCES += \ #RESOURCES += \
BG.qrc # BG.qrc
...@@ -34,8 +34,6 @@ MainWindow::MainWindow() ...@@ -34,8 +34,6 @@ MainWindow::MainWindow()
QString serialNumber; QString serialNumber;
findLocalSerialNumber(serialNumber); findLocalSerialNumber(serialNumber);
qInfo()<<"serialNumber==:"<<serialNumber;
bool configFetched = false; bool configFetched = false;
while (!configFetched) { while (!configFetched) {
HttpService httpService(httpurl); HttpService httpService(httpurl);
...@@ -70,12 +68,20 @@ MainWindow::MainWindow() ...@@ -70,12 +68,20 @@ MainWindow::MainWindow()
float carShapeConfidence=config.uniformConfig.carShapeConfidence; float carShapeConfidence=config.uniformConfig.carShapeConfidence;
float carConfidence=config.licensePlateConfig.carConfidence; bool is_high=config.licensePlateConfig.isHigh;
int maxNum = config.licensePlateConfig.maxNum;
bool useHalf = config.licensePlateConfig.useHalf;
float boxThreshold = config.licensePlateConfig.boxConfThreshold;
float nmsThreshold = config.licensePlateConfig.nmsThreshold;
float recThreshold = config.licensePlateConfig.recConfidenceThreshold;
AlgorithmTaskManage &algorithmTaskManage= AlgorithmTaskManage::getInstance(); AlgorithmTaskManage &algorithmTaskManage= AlgorithmTaskManage::getInstance();
algorithmTaskManage.initialize(humanDetectionLen,licensePlateLen,faceLen,true,0x00); algorithmTaskManage.initialize(humanDetectionLen,licensePlateLen,faceLen,true,0x00);
algorithmTaskManage.initHumanDetectionManage(modelPaths,carShapeConfidence,uniformColor); algorithmTaskManage.initHumanDetectionManage(modelPaths,carShapeConfidence,uniformColor);
algorithmTaskManage.initLicensePlateManage(modelPaths,carConfidence); algorithmTaskManage.initLicensePlateManage(modelPaths,is_high,maxNum,
useHalf,boxThreshold,nmsThreshold,recThreshold
);
MediaFaceImage* mediaFaceImage= MediaFaceImage::getInstance(); MediaFaceImage* mediaFaceImage= MediaFaceImage::getInstance();
QString configPath = qSetting->value("devices/sz_config_path").toString(); QString configPath = qSetting->value("devices/sz_config_path").toString();
...@@ -118,16 +124,22 @@ MainWindow::MainWindow() ...@@ -118,16 +124,22 @@ MainWindow::MainWindow()
if (!server.listen(QHostAddress::Any, port)) { if (!server.listen(QHostAddress::Any, port)) {
qInfo() << "Error: Unable to start the server on port 12345"; qInfo() << "Error: Unable to start the server on port 12345";
} else { } else {
qDebug() << "Server started, listening on port 12345"; qInfo() << "Server started, listening on port 12345";
} }
config.mqttConfig.clientId=serialNumber;
QString topic = QStringLiteral("/thingshub/%1/device/reply").arg(serialNumber);
config.mqttConfig.topic=topic;
this->mqttConfig= config.mqttConfig; this->mqttConfig= config.mqttConfig;
MqttSubscriber* subscriber = MqttSubscriber::getInstance(mqttConfig); runOrRebootMqtt(mqttConfig,httpurl,serialNumber);
}
void MainWindow::runOrRebootMqtt(vides_data::MqttConfig &mqtt_config,QString &httpUrl,QString &serialNumber){
MqttSubscriber* subscriber = MqttSubscriber::getInstance(this);
subscriber->init(mqtt_config,httpUrl,serialNumber);
subscriber->start(); subscriber->start();
} }
void MainWindow::divParameterUpdate(vides_data::responseConfig &cloudConfig ){ void MainWindow::divParameterUpdate(vides_data::responseConfig &cloudConfig,QString &httpUrl,QString &serialNumber ){
bool faceAlgorithm = false, licensePlateAlgorithm = false, uniformAlgorithm = false, timeChange = false; bool faceAlgorithm = false, licensePlateAlgorithm = false, uniformAlgorithm = false, timeChange = false;
AlgorithmTaskManage &algorithmTaskManage= AlgorithmTaskManage::getInstance(); AlgorithmTaskManage &algorithmTaskManage= AlgorithmTaskManage::getInstance();
...@@ -154,13 +166,33 @@ void MainWindow::divParameterUpdate(vides_data::responseConfig &cloudConfig ){ ...@@ -154,13 +166,33 @@ void MainWindow::divParameterUpdate(vides_data::responseConfig &cloudConfig ){
if(!faceAlgorithm && !licensePlateAlgorithm && !uniformAlgorithm && !timeChange){ if(!faceAlgorithm && !licensePlateAlgorithm && !uniformAlgorithm && !timeChange){
return; return;
} }
if(config.mqttConfig.updateAt!=cloudConfig.mqttConfig.updateAt){
cloudConfig.mqttConfig.topic=config.mqttConfig.topic;
runOrRebootMqtt(cloudConfig.mqttConfig,httpUrl,serialNumber);
}
__uint8_t alg= this->intToUint8t(faceAlgorithm,licensePlateAlgorithm,uniformAlgorithm,false) ;
vides_data::DetectionParams params;
__uint8_t alg= this->intToUint8t(faceAlgorithm,licensePlateAlgorithm,uniformAlgorithm) ; params.newHumanDetectionLen =cloudConfig.uniformConfig.humanDetectionLen;
algorithmTaskManage.releaseResources(cloudConfig.uniformConfig.humanDetectionLen params.newLicensePlateLen =cloudConfig.licensePlateConfig.licensePlateLen;
,cloudConfig.licensePlateConfig.licensePlateLen, params.newFaceLen =cloudConfig.faceConfig.faceLen;
cloudConfig.faceConfig.faceLen,modelPaths, params.modelPaths = modelPaths;
cloudConfig.uniformConfig.carShapeConfidence params.humanCarShapeConfidence =cloudConfig.uniformConfig.carShapeConfidence;
,cloudConfig.uniformConfig.uniformColor,cloudConfig.licensePlateConfig.carConfidence,localImageMap,cloudConfig.faceConfig.faceNumbers,cloudConfig.faceConfig.confidence,alg); params.uniformColor =cloudConfig.uniformConfig.uniformColor;
params.faceMaps = localImageMap;
params.numberFaces =cloudConfig.faceConfig.faceNumbers;
params.faceConfidence =cloudConfig.faceConfig.confidence;
params.algorithmPermissions =alg;
params.isHigh =cloudConfig.licensePlateConfig.isHigh;
params.maxNum = cloudConfig.licensePlateConfig.maxNum;
params.useHalf = cloudConfig.licensePlateConfig.useHalf;
params.boxConfThreshold = cloudConfig.licensePlateConfig.boxConfThreshold;
params.nmsThreshold =cloudConfig.licensePlateConfig.nmsThreshold;
params.recConfidenceThreshold = cloudConfig.licensePlateConfig.recConfidenceThreshold;
algorithmTaskManage.releaseResources(params);
if(config.timerSettings.updateAt!=cloudConfig.timerSettings.updateAt){ if(config.timerSettings.updateAt!=cloudConfig.timerSettings.updateAt){
if(config.timerSettings.deleteLogFileTimer!=cloudConfig.timerSettings.deleteLogFileTimer){ if(config.timerSettings.deleteLogFileTimer!=cloudConfig.timerSettings.deleteLogFileTimer){
deleteLogFileTimer->stop(); deleteLogFileTimer->stop();
...@@ -229,7 +261,7 @@ void MainWindow::handleMatNewConnection(){ ...@@ -229,7 +261,7 @@ void MainWindow::handleMatNewConnection(){
QRegExp urlRegEx("GET /cameras/([^/]+)/current_image HTTP"); QRegExp urlRegEx("GET /cameras/([^/]+)/current_image HTTP");
if(urlRegEx.indexIn(request) != -1) { if(urlRegEx.indexIn(request) != -1) {
QString sn = urlRegEx.cap(1); QString sn = urlRegEx.cap(1);
qDebug() << "Requested Camera SN: " << sn; qInfo() << "Requested Camera SN: " << sn;
bool foundCamera = false; bool foundCamera = false;
for (auto it = faceDetectionParkingPushs.begin(); it != faceDetectionParkingPushs.end(); ++it) { for (auto it = faceDetectionParkingPushs.begin(); it != faceDetectionParkingPushs.end(); ++it) {
QString currentSn = it->second->getSSn(); QString currentSn = it->second->getSSn();
...@@ -283,7 +315,7 @@ void MainWindow::removeImageFiles(QString id){ ...@@ -283,7 +315,7 @@ void MainWindow::removeImageFiles(QString id){
QString value = localIt->second; QString value = localIt->second;
QFile file(value); QFile file(value);
if (!file.open(QIODevice::WriteOnly)) { if (!file.open(QIODevice::WriteOnly)) {
qDebug() << "removeImageFiles open fail" << value; qInfo() << "removeImageFiles open fail" << value;
} else { } else {
file.remove(); file.remove();
} }
...@@ -346,7 +378,7 @@ void MainWindow::updateLocalFace(const QString &httpurl) { ...@@ -346,7 +378,7 @@ void MainWindow::updateLocalFace(const QString &httpurl) {
if (localIt != localImageMap.end()) { if (localIt != localImageMap.end()) {
QFile file(localIt->second); QFile file(localIt->second);
if (!file.open(QIODevice::WriteOnly)) { if (!file.open(QIODevice::WriteOnly)) {
qDebug() << "open fail" << localIt->second; qInfo() << "open fail" << localIt->second;
} else { } else {
file.remove(); file.remove();
qSetting->beginGroup("localImageMap"); qSetting->beginGroup("localImageMap");
...@@ -476,7 +508,7 @@ void MainWindow::startCamera(const QString &httpurl){ ...@@ -476,7 +508,7 @@ void MainWindow::startCamera(const QString &httpurl){
return ; return ;
} }
instace.deleteObj(res_config); instace.deleteObj(res_config);
divParameterUpdate(cloudConfig); divParameterUpdate(cloudConfig,nonConstHttpUrl,serialNumber);
for (const auto& device : devices.list) { for (const auto& device : devices.list) {
if(localDevices.count(device.sSn)>0 ){ if(localDevices.count(device.sSn)>0 ){
...@@ -512,7 +544,7 @@ void MainWindow::startCamera(const QString &httpurl){ ...@@ -512,7 +544,7 @@ void MainWindow::startCamera(const QString &httpurl){
else { else {
CameraHandle *indexHandle=findHandle(device.sSn); CameraHandle *indexHandle=findHandle(device.sSn);
if(indexHandle!=nullptr &&device.is_reboot){ if(indexHandle!=nullptr &&device.is_reboot){
indexHandle->deviceReboot(false); indexHandle->deviceReboot();
}else { }else {
auto it = this->faceDetectionParkingPushs.find(key); auto it = this->faceDetectionParkingPushs.find(key);
if (it != this->faceDetectionParkingPushs.end()) { if (it != this->faceDetectionParkingPushs.end()) {
...@@ -524,7 +556,7 @@ void MainWindow::startCamera(const QString &httpurl){ ...@@ -524,7 +556,7 @@ void MainWindow::startCamera(const QString &httpurl){
reStatus.camera_info_list.push_front(camera_info); reStatus.camera_info_list.push_front(camera_info);
__uint8_t new_algorithm= intToUint8t(devConfig.faceConfig.isOn,devConfig.licensePlateConfig.isOn,devConfig.uniformConfig.isOn); __uint8_t new_algorithm= intToUint8t(devConfig.faceConfig.isOn,devConfig.licensePlateConfig.isOn,devConfig.uniformConfig.isOn,devConfig.humanConfig.isOn);
offlineCameraHandle->cameraParameterUpdate(devConfig); offlineCameraHandle->cameraParameterUpdate(devConfig);
offlineCameraHandle->initAlgorithmPermissions(new_algorithm); offlineCameraHandle->initAlgorithmPermissions(new_algorithm);
...@@ -692,14 +724,14 @@ void MainWindow::initEncodeToString(QString &enCodeJson) { ...@@ -692,14 +724,14 @@ void MainWindow::initEncodeToString(QString &enCodeJson) {
} }
bool MainWindow::iniWorkSpVMn(vides_data::responseGb28181 *gb28181,QString &workSpWMn,QString &sn){ bool MainWindow::iniWorkSpVMn(vides_data::responseGb28181 *gb28181,QString &workSpWMn,QString &sn){
qDebug()<<"iniWorkSpVMn=="<<sn; qInfo()<<"iniWorkSpVMn=="<<sn;
QString jsonfile=QCoreApplication::applicationDirPath()+"/camera_config.json"; QString jsonfile=QCoreApplication::applicationDirPath()+"/camera_config.json";
bool isEqual=true; bool isEqual=true;
// 读取 JSON 配置文件 // 读取 JSON 配置文件
QFile file(jsonfile); QFile file(jsonfile);
if (!file.open(QIODevice::ReadOnly)) { if (!file.open(QIODevice::ReadOnly)) {
qDebug() << "Failed to open the camera_config.json"; qInfo() << "Failed to open the camera_config.json";
return isEqual; return isEqual;
} }
QJsonObject toJsonObject; QJsonObject toJsonObject;
...@@ -929,8 +961,10 @@ void MainWindow::initRecordingToString(QString &recorJson){ ...@@ -929,8 +961,10 @@ void MainWindow::initRecordingToString(QString &recorJson){
recorJson = QString::fromUtf8(jsonDocument.toJson()); recorJson = QString::fromUtf8(jsonDocument.toJson());
} }
__uint8_t MainWindow::intToUint8t(bool faceAlgorithm, bool licensePlateAlgorithm, bool uniformAlgorithm) { __uint8_t MainWindow::intToUint8t(bool faceAlgorithm, bool licensePlateAlgorithm, bool uniformAlgorithm,bool humanAlgorithm) {
__uint8_t result = 0; __uint8_t result = 0;
//人形识别对应最高高位(第3位)
result |= (humanAlgorithm ? 1 : 0) << 3;
// 工服识别对应最高位(第2位) // 工服识别对应最高位(第2位)
result |= (uniformAlgorithm ? 1 : 0) << 2; result |= (uniformAlgorithm ? 1 : 0) << 2;
...@@ -940,6 +974,9 @@ __uint8_t MainWindow::intToUint8t(bool faceAlgorithm, bool licensePlateAlgorithm ...@@ -940,6 +974,9 @@ __uint8_t MainWindow::intToUint8t(bool faceAlgorithm, bool licensePlateAlgorithm
// 车牌识别对应最低位(第0位) // 车牌识别对应最低位(第0位)
result |= (licensePlateAlgorithm ? 1 : 0); result |= (licensePlateAlgorithm ? 1 : 0);
qInfo()<<"算法结果"<<result;
return result; return result;
} }
void MainWindow::initCameras(vides_data::cameraParameters &parameter,vides_data::responseConfig &devConfig,const std::list<vides_data::responseArea>&areas,std::list<vides_data::requestCameraInfo>&camera_info_list){ void MainWindow::initCameras(vides_data::cameraParameters &parameter,vides_data::responseConfig &devConfig,const std::list<vides_data::responseArea>&areas,std::list<vides_data::requestCameraInfo>&camera_info_list){
...@@ -951,7 +988,7 @@ void MainWindow::initCameras(vides_data::cameraParameters &parameter,vides_data: ...@@ -951,7 +988,7 @@ void MainWindow::initCameras(vides_data::cameraParameters &parameter,vides_data:
CameraHandle * cameraHandle =new CameraHandle(parameter.sDevId,parameter.httpUrl,parameter.sSn,parameter.channel,image_save,heightReference,devConfig); CameraHandle * cameraHandle =new CameraHandle(parameter.sDevId,parameter.httpUrl,parameter.sSn,parameter.channel,image_save,heightReference,devConfig);
int sdk_handle=cameraHandle->sdkDevLoginSyn(parameter.sDevId,parameter.nDevPort,parameter.sUserName,parameter.sPassword,3000); int sdk_handle=cameraHandle->sdkDevLoginSyn(parameter.sDevId,parameter.nDevPort,parameter.sUserName,parameter.sPassword,3000);
qDebug()<<"句柄为2:"<<sdk_handle; qInfo()<<"句柄为2:"<<sdk_handle;
if(sdk_handle<=0){ if(sdk_handle<=0){
qInfo() << "登录失败"; qInfo() << "登录失败";
return ; return ;
...@@ -961,6 +998,8 @@ void MainWindow::initCameras(vides_data::cameraParameters &parameter,vides_data: ...@@ -961,6 +998,8 @@ void MainWindow::initCameras(vides_data::cameraParameters &parameter,vides_data:
initDevConfigSyn(cameraHandle,devConfig); initDevConfigSyn(cameraHandle,devConfig);
cameraHandle->sdkDevSetAlarmListener(sdk_handle,0);
int synTime=devConfig.camera.devSnapSynTimer; int synTime=devConfig.camera.devSnapSynTimer;
uint64 face_frequency=devConfig.faceConfig.faceFrequency; uint64 face_frequency=devConfig.faceConfig.faceFrequency;
...@@ -979,7 +1018,8 @@ void MainWindow::initCameras(vides_data::cameraParameters &parameter,vides_data: ...@@ -979,7 +1018,8 @@ void MainWindow::initCameras(vides_data::cameraParameters &parameter,vides_data:
cameraHandle->findFirmwareVersion(camera_info.firmware_version); cameraHandle->findFirmwareVersion(camera_info.firmware_version);
camera_info_list.push_front(camera_info); camera_info_list.push_front(camera_info);
__uint8_t new_algorithm= intToUint8t(devConfig.faceConfig.isOn,devConfig.licensePlateConfig.isOn,devConfig.uniformConfig.isOn);
__uint8_t new_algorithm= (devConfig.faceConfig.isOn,devConfig.licensePlateConfig.isOn,devConfig.uniformConfig.isOn,devConfig.humanConfig.isOn);
cameraHandle->initAlgorithmPermissions(new_algorithm); cameraHandle->initAlgorithmPermissions(new_algorithm);
cameraHandle->initParkingSpaceInfo(areas); cameraHandle->initParkingSpaceInfo(areas);
......
...@@ -38,13 +38,15 @@ public: ...@@ -38,13 +38,15 @@ public:
void createDirectory(int flag,const QString& dirName, const QString& successMsg, const QString& failureMsg); void createDirectory(int flag,const QString& dirName, const QString& successMsg, const QString& failureMsg);
void runOrRebootMqtt(vides_data::MqttConfig &mqtt_config,QString &httpUrl,QString &serialNumber);
void initFaceFaceRecognition(); void initFaceFaceRecognition();
void initCameras(vides_data::cameraParameters &parameter, vides_data::responseConfig &devConfig, const std::list<vides_data::responseArea>&areas,std::list<vides_data::requestCameraInfo>&camera_info_list); void initCameras(vides_data::cameraParameters &parameter, vides_data::responseConfig &devConfig, const std::list<vides_data::responseArea>&areas,std::list<vides_data::requestCameraInfo>&camera_info_list);
__uint8_t intToUint8t(bool faceAlgorithm,bool licensePlateAlgorithm,bool uniformAlgorithm);
__uint8_t intToUint8t(bool faceAlgorithm,bool licensePlateAlgorithm,bool uniformAlgorithm,bool humanAlgorithm);
//盒子参数更新 //盒子参数更新
void divParameterUpdate(vides_data::responseConfig &cloudConfig ); void divParameterUpdate(vides_data::responseConfig &cloudConfig,QString &httpUrl,QString &serialNumber );
static MainWindow * sp_this; static MainWindow * sp_this;
......
#define __SSP_STRONG__ 3
#define __DBL_MIN_EXP__ (-1021)
#define __FLT32X_MAX_EXP__ 1024
#define __cpp_attributes 200809
#define __UINT_LEAST16_MAX__ 0xffff
#define __ARM_SIZEOF_WCHAR_T 4
#define __ATOMIC_ACQUIRE 2
#define __FLT128_MAX_10_EXP__ 4932
#define __FLT_MIN__ 1.17549435082228750796873653722224568e-38F
#define __GCC_IEC_559_COMPLEX 2
#define __UINT_LEAST8_TYPE__ unsigned char
#define __INTMAX_C(c) c ## L
#define __CHAR_BIT__ 8
#define __UINT8_MAX__ 0xff
#define __WINT_MAX__ 0xffffffffU
#define __FLT32_MIN_EXP__ (-125)
#define __cpp_static_assert 200410
#define __ORDER_LITTLE_ENDIAN__ 1234
#define __SIZE_MAX__ 0xffffffffffffffffUL
#define __WCHAR_MAX__ 0xffffffffU
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
#define __DBL_DENORM_MIN__ double(4.94065645841246544176568792868221372e-324L)
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
#define __GCC_ATOMIC_CHAR_LOCK_FREE 2
#define __GCC_IEC_559 2
#define __FLT32X_DECIMAL_DIG__ 17
#define __FLT_EVAL_METHOD__ 0
#define __unix__ 1
#define __cpp_binary_literals 201304
#define __FLT64_DECIMAL_DIG__ 17
#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2
#define __cpp_variadic_templates 200704
#define __UINT_FAST64_MAX__ 0xffffffffffffffffUL
#define __SIG_ATOMIC_TYPE__ int
#define __DBL_MIN_10_EXP__ (-307)
#define __FLT16_EPSILON__ 9.76562500000000000000000000000000000e-4F16
#define __FINITE_MATH_ONLY__ 0
#define __ARM_FEATURE_UNALIGNED 1
#define __GNUC_PATCHLEVEL__ 0
#define __FLT32_HAS_DENORM__ 1
#define __UINT_FAST8_MAX__ 0xff
#define __has_include(STR) __has_include__(STR)
#define __DEC64_MAX_EXP__ 385
#define __INT8_C(c) c
#define __INT_LEAST8_WIDTH__ 8
#define __UINT_LEAST64_MAX__ 0xffffffffffffffffUL
#define __SHRT_MAX__ 0x7fff
#define __LDBL_MAX__ 1.18973149535723176508575932662800702e+4932L
#define __ARM_FEATURE_IDIV 1
#define __FLT64X_MAX_10_EXP__ 4932
#define __ARM_FP 14
#define __UINT_LEAST8_MAX__ 0xff
#define __GCC_ATOMIC_BOOL_LOCK_FREE 2
#define __FLT128_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966F128
#define __UINTMAX_TYPE__ long unsigned int
#define __linux 1
#define __DEC32_EPSILON__ 1E-6DF
#define __FLT_EVAL_METHOD_TS_18661_3__ 0
#define __OPTIMIZE__ 1
#define __CHAR_UNSIGNED__ 1
#define __UINT32_MAX__ 0xffffffffU
#define __GXX_EXPERIMENTAL_CXX0X__ 1
#define __AARCH64_CMODEL_SMALL__ 1
#define __LDBL_MAX_EXP__ 16384
#define __FLT128_MIN_EXP__ (-16381)
#define __WINT_MIN__ 0U
#define __linux__ 1
#define __FLT128_MIN_10_EXP__ (-4931)
#define __INT_LEAST16_WIDTH__ 16
#define __SCHAR_MAX__ 0x7f
#define __FLT128_MANT_DIG__ 113
#define __WCHAR_MIN__ 0U
#define __INT64_C(c) c ## L
#define __DBL_DIG__ 15
#define __GCC_ATOMIC_POINTER_LOCK_FREE 2
#define __FLT64X_MANT_DIG__ 113
#define _FORTIFY_SOURCE 2
#define __SIZEOF_INT__ 4
#define __SIZEOF_POINTER__ 8
#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2
#define __USER_LABEL_PREFIX__
#define __FLT64X_EPSILON__ 1.92592994438723585305597794258492732e-34F64x
#define __STDC_HOSTED__ 1
#define __LDBL_HAS_INFINITY__ 1
#define __ARM_ALIGN_MAX_STACK_PWR 16
#define __FLT32_DIG__ 6
#define __FLT_EPSILON__ 1.19209289550781250000000000000000000e-7F
#define __GXX_WEAK__ 1
#define __SHRT_WIDTH__ 16
#define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L
#define __DEC32_MAX__ 9.999999E96DF
#define __cpp_threadsafe_static_init 200806
#define __ARM_SIZEOF_MINIMAL_ENUM 4
#define __FLT64X_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966F64x
#define __FLT32X_HAS_INFINITY__ 1
#define __INT32_MAX__ 0x7fffffff
#define __INT_WIDTH__ 32
#define __SIZEOF_LONG__ 8
#define __STDC_IEC_559__ 1
#define __STDC_ISO_10646__ 201706L
#define __UINT16_C(c) c
#define __PTRDIFF_WIDTH__ 64
#define __DECIMAL_DIG__ 36
#define __FLT64_EPSILON__ 2.22044604925031308084726333618164062e-16F64
#define __gnu_linux__ 1
#define __INTMAX_WIDTH__ 64
#define __FLT64_MIN_EXP__ (-1021)
#define __has_include_next(STR) __has_include_next__(STR)
#define __FLT64X_MIN_10_EXP__ (-4931)
#define __LDBL_HAS_QUIET_NAN__ 1
#define __FLT16_MIN_EXP__ (-13)
#define __FLT64_MANT_DIG__ 53
#define __GNUC__ 7
#define __GXX_RTTI 1
#define __pie__ 2
#define __cpp_delegating_constructors 200604
#define __FLT_HAS_DENORM__ 1
#define __SIZEOF_LONG_DOUBLE__ 16
#define __BIGGEST_ALIGNMENT__ 16
#define __STDC_UTF_16__ 1
#define __FLT64_MAX_10_EXP__ 308
#define __FLT16_MAX_10_EXP__ 4
#define __FLT32_HAS_INFINITY__ 1
#define __DBL_MAX__ double(1.79769313486231570814527423731704357e+308L)
#define __cpp_raw_strings 200710
#define __INT_FAST32_MAX__ 0x7fffffffffffffffL
#define __DBL_HAS_INFINITY__ 1
#define __INT64_MAX__ 0x7fffffffffffffffL
#define __DEC32_MIN_EXP__ (-94)
#define __INTPTR_WIDTH__ 64
#define __FLT32X_HAS_DENORM__ 1
#define __INT_FAST16_TYPE__ long int
#define __LDBL_HAS_DENORM__ 1
#define __cplusplus 201103L
#define __cpp_ref_qualifiers 200710
#define __DEC128_MAX__ 9.999999999999999999999999999999999E6144DL
#define __INT_LEAST32_MAX__ 0x7fffffff
#define __DEC32_MIN__ 1E-95DF
#define __DEPRECATED 1
#define __cpp_rvalue_references 200610
#define __DBL_MAX_EXP__ 1024
#define __WCHAR_WIDTH__ 32
#define __FLT32_MAX__ 3.40282346638528859811704183484516925e+38F32
#define __DEC128_EPSILON__ 1E-33DL
#define __FLT16_DECIMAL_DIG__ 5
#define __PTRDIFF_MAX__ 0x7fffffffffffffffL
#define __STDC_NO_THREADS__ 1
#define __FLT32_HAS_QUIET_NAN__ 1
#define __GNUG__ 7
#define __LONG_LONG_MAX__ 0x7fffffffffffffffLL
#define __SIZEOF_SIZE_T__ 8
#define __cpp_rvalue_reference 200610
#define __ARM_ALIGN_MAX_PWR 28
#define __cpp_nsdmi 200809
#define __FLT64X_MIN_EXP__ (-16381)
#define __SIZEOF_WINT_T__ 4
#define __LONG_LONG_WIDTH__ 64
#define __cpp_initializer_lists 200806
#define __FLT32_MAX_EXP__ 128
#define __cpp_hex_float 201603
#define __GCC_HAVE_DWARF2_CFI_ASM 1
#define __ARM_FP16_FORMAT_IEEE 1
#define __GXX_ABI_VERSION 1011
#define __FLT128_HAS_INFINITY__ 1
#define __FLT_MIN_EXP__ (-125)
#define __FLT16_MANT_DIG__ 11
#define __cpp_lambdas 200907
#define __FLT64X_HAS_QUIET_NAN__ 1
#define __INT_FAST64_TYPE__ long int
#define __FP_FAST_FMAF 1
#define __FLT64_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F64
#define __DBL_MIN__ double(2.22507385850720138309023271733240406e-308L)
#define __PIE__ 2
#define __FLT16_DENORM_MIN__ 5.96046447753906250000000000000000000e-8F16
#define __LP64__ 1
#define __FLT_EVAL_METHOD_C99__ 0
#define __FLT32X_EPSILON__ 2.22044604925031308084726333618164062e-16F32x
#define __aarch64__ 1
#define __FLT64_MIN_10_EXP__ (-307)
#define __ARM_FP16_ARGS 1
#define __FLT16_MIN_10_EXP__ (-4)
#define __FLT64X_DECIMAL_DIG__ 36
#define __DEC128_MIN__ 1E-6143DL
#define __REGISTER_PREFIX__
#define __UINT16_MAX__ 0xffff
#define __DBL_HAS_DENORM__ 1
#define __FLT32_MIN__ 1.17549435082228750796873653722224568e-38F32
#define __UINT8_TYPE__ unsigned char
#define __FLT_MANT_DIG__ 24
#define __LDBL_DECIMAL_DIG__ 36
#define __VERSION__ "7.5.0"
#define __UINT64_C(c) c ## UL
#define __cpp_unicode_characters 200704
#define _STDC_PREDEF_H 1
#define __ARM_FEATURE_FMA 1
#define __GCC_ATOMIC_INT_LOCK_FREE 2
#define __FLT128_MAX_EXP__ 16384
#define __FLT32_MANT_DIG__ 24
#define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__
#define __FLT32X_MIN_EXP__ (-1021)
#define __FLT16_DIG__ 3
#define __STDC_IEC_559_COMPLEX__ 1
#define __FLT128_HAS_DENORM__ 1
#define __FLT128_DIG__ 33
#define __SCHAR_WIDTH__ 8
#define __INT32_C(c) c
#define __DEC64_EPSILON__ 1E-15DD
#define __ORDER_PDP_ENDIAN__ 3412
#define __DEC128_MIN_EXP__ (-6142)
#define __FLT32_MAX_10_EXP__ 38
#define __ARM_64BIT_STATE 1
#define __INT_FAST32_TYPE__ long int
#define __UINT_LEAST16_TYPE__ short unsigned int
#define __FLT64X_HAS_INFINITY__ 1
#define unix 1
#define __INT16_MAX__ 0x7fff
#define __cpp_rtti 199711
#define __SIZE_TYPE__ long unsigned int
#define __UINT64_MAX__ 0xffffffffffffffffUL
#define __FLT64X_DIG__ 33
#define __INT8_TYPE__ signed char
#define __ELF__ 1
#define __FLT_RADIX__ 2
#define __INT_LEAST16_TYPE__ short int
#define __ARM_ARCH_PROFILE 65
#define __LDBL_EPSILON__ 1.92592994438723585305597794258492732e-34L
#define __UINTMAX_C(c) c ## UL
#define __GLIBCXX_BITSIZE_INT_N_0 128
#define __ARM_PCS_AAPCS64 1
#define __SIG_ATOMIC_MAX__ 0x7fffffff
#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2
#define __SIZEOF_PTRDIFF_T__ 8
#define __FLT32X_MANT_DIG__ 53
#define __AARCH64EL__ 1
#define __FLT16_MAX_EXP__ 16
#define __DEC32_SUBNORMAL_MIN__ 0.000001E-95DF
#define __INT_FAST16_MAX__ 0x7fffffffffffffffL
#define __FLT64_DIG__ 15
#define __UINT_FAST32_MAX__ 0xffffffffffffffffUL
#define __UINT_LEAST64_TYPE__ long unsigned int
#define __FLT_HAS_QUIET_NAN__ 1
#define __FLT_MAX_10_EXP__ 38
#define __LONG_MAX__ 0x7fffffffffffffffL
#define __FLT64X_HAS_DENORM__ 1
#define __DEC128_SUBNORMAL_MIN__ 0.000000000000000000000000000000001E-6143DL
#define __FLT_HAS_INFINITY__ 1
#define __unix 1
#define __cpp_unicode_literals 200710
#define __UINT_FAST16_TYPE__ long unsigned int
#define __DEC64_MAX__ 9.999999999999999E384DD
#define __INT_FAST32_WIDTH__ 64
#define __CHAR16_TYPE__ short unsigned int
#define __PRAGMA_REDEFINE_EXTNAME 1
#define __SIZE_WIDTH__ 64
#define __INT_LEAST16_MAX__ 0x7fff
#define __DEC64_MANT_DIG__ 16
#define __UINT_LEAST32_MAX__ 0xffffffffU
#define __FLT32_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F32
#define __GCC_ATOMIC_LONG_LOCK_FREE 2
#define __SIG_ATOMIC_WIDTH__ 32
#define __INT_LEAST64_TYPE__ long int
#define __ARM_FEATURE_CLZ 1
#define __INT16_TYPE__ short int
#define __INT_LEAST8_TYPE__ signed char
#define __FLT16_MAX__ 6.55040000000000000000000000000000000e+4F16
#define __DEC32_MAX_EXP__ 97
#define __INT_FAST8_MAX__ 0x7f
#define __ARM_ARCH 8
#define __FLT128_MAX__ 1.18973149535723176508575932662800702e+4932F128
#define __INTPTR_MAX__ 0x7fffffffffffffffL
#define linux 1
#define __cpp_range_based_for 200907
#define __FLT64_HAS_QUIET_NAN__ 1
#define __FLT32_MIN_10_EXP__ (-37)
#define __EXCEPTIONS 1
#define __LDBL_MANT_DIG__ 113
#define __DBL_HAS_QUIET_NAN__ 1
#define __FLT64_HAS_INFINITY__ 1
#define __FLT64X_MAX__ 1.18973149535723176508575932662800702e+4932F64x
#define __FLT16_HAS_INFINITY__ 1
#define __SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1)
#define __INTPTR_TYPE__ long int
#define __UINT16_TYPE__ short unsigned int
#define __WCHAR_TYPE__ unsigned int
#define __SIZEOF_FLOAT__ 4
#define __pic__ 2
#define __UINTPTR_MAX__ 0xffffffffffffffffUL
#define __ARM_ARCH_8A 1
#define __INT_FAST64_WIDTH__ 64
#define __DEC64_MIN_EXP__ (-382)
#define __cpp_decltype 200707
#define __FLT32_DECIMAL_DIG__ 9
#define __INT_FAST64_MAX__ 0x7fffffffffffffffL
#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1
#define __FLT_DIG__ 6
#define __FLT64X_MAX_EXP__ 16384
#define __UINT_FAST64_TYPE__ long unsigned int
#define __INT_MAX__ 0x7fffffff
#define __FLT16_HAS_QUIET_NAN__ 1
#define __INT64_TYPE__ long int
#define __FLT_MAX_EXP__ 128
#define __ORDER_BIG_ENDIAN__ 4321
#define __DBL_MANT_DIG__ 53
#define __cpp_inheriting_constructors 201511
#define __INT_LEAST64_MAX__ 0x7fffffffffffffffL
#define __DEC64_MIN__ 1E-383DD
#define __WINT_TYPE__ unsigned int
#define __UINT_LEAST32_TYPE__ unsigned int
#define __SIZEOF_SHORT__ 2
#define __LDBL_MIN_EXP__ (-16381)
#define __FLT64_MAX__ 1.79769313486231570814527423731704357e+308F64
#define __WINT_WIDTH__ 32
#define __INT_LEAST8_MAX__ 0x7f
#define __FLT32X_MAX_10_EXP__ 308
#define __SIZEOF_INT128__ 16
#define __FLT16_MIN__ 6.10351562500000000000000000000000000e-5F16
#define __WCHAR_UNSIGNED__ 1
#define __LDBL_MAX_10_EXP__ 4932
#define __ATOMIC_RELAXED 0
#define __DBL_EPSILON__ double(2.22044604925031308084726333618164062e-16L)
#define __FLT128_MIN__ 3.36210314311209350626267781732175260e-4932F128
#define _LP64 1
#define __UINT8_C(c) c
#define __FLT64_MAX_EXP__ 1024
#define __INT_LEAST32_TYPE__ int
#define __SIZEOF_WCHAR_T__ 4
#define __ARM_NEON 1
#define __FLT128_HAS_QUIET_NAN__ 1
#define __INT_FAST8_TYPE__ signed char
#define __FLT64X_MIN__ 3.36210314311209350626267781732175260e-4932F64x
#define __GNUC_STDC_INLINE__ 1
#define __FLT64_HAS_DENORM__ 1
#define __FLT32_EPSILON__ 1.19209289550781250000000000000000000e-7F32
#define __FLT16_HAS_DENORM__ 1
#define __DBL_DECIMAL_DIG__ 17
#define __STDC_UTF_32__ 1
#define __INT_FAST8_WIDTH__ 8
#define __DEC_EVAL_METHOD__ 2
#define __FLT32X_MAX__ 1.79769313486231570814527423731704357e+308F32x
#define __cpp_runtime_arrays 198712
#define __UINT64_TYPE__ long unsigned int
#define __UINT32_C(c) c ## U
#define __INTMAX_MAX__ 0x7fffffffffffffffL
#define __cpp_alias_templates 200704
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
#define __FLT_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F
#define __INT8_MAX__ 0x7f
#define __LONG_WIDTH__ 64
#define __PIC__ 2
#define __UINT_FAST32_TYPE__ long unsigned int
#define __CHAR32_TYPE__ unsigned int
#define __FLT_MAX__ 3.40282346638528859811704183484516925e+38F
#define __FP_FAST_FMA 1
#define __cpp_constexpr 200704
#define __ARM_FEATURE_NUMERIC_MAXMIN 1
#define __INT32_TYPE__ int
#define __SIZEOF_DOUBLE__ 8
#define __cpp_exceptions 199711
#define __FLT_MIN_10_EXP__ (-37)
#define __FLT64_MIN__ 2.22507385850720138309023271733240406e-308F64
#define __INT_LEAST32_WIDTH__ 32
#define __INTMAX_TYPE__ long int
#define __DEC128_MAX_EXP__ 6145
#define __FLT32X_HAS_QUIET_NAN__ 1
#define __ATOMIC_CONSUME 1
#define __GNUC_MINOR__ 5
#define __GLIBCXX_TYPE_INT_N_0 __int128
#define __INT_FAST16_WIDTH__ 64
#define __UINTMAX_MAX__ 0xffffffffffffffffUL
#define __DEC32_MANT_DIG__ 7
#define __FLT32X_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F32x
#define __DBL_MAX_10_EXP__ 308
#define __LDBL_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966L
#define __INT16_C(c) c
#define __ARM_ARCH_ISA_A64 1
#define __STDC__ 1
#define __FLT32X_DIG__ 15
#define __PTRDIFF_TYPE__ long int
#define __ATOMIC_SEQ_CST 5
#define __UINT32_TYPE__ unsigned int
#define __FLT32X_MIN_10_EXP__ (-307)
#define __UINTPTR_TYPE__ long unsigned int
#define __DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD
#define __DEC128_MANT_DIG__ 34
#define __LDBL_MIN_10_EXP__ (-4931)
#define __FLT128_EPSILON__ 1.92592994438723585305597794258492732e-34F128
#define __SIZEOF_LONG_LONG__ 8
#define __cpp_user_defined_literals 200809
#define __FLT128_DECIMAL_DIG__ 36
#define __GCC_ATOMIC_LLONG_LOCK_FREE 2
#define __FLT32X_MIN__ 2.22507385850720138309023271733240406e-308F32x
#define __LDBL_DIG__ 33
#define __FLT_DECIMAL_DIG__ 9
#define __UINT_FAST16_MAX__ 0xffffffffffffffffUL
#define __GCC_ATOMIC_SHORT_LOCK_FREE 2
#define __INT_LEAST64_WIDTH__ 64
#define __UINT_FAST8_TYPE__ unsigned char
#define _GNU_SOURCE 1
#define __ATOMIC_ACQ_REL 4
#define __ATOMIC_RELEASE 3
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