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
17package android.hardware.soundtrigger@2.3;
18
19import android.hidl.safe_union@1.0::Monostate;
20import @2.0::ISoundTriggerHw.Properties;
21import @2.1::ISoundTriggerHw.RecognitionConfig;
22
23/**
24 * AudioCapabilities supported by the implemented HAL
25 * driver.
26 */
27enum AudioCapabilities : uint32_t {
28    /**
29     * If set the underlying module supports AEC.
30     */
31    ECHO_CANCELLATION = 1 << 0,
32    /**
33     * If set, the underlying module supports noise suppression.
34     */
35    NOISE_SUPPRESSION = 1 << 1,
36};
37
38/**
39 * Extended implementation properties providing verbose implementation
40 * details.
41 */
42struct Properties {
43    @2.0::ISoundTriggerHw.Properties base;
44
45    /**
46     * String naming the architecture used for running the supported models.
47     * (eg. DSP architecture)
48     */
49    string supportedModelArch;
50
51    /**
52     * Bit field encoding of the AudioCapabilities
53     * supported by the firmware.
54     */
55    bitfield<AudioCapabilities> audioCapabilities;
56};
57
58/**
59 * Configuration for sound trigger capture session passed to
60 * startRecognition_2_1() method.
61 */
62struct RecognitionConfig {
63    @2.1::ISoundTriggerHw.RecognitionConfig base;
64
65    /**
66     * Bit field encoding of the AudioCapabilities
67     * supported by the firmware.
68     */
69    bitfield<AudioCapabilities> audioCapabilities;
70};
71
72/**
73 * Model specific parameters to be used with parameter set and get APIs
74 */
75enum ModelParameter : int32_t {
76    /**
77     * Placeholder for invalid model parameter used for returning error or
78     * passing an invalid value.
79     */
80    INVALID = -1,
81
82    /**
83     * Controls the sensitivity threshold adjustment factor for a given model.
84     * Negative value corresponds to less sensitive model (high threshold) and
85     * a positive value corresponds to a more sensitive model (low threshold).
86     * Default value is 0.
87     */
88    THRESHOLD_FACTOR = 0
89};
90
91/**
92 * Safe union wrapping ModelParameterRange.
93 * Monostate is used to indicate there is no valid range
94 */
95safe_union OptionalModelParameterRange {
96    Monostate noinit;
97    ModelParameterRange range;
98};
99
100/**
101 * Model specific range support for a given parameter
102 */
103struct ModelParameterRange {
104    /**
105     * start of supported value range inclusive
106     */
107    int32_t start;
108    /**
109     * end of supported value range inclusive
110     */
111    int32_t end;
112};
113