android.hardware.cts.helpers.sensorverification.GyroscopeIntegrationVerification

Here are the examples of the java api class android.hardware.cts.helpers.sensorverification.GyroscopeIntegrationVerification taken from open source projects.

1. GyroscopeMeasurementTestActivity#verifyMeasurements()

Project: CtsVerifier
File: GyroscopeMeasurementTestActivity.java
/**
     * This test verifies that the Gyroscope measures the appropriate angular position.
     *
     * The test takes a set of samples from the sensor under test and calculates the angular
     * position for each axis that the sensor data collects. It then compares it against the test
     * expectations that are represented by signed values. It verifies that the readings have the
     * right magnitude.
     */
private String verifyMeasurements(int instructionsResId, int rotationAxis, int expectationDeg) throws Throwable {
    setRendererRotation(rotationAxis, expectationDeg >= 0);
    SensorTestLogger logger = getTestLogger();
    logger.logInstructions(instructionsResId);
    waitForUserToBegin();
    logger.logWaitForSound();
    TestSensorEnvironment environment = new TestSensorEnvironment(getApplicationContext(), Sensor.TYPE_GYROSCOPE, SensorManager.SENSOR_DELAY_FASTEST);
    TestSensorOperation sensorOperation = TestSensorOperation.createOperation(environment, ROTATION_COLLECTION_SEC, TimeUnit.SECONDS);
    int gyroscopeAxes = environment.getSensorAxesCount();
    int[] expectationsDeg = getExpectationsDeg(gyroscopeAxes, rotationAxis, expectationDeg);
    float[] thresholdsDeg = getThresholdsDeg(gyroscopeAxes, rotationAxis);
    GyroscopeIntegrationVerification integrationVerification = new GyroscopeIntegrationVerification(expectationsDeg, thresholdsDeg);
    sensorOperation.addVerification(integrationVerification);
    try {
        sensorOperation.execute(getCurrentTestNode());
    } finally {
        playSound();
    }
    return null;
}