/*
 * Copyright 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.soundtrigger@2.1;

import @2.0::ISoundTriggerHwCallback;
import @2.0::PhraseRecognitionExtra;

/**
 * SoundTrigger HAL Callback interface. Obtained during SoundTrigger setup.
 */
@hidl_callback
interface ISoundTriggerHwCallback extends @2.0::ISoundTriggerHwCallback {

    /**
     * Generic recognition event sent via recognition callback.
     */
    struct RecognitionEvent {
        /** Event header. Any data contained in the 'header.data' field
         * is ignored */
        @2.0::ISoundTriggerHwCallback.RecognitionEvent header;
        /** Opaque event data */
        memory data;
    };

    /**
     * Specialized recognition event for key phrase recognitions.
     */
    struct PhraseRecognitionEvent {
        /** Common part of the recognition event */
        RecognitionEvent common;
        /** List of descriptors for each recognized key phrase */
        vec<PhraseRecognitionExtra> phraseExtras;
    };

    /**
     * Event sent via load sound model callback.
     */
    struct ModelEvent {
        /** Event header. Any data contained in the 'header.data' field
         * is ignored */
        @2.0::ISoundTriggerHwCallback.ModelEvent header;
        /** Opaque event data, passed transparently by the framework */
        memory data;
    };

    /**
     * Callback method called by the HAL when the sound recognition triggers.
     *
     * @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*())
     */
    recognitionCallback_2_1(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_2_1(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
     *     model loading operation
     * @param cookie The cookie passed by the framework when loading was
     *     initiated (see ISoundtriggerHw.loadSoundModel*())
     */
    soundModelCallback_2_1(ModelEvent event, CallbackCookie cookie);
};