1/*
2 * Copyright (C) 2018 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.vibrator@1.3;
18
19import @1.0::EffectStrength;
20import @1.0::Status;
21import @1.2::IVibrator;
22
23interface IVibrator extends @1.2::IVibrator {
24  /**
25   * Returns whether the vibrator supports control through an alternate interface.
26   */
27  supportsExternalControl() generates (bool supports);
28
29  /**
30   * Enables/disables control override of vibrator to audio.
31   *
32   * When this API is set, the vibrator control should be ceded to audio system
33   * for haptic audio. While this is enabled, issuing of other commands to control
34   * the vibrator is unsupported and the resulting behavior is undefined. Amplitude
35   * control may or may not be supported and is reflected in the return value of
36   * supportsAmplitudeControl() while this is enabled. When this is disabled, the
37   * vibrator should resume to an off state.
38   *
39   * @param enabled Whether external control should be enabled or disabled.
40   * @return status Whether the command was successful or not. Must return
41   *                Status::UNSUPPORTED_OPERATION if external control is
42   *                not supported by the device.
43   */
44  setExternalControl(bool enabled) generates (Status status);
45
46  /**
47   * Fire off a predefined haptic event.
48   *
49   * @param event The type of haptic event to trigger.
50   * @return status Whether the effect was successfully performed or not. Must
51   *     return Status::UNSUPPORTED_OPERATION if the effect is not supported.
52   * @return lengthMs The length of time the event is expected to take in
53   *     milliseconds. This doesn't need to be perfectly accurate, but should be a reasonable
54   *     approximation. Should be a positive, non-zero value if the returned status is Status::OK,
55   *     and set to 0 otherwise.
56   */
57  perform_1_3(Effect effect, EffectStrength strength)
58          generates (Status status, uint32_t lengthMs);
59};
60