Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4b776c9 authored by Eric Laurent's avatar Eric Laurent
Browse files

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
parent 12adb906
Loading
Loading
Loading
Loading
+28 −0
Original line number Original line Diff line number Diff line
@@ -158,6 +158,34 @@ interface ISoundTriggerHw {
                   CallbackCookie cookie)
                   CallbackCookie cookie)
            generates (int32_t retval, SoundModelHandle modelHandle);
            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
     * Unload a sound model. A sound model may be unloaded to make room for a
     * new one to overcome implementation limitations.
     * new one to overcome implementation limitations.
+11 −0
Original line number Original line Diff line number Diff line
@@ -92,6 +92,17 @@ interface ISoundTriggerHwCallback {
     *               started (see ISoundtriggerHw.startRecognition()
     *               started (see ISoundtriggerHw.startRecognition()
     */
     */
    recognitionCallback(RecognitionEvent event, CallbackCookie cookie);
    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
     * Callback method called by the HAL when the sound model loading completes
     * @param event A ModelEvent structure containing detailed results of the
     * @param event A ModelEvent structure containing detailed results of the