//============================================================================== int COptoTrack::DisconnectOpto(){ int iSensor; if( !IsRunning() ) { CP_printf("Opto is not connected!\n"); return 1; } CP_printf("\nDisonnecting OptoTrak... "); // Stop the thread, specify stopping time in ms (duration of 10 frames) if( m_StopReadingThread( int(FRAME_TIME_MS) * 10 ) > 1 ) { CP_printf("\nError: m_StopReadingThread() failed!\n"); return 1; } // release the buffers RemoveBuffer(); // Set signal level indicator to OFF for(iSensor =0; iSensor < N_SENSORS_MAX; iSensor++) m_iDistirtionLevel[iSensor]= ecSensorOff; CP_printf("Opto disconnected.\n"); CP_printf("Collected %d frames.\n", m_iReadCount); CP_printf("Last frame index from OptotTrak: %d\n", m_iOptoFrameIdx); CP_printf("Number of missed frames: %d\n", m_nMissedFrames); CP_printf("Number of missed times: %d\n", m_nMissedTimes); CP_printf("++++++++++++++++++++++++++++++++++++++\n"); return 0; }
//============================================================================== int CEyeTrack::DisconnectISCAN(){ if( iPortIO_Granted ) { PortOutput( LPT_CONTROL, GATE_OFF); } //Terminate thread m_StopReadingThread( 500 ); // thread stop time msec m_Serial.disconnect(); RemoveBuffer(); CP_printf("Disconnected ISCAN\n"); return 0; }
//=========================================================================== CReadingThread::~CReadingThread() { if( m_hReadingThread ) m_StopReadingThread(); }