#pragma once
#include "pch.h"
#include "ZZ_Types.h"
//http://172.16.0.234/fileup/Data_uper.php 
//http://172.16.0.234/fileup/Dev_info_uper.php 
//http://172.16.0.234/fileup/Warning.php

using namespace std;
using namespace ZZ_MISCDEF::ZZ_DATAFILE;
using namespace ZZ_MISCDEF::ZZ_RUNPARAMS;
using namespace ZZ_MISCDEF::IRIS::FS;
using namespace ZZ_MISCDEF;

class ZZ_HttpTransfer :public QObject
{
	Q_OBJECT
public:
	ZZ_HttpTransfer(QObject* parent = nullptr);
	~ZZ_HttpTransfer();
public:
public:
	//void Init_Self();

	int SendData();
	int SendInfo();
	int SendErr();

	void SetErrInfo(ErrInfo struErrInfo);
	void SetContext(EContext struEC, MEContext struMEC);
	void SetDeviceInfo(RunTimeGrabberParams struGrabberRTParams);
	void SetCalData(vector<vector<CalDataFrame>> vecCalcedData);
private:
	void Delay_MSec(ZZ_U16 usMS);
	
private:
	QNetworkAccessManager        *m_pNetworkManager;
	QNetworkAccessManager        *m_pNetworkManagerThread;

	ErrInfo                       m_struErrInfo;
	EContext                      m_struEC;
	MEContext                     m_struMEC;
	RunTimeGrabberParams          m_struGrabberRTParams;
	vector<vector<CalDataFrame>>  m_vecCalcedData;

	QString m_qstrUploadURL;
	int     m_iFlagIsReplied;
public slots:
	int SlotReplyFinished(QNetworkReply*  qnReply);
	int SlotReplyFinishedThread(QNetworkReply*  qnReply);
	//int SlotInit_Self();
signals:
	//void SignalInit_Self();
};