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