private bool ConfigurePipeline() { if (CallbacksAdded) { BTPipeline.TrignoBtManager.ComponentAdded -= ComponentAdded; BTPipeline.TrignoBtManager.ComponentLost -= ComponentLost; BTPipeline.TrignoBtManager.ComponentRemoved -= ComponentRemoved; } BTPipeline.TrignoBtManager.ComponentAdded += ComponentAdded; BTPipeline.TrignoBtManager.ComponentLost += ComponentLost; BTPipeline.TrignoBtManager.ComponentRemoved += ComponentRemoved; CallbacksAdded = true; TrignoBTConfig btConfigurationObject = new TrignoBTConfig { EOS = EmgOrSimulate.EMG }; if (PortableIoc.Instance.CanResolve <TrignoBTConfig>()) { PortableIoc.Instance.Unregister <TrignoBTConfig>(); } PortableIoc.Instance.Register(ioc => btConfigurationObject); var inputConfiguration = new BTDsConfig(); inputConfiguration.NumberOfSensors = BTPipeline.TrignoBtManager.Components.Count; foreach (var somecomp in BTPipeline.TrignoBtManager.Components.Where(x => x.State == SelectionState.Allocated)) { string selectedMode = "EMG+IMU,ACC:+/-2g,GYRO:+/-500dps"; // Synchronize to the UI thread and check if the mode textbox value exists in the // available sample modes for the sensor. Application.Current.Dispatcher.BeginInvoke(new Action(() => { if (somecomp.Configuration.SampleModes.Contains(tbox_SetMode.Text)) { selectedMode = tbox_SetMode.Text; } })); somecomp.Configuration.SelectSampleMode(selectedMode); if (somecomp.Configuration == null) { return(false); } } PipelineController.Instance.PipelineIds[0].ApplyInputConfigurations(inputConfiguration); var transformTopology = GenerateTransforms(); PipelineController.Instance.PipelineIds[0].ApplyOutputConfigurations(transformTopology); PipelineController.Instance.PipelineIds[0].RunTime = int.MaxValue; return(true); }
private bool ConfigurePipeline() { if (CallbacksAdded) { BTPipeline.TrignoBtManager.ComponentAdded -= ComponentAdded; BTPipeline.TrignoBtManager.ComponentLost -= ComponentLost; BTPipeline.TrignoBtManager.ComponentRemoved -= ComponentRemoved; } BTPipeline.TrignoBtManager.ComponentAdded += ComponentAdded; BTPipeline.TrignoBtManager.ComponentLost += ComponentLost; BTPipeline.TrignoBtManager.ComponentRemoved += ComponentRemoved; CallbacksAdded = true; TrignoBTConfig btConfigurationObject = new TrignoBTConfig { EOS = EmgOrSimulate.EMG }; if (PortableIoc.Instance.CanResolve <TrignoBTConfig>()) { PortableIoc.Instance.Unregister <TrignoBTConfig>(); } PortableIoc.Instance.Register(ioc => btConfigurationObject); var inputConfiguration = new BTDsConfig(); inputConfiguration.NumberOfSensors = BTPipeline.TrignoBtManager.Components.Count; foreach (var somecomp in BTPipeline.TrignoBtManager.Components.Where(x => x.State == SelectionState.Allocated)) { string selectedMode = "EMG+IMU,ACC:+/-2g,GYRO:+/-500dps"; somecomp.Configuration.SelectSampleMode(selectedMode); if (somecomp.Configuration == null) { return(false); } } PipelineController.Instance.PipelineIds[0].ApplyInputConfigurations(inputConfiguration); var transformTopology = GenerateTransforms(); PipelineController.Instance.PipelineIds[0].ApplyOutputConfigurations(transformTopology); PipelineController.Instance.PipelineIds[0].RunTime = 15; return(true); }