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