#pragma once
#include <QThread>
#include <QDebug>
#include <QDateTime>
#include <opencv2/opencv.hpp>
#include <opencv2/imgproc/types_c.h>
#include "SyncQueue.h"
#include "ASyncQueue.h"
#include "common.h"
class SyncWorkThread :
    public QThread
{
    Q_OBJECT

#ifdef SYNC_CAMERA
signals:
    void notify(int Num, int Cnt, cv::Mat);
    void display_timecost(int Num, int ms);
    void display_check_total(int Num, long no);
    void display_jd_no(int Num, QString jd_no);

    void event_ok(int Num);
    void event_ng(int Num);
#endif

public:
    SyncWorkThread(QObject* parent = 0) : QThread(parent)
    {

    }
    ~SyncWorkThread();

    void init(SyncQueue<std::vector<std::pair<int, cv::Mat>>>* image_ptr, ASyncQueue<bool>* result_ptr);
    void start_work();
    void stop();
protected:
    void run();
public:
    int local_camera_number;
    SyncQueue<std::vector<std::pair<int, cv::Mat>>>* local_g_image_sync_queue;
    ASyncQueue<bool>* local_g_result_queue;
    bool b_quit;
    long frame_total[NumberOfSupportedCameras];
    SysConf local_SysConf;
    DisplayLabelConf local_DisplayLabelConf;
};
