Click here to Skip to main content
15,885,365 members
Articles / Programming Languages / C++

ECG for Windows XP (Export data to TXT files)

Rate me:
Please Sign up or sign in to vote.
3.67/5 (13 votes)
1 Sep 20045 min read 95.4K   6.1K   40  
This is ECG_1.1 project version. Now the program can save medical records in to TXT files and can run on Windows XP.
// MultimediaTimer.cpp: implementation of the MultimediaTimer class.
//
//////////////////////////////////////////////////////////////////////
//Petrov Georgi Kostadinov Multimedia Function Timer call
#include "stdafx.h"
#include "MultimediaTimer.h"
#include "Mmsystem.h"
#include "conio.h"
//don't forget to include Winmm.lib!!!

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////



MultimediaTimer::~MultimediaTimer()
{

}

void MultimediaTimer::StartTimer(void* obj,int period, int resolution,ThreadTimerProc lpTimerProc)
{
//������� �� �������� ��� ������� �� ���� void
//typedef void(*ThreadTimerProc)(void* obj,UINT idEvent);
	i_count = 0;
	//void* object;//�������� ��� void
	object = obj;//�������� ����� ��� ��������
	//����� �� ����� ������ � ��������� ������ ������ �� ����������
	proc = lpTimerProc;//proc � ��������� ��� ���
	//������������ �������� ��� ����� � ����������
	if(period<2)
		period = 2;//max speed 500Hz
	if(resolution<10)
		resolution = 10;//min resolution +-50 Hz

	i_MMperiod = period;
	timeBeginPeriod(period);
	m_idEvent = timeSetEvent(
		i_MMperiod,
		resolution,
		TimerFunction,//CALLBACK ������� ����� ���������� � ��������� 
		//����� �� �������� �������
		(DWORD)this,//�������� ��� ���� ����
		TIME_PERIODIC|TIME_CALLBACK_FUNCTION);
}

void CALLBACK MultimediaTimer::TimerFunction(UINT wTimerID, UINT msg, DWORD dwUser, DWORD dw1, DWORD dw2)
{
	MultimediaTimer * ptimer = (MultimediaTimer*) dwUser;
	ptimer->MMTimerHandler();//�������� ������� � ����� ����

	//proc = lpTimerProc;//proc � ��������� ��� ���
	//������������ ������� �� �������� ��� ������� void( ����� � ����������)
	///void* object;//� �������� ��� �������� ����� �� �����
	//� ����� �� ������ ��������� ����� �� ����������
	////UINT m_idEvent;
//������� �� �������� ��� ������� �� ���� void
//typedef void(*ThreadTimerProc)(void* obj,UINT idEvent);
	//������ ���������� ���� ��� �� �� ��������� �� -> 
	//���� � ��� ��������!!! ��� �������� ����� ��������
	//proc(object,m_idEvent);
	ptimer->proc (ptimer->object, ptimer->m_idEvent);//��������� 
	//� ����� �� ������� ����� �� �������� �� �������-���������
}

void MultimediaTimer::MMTimerHandler()
{


}

void MultimediaTimer::StopTimer()
{
	timeKillEvent(m_idEvent);//destroy event ID

	timeEndPeriod(i_MMperiod);
}
/*
How to use?
void CTurboDlg::OnStop() 
{
	// TODO: Add your control notification handler code here
	MMTimer.StopTimer();
	UpdateData(false);
}
DECLARE AS STATIC!!!!!!!!!!!!!!!!
//This is our receiver function on our class that will use MM timer
static	void TimerFunction(void* obj,UINT idEvent);

void CTurboDlg::TimerFunction(void* obj,UINT idEvent)
{
	CTurboDlg * dlg = (CTurboDlg*) obj;
	dlg->handleTimer(idEvent);//��������� ��� ���������
	//� ��������� ����
}

void CTurboDlg::OnStart() 
{
	// TODO: Add your control notification handler code here
	m_count = 0;
	//TimerFunction ��� ��� ���������� �������� ��� ��������
	//����� �� ������� ���� � ���������� UINT idEvant
	//��� ����������� �� TimerFunction � ����� �� �������
	//���� � �������� ��� ����� ����� ������ � ����������
	MMTimer.StartTimer(this,2,10,TimerFunction);	
}

void CTurboDlg::handleTimer(UINT nIDEvent)
{
	if(m_count<5000)
		m_count++;
	else
		MMTimer.StopTimer();
}

void CTurboDlg::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	
	CDialog::OnTimer(nIDEvent);
}
*/

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Systems Engineer
Bulgaria Bulgaria
PhD, Cum Laude in digital automation systems
M.S. in Telemommunication management
B.S. in Telecommunication systems engineering
Programming: CUDA, C/C++, VHDL
Software and Hardware development and consulting:
data acquisition, image processing, medical instrumentation

Comments and Discussions