Ejemplo n.º 1
0
        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;

            PipelineController.Instance.PipelineIds[0].TrignoBtManager.Configuration = new TrignoBTConfig()
            {
                EOS = EmgOrSimulate.EMG
            };

            var inputConfiguration = new BTDsConfig();

            inputConfiguration.NumberOfSensors = BTPipeline.TrignoBtManager.Components.Count;
            foreach (var somecomp in BTPipeline.TrignoBtManager.Components)
            {
                if (somecomp.State != SelectionState.Allocated)
                {
                    continue;
                }

                string selectedMode = "EMG (1000 Hz)";//"EMG+IMU,ACC:+/-2g,GYRO:+/-250dps";
                somecomp.SensorConfiguration.SelectSampleMode(selectedMode);

                if (somecomp.SensorConfiguration == null)
                {
                    return(false);
                }
            }

            PipelineController.Instance.PipelineIds[0].ApplyInputConfigurations(inputConfiguration);
            var transformTopology = GenerateTransforms();

            PipelineController.Instance.PipelineIds[0].ApplyOutputConfigurations(transformTopology);
            PipelineController.Instance.PipelineIds[0].RunTime = Double.MaxValue;
            return(true);
        }