SensorListener.java revision 54b6cfa9a9e5b861a9930af873580d6dc20f773c
1/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware;
18
19/**
20 * Used for receiving notifications from the SensorManager when
21 * sensor values have changed.
22 */
23public interface SensorListener {
24
25    /**
26     * Called when sensor values have changed.
27     * The length and contents of the values array vary
28     * depending on which sensor is being monitored.
29     * See {@link android.hardware.SensorManager SensorManager}
30     * for details on possible sensor types and values.
31     *
32     * @param sensor The ID of the sensor being monitored
33     * @param values The new values for the sensor
34     */
35    public void onSensorChanged(int sensor, float[] values);
36
37    /**
38     * Called when the accuracy of a sensor has changed.
39     * See {@link android.hardware.SensorManager SensorManager}
40     * for details.
41     *
42     * @param sensor The ID of the sensor being monitored
43     * @param accuracy The new accuracy of this sensor
44     */
45    public void onAccuracyChanged(int sensor, int accuracy);
46}
47