Exemplo n.º 1
0
        public void StartSensors()
        {
            m_logger.Debug("StartSensors");

            Pedometer.Start();
            Compass.Start();
        }
Exemplo n.º 2
0
        public void StartReading(int reportInterval = -1)
        {
            if (reportInterval >= 0)
            {
                _pedometer.Interval = (uint)reportInterval;
            }

            _pedometer.DataUpdated += PedometerReadingChanged;
            _pedometer.Start();
        }
        /// <summary>
        /// Starts sensor and registers listener to a sensor
        /// </summary>
        /// <param name="listener">Event handler to listen sensor events</param>
        public void Start(EventHandler <SensorEventArgs> listener)
        {
            handler = (sender, e) =>
            {
                listener?.Invoke(this,
                                 new SensorEventArgs(new List <float>()
                {
                    e.StepCount,
                    e.WalkStepCount,
                    e.RunStepCount,
                    e.MovingDistance,
                    e.LastSpeed,
                    e.LastSteppingFrequency,
                    (int)e.LastStepStatus
                }));
            };

            sensor.DataUpdated += handler;
            sensor.Start();
        }
Exemplo n.º 4
0
        public IObservable <int> WhenReadingTaken()
        => this.observable ??= Observable.Create <int>(ob =>
        {
            var handler = new EventHandler <PedometerDataUpdatedEventArgs>((sender, args) =>
                                                                           ob.OnNext((int)args.StepCount)
                                                                           );
            var sensor = new Pedometer
            {
                Interval = 1000
            };
            sensor.DataUpdated += handler;
            sensor.Start();

            return(() =>
            {
                sensor.Stop();
                sensor.DataUpdated -= handler;
                sensor.Dispose();
            });
        })
        .Publish()
        .RefCount();
 /// <summary>
 /// Starts the sensor to receive sensor data
 /// </summary>
 public void Start()
 {
     _sensor.Start();
 }