80 lines
2.7 KiB
C++
80 lines
2.7 KiB
C++
#ifndef Logic_hdataintegration_H
|
|
#define Logic_hdataintegration_H
|
|
#include <QObject>
|
|
#include <QThread>
|
|
#include <QJsonObject>
|
|
#include <QJsonArray>
|
|
#include <Windows.h>
|
|
|
|
#include "struct.h"
|
|
#include "Logic_taskthread.h"
|
|
|
|
#pragma execution_character_set("utf-8") //能够正常显示中文字符串
|
|
class Logic_hdataintegration : public QThread
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit Logic_hdataintegration(QObject *parent = nullptr):mm_obj(parent){}
|
|
~Logic_hdataintegration();
|
|
void run();
|
|
void init(QJsonObject obj);
|
|
void setStationKey(QString stationKey){m_stationKey = stationKey;}
|
|
void setAlgorithmKey(QString algorithmKey) { m_algorithmKey = algorithmKey; }
|
|
void setTriggerCondition(QJsonArray triggerCondition) { trigger_condition = triggerCondition; }
|
|
void setSavePath(QString m_savePath) { savePath = m_savePath; }
|
|
void setMutex( QMutex *mutex){m_mutex = mutex;}
|
|
void setDataTimeMutex(QMutex* mutex) { m_mutexDataTime = mutex; }
|
|
bool triggerConditionList();
|
|
bool checkConditionData ( QJsonObject obj,QString andOr); // 检查数据
|
|
QByteArray encodeData(QVector<QByteArray> &vector_byte);
|
|
QByteArray encodeSnData(QVector<QString> vector_sn);
|
|
|
|
|
|
bool ifContainsCamera(QString cameraKey);
|
|
void set_Logic_taskthread(Logic_taskthread* taskthread);
|
|
//触发信号
|
|
QString m_trigger_signal = "";
|
|
//回复信号
|
|
QString m_trigger_back_signal = "";
|
|
//触发信号
|
|
QString m_trigger_signal_send_back = "";
|
|
//
|
|
QString SN_dataTime;
|
|
//算法名
|
|
QString m_algorithmKey;
|
|
//algorithmlist下,单个算法模块的,配置文件内容
|
|
QJsonObject algorithmObject;
|
|
//最大检查时间
|
|
int maxCheckTime=0;
|
|
//工站名
|
|
QString m_stationKey;
|
|
int addDataNums = 0;
|
|
bool ifalwaysRun = false;
|
|
QString cameraKey="";
|
|
SnCameraData m_cameraData;
|
|
int camera_index=0;
|
|
int myTaskNum = 0;
|
|
cv::Mat lastMat=cv::Mat();
|
|
private:
|
|
Logic_taskthread* my_Logic_taskthread = nullptr;
|
|
QObject *mm_obj;
|
|
QString m_stationName = "";
|
|
//避免Logic_hdataintegration被多处同时调用,发送访问冲突
|
|
QMutex *m_mutex;
|
|
QJsonArray m_moduleobj_array; // 存储所有算法模块的模块列表
|
|
|
|
QJsonArray trigger_condition; //配置文件,单个检测数据内容,相机SN、图片序号
|
|
//结果保存路径总文件夹
|
|
QString savePath;
|
|
//QDataTime的锁,不加锁有遇到崩溃
|
|
QMutex* m_mutexDataTime;
|
|
|
|
bool ifCheckTimeOut = false;
|
|
bool checkResult = false;
|
|
int timeOutCondition[100] = { 0 }; //条件超时未满足标志
|
|
bool ifRun = true;
|
|
QVector<QString > queue_vector_sn;
|
|
};
|
|
|
|
#endif // Logic_hdataintegration_H
|