#include "pch.h"
#include "ATPControl_Serial_QT.h"
#include "Logger.h"
#include "SystemConfigger.h"
#include "MainDataGrabber.h"
#include "DataFileProcessor.h"
using namespace std;
#pragma once


int main(int argc, char *argv[])
{
	QCoreApplication a(argc, argv);
	//////////////////////////////////////////////////////////////////////////logger
	//QT_LOG::ZZ_InitLogger(QCoreApplication::applicationDirPath() + "/Log/");
	
	
	//////////////////////////////////////////////////////////////////////////configger
	DataFileProcessor testdp;
	ZZ_SysConfigger test;
	RunTimeGrabberParams testp;
	EContext testEC;
	MEContext testMEC;
	test.Initialize();
	test.LoadSettingsFromFile_System();
	test.LoadSettingsFromFile_MISC();
	test.GetGrabberRunParams(testp);
	test.GetECParams(testEC);
	test.GetMECParams(testMEC);

	testdp.SetEnvironmentContex(testEC);
	testdp.SetManmadeEnviromentalContext(testMEC);
	testdp.WriteDataFile();
	//////////////////////////////////////////////////////////////////////////test
	using namespace ZZ_MISCDEF::ZZ_RUNPARAMS;
	CMainDataGrabber testDG;
	QThread* m_pqDataGrabberThreadHolder = new QThread();
	testDG.moveToThread(m_pqDataGrabberThreadHolder);
	testDG.SetGrabberParams(testp);
	testDG.InitThreadStatus();
	testDG.InitializeWorkers();
	testDG.SetupMsgPipelines();
	testDG.StartWorkers();
	m_pqDataGrabberThreadHolder->start();

	testDG.StartGrab();

	//QString qstrTest = "This is a test message 2";
	//qDebug() << qstrTest;
	//cout << "This is a test message";

	//test.LoadSettings_Test();

	//ZZ_DataGrabberThread m_test;
	//m_test.GrabOnce();
	//QThread*      m_pqDataGrabberThreadHolder;


	//m_pqDataGrabberThreadHolder->start();
	//m_test.TestGrabOnce();
	//m_test.StartGrabCall();
	//QThread::msleep(5000);

	//m_test.StopTestGrab();
// 	ZZ_ATPControl_Serial_Qt m_ctrlATP;
// 	QByteArray qbTest;
// 	m_ctrlATP.ATPInitialize(7);
// 	m_ctrlATP.GetDeviceAttribute();
// 	m_ctrlATP.SetExposureTime(m_ctrlATP.m_adaDeviceAttr.iMinIntegrationTime);
// 	m_ctrlATP.RecvData(qbTest);
	//////////////////////////////////////////////////////////////////////////
	return a.exec();
}



