xref: /aosp_15_r20/hardware/interfaces/sensors/2.0/ISensors.hal (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1*4d7e907cSAndroid Build Coastguard Worker/*
2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2018 The Android Open Source Project
3*4d7e907cSAndroid Build Coastguard Worker *
4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at
7*4d7e907cSAndroid Build Coastguard Worker *
8*4d7e907cSAndroid Build Coastguard Worker *      http://www.apache.org/licenses/LICENSE-2.0
9*4d7e907cSAndroid Build Coastguard Worker *
10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License.
15*4d7e907cSAndroid Build Coastguard Worker */
16*4d7e907cSAndroid Build Coastguard Worker
17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected];
18*4d7e907cSAndroid Build Coastguard Worker
19*4d7e907cSAndroid Build Coastguard Workerimport @1.0::Event;
20*4d7e907cSAndroid Build Coastguard Workerimport @1.0::OperationMode;
21*4d7e907cSAndroid Build Coastguard Workerimport @1.0::RateLevel;
22*4d7e907cSAndroid Build Coastguard Workerimport @1.0::Result;
23*4d7e907cSAndroid Build Coastguard Workerimport @1.0::SensorInfo;
24*4d7e907cSAndroid Build Coastguard Workerimport @1.0::SharedMemInfo;
25*4d7e907cSAndroid Build Coastguard Workerimport @2.0::ISensorsCallback;
26*4d7e907cSAndroid Build Coastguard Worker
27*4d7e907cSAndroid Build Coastguard Workerinterface ISensors {
28*4d7e907cSAndroid Build Coastguard Worker    /**
29*4d7e907cSAndroid Build Coastguard Worker     * Enumerate all available (static) sensors.
30*4d7e907cSAndroid Build Coastguard Worker     *
31*4d7e907cSAndroid Build Coastguard Worker     * The SensorInfo for each sensor returned by getSensorsList must be stable
32*4d7e907cSAndroid Build Coastguard Worker     * from the initial call to getSensorsList after a device boot until the
33*4d7e907cSAndroid Build Coastguard Worker     * entire system restarts. The SensorInfo for each sensor must not change
34*4d7e907cSAndroid Build Coastguard Worker     * between subsequent calls to getSensorsList, even across restarts of the
35*4d7e907cSAndroid Build Coastguard Worker     * HAL and its dependencies (for example, the sensor handle for a given
36*4d7e907cSAndroid Build Coastguard Worker     * sensor must not change across HAL restarts).
37*4d7e907cSAndroid Build Coastguard Worker     */
38*4d7e907cSAndroid Build Coastguard Worker    getSensorsList() generates (vec<SensorInfo> list);
39*4d7e907cSAndroid Build Coastguard Worker
40*4d7e907cSAndroid Build Coastguard Worker    /**
41*4d7e907cSAndroid Build Coastguard Worker     * Place the module in a specific mode. The following modes are defined
42*4d7e907cSAndroid Build Coastguard Worker     *
43*4d7e907cSAndroid Build Coastguard Worker     *  SENSOR_HAL_NORMAL_MODE - Normal operation. Default state of the module.
44*4d7e907cSAndroid Build Coastguard Worker     *
45*4d7e907cSAndroid Build Coastguard Worker     *  SENSOR_HAL_DATA_INJECTION_MODE - Loopback mode.
46*4d7e907cSAndroid Build Coastguard Worker     *    Data is injected for the supported sensors by the sensor service in
47*4d7e907cSAndroid Build Coastguard Worker     *    this mode.
48*4d7e907cSAndroid Build Coastguard Worker     *
49*4d7e907cSAndroid Build Coastguard Worker     * @return OK on success
50*4d7e907cSAndroid Build Coastguard Worker     *     BAD_VALUE if requested mode is not supported
51*4d7e907cSAndroid Build Coastguard Worker     *     PERMISSION_DENIED if operation is not allowed
52*4d7e907cSAndroid Build Coastguard Worker     */
53*4d7e907cSAndroid Build Coastguard Worker    setOperationMode(OperationMode mode) generates (Result result);
54*4d7e907cSAndroid Build Coastguard Worker
55*4d7e907cSAndroid Build Coastguard Worker    /**
56*4d7e907cSAndroid Build Coastguard Worker     * Activate/de-activate one sensor.
57*4d7e907cSAndroid Build Coastguard Worker     *
58*4d7e907cSAndroid Build Coastguard Worker     * After sensor de-activation, existing sensor events that have not
59*4d7e907cSAndroid Build Coastguard Worker     * been written to the event queue must be abandoned immediately so that
60*4d7e907cSAndroid Build Coastguard Worker     * subsequent activations do not get stale sensor events (events
61*4d7e907cSAndroid Build Coastguard Worker     * that are generated prior to the latter activation).
62*4d7e907cSAndroid Build Coastguard Worker     *
63*4d7e907cSAndroid Build Coastguard Worker     * @param sensorHandle is the handle of the sensor to change.
64*4d7e907cSAndroid Build Coastguard Worker     * @param enabled set to true to enable, or false to disable the sensor.
65*4d7e907cSAndroid Build Coastguard Worker     * @return result OK on success, BAD_VALUE if sensorHandle is invalid.
66*4d7e907cSAndroid Build Coastguard Worker     */
67*4d7e907cSAndroid Build Coastguard Worker    activate(int32_t sensorHandle, bool enabled) generates (Result result);
68*4d7e907cSAndroid Build Coastguard Worker
69*4d7e907cSAndroid Build Coastguard Worker    /**
70*4d7e907cSAndroid Build Coastguard Worker     * Initialize the Sensors HAL's Fast Message Queues (FMQ) and callback.
71*4d7e907cSAndroid Build Coastguard Worker     *
72*4d7e907cSAndroid Build Coastguard Worker     * The Fast Message Queues (FMQ) that are used to send data between the
73*4d7e907cSAndroid Build Coastguard Worker     * framework and the HAL. The callback is used by the HAL to notify the
74*4d7e907cSAndroid Build Coastguard Worker     * framework of asynchronous events, such as a dynamic sensor connection.
75*4d7e907cSAndroid Build Coastguard Worker     *
76*4d7e907cSAndroid Build Coastguard Worker     * The Event FMQ is used to transport sensor events from the HAL to the
77*4d7e907cSAndroid Build Coastguard Worker     * framework. The Event FMQ is created using the eventQueueDescriptor.
78*4d7e907cSAndroid Build Coastguard Worker     * Data may only be written to the Event FMQ. Data must not be read from
79*4d7e907cSAndroid Build Coastguard Worker     * the Event FMQ since the framework is the only reader. Upon receiving
80*4d7e907cSAndroid Build Coastguard Worker     * sensor events, the HAL writes the sensor events to the Event FMQ.
81*4d7e907cSAndroid Build Coastguard Worker     *
82*4d7e907cSAndroid Build Coastguard Worker     * Once the HAL is finished writing sensor events to the Event FMQ, the HAL
83*4d7e907cSAndroid Build Coastguard Worker     * must notify the framework that sensor events are available to be read and
84*4d7e907cSAndroid Build Coastguard Worker     * processed. This is accomplished by either:
85*4d7e907cSAndroid Build Coastguard Worker     *     1) Calling the Event FMQ’s EventFlag::wake() function with
86*4d7e907cSAndroid Build Coastguard Worker              EventQueueFlagBits::READ_AND_PROCESS
87*4d7e907cSAndroid Build Coastguard Worker     *     2) Setting the write notification in the Event FMQ’s writeBlocking()
88*4d7e907cSAndroid Build Coastguard Worker     *        function to EventQueueFlagBits::READ_AND_PROCESS.
89*4d7e907cSAndroid Build Coastguard Worker     *
90*4d7e907cSAndroid Build Coastguard Worker     * If the Event FMQ’s writeBlocking() function is used, the read
91*4d7e907cSAndroid Build Coastguard Worker     * notification must be set to EventQueueFlagBits::EVENTS_READ in order to
92*4d7e907cSAndroid Build Coastguard Worker     * be notified and unblocked when the framework has successfully read events
93*4d7e907cSAndroid Build Coastguard Worker     * from the Event FMQ.
94*4d7e907cSAndroid Build Coastguard Worker     *
95*4d7e907cSAndroid Build Coastguard Worker     * The Wake Lock FMQ is used by the framework to notify the HAL when it is
96*4d7e907cSAndroid Build Coastguard Worker     * safe to release its wake_lock. When the framework receives WAKE_UP events
97*4d7e907cSAndroid Build Coastguard Worker     * from the Event FMQ and the framework has acquired a wake_lock, the
98*4d7e907cSAndroid Build Coastguard Worker     * framework must write the number of WAKE_UP events processed to the Wake
99*4d7e907cSAndroid Build Coastguard Worker     * Lock FMQ. When the HAL reads the data from the Wake Lock FMQ, the HAL
100*4d7e907cSAndroid Build Coastguard Worker     * decrements its current count of unprocessed WAKE_UP events and releases
101*4d7e907cSAndroid Build Coastguard Worker     * its wake_lock if the current count of unprocessed WAKE_UP events is
102*4d7e907cSAndroid Build Coastguard Worker     * zero. It is important to note that the HAL must acquire the wake lock and
103*4d7e907cSAndroid Build Coastguard Worker     * update its internal state regarding the number of outstanding WAKE_UP
104*4d7e907cSAndroid Build Coastguard Worker     * events _before_ posting the event to the Wake Lock FMQ, in order to avoid
105*4d7e907cSAndroid Build Coastguard Worker     * a race condition that can lead to loss of wake lock synchronization with
106*4d7e907cSAndroid Build Coastguard Worker     * the framework.
107*4d7e907cSAndroid Build Coastguard Worker     *
108*4d7e907cSAndroid Build Coastguard Worker     * The framework must use the WakeLockQueueFlagBits::DATA_WRITTEN value to
109*4d7e907cSAndroid Build Coastguard Worker     * notify the HAL that data has been written to the Wake Lock FMQ and must
110*4d7e907cSAndroid Build Coastguard Worker     * be read by HAL.
111*4d7e907cSAndroid Build Coastguard Worker     *
112*4d7e907cSAndroid Build Coastguard Worker     * The ISensorsCallback is used by the HAL to notify the framework of
113*4d7e907cSAndroid Build Coastguard Worker     * asynchronous events, such as a dynamic sensor connection.
114*4d7e907cSAndroid Build Coastguard Worker     *
115*4d7e907cSAndroid Build Coastguard Worker     * The name of any wake_lock acquired by the Sensors HAL for WAKE_UP events
116*4d7e907cSAndroid Build Coastguard Worker     * must begin with "SensorsHAL_WAKEUP".
117*4d7e907cSAndroid Build Coastguard Worker     *
118*4d7e907cSAndroid Build Coastguard Worker     * If WAKE_LOCK_TIMEOUT_SECONDS has elapsed since the most recent WAKE_UP
119*4d7e907cSAndroid Build Coastguard Worker     * event was written to the Event FMQ without receiving a message on the
120*4d7e907cSAndroid Build Coastguard Worker     * Wake Lock FMQ, then any held wake_lock for WAKE_UP events must be
121*4d7e907cSAndroid Build Coastguard Worker     * released.
122*4d7e907cSAndroid Build Coastguard Worker     *
123*4d7e907cSAndroid Build Coastguard Worker     * If either the Event FMQ or the Wake Lock FMQ is already initialized when
124*4d7e907cSAndroid Build Coastguard Worker     * initialize is invoked, then both existing FMQs must be discarded and the
125*4d7e907cSAndroid Build Coastguard Worker     * new descriptors must be used to create new FMQs within the HAL. The
126*4d7e907cSAndroid Build Coastguard Worker     * number of outstanding WAKE_UP events should also be reset to zero, and
127*4d7e907cSAndroid Build Coastguard Worker     * any outstanding wake_locks held as a result of WAKE_UP events should be
128*4d7e907cSAndroid Build Coastguard Worker     * released.
129*4d7e907cSAndroid Build Coastguard Worker     *
130*4d7e907cSAndroid Build Coastguard Worker     * All active sensor requests and direct channels must be closed and
131*4d7e907cSAndroid Build Coastguard Worker     * properly cleaned up when initialize is called in order to ensure that the
132*4d7e907cSAndroid Build Coastguard Worker     * HAL and framework's state is consistent (e.g. after a runtime restart).
133*4d7e907cSAndroid Build Coastguard Worker     *
134*4d7e907cSAndroid Build Coastguard Worker     * initialize must be thread safe and prevent concurrent calls
135*4d7e907cSAndroid Build Coastguard Worker     * to initialize from simultaneously modifying state.
136*4d7e907cSAndroid Build Coastguard Worker     *
137*4d7e907cSAndroid Build Coastguard Worker     * @param eventQueueDescriptor Fast Message Queue descriptor that is used to
138*4d7e907cSAndroid Build Coastguard Worker     *     create the Event FMQ which is where sensor events are written. The
139*4d7e907cSAndroid Build Coastguard Worker     *     descriptor is obtained from the framework's FMQ that is used to read
140*4d7e907cSAndroid Build Coastguard Worker     *     sensor events.
141*4d7e907cSAndroid Build Coastguard Worker     * @param wakeLockDescriptor Fast Message Queue descriptor that is used to
142*4d7e907cSAndroid Build Coastguard Worker     *     create the Wake Lock FMQ which is where wake_lock events are read
143*4d7e907cSAndroid Build Coastguard Worker     *     from. The descriptor is obtained from the framework's FMQ that is
144*4d7e907cSAndroid Build Coastguard Worker     *     used to write wake_lock events.
145*4d7e907cSAndroid Build Coastguard Worker     * @param sensorsCallback sensors callback that receives asynchronous data
146*4d7e907cSAndroid Build Coastguard Worker     *     from the Sensors HAL.
147*4d7e907cSAndroid Build Coastguard Worker     * @return result OK on success; BAD_VALUE if descriptor is invalid (such
148*4d7e907cSAndroid Build Coastguard Worker     *     as null)
149*4d7e907cSAndroid Build Coastguard Worker     */
150*4d7e907cSAndroid Build Coastguard Worker    @entry
151*4d7e907cSAndroid Build Coastguard Worker    @callflow(next = {"getSensorsList"})
152*4d7e907cSAndroid Build Coastguard Worker    initialize(fmq_sync<Event> eventQueueDescriptor,
153*4d7e907cSAndroid Build Coastguard Worker               fmq_sync<uint32_t> wakeLockDescriptor,
154*4d7e907cSAndroid Build Coastguard Worker               ISensorsCallback sensorsCallback)
155*4d7e907cSAndroid Build Coastguard Worker        generates
156*4d7e907cSAndroid Build Coastguard Worker              (Result result);
157*4d7e907cSAndroid Build Coastguard Worker
158*4d7e907cSAndroid Build Coastguard Worker    /**
159*4d7e907cSAndroid Build Coastguard Worker     * Sets a sensor’s parameters, including sampling frequency and maximum
160*4d7e907cSAndroid Build Coastguard Worker     * report latency. This function can be called while the sensor is
161*4d7e907cSAndroid Build Coastguard Worker     * activated, in which case it must not cause any sensor measurements to
162*4d7e907cSAndroid Build Coastguard Worker     * be lost: transitioning from one sampling rate to the other cannot cause
163*4d7e907cSAndroid Build Coastguard Worker     * lost events, nor can transitioning from a high maximum report latency to
164*4d7e907cSAndroid Build Coastguard Worker     * a low maximum report latency.
165*4d7e907cSAndroid Build Coastguard Worker     *
166*4d7e907cSAndroid Build Coastguard Worker     * @param sensorHandle handle of sensor to be changed.
167*4d7e907cSAndroid Build Coastguard Worker     * @param samplingPeriodNs specifies sensor sample period in nanoseconds.
168*4d7e907cSAndroid Build Coastguard Worker     * @param maxReportLatencyNs allowed delay time before an event is sampled
169*4d7e907cSAndroid Build Coastguard Worker     *     to time of report.
170*4d7e907cSAndroid Build Coastguard Worker     * @return result OK on success, BAD_VALUE if any parameters are invalid.
171*4d7e907cSAndroid Build Coastguard Worker     */
172*4d7e907cSAndroid Build Coastguard Worker    batch(int32_t sensorHandle,
173*4d7e907cSAndroid Build Coastguard Worker          int64_t samplingPeriodNs,
174*4d7e907cSAndroid Build Coastguard Worker          int64_t maxReportLatencyNs)
175*4d7e907cSAndroid Build Coastguard Worker        generates (
176*4d7e907cSAndroid Build Coastguard Worker          Result result);
177*4d7e907cSAndroid Build Coastguard Worker
178*4d7e907cSAndroid Build Coastguard Worker    /**
179*4d7e907cSAndroid Build Coastguard Worker     * Trigger a flush of internal FIFO.
180*4d7e907cSAndroid Build Coastguard Worker     *
181*4d7e907cSAndroid Build Coastguard Worker     * Flush adds a FLUSH_COMPLETE metadata event to the end of the "batch mode"
182*4d7e907cSAndroid Build Coastguard Worker     * FIFO for the specified sensor and flushes the FIFO.  If the FIFO is empty
183*4d7e907cSAndroid Build Coastguard Worker     * or if the sensor doesn't support batching (FIFO size zero), return
184*4d7e907cSAndroid Build Coastguard Worker     * SUCCESS and add a trivial FLUSH_COMPLETE event added to the event stream.
185*4d7e907cSAndroid Build Coastguard Worker     * This applies to all sensors other than one-shot sensors. If the sensor
186*4d7e907cSAndroid Build Coastguard Worker     * is a one-shot sensor, flush must return BAD_VALUE and not generate any
187*4d7e907cSAndroid Build Coastguard Worker     * flush complete metadata.  If the sensor is not active at the time flush()
188*4d7e907cSAndroid Build Coastguard Worker     * is called, flush() return BAD_VALUE.
189*4d7e907cSAndroid Build Coastguard Worker     *
190*4d7e907cSAndroid Build Coastguard Worker     * @param sensorHandle handle of sensor to be flushed.
191*4d7e907cSAndroid Build Coastguard Worker     * @return result OK on success and BAD_VALUE if sensorHandle is invalid.
192*4d7e907cSAndroid Build Coastguard Worker     */
193*4d7e907cSAndroid Build Coastguard Worker    flush(int32_t sensorHandle) generates (Result result);
194*4d7e907cSAndroid Build Coastguard Worker
195*4d7e907cSAndroid Build Coastguard Worker    /**
196*4d7e907cSAndroid Build Coastguard Worker     * Inject a single sensor event or push operation environment parameters to
197*4d7e907cSAndroid Build Coastguard Worker     * device.
198*4d7e907cSAndroid Build Coastguard Worker     *
199*4d7e907cSAndroid Build Coastguard Worker     * When device is in NORMAL mode, this function is called to push operation
200*4d7e907cSAndroid Build Coastguard Worker     * environment data to device. In this operation, Event is always of
201*4d7e907cSAndroid Build Coastguard Worker     * SensorType::AdditionalInfo type. See operation evironment parameters
202*4d7e907cSAndroid Build Coastguard Worker     * section in AdditionalInfoType.
203*4d7e907cSAndroid Build Coastguard Worker     *
204*4d7e907cSAndroid Build Coastguard Worker     * When device is in DATA_INJECTION mode, this function is also used for
205*4d7e907cSAndroid Build Coastguard Worker     * injecting sensor events.
206*4d7e907cSAndroid Build Coastguard Worker     *
207*4d7e907cSAndroid Build Coastguard Worker     * Regardless of OperationMode, injected SensorType::ADDITIONAL_INFO
208*4d7e907cSAndroid Build Coastguard Worker     * type events should not be routed back to the sensor event queue.
209*4d7e907cSAndroid Build Coastguard Worker     *
210*4d7e907cSAndroid Build Coastguard Worker     * @see AdditionalInfoType
211*4d7e907cSAndroid Build Coastguard Worker     * @see OperationMode
212*4d7e907cSAndroid Build Coastguard Worker     * @param event sensor event to be injected
213*4d7e907cSAndroid Build Coastguard Worker     * @return result OK on success; PERMISSION_DENIED if operation is not
214*4d7e907cSAndroid Build Coastguard Worker     *     allowed; INVALID_OPERATION, if this functionality is unsupported;
215*4d7e907cSAndroid Build Coastguard Worker     *     BAD_VALUE if sensor event cannot be injected.
216*4d7e907cSAndroid Build Coastguard Worker     */
217*4d7e907cSAndroid Build Coastguard Worker    injectSensorData(Event event) generates (Result result);
218*4d7e907cSAndroid Build Coastguard Worker
219*4d7e907cSAndroid Build Coastguard Worker    /**
220*4d7e907cSAndroid Build Coastguard Worker     * Register direct report channel.
221*4d7e907cSAndroid Build Coastguard Worker     *
222*4d7e907cSAndroid Build Coastguard Worker     * Register a direct channel with supplied shared memory information. Upon
223*4d7e907cSAndroid Build Coastguard Worker     * return, the sensor hardware is responsible for resetting the memory
224*4d7e907cSAndroid Build Coastguard Worker     * content to initial value (depending on memory format settings).
225*4d7e907cSAndroid Build Coastguard Worker     *
226*4d7e907cSAndroid Build Coastguard Worker     * @param mem shared memory info data structure.
227*4d7e907cSAndroid Build Coastguard Worker     * @return result OK on success; BAD_VALUE if shared memory information is
228*4d7e907cSAndroid Build Coastguard Worker     *     not consistent; NO_MEMORY if shared memory cannot be used by sensor
229*4d7e907cSAndroid Build Coastguard Worker     *     system; INVALID_OPERATION if functionality is not supported.
230*4d7e907cSAndroid Build Coastguard Worker     * @return channelHandle a positive integer used for referencing registered
231*4d7e907cSAndroid Build Coastguard Worker     *     direct channel (>0) in configureDirectReport and
232*4d7e907cSAndroid Build Coastguard Worker     *     unregisterDirectChannel if result is OK, -1 otherwise.
233*4d7e907cSAndroid Build Coastguard Worker     */
234*4d7e907cSAndroid Build Coastguard Worker    registerDirectChannel(SharedMemInfo mem)
235*4d7e907cSAndroid Build Coastguard Worker               generates (Result result,
236*4d7e907cSAndroid Build Coastguard Worker                          int32_t channelHandle);
237*4d7e907cSAndroid Build Coastguard Worker
238*4d7e907cSAndroid Build Coastguard Worker    /**
239*4d7e907cSAndroid Build Coastguard Worker     * Unregister direct report channel.
240*4d7e907cSAndroid Build Coastguard Worker     *
241*4d7e907cSAndroid Build Coastguard Worker     * Unregister a direct channel previously registered using
242*4d7e907cSAndroid Build Coastguard Worker     * registerDirectChannel, and remove all active sensor report configured in
243*4d7e907cSAndroid Build Coastguard Worker     * still active sensor report configured in the direct channel.
244*4d7e907cSAndroid Build Coastguard Worker     *
245*4d7e907cSAndroid Build Coastguard Worker     * @param channelHandle handle of direct channel to be unregistered.
246*4d7e907cSAndroid Build Coastguard Worker     * @return result OK if direct report is supported; INVALID_OPERATION
247*4d7e907cSAndroid Build Coastguard Worker     *     otherwise.
248*4d7e907cSAndroid Build Coastguard Worker     */
249*4d7e907cSAndroid Build Coastguard Worker    unregisterDirectChannel(int32_t channelHandle) generates (Result result);
250*4d7e907cSAndroid Build Coastguard Worker
251*4d7e907cSAndroid Build Coastguard Worker    /**
252*4d7e907cSAndroid Build Coastguard Worker     * Configure direct sensor event report in direct channel.
253*4d7e907cSAndroid Build Coastguard Worker     *
254*4d7e907cSAndroid Build Coastguard Worker     * This function start, modify rate or stop direct report of a sensor in a
255*4d7e907cSAndroid Build Coastguard Worker     * certain direct channel.
256*4d7e907cSAndroid Build Coastguard Worker     *
257*4d7e907cSAndroid Build Coastguard Worker     * @param sensorHandle handle of sensor to be configured. When combined
258*4d7e907cSAndroid Build Coastguard Worker     *     with STOP rate, sensorHandle can be -1 to denote all active sensors
259*4d7e907cSAndroid Build Coastguard Worker     *     in the direct channel specified by channel Handle.
260*4d7e907cSAndroid Build Coastguard Worker     * @param channelHandle handle of direct channel to be configured.
261*4d7e907cSAndroid Build Coastguard Worker     * @param rate rate level, see RateLevel enum.
262*4d7e907cSAndroid Build Coastguard Worker     * @return result OK on success; BAD_VALUE if parameter is invalid (such as
263*4d7e907cSAndroid Build Coastguard Worker     *     rate level is not supported by sensor, channelHandle does not exist,
264*4d7e907cSAndroid Build Coastguard Worker     *     etc); INVALID_OPERATION if functionality is not supported.
265*4d7e907cSAndroid Build Coastguard Worker     * @return reportToken positive integer to identify multiple sensors of
266*4d7e907cSAndroid Build Coastguard Worker     *     the same type in a single direct channel. Ignored if rate is STOP.
267*4d7e907cSAndroid Build Coastguard Worker     *     See SharedMemFormat.
268*4d7e907cSAndroid Build Coastguard Worker     */
269*4d7e907cSAndroid Build Coastguard Worker    configDirectReport(
270*4d7e907cSAndroid Build Coastguard Worker            int32_t sensorHandle,
271*4d7e907cSAndroid Build Coastguard Worker            int32_t channelHandle,
272*4d7e907cSAndroid Build Coastguard Worker            RateLevel rate
273*4d7e907cSAndroid Build Coastguard Worker        ) generates (
274*4d7e907cSAndroid Build Coastguard Worker            Result result,
275*4d7e907cSAndroid Build Coastguard Worker            int32_t reportToken);
276*4d7e907cSAndroid Build Coastguard Worker};
277