public void OnAcceleromterUpdate() // IAcceleromterListener { labelAcceleromterStatus.Text = "AccelerometerStatus: " + accelerometerProvider.GetStatus(); labelAcceleromterValueX.Text = "AccelerometerValueX: " + accelerometerProvider.GetX(); labelAcceleromterValueY.Text = "AccelerometerValueY: " + accelerometerProvider.GetY(); labelAcceleromterValueZ.Text = "AccelerometerValueZ: " + accelerometerProvider.GetZ(); labelAcceleromterValueXDelta.Text = "AccelerometerValueXDelta: " + accelerometerProvider.GetXDelta(); labelAcceleromterValueYDelta.Text = "AccelerometerValueYDelta: " + accelerometerProvider.GetYDelta(); labelAcceleromterValueZDelta.Text = "AccelerometerValueZDelta: " + accelerometerProvider.GetZDelta(); labelAcceleromterSpeed.Text = "AcceleromterSpeed: " + accelerometerProvider.GetSpeed(); labelAcceleromterInfo.Text = "AccelerometerInfo: " + accelerometerProvider.GetInfo(); }
bool OnTimer() { timeMilliSeconds += SAMPLE_INTERVAL_MS; if (timeMilliSeconds > SAMPLE_DURATION_MS) { btnOk.IsEnabled = true; state = CalibrationState.End; if (GetCalibration() < CALIBRATION_SUCCESS_LIMIT) { // not successful lblText.Text = Localization.pageCalibrationNotOk; lblText.TextColor = Color.FromHex("FF0000"); } else { // successful lblText.Text = Localization.pageCalibrationOk; lblText.TextColor = Color.FromHex("00FF00"); } btnOk.Image = Localization.btn_calibration_done; return(false); // stop timer } var sensorXDelta = accelerometerProvider.GetXDelta(); var sensorYDelta = accelerometerProvider.GetYDelta(); var sensorZDelta = accelerometerProvider.GetZDelta(); var noise = Math.Abs(sensorXDelta + sensorYDelta + sensorZDelta); calibration = calibrationFilter.Get(noise); if (Config.Calibration.LiveLabelEnabled) { lblText.Text = "" + GetCalibration().ToString("0.0") + " m/s²"; } // animate, switch one image after another visible switch (timeMilliSeconds) { case 300: accelerometerProvider.SetListener(this); imgCalibAnim1.IsVisible = false; imgCalibAnim2.IsVisible = true; break; case 2200: imgCalibAnim2.IsVisible = false; imgCalibAnim3.IsVisible = true; break; case 3800: imgCalibAnim3.IsVisible = false; imgCalibAnim4.IsVisible = true; break; case 4500: accelerometerProvider.SetListener(null); break; } return(true); // restart timer }