/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.frameworks.sensorservice@1.0;

/**
 * An IEventQueue is an interface to manage an event queue created by
 * ISensorManager.
 */
interface IEventQueue {
    /**
     * Enable the selected sensor with a specified sampling period and
     * max batch report latency. If enableSensor is called multiple times on the
     * same sensor, the previous calls must be overridden by the last call.
     *
     * @param  sensorHandle the sensor to enable. Must be a sensor acquired from
     *                      the ISensorManager that creates this IEventQueue.
     * @param  samplingPeriodUs
     *                      sampling period in microseconds.
     * @param  maxBatchReportLatencyUs
     *                      max batch report latency in microseconds.
     * @return result       OK if successful, or
     *                      PERMISSION_DENIED, BAD_VALUE, INVALID_OPERATION,
     *                      NO_INIT for errors.
     */
    enableSensor(int32_t sensorHandle,
                 int32_t samplingPeriodUs,
                 int64_t maxBatchReportLatencyUs)
      generates (Result result);

    /**
     * Disable the selected sensor.
     *
     * @param  sensorHandle the sensor to disable. Must be a sensor acquired from
     *                      the ISensorManager that creates this IEventQueue.
     * @return result       OK if successful,
     *                      BAD_VALUE or NO_INIT for errors.
     */
    disableSensor(int32_t sensorHandle) generates (Result result);
};