public void processCalibration() { try { setMessage(ProjectConstants.CALIBRATION_STARTED_MESSAGE); Thread.Sleep(ProjectConstants.CALIBRATION_MESSAGE_LOOK_TIME); IWiimoteCalibrationRecord l_StandStill = m_CalibrationRecord.getStandStillRecordingItem(DateTime.UtcNow); if (!mCalibrationRunning) { return; } setMessage(ProjectConstants.STAND_STILL_IN_PROGRESS_MESSAGE); recordCalibrationItem(l_StandStill); if (!mCalibrationRunning) { return; } setMessage(ProjectConstants.STAND_STILL_CALIBRATION_DONE_MESSAGE); Thread.Sleep(ProjectConstants.CALIBRATION_MESSAGE_LOOK_TIME); IWiimoteCalibrationRecord l_Left = m_CalibrationRecord.getLeftRecordingItem(DateTime.UtcNow); if (!mCalibrationRunning) { return; } setMessage(ProjectConstants.LEFT_CALIBRATION_IN_PROGRESS_MESSAGE); recordCalibrationItem(l_Left); if (!mCalibrationRunning) { return; } setMessage(ProjectConstants.LEFT_CALIBRATION_DONE_MESSAGE); Thread.Sleep(ProjectConstants.CALIBRATION_MESSAGE_LOOK_TIME); IWiimoteCalibrationRecord l_Right = m_CalibrationRecord.getRightRecordingItem(DateTime.UtcNow); if (!mCalibrationRunning) { return; } setMessage(ProjectConstants.RIGHT_CALIBRATION_IN_PROGRESS_MESSAGE); recordCalibrationItem(l_Right); m_CalibrationRecord.calculateCalibration(); WiimoteDataStore.getWiimoteDataStore().save(); if (!mCalibrationRunning) { return; } setMessage(ProjectConstants.CALIBRATION_DONE_MESSAGE); } catch (WiimoteCommunicationException ex) { throw ex; } catch (WiimoteConnectionException ex) { throw ex; } return; }
private void recordCalibrationItem(IWiimoteCalibrationRecord l_Record) { try { m_Wiimotes.startRecording(l_Record, false, this, "", true); lock (calibrationRecordingSync) Monitor.Wait(calibrationRecordingSync); } catch (WiimoteCommunicationException ex) { throw ex; } catch (WiimoteConnectionException ex) { throw ex; } }