• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2017 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.frameworks.sensorservice@1.0;
18
19import android.hardware.sensors@1.0::RateLevel;
20
21/**
22 * The interface represents a direct channel created by
23 * ISensorManager.createSharedMemoryDirectChannel() and
24 * ISensorMangaer.createHardwareBufferDirectChannel().
25 */
26interface IDirectReportChannel {
27
28    /**
29     * Configure direct report on channel
30     *
31     * Configure sensor direct report on a direct channel: set rate to value
32     * other than STOP so that sensor event can be directly written into the
33     * shared memory region used for creating the channel; set rate to STOP will
34     * stop the sensor direct report.
35     *
36     * To stop all active sensor direct report configured to a channel, set
37     * sensorHandle to -1 and rate to STOP.
38     *
39     * @param  sensorHandle handle of the sensor to operate on. If it is -1
40     *                      and rate is STOP, the call must stop of all active
41     *                      sensor direct report.
42     * @param  rate         rate level value to set on the specified sensor.
43     *
44     * @return result      OK on success;
45     *                     BAD_VALUE if parameter is invalid (for example,
46     *                     rate level is not supported by sensor, etc);
47     *                     INVALID_OPERATION if functionality is not supported.
48     * @return token       the token used to distinguish sensor events from
49     *                     multiple different sensors of the same type in a
50     *                     single direct channel, or 0 if: (1) no such token
51     *                     may be returned or (2) error (in which case result
52     *                     must be value other than OK).
53     */
54    configure(int32_t sensorHandle, RateLevel rate)
55            generates (int32_t token, Result result);
56};
57