public void AddSubSession(SubSession subSession) { _subsessions.Add(subSession); }
/// <summary> /// Called everytime a sub session is recorded /// </summary> /// <param name="subSessionStartTime"></param> /// <param name="subSessionEndTime"></param> private static void VirtualMotionCaptureController_VirtualMotionCaptureSubSessionRecorded(DateTime subSessionStartTime, DateTime subSessionEndTime) { //Set the times _currentSubSession.SubSessionStartTime = subSessionStartTime; _currentSubSession.SubSessionEndTime = subSessionEndTime; _currentSession.MotionCaptureDataRecorded = true; //if the first, set the session start time if (_currentSession.SubSessions.Count == 0) { _currentSession.SessionStartTime = _currentSubSession.SubSessionStartTime; } //Add it to the session _currentSession.AddSubSession(_currentSubSession); _currentSession.SessionCompleted = true; _currentSession.ScheduledSession = false; _currentSubSession = new SubSession(); }
/// <summary> /// Starts recording /// </summary> private static void StartRecording() { //register for the recording ended event, put the controller into record mode _currentSubSession = new SubSession(); VirtualMotionCaptureController.MotionCaptureDataRecord(true); VirtualMotionCaptureController.VirtualMotionCaptureSubSessionRecorded += new VirtualMotionCaptureController.VirtualMotionCaptureSubSessionRecordedEventHandler(VirtualMotionCaptureController_VirtualMotionCaptureSubSessionRecorded); _remoteDataManager.ServerPlayingStatus(false); Communication.OptitrackCommandParser_Server.VirtualMotionCaputrePlayback = false; _remoteDataManager.ServerRecordingStatus(true); }
/// <summary> /// Fired when playback ends /// </summary> /// <param name="subSessionStartTime"></param> static void VirtualMotionCaptureController_VirtualMotionCaptureSubSessionPlaybackEnded(DateTime subSessionStartTime) { //If there are multiple subsessions and this wasn't the last, then move onto the next subsession //TODO moddify this to allow looping of subsessions and of the complete session if (_currentSubSessionIndex < _currentSession.SubSessions.Count -1) { _currentSubSessionIndex++; _currentSubSession = _currentSession.SubSessions[_currentSubSessionIndex]; if (System.IO.File.Exists(VirtualMotionCaptureController.BuildSubSessionFileName(_currentSubSession.SubSessionStartTime))) { VirtualMotionCaptureController.OpenMotionCaptureSubSession(_currentSubSession.SubSessionStartTime); } else { StopPlayback(); } } else { StopPlayback(); } }
/// <summary> /// Gets ready to play back a session /// </summary> /// <param name="patientIndex"></param> /// <param name="sessionIndex"></param> /// <param name="subSessionIndex"></param> static void Patient_Remote_DataManager_OpenSessionForPlaybackRequestedByClient(int patientIndex, int sessionIndex, int subSessionIndex) { //use the indexes to load the correct subsession _currentSession = _patients[patientIndex].Sessions[sessionIndex]; _currentSubSessionIndex = subSessionIndex; _currentSubSession = _currentSession.SubSessions[_currentSubSessionIndex]; //Check the motion capture data is present on disk, if it is, open the subsession, else mark it as not pressent if(System.IO.File.Exists(VirtualMotionCaptureController.BuildSubSessionFileName(_currentSubSession.SubSessionStartTime))) { VirtualMotionCaptureController.OpenMotionCaptureSubSession(_currentSubSession.SubSessionStartTime); } else { //data isn't availiable _currentSession.MotionCaptureDataRecorded = false; _currentSession.SubSessions[_currentSubSessionIndex] = _currentSubSession; _patients[_patientIndex].Sessions[_currentSessionIndex] = _currentSession; Patient_Remote_DataManager_UpdatePatientRequestedByClient(_patients[_patientIndex], _patientIndex); } }