Ejemplo n.º 1
1
  public void onSensorChanged(SensorEvent event) {
    if (event.sensor.getType() == Sensor.TYPE_ROTATION_VECTOR && measuring) {
      SensorManager.getRotationMatrixFromVector(rMat, event.values);

      int newOrientation = getWindowManager().getDefaultDisplay().getRotation();

      if (newOrientation != oldOrientation) {

        switch (newOrientation) {
          case Surface.ROTATION_90:
            axisX = SensorManager.AXIS_X;
            axisY = SensorManager.AXIS_Y;
            break;

          case Surface.ROTATION_180:
            axisX = SensorManager.AXIS_Y;
            axisY = SensorManager.AXIS_MINUS_X;
            break;

          case Surface.ROTATION_270:
            axisX = SensorManager.AXIS_MINUS_X;
            axisY = SensorManager.AXIS_MINUS_Y;
            break;

          case Surface.ROTATION_0:
            axisX = SensorManager.AXIS_MINUS_Y;
            axisY = SensorManager.AXIS_X;
            break;

          default:
            break;
        }

        oldOrientation = newOrientation;
      }

      SensorManager.remapCoordinateSystem(rMat, axisX, axisY, mapped);

      x = (float) Math.sin(SensorManager.getOrientation(mapped, orientation)[1]);
      y = (float) Math.sin(SensorManager.getOrientation(mapped, orientation)[2]);

      r = (float) Math.hypot(x, y);
      theta = (float) Math.atan(y / x);

      if (r < .1) {
        if (!lit) {
          liquid.setImageResource(R.drawable.bubble_lit);
          lit = true;
        }
      } else {
        if (lit) {
          liquid.setImageResource(R.drawable.bubble_round);
          lit = false;
        }
      }

      if (r > 1) {
        x = (float) Math.copySign(Math.cos(theta), x);
        y = (float) Math.copySign(Math.sin(theta), y);
      }

      bubble.setLayoutParams(
          new AbsoluteLayout.LayoutParams(
              ball,
              ball,
              (int) (x * -size + size - ball / 2),
              (int) (y * -size + size - ball / 2)));
    }
  }
Ejemplo n.º 2
0
 /** calculates orientation angles from accelerometer and magnetometer output */
 private void calculateAccMagOrientation() {
   if (SensorManager.getRotationMatrix(rotationMatrix, null, accel, magnet)) {
     float[] tempMatrix = new float[9];
     if (portrait) {
       // dont remap in portrait
       if (isTablet) {
         SensorManager.remapCoordinateSystem(
             rotationMatrix, SensorManager.AXIS_Y, SensorManager.AXIS_MINUS_X, tempMatrix);
       } else {
         SensorManager.remapCoordinateSystem(
             rotationMatrix, SensorManager.AXIS_X, SensorManager.AXIS_Y, tempMatrix);
       }
     } else {
       // remap in landscape
       if (isTablet) {
         SensorManager.remapCoordinateSystem(
             rotationMatrix, SensorManager.AXIS_X, SensorManager.AXIS_Y, tempMatrix);
       } else {
         SensorManager.remapCoordinateSystem(
             rotationMatrix, SensorManager.AXIS_Y, SensorManager.AXIS_MINUS_X, tempMatrix);
       }
     }
     SensorManager.getOrientation(tempMatrix, accMagOrientation);
     rotationMatrix = tempMatrix;
   }
 }
Ejemplo n.º 3
0
  void sendHeadVector() {
    mHeadTracker.getLastHeadView(headView, 0);
    // Matrix.rotateM(headView, 0, 180, 0, 0, 1);  //upside down
    SensorManager.remapCoordinateSystem(
        headView, SensorManager.AXIS_Z, SensorManager.AXIS_MINUS_Y, headView);
    // SensorManager.remapCoordinateSystem(headView, SensorManager.AXIS_MINUS_Z,
    // SensorManager.AXIS_Y, headView); //rotate for sensor.

    PutDataMapRequest req = PutDataMapRequest.create("/head");
    for (int i = 0; i < 16; ++i) {
      req.getDataMap().putFloat(HEAD_PRE + i, headView[i]);
    }
    req.getDataMap().putLong("time", new Date().getTime());
    Wearable.DataApi.putDataItem(mGoogleApiClient, req.asPutDataRequest())
        .setResultCallback(
            new ResultCallback<DataApi.DataItemResult>() {
              @Override
              public void onResult(DataApi.DataItemResult dataItemResult) {
                if (dataItemResult.getStatus().isSuccess()) {
                  Log.d("TEST", "Data item set: " + dataItemResult.getDataItem().getUri());
                } else if (dataItemResult.getStatus().isCanceled()) {
                  Log.d("TEST", "canceled");
                } else if (dataItemResult.getStatus().isInterrupted()) {
                  Log.d("TEST", "interrupted");
                }
              }
            });
  }
Ejemplo n.º 4
0
  public void onSensorChanged(SensorEvent event) {

    boolean gotRotation =
        SensorManager.getRotationMatrix(rotation, identity, lastAccelerometer, lastCompass);
    switch (event.sensor.getType()) {
      case Sensor.TYPE_ROTATION_VECTOR:
        break;
      case Sensor.TYPE_MAGNETIC_FIELD:
        lastCompass = exponentialSmoothing(event.values, lastCompass, ALPHA);
        break;
      case Sensor.TYPE_ACCELEROMETER:
        lastAccelerometer = exponentialSmoothing(event.values, lastAccelerometer, ALPHA);

        break;
    }
    if (gotRotation) {
      float cameraRotation[] = new float[9];
      // remap such that the camera is pointing straight down the Y axis
      SensorManager.remapCoordinateSystem(
          rotation, SensorManager.AXIS_X, SensorManager.AXIS_Z, cameraRotation);

      // orientation vector
      orientation = new float[3];
      SensorManager.getOrientation(cameraRotation, orientation);
    }
  }
Ejemplo n.º 5
0
  @Override
  public void onSensorChanged(SensorEvent event) {
    if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) {
      magnetic_field_values[0] =
          (float) (magnetic_field_values[0] * (1.0 - KFILTER) + event.values[0] * KFILTER);
      magnetic_field_values[1] =
          (float) (magnetic_field_values[1] * (1.0 - KFILTER) + event.values[1] * KFILTER);
      magnetic_field_values[2] =
          (float) (magnetic_field_values[2] * (1.0 - KFILTER) + event.values[2] * KFILTER);
    }
    if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
      accelerometer_values[0] =
          (float) (accelerometer_values[0] * (1.0 - KFILTER) + event.values[0] * KFILTER);
      accelerometer_values[1] =
          (float) (accelerometer_values[1] * (1.0 - KFILTER) + event.values[1] * KFILTER);
      accelerometer_values[2] =
          (float) (accelerometer_values[2] * (1.0 - KFILTER) + event.values[2] * KFILTER);

      rollingZ = (float) ((accelerometer_values[2] * KFILTER) + rollingZ * (1.0 - KFILTER));
      rollingX = (float) ((accelerometer_values[0] * KFILTER) + rollingX * (1.0 - KFILTER));

      if (rollingZ != 0.0f) {
        inclination = (float) Math.atan(rollingX / rollingZ);
      } else if (rollingX < 0) {
        inclination = (float) (Math.PI / 2.0);
      } else if (rollingX >= 0) {
        inclination = (float) (3 * Math.PI / 2.0);
      }

      inclination = (float) (inclination * (360 / (2 * Math.PI)));
      if (inclination < 0) inclination += 90;
      else inclination -= 90;
    }

    if (magnetic_field_values != null && accelerometer_values != null) {

      float[] R = new float[MATRIX_SIZE];
      float[] I = new float[MATRIX_SIZE];

      if (SensorManager.getRotationMatrix(R, I, accelerometer_values, magnetic_field_values)) {

        float[] orientation_values = new float[3];
        SensorManager.remapCoordinateSystem(R, SensorManager.AXIS_X, SensorManager.AXIS_Z, R);
        SensorManager.getOrientation(R, orientation_values);

        // radians
        float azimuth = (float) Math.toDegrees(orientation_values[0]);
        azimuth = (azimuth + 360) % 360;

        direction = (float) ((azimuth * KFILTER) + direction * (1.0 - KFILTER));
      }
    }

    scoreView.setText("Score: " + score);
    timeView.setText(String.format("Time Remaining: %.2f", timeRemaining));
  }
    @Override
    public void onSensorChanged(final SensorEvent event) {

      if (event.sensor.getType() == Sensor.TYPE_ROTATION_VECTOR) {
        synchronized (mRotationMatrix) {
          SensorManager.getRotationMatrixFromVector(mRotationMatrix, event.values);

          final int mScreenRotation =
              mActivity.getWindowManager().getDefaultDisplay().getRotation();

          switch (mScreenRotation) {
            case Surface.ROTATION_90:
              // x => y   &&    y => -x
              SensorManager.remapCoordinateSystem(
                  mRotationMatrix, SensorManager.AXIS_Y, SensorManager.AXIS_MINUS_X, mTmpMatrix);
              System.arraycopy(mTmpMatrix, 0, mRotationMatrix, 0, mTmpMatrix.length);
              break;
            case Surface.ROTATION_270:
              // x => -y   &&    y => x
              SensorManager.remapCoordinateSystem(
                  mRotationMatrix, SensorManager.AXIS_MINUS_Y, SensorManager.AXIS_X, mTmpMatrix);
              System.arraycopy(mTmpMatrix, 0, mRotationMatrix, 0, mTmpMatrix.length);
              break;
            default:
              break;
          }

          // Rotation of 90 degrees about x axis
          Matrix.rotateM(mRotationMatrix, 0, 90, 1, 0, 0);

          // we just got a new value. Update 'new' flag.
          mHasNewValue = true;
        }

        // finally, throw the event to listeners.
        mNotifyListeners(event);
      }
    }
 @Override
 public void onSensorChanged(SensorEvent event) {
   float rotationMatrix[] = new float[16];
   SensorManager.getRotationMatrixFromVector(rotationMatrix, event.values);
   float[] orientationValues = new float[3];
   readDisplayRotation();
   SensorManager.remapCoordinateSystem(rotationMatrix, mAxisX, mAxisY, rotationMatrix);
   SensorManager.getOrientation(rotationMatrix, orientationValues);
   double azimuth = Math.toDegrees(orientationValues[0]);
   // Azimuth values are now -180-180 (N=0), but once added to the location object
   // they become 0-360 (N=0).
   @SuppressLint("UseValueOf")
   Float newBearing = new Float(azimuth);
   if (mBearing == null || Math.abs(mBearing - newBearing) > MIN_BEARING_DIFF) {
     mBearing = newBearing;
     if (mCurrentBestLocation != null) {
       mCurrentBestLocation.setBearing(mBearing);
     }
     mLocationCallback.handleNewBearing(mBearing);
   }
 }
        @Override
        public void onSensorChanged(SensorEvent event) {
          if (event.sensor.getType() == Sensor.TYPE_ROTATION_VECTOR) {
            // Get the current heading from the sensor, then notify the listeners of the
            // change.
            SensorManager.getRotationMatrixFromVector(mRotationMatrix, event.values);
            SensorManager.remapCoordinateSystem(
                mRotationMatrix, SensorManager.AXIS_X, SensorManager.AXIS_Z, mRotationMatrix);
            SensorManager.getOrientation(mRotationMatrix, mOrientation);

            // Store the pitch (used to display a message indicating that the user's head
            // angle is too steep to produce reliable results.
            mPitch = (float) Math.toDegrees(mOrientation[1]);

            // Convert the heading (which is relative to magnetic north) to one that is
            // relative to true north, using the user's current location to compute this.
            float magneticHeading = (float) Math.toDegrees(mOrientation[0]);
            mHeading =
                MathUtils.mod(computeTrueNorth(magneticHeading), 360.0f) - ARM_DISPLACEMENT_DEGREES;

            notifyOrientationChanged();
          }
        }
Ejemplo n.º 9
0
    private void a()
    {
        SensorManager.getRotationMatrix(f, null, d, e);
        c;
        JVM INSTR tableswitch 0 1: default 44
    //                   0 44
    //                   1 70;
           goto _L1 _L1 _L2
_L2:
        SensorManager.remapCoordinateSystem(f, 2, 129, f);
_L1:
        float af[] = a;
        SensorManager.getOrientation(f, af);
        int i = -1 + af.length;
        do
        {
            if (i < 0)
            {
                return;
            }
            af[i] = 57.29578F * af[i];
            i--;
        } while (true);
        if (true) goto _L1; else goto _L3
  private float[] calculateOrientation() {
    float[] values = new float[3];
    float[] inR = new float[9];
    float[] outR = new float[9];

    SensorManager.getRotationMatrix(inR, null, mAccelerometerValues, mMagneticValues);

    int xAxis = SensorManager.AXIS_X;
    int yAxis = SensorManager.AXIS_Y;

    switch (mRotation) {
      case Surface.ROTATION_90:
        xAxis = SensorManager.AXIS_Y;
        yAxis = SensorManager.AXIS_MINUS_X;
        break;
      case Surface.ROTATION_180:
        yAxis = SensorManager.AXIS_MINUS_Y;
        break;
      case Surface.ROTATION_270:
        xAxis = SensorManager.AXIS_MINUS_Y;
        yAxis = SensorManager.AXIS_X;
        break;
      default:
        break;
    }

    SensorManager.remapCoordinateSystem(inR, xAxis, yAxis, outR);

    SensorManager.getOrientation(inR, values);

    values[0] = (float) Math.toDegrees(values[0]);
    values[1] = (float) Math.toDegrees(values[1]);
    values[2] = (float) Math.toDegrees(values[2]);

    return values;
  }
Ejemplo n.º 11
0
  public void onSensorChanged(SensorEvent event) {

    KrollDict data = new KrollDict();
    data.put("sType", event.sensor.getType());
    switch (event.sensor.getType()) {
      case Sensor.TYPE_ACCELEROMETER:
        if (event.timestamp - lastSensorAccelerometerEventTimestamp > 100) {
          accellerometerValues = event.values.clone();
          accellerometerValues =
              accelerationFilter.filterFloat(
                  accellerometerValues); // Use a mean filter to smooth the sensor inputs
          accelerationSampleCount++; // Count the number of samples received.

          // Only determine the initial orientation after the acceleration sensor
          // and magnetic sensor have had enough time to be smoothed by the mean
          // filters. Also, only do this if the orientation hasn't already been
          // determined since we only need it once.
          if (accelerationSampleCount > 30 && magneticSampleCount > 30 && !hasInitialOrientation) {
            calculateOrientation();
          }
          // End gyroscope stuffs

          lastSensorAccelerometerEventTimestamp = event.timestamp;

          float[] linear_acceleration = new float[3];
          final float alpha = (float) 0.8;

          gravity[0] = alpha * gravity[0] + (1 - alpha) * accellerometerValues[0];
          gravity[1] = alpha * gravity[1] + (1 - alpha) * accellerometerValues[1];
          gravity[2] = alpha * gravity[2] + (1 - alpha) * accellerometerValues[2];

          linear_acceleration[0] = accellerometerValues[0] - gravity[0];
          linear_acceleration[1] = accellerometerValues[1] - gravity[1];
          linear_acceleration[2] = accellerometerValues[2] - gravity[2];

          float x = accellerometerValues[0];
          float y = accellerometerValues[1];
          float z = accellerometerValues[2];

          data.put("x", x);
          data.put("y", y);
          data.put("z", z);
          data.put("linearAccelerationX", linear_acceleration[0]);
          data.put("linearAccelerationY", linear_acceleration[1]);
          data.put("linearAccelerationZ", linear_acceleration[2]);
        }
        break;
      case Sensor.TYPE_MAGNETIC_FIELD:
        magneticFieldValues = event.values.clone();
        // Gyroscope stuffs.
        magneticFieldValues =
            magneticFilter.filterFloat(
                magneticFieldValues); // Use a mean filter to smooth the sensor inputs
        magneticSampleCount++; // Count the number of samples received.
        // End gyroscope stuffs

        double magnetometer =
            Math.sqrt(
                Math.pow(magneticFieldValues[0], 2)
                    + Math.pow(magneticFieldValues[1], 2)
                    + Math.pow(magneticFieldValues[2], 2));
        data.put("magnetometer", magnetometer);
        data.put("x", magneticFieldValues[0]);
        data.put("y", magneticFieldValues[1]);
        data.put("z", magneticFieldValues[2]);

        if (accellerometerValues != null && magneticFieldValues != null) {

          boolean success =
              SensorManager.getRotationMatrix(R, I, accellerometerValues, magneticFieldValues);
          SensorManager.remapCoordinateSystem(R, SensorManager.AXIS_X, SensorManager.AXIS_Z, outR);
          if (success) {
            SensorManager.getOrientation(R, orientation);
            float azimuthInDegress = (float) (Math.toDegrees(orientation[0]) + 360) % 360;
            data.put("compassRotation", azimuthInDegress);
          }
          SensorManager.getOrientation(outR, orientationPitchRollAzimuth);
          data.put("azimuth", orientationPitchRollAzimuth[0]);
          data.put("pitch", orientationPitchRollAzimuth[1]);
          data.put("roll", orientationPitchRollAzimuth[2]);
        }
        break;
      case Sensor.TYPE_AMBIENT_TEMPERATURE:
        ambiantTemperatureValues = event.values.clone();
        data.put("celcius", ambiantTemperatureValues[0]);
        data.put("fahrenheit", ((ambiantTemperatureValues[0] * 9) / 5) + 32);
        break;
      case Sensor.TYPE_GAME_ROTATION_VECTOR:
        // Approfondire la sortie des infos avec cet example
        // https://github.com/kplatfoot/android-rotation-sensor-sample/blob/master/src/com/kviation/android/sample/orientation/Orientation.java
        /*
        http://developer.android.com/reference/android/hardware/SensorEvent.html#values
        values[0]: x*sin(θ/2)
        values[1]: y*sin(θ/2)
        values[2]: z*sin(θ/2)
        values[3]: cos(θ/2)
        values[4]: estimated heading Accuracy (in radians) (-1 if unavailable)
        */
        gameRotationVectorValues = event.values.clone();
        data.put("x", gameRotationVectorValues[0]);
        data.put("y", gameRotationVectorValues[1]);
        data.put("z", gameRotationVectorValues[2]);
        data.put("cos", gameRotationVectorValues[3]);
        // data.put("headingAccuracy", gameRotationVectorValues[4]);
        break;
      case Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR:
        geomagneticRotationVectorValues = event.values.clone();
        data.put("x", geomagneticRotationVectorValues[0]);
        data.put("y", geomagneticRotationVectorValues[1]);
        data.put("z", geomagneticRotationVectorValues[2]);
        break;
      case Sensor.TYPE_GRAVITY:
        gravityValues = event.values.clone();
        data.put("x", gravityValues[0]);
        data.put("y", gravityValues[1]);
        data.put("z", gravityValues[2]);
        break;
      case Sensor.TYPE_GYROSCOPE:
        gyroscopeValues = event.values.clone();
        // from http://developer.android.com/reference/android/hardware/SensorEvent.html#values
        // http://www.kircherelectronics.com/blog/index.php/11-android/sensors/16-android-gyroscope-fusion

        // This timestep's delta rotation to be multiplied by the current rotation
        // after computing it from the gyro sample data.
        if (!hasInitialOrientation) {
          return;
        }
        // Initialization of the gyroscope based rotation matrix
        if (!stateInitializedCalibrated) {
          currentRotationMatrix =
              matrixMultiplication(currentRotationMatrix, initialRotationMatrix);
          stateInitializedCalibrated = true;
        }

        if (lastSensorGyroscopeEventTimestamp != 0 && stateInitializedCalibrated) {
          final float dT = (event.timestamp - lastSensorGyroscopeEventTimestamp) * NS2S;
          // Axis of the rotation sample, not normalized yet.
          float axisX = gyroscopeValues[0];
          float axisY = gyroscopeValues[1];
          float axisZ = gyroscopeValues[2];

          // Calculate the angular speed of the sample
          float omegaMagnitude = (float) Math.sqrt(axisX * axisX + axisY * axisY + axisZ * axisZ);

          // Normalize the rotation vector if it's big enough to get the axis
          if (omegaMagnitude > EPSILON) {
            axisX /= omegaMagnitude;
            axisY /= omegaMagnitude;
            axisZ /= omegaMagnitude;
          }

          // Integrate around this axis with the angular speed by the timestep
          // in order to get a delta rotation from this sample over the timestep
          // We will convert this axis-angle representation of the delta rotation
          // into a quaternion before turning it into the rotation matrix.
          float thetaOverTwo = omegaMagnitude * dT / 2.0f;
          float sinThetaOverTwo = (float) Math.sin(thetaOverTwo);
          float cosThetaOverTwo = (float) Math.cos(thetaOverTwo);
          deltaRotationVector[0] = sinThetaOverTwo * axisX;
          deltaRotationVector[1] = sinThetaOverTwo * axisY;
          deltaRotationVector[2] = sinThetaOverTwo * axisZ;
          deltaRotationVector[3] = cosThetaOverTwo;

          SensorManager.getRotationMatrixFromVector(deltaRotationMatrix, deltaRotationVector);
          // User code should concatenate the delta rotation we computed with the current rotation
          // in order to get the updated rotation.
          currentRotationMatrix = matrixMultiplication(currentRotationMatrix, deltaRotationMatrix);
          SensorManager.getOrientation(currentRotationMatrix, gyroscopeOrientation);

          data.put("x", gyroscopeValues[0]);
          data.put("y", gyroscopeValues[1]);
          data.put("z", gyroscopeValues[2]);
          data.put("radianX", gyroscopeOrientation[0]);
          data.put("radianY", gyroscopeOrientation[1]);
          data.put("radianZ", gyroscopeOrientation[2]);
          data.put("degreesX", Math.toDegrees(gyroscopeOrientation[0]));
          data.put("degreesY", Math.toDegrees(gyroscopeOrientation[1]));
          data.put("degreesZ", Math.toDegrees(gyroscopeOrientation[2]));
        }
        lastSensorGyroscopeEventTimestamp = event.timestamp;
        break;
      case Sensor.TYPE_GYROSCOPE_UNCALIBRATED:
        gyroscopeUncalibratedValues = event.values.clone();
        break;
        /*case Sensor.TYPE_HEART_RATE:
        heartRateValues = event.values.clone();
        data.put("rate", x);
        break;*/
      case Sensor.TYPE_LIGHT:
        lightValues = event.values.clone();
        data.put("lux", lightValues[0]);
        break;
      case Sensor.TYPE_LINEAR_ACCELERATION:
        linearAccelerationValues = event.values.clone();

        float x = linearAccelerationValues[0];
        float y = linearAccelerationValues[1];
        float z = linearAccelerationValues[2];

        data.put("x", x);
        data.put("y", y);
        data.put("z", z);
        break;
      case Sensor.TYPE_MAGNETIC_FIELD_UNCALIBRATED:
        magneticFieldUncalibratedValues = event.values.clone();
        data.put("x_uncalib", magneticFieldUncalibratedValues[0]);
        data.put("y_uncalib", magneticFieldUncalibratedValues[1]);
        data.put("z_uncalib", magneticFieldUncalibratedValues[2]);
        data.put("x_bias", magneticFieldUncalibratedValues[3]);
        data.put("y_bias", magneticFieldUncalibratedValues[4]);
        data.put("z_bias", magneticFieldUncalibratedValues[5]);
        break;
      case Sensor.TYPE_PROXIMITY:
        proximityValues = event.values.clone();
        data.put("cm", proximityValues[0]);
        break;
      case Sensor.TYPE_RELATIVE_HUMIDITY:
        relativeHumidityValues = event.values.clone();
        data.put("percent", relativeHumidityValues[0]);
        break;
      case Sensor.TYPE_ROTATION_VECTOR:
        rotationVectorValues = event.values.clone();
        data.put("x", rotationVectorValues[0]);
        data.put("y", rotationVectorValues[1]);
        data.put("z", rotationVectorValues[2]);
        data.put("cos", rotationVectorValues[3]);
        data.put("headingAccuracy", rotationVectorValues[4]);
        break;
      case Sensor.TYPE_SIGNIFICANT_MOTION:
        significantMotionValues = event.values.clone();
        Log.i(LCAT, "TYPE_SIGNIFICANT_MOTION:" + significantMotionValues[0]);
        data.put("motion", significantMotionValues[0]);
        break;
      case Sensor.TYPE_STEP_COUNTER:
        stepCounterValues = event.values.clone();
        if (stepCounterOffset == 0) {
          stepCounterOffset = stepCounterValues[0];
        }
        data.put("val", stepCounterValues[0]);
        data.put("count", stepCounterValues[0] - stepCounterOffset);
        break;
      case Sensor.TYPE_ORIENTATION:
        orientationValues = event.values.clone();
        data.put("orientation", orientationValues[0]);
        data.put("pitch", orientationValues[1]);
        data.put("roll", orientationValues[2]);
        break;
      case Sensor.TYPE_STEP_DETECTOR:
        stepDetectorValues = event.values.clone();
        if (stepDetectorValues[0] == 1.0f) {
          stepDetectorCounter++;
        }
        data.put("count", stepDetectorCounter);
        break;
    }
    fireEvent(EVENT_UPDATE, data);
  }