#pragma once
#include <afxmt.h>
#include "ECGDateSaveFile.h"

#define SAVE_ECGDATA_LENGTH		1024
#define SAVE_RAWDATA_LENGTH		4096
// DataSaveThread

class DataSaveThread : public CWinThread
{
	DECLARE_DYNCREATE(DataSaveThread)

protected:
	DataSaveThread();           // 动态创建所使用的受保护的构造函数
	virtual ~DataSaveThread();

public:
	int m_i32Exit;
	virtual BOOL InitInstance();
	virtual int ExitInstance();
	virtual int Run();
	int Add_ECGData(unsigned short *buff, int length, int type);
	int Add_ECGData2(int data, int type);
	CECGDateSaveFile *m_pCECGDateSaveFile;
protected:
	DECLARE_MESSAGE_MAP()

private:
	//每个通道要保存的数据
	INT16 *m_i16ECGData[13];
	int m_i16WaveDateW[13], m_i16WaveDateR[13], m_i16WaveDateLength[13];
	CCriticalSection g_CSECGData;
	
};