1/*
2 * Copyright 2016 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.0;
18
19/**
20 * Sound model types modes used in ISoundTriggerHw.SoundModel
21 */
22enum SoundModelType : int32_t {
23    /** use for unspecified sound model type */
24    UNKNOWN   = -1,
25    /** use for key phrase sound models */
26    KEYPHRASE = 0,
27    /** use for all models other than keyphrase */
28    GENERIC   = 1,
29};
30
31typedef int32_t SoundModelHandle;
32
33
34/**
35 * Recognition modes used in ISoundTriggerHw.RecognitionConfig,
36 * ISoundTriggerHw.Properties or PhraseRecognitionExtra
37 */
38enum RecognitionMode : uint32_t {
39    /** simple voice trigger */
40    VOICE_TRIGGER       = (1 << 0),
41    /** trigger only if one user in model identified */
42    USER_IDENTIFICATION = (1 << 1),
43    /** trigger only if one user in mode authenticated */
44    USER_AUTHENTICATION = (1 << 2),
45    /** generic sound trigger */
46    GENERIC_TRIGGER     = (1 << 3),
47};
48
49/**
50 * Confidence level for each user in structure PhraseRecognitionExtra
51 */
52struct ConfidenceLevel {
53    /** user ID */
54    uint32_t userId;
55    /** confidence level in percent (0 - 100): */
56    /** - min level for recognition configuration */
57    /** - detected level for recognition event */
58    uint32_t levelPercent;
59};
60
61/**
62 * Specialized recognition event for key phrase detection
63 */
64struct PhraseRecognitionExtra {
65    /** keyphrase ID */
66    uint32_t id;
67    /** recognition modes used for this keyphrase */
68    uint32_t recognitionModes;
69    /** confidence level for mode RecognitionMode.VOICE_TRIGGER */
70    uint32_t confidenceLevel;
71    /**
72     * list of confidence levels per user for
73     * RecognitionMode.USER_IDENTIFICATION and
74     * RecognitionMode.USER_AUTHENTICATION */
75    vec<ConfidenceLevel> levels;
76};
77
78