#pragma once
#include"pch.h"
#include <vector>
#include "AbstractFSController.h"

using namespace std;
using namespace ZZ_MISCDEF::ZZ_RUNPARAMS;

class CMainDataGrabber :public QObject
{
	Q_OBJECT
public:
	CMainDataGrabber(QObject* parent = nullptr);
	~CMainDataGrabber();

private:
	vector<CAbstractFSController *> m_pControlThread;
	vector<QThread* >               m_pqThreadHolder;

	int *m_piFlagCaptureThreadStatus;
	int m_iTotalThreads;

	int m_iFlagIsCapturing;

	AcqTimeSettings m_struAcqTime;
	FSContext   m_struDeviceContext;

public:
	//Call this first
	int SetGrabberParams(RunTimeGrabberParams struGrabberRTParams);

	int InitThreadStatus();
	int InitializeWorkers();
	int StartWorkers();

	int SetupMsgPipelines();

public slots:
	int HandleThreadEvent(int iThreadID, int iFlagStatus);
	int StartGrab();
	int GrabFinished();

signals:
	void SignalStartGrabOnce();
	void SignalStopGrab();
	void SignalGrabOnceFinished();
	void SignalStartGrab();
};