1/*
2 * Copyright 2017 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.1;
18
19import @2.0::ISoundTriggerHwCallback;
20import @2.0::PhraseRecognitionExtra;
21
22/**
23 * SoundTrigger HAL Callback interface. Obtained during SoundTrigger setup.
24 */
25interface ISoundTriggerHwCallback extends @2.0::ISoundTriggerHwCallback {
26
27    /**
28     * Generic recognition event sent via recognition callback.
29     */
30    struct RecognitionEvent {
31        /** Event header. Any data contained in the 'header.data' field
32         * is ignored */
33        @2.0::ISoundTriggerHwCallback.RecognitionEvent header;
34        /** Opaque event data */
35        memory data;
36    };
37
38    /**
39     * Specialized recognition event for key phrase recognitions.
40     */
41    struct PhraseRecognitionEvent {
42        /** Common part of the recognition event */
43        RecognitionEvent common;
44        /** List of descriptors for each recognized key phrase */
45        vec<PhraseRecognitionExtra> phraseExtras;
46    };
47
48    /**
49     * Event sent via load sound model callback.
50     */
51    struct ModelEvent {
52        /** Event header. Any data contained in the 'header.data' field
53         * is ignored */
54        @2.0::ISoundTriggerHwCallback.ModelEvent header;
55        /** Opaque event data, passed transparently by the framework */
56        memory data;
57    };
58
59    /**
60     * Callback method called by the HAL when the sound recognition triggers.
61     *
62     * @param event A RecognitionEvent structure containing detailed results
63     *     of the recognition triggered
64     * @param cookie The cookie passed by the framework when recognition was
65     *     started (see ISoundtriggerHw.startRecognition*())
66     */
67    recognitionCallback_2_1(RecognitionEvent event, CallbackCookie cookie);
68
69    /**
70     * Callback method called by the HAL when the sound recognition triggers
71     * for a key phrase sound model.
72     *
73     * @param event A RecognitionEvent structure containing detailed results
74     *     of the recognition triggered
75     * @param cookie The cookie passed by the framework when recognition was
76     *     started (see ISoundtriggerHw.startRecognition*())
77     */
78    phraseRecognitionCallback_2_1(PhraseRecognitionEvent event,
79                                  CallbackCookie cookie);
80
81    /**
82     * Callback method called by the HAL when the sound model loading completes.
83     *
84     * @param event A ModelEvent structure containing detailed results of the
85     *     model loading operation
86     * @param cookie The cookie passed by the framework when loading was
87     *     initiated (see ISoundtriggerHw.loadSoundModel*())
88     */
89    soundModelCallback_2_1(ModelEvent event, CallbackCookie cookie);
90};
91