Exemplo n.º 1
0
        /// <summary>
        /// 步数变化
        /// </summary>
        private void Pedometer_ReadingChanged(Pedometer sender, PedometerReadingChangedEventArgs args)
        {
            PedometerReading reding = args.Reading;

            if (reding.StepKind == PedometerStepKind.Running)
            {
                if (rs == reding.CumulativeSteps)
                {
                    return;
                }
                rs = reding.CumulativeSteps;
            }
            else
            {
                if (ws == reding.CumulativeSteps)
                {
                    return;
                }
                ws = reding.CumulativeSteps;
            }
            double h    = Math.Round(nowH, 1);
            double p    = pressure.GetCurrentReading().StationPressureInHectopascals;
            int    s    = args.Reading.CumulativeSteps;
            long   time = TimeUtil.getNowStamp();

            dm.insertHeight(time, h, p, ws, rs);
        }
Exemplo n.º 2
0
        public void PrintSensors(bool fast = false)
        {
            //BarometerReading read = baro.GetCurrentReading();
            var accR = acc.GetCurrentReading();
            //Debug.WriteLine(Math.Sqrt(Math.Pow(accR.AccelerationX; 2) + Math.Pow(accR.AccelerationY; 2) + Math.Pow(accR.AccelerationZ; 2)) + " (" + accR.AccelerationX + "/" + accR.AccelerationX + "/" + accR.AccelerationX + ")");
            //var actR = act.GetCurrentReadingAsync().GetResults();
            //Debug.WriteLine(actR.Activity + " (" + actR.Confidence + ")");
            //Debug.WriteLine(alt.GetCurrentReading().AltitudeChangeInMeters);
            //Debug.WriteLine(baro.GetCurrentReading().StationPressureInHectopascals);
            var compR = comp.GetCurrentReading();
            //Debug.WriteLine(compR.HeadingMagneticNorth + " (+/-" + compR.HeadingAccuracy + ")");
            var gyroR = gyro.GetCurrentReading();
            //Debug.WriteLine("(" + gyroR.AngularVelocityX + "/" + gyroR.AngularVelocityY + "/" + gyroR.AngularVelocityZ + ")");
            var incR = inc.GetCurrentReading();
            //Debug.WriteLine("(" + incR.PitchDegrees + "/" + incR.RollDegrees + "/" + incR.YawDegrees + ")");
            //var psR=ps.GetCurrentReading();
            //Debug.WriteLine(psR.IsDetected + ": " + psR.DistanceInMillimeters);
            //Debug.WriteLine(sos.GetCurrentOrientation());



            String csv = (Math.Sqrt(Math.Pow(accR.AccelerationX, 2) + Math.Pow(accR.AccelerationY, 2) + Math.Pow(accR.AccelerationZ, 2)) + ";" + accR.AccelerationX + ";" + accR.AccelerationY + ";" + accR.AccelerationZ + ";"
                          + alt.GetCurrentReading().AltitudeChangeInMeters + ";" + baro.GetCurrentReading().StationPressureInHectopascals + ";" + compR.HeadingMagneticNorth + ";" + compR.HeadingTrueNorth + ";" + compR.HeadingAccuracy
                          + ";" + gyroR.AngularVelocityX + ";" + gyroR.AngularVelocityY + ";" + gyroR.AngularVelocityZ + ";" + incR.PitchDegrees + ";" + incR.RollDegrees + ";" + incR.YawDegrees + ";" + sos.GetCurrentOrientation() + ";" + accR.Timestamp.ToUnixTimeMilliseconds() + ";" + fast);

            Debug.WriteLine(csv);
            StorageInterface.AppendToKnownStorageFile(Token, csv + "\r\n").GetAwaiter();
            OUT.Text += csv + "\r\n";
        }
Exemplo n.º 3
0
 /// <summary>
 /// This is the click handler for the 'GetData' button.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ScenarioGetData(object sender, RoutedEventArgs e)
 {
     if (null != sensor)
     {
         BarometerReading reading = sensor.GetCurrentReading();
         if (null != reading)
         {
             ScenarioOutput_hPa.Text = String.Format("{0,5:0.00}", reading.StationPressureInHectopascals);
         }
     }
     else
     {
         rootPage.NotifyUser("No barometer found", NotifyType.ErrorMessage);
     }
 }