diff --git a/ECTrainer2/ECTrainer.h b/ECTrainer2/ECTrainer.h index b40426b..0e3db05 100644 --- a/ECTrainer2/ECTrainer.h +++ b/ECTrainer2/ECTrainer.h @@ -6,8 +6,8 @@ //#define TOBII_ADDR "192.168.71.50" #define TOBII_ADDR "192.168.23.155" -//#define EYEDEVICE_GLASS2 -#define EYEDEVICE_NONE +#define EYEDEVICE_GLASS2 +//#define EYEDEVICE_NONE class BaseProcess; class ECTrainerGUI; diff --git a/ECTrainer2/Worker.cpp b/ECTrainer2/Worker.cpp index 74fd794..0ab37fe 100644 --- a/ECTrainer2/Worker.cpp +++ b/ECTrainer2/Worker.cpp @@ -12,7 +12,6 @@ Worker::Worker(ECTrainer* pEct) : BaseProcess(pEct) , _AppStatus(APP_STATUS::BOOT) , _fpLogData(NULL) - , _fpLogEvent(NULL) , _pExpTimer(NULL) , _pContactTimer(NULL) , _TargetImage() @@ -27,8 +26,6 @@ // �f�X�g���N�^ Worker::~Worker() { - if (_fpLogData) fclose(_fpLogData); - if (_fpLogEvent) fclose(_fpLogEvent); mwut::SafeDelete((void**)&_pExpTimer); mwut::SafeDelete((void**)&_pContactTimer); mwut::SafeDelete((void**)&_pNohitTimer); @@ -43,10 +40,6 @@ _ftprintf(_fpLogData, _T("time,stimNo,stimTime,gazeVx,gazeVy,gazeIx,gazeIy,target,contact time,Feedback,RR," "H11,H12,H13,H21,H22,H23,H31,H32,H33\n")); - if (_tfopen_s(&_fpLogEvent, EVENT_LOG_FILE, _T("w")) != 0) { - _pEct->MsgBox(_T("Can't open event log file."), MB_ICONERROR); - return false; - } _AppStatus = APP_STATUS::IDLE; @@ -195,11 +188,12 @@ case (int)ECTMSG::EXP_START: // �����J�n if (_AppStatus == APP_STATUS::IDLE) { - _AppStatus = APP_STATUS::STIM; - ((BaseProcess*)_pEct->PStimulus())->PostMsg(ECTMSG::EXP_START); + this->EventLog(_T("Experiment Start")); _pExpTimer->Reset(); this->ResetParams(); + ((BaseProcess*)_pEct->PStimulus())->PostMsg(ECTMSG::EXP_START); + _AppStatus = APP_STATUS::STIM; } break; @@ -213,6 +207,7 @@ case (int)ECTMSG::EXP_END: // �����I�� if (_AppStatus == APP_STATUS::STIM) { + if (_fpLogData) fclose(_fpLogData); _AppStatus = APP_STATUS::IDLE; ((BaseProcess*)_pEct->PStimulus())->PostMsg(ECTMSG::EXP_END); this->EventLog(_T("Experiment Finished")); @@ -282,8 +277,16 @@ // �C�x���g���O�o�� void Worker::EventLog(const TCHAR* msg) { - std::wstring datestr = mwut::Multi2Wide(mwut::DateTimeStr()); - _ftprintf(_fpLogEvent, _T("%s %s\n"), datestr.c_str(), msg); + FILE* fp = NULL; // �C�x���g���O�t�@�C���|�C���^ + if (_tfopen_s(&fp, EVENT_LOG_FILE, _T("a")) != 0) { + _pEct->MsgBox(_T("Can't open event log file."), MB_ICONERROR); + return; + } + + std::wstring datestr = mwut::Multi2Wide(mwut::DateTimeStr()); + _ftprintf(fp, _T("%s %s\n"), datestr.c_str(), msg); mwut::DebugPrintf(_T("%s %s\n"), datestr.c_str(), msg); + + fclose(fp); } diff --git a/ECTrainer2/Worker.h b/ECTrainer2/Worker.h index 18ebef7..c92fe80 100644 --- a/ECTrainer2/Worker.h +++ b/ECTrainer2/Worker.h @@ -33,7 +33,6 @@ const int NOHIT_TIME = 100; // �������O�ꂽ�Ɣ��肷�鎞�� msec APP_STATUS _AppStatus; // �A�v���P�[�V������� FILE* _fpLogData; // �f�[�^���O�t�@�C���|�C���^ - FILE* _fpLogEvent; // �C�x���g���O�t�@�C���|�C���^ mwut::HPTimer* _pExpTimer; // �����o�ߎ��� mwut::HPTimer* _pContactTimer; // �ڕW�R���^�N�g���� mwut::HPTimer* _pNohitTimer; // �����O�ꎞ��