From a4b776c97a07498aa76e186d5eec88ea8b32dbdf Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Thu, 13 Oct 2016 15:11:24 -0700 Subject: [PATCH] sound trigger HAL: add specialized methods for extended sound models Initial HAL definition was using base struct types (e.g SoundModel) to pass either a base struct or a struct extended by composition. This doesn't work with how autogenerated code passes data over binder. Bug: 32022304 Change-Id: I7d4ba6d063e80ba38af3db01043cafc7a084c426 --- soundtrigger/2.0/ISoundTriggerHw.hal | 28 ++++++++++++++++++++ soundtrigger/2.0/ISoundTriggerHwCallback.hal | 11 ++++++++ 2 files changed, 39 insertions(+) diff --git a/soundtrigger/2.0/ISoundTriggerHw.hal b/soundtrigger/2.0/ISoundTriggerHw.hal index a1be85d9b5..cf35ef1cff 100644 --- a/soundtrigger/2.0/ISoundTriggerHw.hal +++ b/soundtrigger/2.0/ISoundTriggerHw.hal @@ -158,6 +158,34 @@ interface ISoundTriggerHw { CallbackCookie cookie) generates (int32_t retval, SoundModelHandle modelHandle); + /* + * Load a key phrase sound model. Once loaded, recognition of this model can + * be started and stopped. Only one active recognition per model at a time. + * The SoundTrigger service must handle concurrent recognition requests by + * different users/applications on the same model. + * The implementation returns a unique handle used by other functions + * (unloadSoundModel(), startRecognition(), etc... + * @param soundModel A PhraseSoundModel structure describing the sound model + * to load. + * @param callback The callback interface on which the soundmodelCallback() + * method will be called upon completion. + * @param cookie The value of the cookie argument passed to the completion + * callback. This unique context information is assigned and + * used only by the framework. + * @return retval Operation completion status: 0 in case of success, + * -EINVAL in case of invalid sound model (e.g 0 data size), + * -ENOSYS in case of invalid operation (e.g max number of + * models exceeded), + * -ENOMEM in case of memory allocation failure, + * -ENODEV in case of initialization error. + * @return modelHandle A unique handle assigned by the HAL for use by the + * framework when controlling activity for this sound model. + */ + loadPhraseSoundModel(PhraseSoundModel soundModel, + ISoundTriggerHwCallback callback, + CallbackCookie cookie) + generates (int32_t retval, SoundModelHandle modelHandle); + /* * Unload a sound model. A sound model may be unloaded to make room for a * new one to overcome implementation limitations. diff --git a/soundtrigger/2.0/ISoundTriggerHwCallback.hal b/soundtrigger/2.0/ISoundTriggerHwCallback.hal index 294d45159d..c6555f6c55 100644 --- a/soundtrigger/2.0/ISoundTriggerHwCallback.hal +++ b/soundtrigger/2.0/ISoundTriggerHwCallback.hal @@ -92,6 +92,17 @@ interface ISoundTriggerHwCallback { * started (see ISoundtriggerHw.startRecognition() */ recognitionCallback(RecognitionEvent event, CallbackCookie cookie); + + /* + * Callback method called by the HAL when the sound recognition triggers + * for a key phrase sound model. + * @param event A RecognitionEvent structure containing detailed results + * of the recognition triggered + * @param cookie The cookie passed by the framework when recognition was + * started (see ISoundtriggerHw.startRecognition() + */ + phraseRecognitionCallback(PhraseRecognitionEvent event, + CallbackCookie cookie); /* * Callback method called by the HAL when the sound model loading completes * @param event A ModelEvent structure containing detailed results of the