1fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent/*
2fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent * Copyright 2016 The Android Open Source Project
3fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent *
4fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent * Licensed under the Apache License, Version 2.0 (the "License");
5fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent * you may not use this file except in compliance with the License.
6fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent * You may obtain a copy of the License at
7fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent *
8fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent *      http://www.apache.org/licenses/LICENSE-2.0
9fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent *
10fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent * Unless required by applicable law or agreed to in writing, software
11fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent * distributed under the License is distributed on an "AS IS" BASIS,
12fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent * See the License for the specific language governing permissions and
14fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent * limitations under the License.
15fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent */
16fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent
17fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurentpackage android.hardware.soundtrigger@2.0;
18fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent
19fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurentimport android.hardware.audio.common@2.0;
20fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent
21fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurentimport ISoundTriggerHwCallback;
22fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent
23fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurentinterface ISoundTriggerHw {
24fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent
2540d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber    /**
26fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * Sound trigger implementation descriptor read by the framework via
27fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * getProperties(). Used by SoundTrigger service to report to applications
28fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * and manage concurrency and policy.
29fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     */
30fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent    struct Properties {
3140d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** Implementor name */
32fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        string   implementor;
3340d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** Implementation description */
34fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        string   description;
3540d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** Implementation version */
36fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        uint32_t version;
3740d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /**
3840d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber         * Unique implementation ID. The UUID must change with each version of
39fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent           the engine implementation */
40fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        Uuid     uuid;
4140d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** Maximum number of concurrent sound models loaded */
42fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        uint32_t maxSoundModels;
4340d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** Maximum number of key phrases */
44fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        uint32_t maxKeyPhrases;
4540d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** Maximum number of concurrent users detected */
46fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        uint32_t maxUsers;
4740d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** All supported modes. e.g RecognitionMode.VOICE_TRIGGER */
48fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        uint32_t recognitionModes;
4940d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** Supports seamless transition from detection to capture */
50fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        bool     captureTransition;
5140d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** Maximum buffering capacity in ms if captureTransition is true */
52fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        uint32_t maxBufferMs;
5340d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** Supports capture by other use cases while detection is active */
54fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        bool     concurrentCapture;
5540d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** Returns the trigger capture in event */
56fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        bool     triggerInEvent;
5740d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /**
5840d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber         * Rated power consumption when detection is active with TDB
59fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent         * silence/sound/speech ratio */
60fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        uint32_t powerConsumptionMw;
61fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent    };
62fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent
63fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent
6440d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber    /**
65fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * Base sound model descriptor. This struct is the header of a larger block
66fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * passed to loadSoundModel() and contains the binary data of the
67fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * sound model.
68fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     */
69fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent    struct SoundModel {
7040d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** Model type. e.g. SoundModelType.KEYPHRASE */
71fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        SoundModelType type;
7240d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** Unique sound model ID. */
73fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        Uuid           uuid;
7440d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /**
7540d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber         * Unique vendor ID. Identifies the engine the sound model
76fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent         * was build for */
77fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        Uuid           vendorUuid;
7840d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** Opaque data transparent to Android framework */
79fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        vec<uint8_t>   data;
80fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent    };
81fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent
8240d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber    /** Key phrase descriptor */
83fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent    struct Phrase {
8440d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** Unique keyphrase ID assigned at enrollment time */
85fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        uint32_t      id;
8640d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** Recognition modes supported by this key phrase */
87fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        uint32_t      recognitionModes;
8840d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** List of users IDs associated with this key phrase */
89fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        vec<uint32_t> users;
9040d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** Locale - Java Locale style (e.g. en_US) */
91fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        string        locale;
9240d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** Phrase text in UTF-8 format. */
93fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        string        text;
94fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent    };
95fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent
9640d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber    /**
97fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * Specialized sound model for key phrase detection.
98fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * Proprietary representation of key phrases in binary data must match
99fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * information indicated by phrases field
100fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     */
101fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent    struct PhraseSoundModel {
10240d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** Common part of sound model descriptor */
103fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        SoundModel  common;
10440d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** List of descriptors for key phrases supported by this sound model */
105fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        vec<Phrase> phrases;
106fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent    };
107fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent
10840d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber    /**
109fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * Configuration for sound trigger capture session passed to
110fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * startRecognition() method
111fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     */
112fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent    struct RecognitionConfig {
11340d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /**
11440d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber         * IO handle that will be used for capture. N/A if captureRequested
115fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent         * is false */
116fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        AudioIoHandle   captureHandle;
11740d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** Input device requested for detection capture */
118fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        AudioDevice     captureDevice;
11940d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** Capture and buffer audio for this recognition instance */
120fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        bool            captureRequested;
12140d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** Configuration for each key phrase */
122fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        vec<PhraseRecognitionExtra> phrases;
12340d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber        /** Opaque capture configuration data transparent to the framework */
124fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent        vec<uint8_t>    data;
125fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent    };
126fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent
127fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent
12840d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber    /**
129fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * Retrieve implementation properties.
130fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * @return retval Operation completion status: 0 in case of success,
131fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *                -ENODEV in case of initialization error.
132fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * @return properties A Properties structure containing implementation
133fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *                    description and capabilities.
134fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     */
135fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent    getProperties() generates (int32_t retval, Properties properties);
136fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent
13740d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber    /**
138fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * Load a sound model. Once loaded, recognition of this model can be
139fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * started and stopped. Only one active recognition per model at a time.
140fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * The SoundTrigger service must handle concurrent recognition requests by
141fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * different users/applications on the same model.
142fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * The implementation returns a unique handle used by other functions
143fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * (unloadSoundModel(), startRecognition(), etc...
144fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * @param soundModel A SoundModel structure describing the sound model to
145fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *                   load.
146fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * @param callback The callback interface on which the soundmodelCallback()
147fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *                 method will be called upon completion.
148fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * @param cookie The value of the cookie argument passed to the completion
149fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *               callback. This unique context information is assigned and
150fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *               used only by the framework.
151fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * @return retval Operation completion status: 0 in case of success,
152fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *                -EINVAL in case of invalid sound model (e.g 0 data size),
153fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *                -ENOSYS in case of invalid operation (e.g max number of
154fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *                models exceeded),
155fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *                -ENOMEM in case of memory allocation failure,
156fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *                -ENODEV in case of initialization error.
157fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * @return modelHandle A unique handle assigned by the HAL for use by the
158fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *                framework when controlling activity for this sound model.
159fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     */
160fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent    loadSoundModel(SoundModel soundModel,
161fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent                   ISoundTriggerHwCallback callback,
162fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent                   CallbackCookie cookie)
163fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent            generates (int32_t retval, SoundModelHandle modelHandle);
164fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent
16540d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber    /**
166a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent     * Load a key phrase sound model. Once loaded, recognition of this model can
167a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent     * be started and stopped. Only one active recognition per model at a time.
168a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent     * The SoundTrigger service must handle concurrent recognition requests by
169a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent     * different users/applications on the same model.
170a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent     * The implementation returns a unique handle used by other functions
171a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent     * (unloadSoundModel(), startRecognition(), etc...
172a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent     * @param soundModel A PhraseSoundModel structure describing the sound model
173a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent     *                   to load.
174a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent     * @param callback The callback interface on which the soundmodelCallback()
175a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent     *                 method will be called upon completion.
176a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent     * @param cookie The value of the cookie argument passed to the completion
177a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent     *               callback. This unique context information is assigned and
178a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent     *               used only by the framework.
179a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent     * @return retval Operation completion status: 0 in case of success,
180a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent     *                -EINVAL in case of invalid sound model (e.g 0 data size),
181a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent     *                -ENOSYS in case of invalid operation (e.g max number of
182a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent     *                models exceeded),
183a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent     *                -ENOMEM in case of memory allocation failure,
184a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent     *                -ENODEV in case of initialization error.
185a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent     * @return modelHandle A unique handle assigned by the HAL for use by the
186a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent     *                framework when controlling activity for this sound model.
187a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent     */
188a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent    loadPhraseSoundModel(PhraseSoundModel soundModel,
189a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent                   ISoundTriggerHwCallback callback,
190a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent                   CallbackCookie cookie)
191a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent            generates (int32_t retval, SoundModelHandle modelHandle);
192a4b776c97a07498aa76e186d5eec88ea8b32dbdfEric Laurent
19340d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber    /**
194fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * Unload a sound model. A sound model may be unloaded to make room for a
195fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * new one to overcome implementation limitations.
196fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * @param modelHandle the handle of the sound model to unload
197fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * @return retval Operation completion status: 0 in case of success,
198fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *                -ENOSYS if the model is not loaded,
199fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *                -ENODEV in case of initialization error.
200fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     */
201fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent    unloadSoundModel(SoundModelHandle modelHandle)
202fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent            generates (int32_t retval);
203fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent
20440d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber    /**
205fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * Start recognition on a given model. Only one recognition active
206fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * at a time per model. Once recognition succeeds of fails, the callback
207fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * is called.
208fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * @param modelHandle the handle of the sound model to use for recognition
209fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * @param config A RecognitionConfig structure containing attributes of the
210fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *               recognition to perform
211fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * @param callback The callback interface on which the recognitionCallback()
212fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *                 method must be called upon recognition.
213fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * @param cookie The value of the cookie argument passed to the recognition
214fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *               callback. This unique context information is assigned and
215fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *               used only by the framework.
216fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * @return retval Operation completion status: 0 in case of success,
217fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *                -EINVAL in case of invalid recognition attributes,
218fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *                -ENOSYS in case of invalid model handle,
219fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *                -ENOMEM in case of memory allocation failure,
220fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *                -ENODEV in case of initialization error.
221fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     */
222fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent    startRecognition(SoundModelHandle modelHandle,
223fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent                     RecognitionConfig config,
224fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent                     ISoundTriggerHwCallback callback,
225fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent                     CallbackCookie cookie)
226fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent            generates (int32_t retval);
227fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent
22840d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber    /**
229fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * Stop recognition on a given model.
230fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * The implementation must not call the recognition callback when stopped
231fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * via this method.
232fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * @param modelHandle The handle of the sound model to use for recognition
233fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * @return retval Operation completion status: 0 in case of success,
234fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *                -ENOSYS in case of invalid model handle,
235fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *                -ENODEV in case of initialization error.
236fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     */
237fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent    stopRecognition(SoundModelHandle modelHandle)
238fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent            generates (int32_t retval);
239fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent
24040d3a9bd8c62714ee58f9363c4456f764aa5a95dAndreas Huber    /**
241fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * Stop recognition on all models.
242fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     * @return retval Operation completion status: 0 in case of success,
243fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     *                -ENODEV in case of initialization error.
244fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent     */
245fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent    stopAllRecognitions()
246fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent            generates (int32_t retval);
247fc496a2fffd5e6a5bb49871ea08bb6f13a57103aEric Laurent};
248