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