#pragma once
#include "pch.h"
#include "ATPControl_Serial_QT.h"
#include "OControl_USB.h"
#include <atomic>

typedef struct tagFSInfo
{
	ZZ_U8         ucDeviceModel;
	int           iInterface;
	std::string   strSN;
}FSInfo;

class CAbstractFSController :public QObject
{
	Q_OBJECT
public:
	CAbstractFSController(QObject* parent = nullptr);
	virtual ~CAbstractFSController();
public:
	//call first
	virtual int SetRunParas(int iThreadID, FSInfo fsInfo);

	//create derived class from base class 
	virtual int InitializeFSControl();

	DataFrame GetLastDataFrame();

private:
	CIrisFSBase *m_pFSCtrl;
	int m_iThreadID;
	FSInfo m_fsInfo;
	DataFrame m_dfDark,m_dfSignal;

private:
	 int PerformAutoExposure();
	 int TakeDarkFrame();
	 int TakeSignal();
	 int SaveDataFile();
public slots:
	virtual int StartAcquisitionSignal();
	virtual int StartAcquisitionDark();

	virtual int StopAcquisition();

signals:
	void SignalAcqStarted();
	void SignalAcqFinished_Signal(int iThreadID, int iFlagStatus);
	void SignalAcqFinished_Dark  (int iThreadID, int iFlagStatus);
};