/**
         * This method
         *  1) Prepares the csv log file for logging Wiimote Data
         *  2) Initializes the Matlab matrix to send data
         */

        public override string startWiimoteLogging(IWiimoteChildRecord wiimoteRecord)
        {
            try
            {
                ITrainingSegmentInfo l_ParentRecord = (ITrainingSegmentInfo)wiimoteRecord.ParentRecord;
                //TODO : Change to member variable
                IWiimoteCalibrationRecordInfo l_Calibration = WiimoteDataStore.getWiimoteDataStore().Calibration;
                setCalibration();

                m_CSVFileWriter = new WiimoteCSVFileWriter(wiimoteRecord.FilePath.Insert(wiimoteRecord.FilePath.Length - 4, "CSharp"));
                m_CSVFileWriter = new WiimoteCSVFileWriter(wiimoteRecord.FilePath);
                m_CSVFileWriter.logHeader(m_CalibrationRecord);

                startRecordingSignalMatlab();
            }
            catch (PipeCommunicationException ex)
            {
                throw new WiimoteCommunicationException(ex);
            }
            catch (CSVFileFormatException ex)
            {
                throw new WiimoteCommunicationException(ex);
            }

            return(null);
        }
示例#2
0
        private void setCurrentPlay()
        {
            ITrainingSegmentInfo lSegmentInfo = getPreviousSegment();

            if (lSegmentInfo != null)
            {
                mOutputParent.SetPreviousPlayName(getFormattedPlayName(lSegmentInfo));
            }
            else
            {
                mOutputParent.SetPreviousPlayName("");
            }

            if (mCurrentTrainingSegment != null && WiimoteDataStore.getWiimoteDataStore().getNumberOfTrainingSegmentInfoRecords() > 0)
            {
                mOutputParent.SetCurentPlayName(getFormattedPlayName(mCurrentTrainingSegment));
            }
            else
            {
                mOutputParent.SetCurentPlayName("");
            }

            lSegmentInfo = getNextSegment();
            if (lSegmentInfo != null)
            {
                mOutputParent.SetNextPlayName(getFormattedPlayName(lSegmentInfo));
            }
            else
            {
                mOutputParent.SetNextPlayName("");
            }

            setCurrentSubFrame();
        }
示例#3
0
        public void startTimer(ITrainingSegmentInfo wiimoteRecord, bool p_MP3Option, string introductoryMessage)
        {
            TimerThread.getTimerThread().startTimer(Configuration.getConfiguration().NumBeatsPerMinute, Configuration.getConfiguration().NumBeatsPerBar,
                                                    Configuration.getConfiguration().NumBars, Configuration.getConfiguration().LeadIn, p_MP3Option, introductoryMessage);
//            TimerThread.getTimerThread().startTimer(wiimoteRecord.NumBeatsPerMinute, wiimoteRecord.NumBeatsPerBar,
//                wiimoteRecord.NumBars, wiimoteRecord.LeadIn, p_MP3Option, introductoryMessage);
        }
示例#4
0
        private string getFormattedPlayName(ITrainingSegmentInfo lSegmentInfo)
        {
            StringBuilder lPlayName = new StringBuilder();

            lPlayName.Append(lSegmentInfo.RecordName);

            return(lPlayName.ToString());
        }
示例#5
0
        public bool nextFrame()
        {
            if (mVideoPlayer != null &&
                (mVideoPlayer.getVideoState() == VideoState.Running ||
                 mVideoPlayer.getVideoState() == VideoState.Paused))
            {
                return(false);
            }

            mCurrentVideoIndex      = (mCurrentVideoIndex + 1) % WiimoteDataStore.getWiimoteDataStore().getNumberOfTrainingSegmentInfoRecords();
            mCurrentTrainingSegment = WiimoteDataStore.getWiimoteDataStore().getTrainingSegmentInfo(mCurrentVideoIndex);
            mCurrentSubVideoIndex   = 0;

            setCurrentPlay();
            setCommandOptions();
            return(true);
        }
示例#6
0
        public void initializeTraining()
        {
            try
            {
                loadTrainingVideoInfoData();

                if (WiimoteDataStore.getWiimoteDataStore().getNumberOfTrainingSegmentInfoRecords() == 0)
                {
                    return; // throw exception here
                }
                mTrainingStarted        = true;
                mCurrentTrainingSegment = WiimoteDataStore.getWiimoteDataStore().getTrainingSegmentInfo(0);
            }
            catch (WiimoteConnectionException ex)
            {
                Console.WriteLine(ex);
                throw ex;
            }
        }
示例#7
0
        public bool previousFrame()
        {
            if (mVideoPlayer != null &&
                (mVideoPlayer.getVideoState() == VideoState.Running ||
                 mVideoPlayer.getVideoState() == VideoState.Paused))
            {
                return(false);
            }

            if (mCurrentVideoIndex > 0)
            {
                mCurrentVideoIndex = mCurrentVideoIndex - 1;
            }
            mCurrentTrainingSegment = WiimoteDataStore.getWiimoteDataStore().getTrainingSegmentInfo(mCurrentVideoIndex);
            mCurrentSubVideoIndex   = 0;

            setCurrentPlay();
            setCommandOptions();
            return(true);
        }
示例#8
0
        public bool gotoFirstSegment()
        {
            if (mVideoPlayer != null &&
                (mVideoPlayer.getVideoState() == VideoState.Running ||
                 mVideoPlayer.getVideoState() == VideoState.Paused))
            {
                return(false);
            }

            if (WiimoteDataStore.getWiimoteDataStore().getNumberOfTrainingSegmentInfoRecords() == 0)
            {
                throw new TrainingVideoException("No Training Data Loaded");
            }

            mCurrentVideoIndex      = 0;
            mCurrentSubVideoIndex   = 0;
            mCurrentTrainingSegment = WiimoteDataStore.getWiimoteDataStore().getTrainingSegmentInfo(mCurrentVideoIndex);
            setCurrentPlay();
            setCommandOptions();
            return(true);
        }
示例#9
0
        public void startRecording(Object recordObject, bool p_MP3Option, object recordingInvoker, string introductoryMessage, bool pUseTImer)
        {
            try
            {
                if (!m_WiimoteConnected)
                {
                    throw new WiimoteConnectionException(ProjectConstants.WIIMOTE_NOT_CONNECTED_MESSAGE, WiimoteState.wiimoteDisconnectedState);
                }


                IWiimoteChildRecord  childRecord  = (IWiimoteChildRecord)recordObject;
                ITrainingSegmentInfo parentRecord = (ITrainingSegmentInfo)childRecord.ParentRecord;

                m_RecordingInvoker = recordingInvoker;

                childRecord.RecordedTime = DateTime.UtcNow;

                //  ApplicationSpeech.speakText(ProjectConstants.RECORDING_STARTED_TEXT);

                m_WiimoteDataAdaptor.startWiimoteLogging(childRecord);


                if (pUseTImer)
                {
                    startTimer(parentRecord, p_MP3Option, introductoryMessage);
                }
//                else
//                    m_WiimoteDataAdaptor.startWiimoteRecording(); //If no TImer is used , no need to wait
                // for lead bar to complete to start recording.
                //Can start recording immediately


                m_SelectedRowForRecord = childRecord;
            }
            catch (WiimoteCommunicationException ex)
            {
                throw new WiimoteConnectionException(ex, WiimoteState.wiimoteDisconnectedState);
            }
        }
示例#10
0
        /**
         * This method
         *  1) Prepares the csv log file for logging Wiimote Data
         *  2) Initializes the Matlab matrix to send data
         */

        public override string startWiimoteLogging(IWiimoteChildRecord wiimoteRecord)
        {
            try
            {
                ITrainingSegmentInfo l_ParentRecord = (ITrainingSegmentInfo)wiimoteRecord.ParentRecord;
                //TODO : Change to member variable
                IWiimoteCalibrationRecordInfo l_Calibration = WiimoteDataStore.getWiimoteDataStore().Calibration;
                setCalibration();
                StartDataCollection(wiimoteRecord.FilePath);

                startRecordingSignalMatlab();
            }
            catch (CSVFileFormatException ex)
            {
                throw new WiimoteCommunicationException(ex);
            }
            catch (Exception ex)
            {
                throw new WiimoteCommunicationException(ex);
            }
            return(null);
        }
示例#11
0
        public string comparePlayToReference(IWiimotePlayRecord p_PlayRecord)
        {
            ITrainingSegmentInfo lTrainingSegmentInfo = (ITrainingSegmentInfo)((IWiimoteChildRecord)p_PlayRecord).ParentRecord;

            return(comparePlayToReference((IWiimoteReferenceRecord)lTrainingSegmentInfo.TrainingReferenceRecord, p_PlayRecord));
        }
示例#12
0
 public void startTimer(ITrainingSegmentInfo wiimoteRecord, bool p_MP3Option,string introductoryMessage)
 {
     TimerThread.getTimerThread().startTimer(Configuration.getConfiguration().NumBeatsPerMinute, Configuration.getConfiguration().NumBeatsPerBar,
         Configuration.getConfiguration().NumBars, Configuration.getConfiguration().LeadIn, p_MP3Option,introductoryMessage);
     //            TimerThread.getTimerThread().startTimer(wiimoteRecord.NumBeatsPerMinute, wiimoteRecord.NumBeatsPerBar,
     //                wiimoteRecord.NumBars, wiimoteRecord.LeadIn, p_MP3Option, introductoryMessage);
 }
        private string getFormattedPlayName(ITrainingSegmentInfo lSegmentInfo)
        {
            StringBuilder lPlayName = new StringBuilder();

            lPlayName.Append(lSegmentInfo.RecordName);

            return lPlayName.ToString();
        }
        public bool previousFrame()
        {
            if (mVideoPlayer != null &&
                (mVideoPlayer.getVideoState() == VideoState.Running ||
                mVideoPlayer.getVideoState() == VideoState.Paused))
                return false;

            if (mCurrentVideoIndex > 0)
                mCurrentVideoIndex = mCurrentVideoIndex - 1;
            mCurrentTrainingSegment = WiimoteDataStore.getWiimoteDataStore().getTrainingSegmentInfo(mCurrentVideoIndex);
            mCurrentSubVideoIndex = 0;

            setCurrentPlay();
            setCommandOptions();
            return true;
        }
        public bool nextFrame()
        {
            if (mVideoPlayer != null &&
                (mVideoPlayer.getVideoState() == VideoState.Running ||
                mVideoPlayer.getVideoState() == VideoState.Paused))
                return false;

            mCurrentVideoIndex = (mCurrentVideoIndex + 1) % WiimoteDataStore.getWiimoteDataStore().getNumberOfTrainingSegmentInfoRecords();
            mCurrentTrainingSegment = WiimoteDataStore.getWiimoteDataStore().getTrainingSegmentInfo(mCurrentVideoIndex);
            mCurrentSubVideoIndex = 0;

            setCurrentPlay();
            setCommandOptions();
            return true;
        }
        public void initializeTraining()
        {
            try
            {

                loadTrainingVideoInfoData();

                if (WiimoteDataStore.getWiimoteDataStore().getNumberOfTrainingSegmentInfoRecords() == 0)
                    return; // throw exception here

                mTrainingStarted = true;
                mCurrentTrainingSegment = WiimoteDataStore.getWiimoteDataStore().getTrainingSegmentInfo(0);

            }
            catch (WiimoteConnectionException ex)
            {
                Console.WriteLine(ex);
                throw ex;
            }
        }
        public bool gotoFirstSegment()
        {
            if (mVideoPlayer != null &&
                (mVideoPlayer.getVideoState() == VideoState.Running ||
                mVideoPlayer.getVideoState() == VideoState.Paused))
                return false;

            if (WiimoteDataStore.getWiimoteDataStore().getNumberOfTrainingSegmentInfoRecords() == 0)
                throw new TrainingVideoException("No Training Data Loaded");

            mCurrentVideoIndex = 0;
            mCurrentSubVideoIndex = 0;
            mCurrentTrainingSegment = WiimoteDataStore.getWiimoteDataStore().getTrainingSegmentInfo(mCurrentVideoIndex);
            setCurrentPlay();
            setCommandOptions();
            return true;
        }