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
This commit is contained in:
Eric Laurent
2016-10-13 15:11:24 -07:00
parent 12adb906e5
commit a4b776c97a
2 changed files with 39 additions and 0 deletions

View File

@@ -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.

View File

@@ -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