Nicholas Ambur | 1e90019 | 2019-10-01 13:11:26 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 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 | |
| 17 | package android.hardware.soundtrigger@2.3; |
| 18 | |
| 19 | import @2.0::SoundModelHandle; |
| 20 | import @2.2::ISoundTriggerHw; |
| 21 | |
| 22 | /** |
| 23 | * SoundTrigger HAL interface. Used for hardware recognition of hotwords |
| 24 | * and other sounds. |
| 25 | */ |
| 26 | interface ISoundTriggerHw extends @2.2::ISoundTriggerHw { |
| 27 | |
| 28 | /** |
Nicholas Ambur | cb49463 | 2019-12-08 21:52:36 -0800 | [diff] [blame] | 29 | * Retrieve extended implementation properties. |
| 30 | * The returned properties includes what is returned from the |
| 31 | * getProperties along with expanded implementation details. |
| 32 | * |
| 33 | * @return retval Operation completion status: 0 in case of success, |
| 34 | * -ENODEV in case of initialization error. |
| 35 | * @return properties A Properties structure containing implementation |
| 36 | * description and capabilities. |
| 37 | */ |
| 38 | getProperties_2_3() generates (int32_t retval, Properties properties); |
| 39 | |
| 40 | /** |
Nicholas Ambur | 1e90019 | 2019-10-01 13:11:26 -0700 | [diff] [blame] | 41 | * Set a model specific parameter with the given value. This parameter |
| 42 | * will keep its value for the duration the model is loaded regardless of starting and stopping |
| 43 | * recognition. Once the model is unloaded, the value will be lost. |
| 44 | * It is expected to check if the handle supports the parameter via the queryParameter |
| 45 | * API prior to calling this method. |
| 46 | * |
| 47 | * @param modelHandle The sound model handle indicating which model to modify parameters |
| 48 | * @param modelParam Parameter to set which will be validated against the |
| 49 | * ModelParameter type. Not putting ModelParameter type |
| 50 | * directly in the definition and validating internally |
| 51 | * allows for forward compatibility. |
| 52 | * @param value The value to set for the given model parameter |
| 53 | * @return status Operation completion status: 0 in case of success, |
| 54 | * -ENODEV if the native service cannot be reached |
| 55 | * -EINVAL invalid input parameter |
| 56 | */ |
| 57 | setParameter(SoundModelHandle modelHandle, ModelParameter modelParam, int32_t value) |
| 58 | generates (int32_t status); |
| 59 | |
| 60 | /** |
| 61 | * Get a model specific parameter. This parameter will keep its value |
| 62 | * for the duration the model is loaded regardless of starting and stopping recognition. |
| 63 | * Once the model is unloaded, the value will be lost. If the value is not set, a default |
| 64 | * value is returned. See ModelParameter for parameter default values. |
| 65 | * It is expected to check if the handle supports the parameter via the queryParameter |
| 66 | * API prior to calling this method. |
| 67 | * |
| 68 | * @param modelHandle The sound model associated with given modelParam |
| 69 | * @param modelParam Parameter to set which will be validated against the |
| 70 | * ModelParameter type. Not putting ModelParameter type |
| 71 | * directly in the definition and validating internally |
| 72 | * allows for forward compatibility. |
| 73 | * @return status Operation completion status: 0 in case of success, |
| 74 | * -ENODEV if the native service cannot be reached |
| 75 | * -EINVAL invalid input parameter |
| 76 | * @return value Value set to the requested parameter. Value is only set when status |
| 77 | * indicates success. |
| 78 | */ |
| 79 | getParameter(SoundModelHandle modelHandle, ModelParameter modelParam) |
| 80 | generates (int32_t status, int32_t value); |
| 81 | |
| 82 | /** |
| 83 | * Get supported parameter attributes with respect to the provided model |
| 84 | * handle. Along with determining the valid range, this API is also used |
| 85 | * to determine if a given parameter ID is supported at all by the |
| 86 | * modelHandle for use with getParameter and setParameter APIs. |
| 87 | * |
| 88 | * @param modelHandle The sound model handle indicating which model to query |
| 89 | * @param modelParam Parameter to set which will be validated against the |
| 90 | * ModelParameter type |
| 91 | * @return status Operation completion status: 0 in case of success |
| 92 | * -ENODEV if the native service cannot be reached |
| 93 | * -EINVAL invalid input parameter |
| 94 | * @return retval ModelParameter structure indicating supported attributes |
| 95 | * of the parameter for the given model handle |
| 96 | */ |
| 97 | queryParameter(SoundModelHandle modelHandle, ModelParameter modelParam) |
| 98 | generates (int32_t status, OptionalModelParameterRange retval); |
| 99 | }; |