/* * Copyright 2019 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.3; import @2.0::SoundModelHandle; import @2.0::ISoundTriggerHwCallback.CallbackCookie; import @2.2::ISoundTriggerHw; import @2.1::ISoundTriggerHwCallback; /** * SoundTrigger HAL interface. Used for hardware recognition of hotwords * and other sounds. */ interface ISoundTriggerHw extends @2.2::ISoundTriggerHw { /** * Retrieve extended implementation properties. * The returned properties includes what is returned from the * getProperties along with expanded implementation details. * * @return retval Operation completion status: 0 in case of success, * -ENODEV in case of initialization error. * @return properties A Properties structure containing implementation * description and capabilities. */ getProperties_2_3() generates (int32_t retval, Properties properties); /** * Start recognition on a given model. Only one recognition active * at a time per model. Once recognition succeeds or fails, the callback * associated with the model handle is called. * * Must have the exact same semantics as startRecognition from * ISoundTriggerHw@2.1 except that the RecognitionConfig includes audio * capabilities applied when the recognition is active. * * @param modelHandle the handle of the sound model to use for recognition * @param config A RecognitionConfig structure containing attributes of the * recognition to perform * @return retval Operation completion status: 0 in case of success, * -EINVAL in case of invalid recognition attributes, * -ENOSYS in case of invalid model handle, * -ENOMEM in case of memory allocation failure, * -ENODEV in case of initialization error. */ startRecognition_2_3(SoundModelHandle modelHandle, RecognitionConfig config) generates (int32_t retval); /** * Set a model specific parameter with the given value. This parameter * will keep its value for the duration the model is loaded regardless of starting and stopping * recognition. Once the model is unloaded, the value will be lost. * It is expected to check if the handle supports the parameter via the queryParameter * API prior to calling this method. * * @param modelHandle The sound model handle indicating which model to modify parameters * @param modelParam Parameter to set which will be validated against the * ModelParameter type. Not putting ModelParameter type * directly in the definition and validating internally * allows for forward compatibility. * @param value The value to set for the given model parameter * @return status Operation completion status: 0 in case of success, * -ENODEV if the native service cannot be reached * -EINVAL invalid input parameter */ setParameter(SoundModelHandle modelHandle, ModelParameter modelParam, int32_t value) generates (int32_t status); /** * Get a model specific parameter. This parameter will keep its value * for the duration the model is loaded regardless of starting and stopping recognition. * Once the model is unloaded, the value will be lost. If the value is not set, a default * value is returned. See ModelParameter for parameter default values. * It is expected to check if the handle supports the parameter via the queryParameter * API prior to calling this method. * * @param modelHandle The sound model associated with given modelParam * @param modelParam Parameter to set which will be validated against the * ModelParameter type. Not putting ModelParameter type * directly in the definition and validating internally * allows for forward compatibility. * @return status Operation completion status: 0 in case of success, * -ENODEV if the native service cannot be reached * -EINVAL invalid input parameter * @return value Value set to the requested parameter. Value is only set when status * indicates success. */ getParameter(SoundModelHandle modelHandle, ModelParameter modelParam) generates (int32_t status, int32_t value); /** * Get supported parameter attributes with respect to the provided model * handle. Along with determining the valid range, this API is also used * to determine if a given parameter ID is supported at all by the * modelHandle for use with getParameter and setParameter APIs. * * @param modelHandle The sound model handle indicating which model to query * @param modelParam Parameter to set which will be validated against the * ModelParameter type * @return status Operation completion status: 0 in case of success * -ENODEV if the native service cannot be reached * -EINVAL invalid input parameter * @return retval OptionalModelParameterRange safe union structure wrapping * ModelParameterRange. This structure indicates supported attributes * of the parameter for the given model handle. If the parameter is not * supported the Monostate of the union is used. */ queryParameter(SoundModelHandle modelHandle, ModelParameter modelParam) generates (int32_t status, OptionalModelParameterRange retval); };