/// <summary> /// /// </summary> /// <param name="recordingObject"></param> public Recorder(Recording recordingObject) : base(0,true,false) { _recording = recordingObject; _recordingConfig = _recording.parameters; _recordingData = _recording.data; }
/// <summary> /// This constructor initializes a default configuration for the PlaybackDataProvider /// </summary> public PlaybackDataProvider() : base() { _framePeriod = 500000; //0.5 msec _framesPerTick = 200; _rnd = new Random(); _timer = new FastTimer(3, (_framesPerTick * _framePeriod) / 1000000, GenerateFrame); //Iinitialization of anything related to loading playback data from file _loadedDataConfig = new RecordingConfig(); _loadedData = new Recording(_loadedDataConfig); _fileReadWriters = new List<IFileReadWriter>(); //Initialization of available IFileReadWriters _fileReadWriters.Add(new HDF5RecordingReadWriter()); //Composing filter string _fileFilters = ""; foreach (IFileReadWriter fileReadWriter in _fileReadWriters) { _fileFilters = _fileFilters + fileReadWriter.supportedFormats.ToString() + "|"; } _fileFilters = _fileFilters + "All Files (*.*)|*.*"; }
public TrainingPackage(RecordingConfig configuration) { _trainingSets = new List<DataSet>(); _validationSets = new List<DataSet>(); _movementCodes = new List<int>(); recordingConfig = configuration; }
/// <summary> /// Basic attribute initialization. Full configuration must be performed by a client class using this model. /// </summary> public AcqModel() { this.PropertyChanged += AcqModel_PropertyChanged; recordingConfig = new RecordingConfig(); recordedData = new Recording(recordingConfig); _acqPipeline = new Pipeline(); dataProvider = "none"; _selectedMovements = new ObservableCollection<Movement>(); _selectedMovements.CollectionChanged += SelectedMovements_CollectionChanged; recordingValid = false; _fileReadWriters = new List<IFileReadWriter>(); //Initialization of available IFileReadWriters _fileReadWriters.Add(new HDF5RecordingReadWriter()); //Composing filter string fileFilters = ""; foreach (IFileReadWriter fileReadWriter in _fileReadWriters) { fileFilters = fileFilters + fileReadWriter.supportedFormats.ToString() + "|"; } fileFilters = fileFilters + "All Files (*.*)|*.*"; }
/// <summary> /// Initializes a RecordingPlanModel form a RecordingConfig object and a list of strings with the basic movements /// Moreover, the RecordingPLanModel will subscribe to the events generated by the RecordingConfig object /// To update the view when required /// </summary> /// <param name="recordingConfig"></param> /// <param name="basicMovements"></param> public RecordingPlanViewModel(RecordingConfig recordingConfig, StringCollection basicMovements) { _recordingConfig = recordingConfig; recordingConfig.PropertyChanged += recordingConfig_PropertyChanged; _basicMovements = new string[basicMovements.Count]; basicMovements.CopyTo(_basicMovements, 0); placeholderBitmap = Convert((Bitmap)Properties.Resources.ResourceManager.GetObject("nofoto")); completedBitmap = Convert((Bitmap)Properties.Resources.ResourceManager.GetObject("ok")); SetSelectedItem(-1); }
public override void Run() { recordingReadWriter = new HDF5RecordingReadWriter(new ConsoleMovementSelector(), Properties.Settings.Default.movementsList, Properties.Settings.Default.allowedMovements); RecordingConfig recordingConfig = new RecordingConfig(); Recording recording = new Recording(recordingConfig); openFileDialog.Filter = recordingReadWriter.supportedFormats.ToString(); if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { recordingReadWriter.ReadFile(openFileDialog.FileName,recording); } //And here we print out the contents of the recording. }
public Recording() { _data = new ObservableCollection<Frame>(); _parameters = new RecordingConfig(); }
public Recording(ObservableCollection<Frame> data, RecordingConfig parameters) { _data = data; _parameters = parameters; }
/// <summary> /// Loads configuration form a Settings object into a recordingConfig object; /// </summary> /// <param name="recordingConfig"></param> /// <param name="settings"></param> private void LoadRecordingConfig(Settings settings, RecordingConfig recordingConfig) { recordingConfig.gain = settings.AcqDeviceGain; recordingConfig.maxVoltage = settings.AcqDeviceMaxV; recordingConfig.minVoltage = settings.AcqDeviceMinV; recordingConfig.nChannels = settings.AcqDeviceNChannels; recordingConfig.sampleFreq = settings.AcqDeviceSampleFreq; recordingConfig.scheduleActive = settings.AcqScheduleActive; recordingConfig.scheduleItemTime = settings.AcqScheduleItemTime; recordingConfig.repetitions = settings.AcqRepetitionsPerMovement; recordingConfig.scheduleWarmupItems = settings.AcqScheduleWarmupItems; }
public override void Run() { ThreadStart runMethod; Thread myThread; runMethod = new ThreadStart(GetRecordingStatusChange); myThread = new Thread(runMethod); _recordingConfig = new RecordingConfig(); _recordingConfig.schedule.Add(new ScheduleItem(7,new ushort[] { 1, 3 })); _recordingConfig.schedule.Add(new ScheduleItem (0, new ushort[] { 0 })); _recordingConfig.schedule.Add(new ScheduleItem (9,new ushort[] { 1, 4 })); _recordingConfig.schedule.Add(new ScheduleItem (0,new ushort[] { 0 })); _recordingConfig.schedule.Add(new ScheduleItem (8,new ushort[] { 2, 3 })); _recordingConfig.schedule.Add(new ScheduleItem (0, new ushort[] { 0 })); _recordingConfig.schedule.Add(new ScheduleItem (10, new ushort[] { 2, 4 })); _recordingController = new AcquisitionController(_pipeline); _recordingController.dataProvider = _myDataProvider; _myDataProvider.recordingConfig = _recordingConfig; _recordingController.recordingConfig = _recordingConfig; _recordingController.StatusChanged += new EventHandler(RecordingStatusChange); _pipeline.StopPendingChanged += new EventHandler(StopPendingChange); _myDataProvider.StatusChanged += new EventHandler(DataProviderStatusChange); _pipeline.AddStage(_recordingController); _pipeline.AddStage(_outputDisplayer); _pipeline.Init(); //Ather the pipeline (and consequently the stages) are initialised, we can already create the //thread that will read the status change queue of the RecordingController object HERE myThread.Start(); _pipeline.Start(); while (_recordingController.currentScheduleItem != -1) { //Wait for the RecordingController to finish the job } //The thread running GetRecordingStatusChange() is ready to finish or has already finished. We do things right //by waiting for it here. myThread.Join(); if (_pipeline.stopPending) { Console.Out.WriteLine("Stopping pipeline on Run method..."); _pipeline.Stop(); Console.Out.WriteLine("Pipeline stopped!"); } Console.WriteLine("\n\nRecordingController execution finished. Press <ENTER> to view the captured data."); Console.ReadLine(); //printing results for (Int32 i = 0; i < _outputDisplayer.output.Count; i++) { Console.Out.WriteLine(_outputDisplayer.output.ElementAt(i)); } _recordingController.StatusChanged -= new EventHandler(RecordingStatusChange); _pipeline.StopPendingChanged -= new EventHandler(StopPendingChange); _myDataProvider.StatusChanged -= new EventHandler(DataProviderStatusChange); }
/// <summary> /// Copies the configuration parameters from another RecordingConfig instance into this one /// </summary> /// <param name="copiedConfig"></param> public void Copy(RecordingConfig sourceConfig) { gain = sourceConfig.gain; maxVoltage = sourceConfig.maxVoltage; minVoltage = sourceConfig.minVoltage; nChannels = sourceConfig.nChannels; for (uint i = 0; i < channelMask.Length; i++) SetChannelEnable(i, sourceConfig.channelMask[i]); repetitions = sourceConfig.repetitions; sampleFreq = sourceConfig.sampleFreq; scheduleActive = sourceConfig.scheduleActive; scheduleItemnSamples = sourceConfig.scheduleItemnSamples; scheduleWarmupItems = sourceConfig.scheduleWarmupItems; thresholdSet.Copy(sourceConfig.thresholdSet); }
public EMGDataProvider() { _isPaused = false; _loop = false; _recordingConfig = new RecordingConfig(2000, 8, 6, -1500, 1500); }
public void StopRecording() { _acqPipeline.Stop(); if (detectThresholds) { RecordingConfig temp = new RecordingConfig(); temp.Copy(recordingConfig); thresholdRecordingConfig = temp; } recordingValid = true; }