/** This is called every INTERVAL_MS ms from the TimerTask. */ protected synchronized void updateData() { // Get current time for time stamps long now_ms = System.currentTimeMillis(); st.onTimerElapsed(now_ms, detector.getLastAcc(), new double[] {lastComp}); // Check if a step is detected upon data if (detector.checkForStep()) { // Call algorithm for navigation/updating position st.onStepDetected(now_ms, lastComp); } }
@Override public void onSensorChanged(SensorEvent event) { switch (event.sensor.getType()) { case Sensor.TYPE_ACCELEROMETER: st.onAccelerometerDataReceived( System.currentTimeMillis(), event.values[0], event.values[1], event.values[2]); // just update the oldest z value detector.addSensorValues(System.currentTimeMillis(), event.values); break; default: } // switch (event.sensor.getType()) }
/* (non-Javadoc) * @see at.fhstp.wificompass.CompassListener#onCompassChanged(float, java.lang.String) */ @Override public void onCompassChanged(float azimuth, float angle, String direction) { st.onCompassDataReceived(System.currentTimeMillis(), azimuth, 0, 0); this.lastComp = azimuth; }