Add basic change for v1453
Change-Id: I9497a61bbc3717f66413794a4e7dee0347c0bc33
diff --git a/mbtk/include/ql_v2/ql_audio_cfg.h b/mbtk/include/ql_v2/ql_audio_cfg.h
new file mode 100755
index 0000000..92a56ba
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_audio_cfg.h
@@ -0,0 +1,533 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_audio_cfg.h
+ @brief audio config API, including audio initlization, audio configuration
+
+ @detailes
+ Quectel AG55x series module AUDIO service.
+
+ @htmlonly
+ <span style="font-weight: bold">History</span>
+ @endhtmlonly
+
+ when | who | what, where, why
+ -------- | --- | ----------------------------------------------------------
+ 2021-11-03 | dameng.lin | Created .
+
+ Copyright (c) 2019 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
+ Quectel Wireless Solution Proprietary and Confidential.
+-------------------------------------------------------------------------------------------------*/
+#ifndef __QL_AUDIO_CFG_H__
+#define __QL_AUDIO_CFG_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#define QL_AUDIO_STATE_0 0
+#define QL_AUDIO_STATE_1 1
+
+
+/**
+ @brief The audio service error callback function
+ @param error error code.See ql_type.h for details.
+*/
+typedef void (*ql_audio_service_error_cb_f)(int error);
+
+extern ql_audio_service_error_cb_f audio_error_callback;
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function initializes an audio service.
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_SERVICE_NOT_READY Audio service not ready. Try again later.
+ @retval Others Failed execution.See ql_type.h for error codes
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_init(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function deinitializes audio services.
+
+ @retval QL_ERR_OK Successful
+ @retval QL_ERR_SERVICE_NOT_READY Service is not ready, need to retry
+ @retval Others Failed execution.See ql_type.h for error codes.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_deinit(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the value of a mixer.
+
+ @param[in] control the name of the mixer
+ @param[in] val_list the value of the mixer to be set. String type value.Multiple values are separated by spaces.
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others Failed execution.See ql_type.h for error codes.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_mixer_control(const char *control, const char *val_list);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the value of the mixer.
+
+ @param[in] control the name of the mixer
+ @param[out] val_list_buf buffer for storing mixer values
+ @param[in] buf_size the buffer size. Unit:Byte
+
+ @retval QL_ERR_OK Successful execution.
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others Failed execution.See ql_type.h for error codes.
+
+ @note Generally, 64 bytes is enough
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_mixer_control(const char *control, char *val_list_buf, uint32_t buf_size);
+
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the microphone gain for voice call uplink.
+
+ @param[in] mic_gain the microphone gain to be set. range:0-65535
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+
+ @note The API should be called before a voice call
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_tx_voice_mic_gain(int32_t mic_gain);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the microphone gain for voice call uplink.
+
+ @param[out] p_mic_gain the current microphone gain for voice call uplink.
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_tx_voice_mic_gain(int32_t *p_mic_gain);
+
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the speaker gain for voice call downlink.
+
+ @param[in] spkr_gain the speaker gain to be set. range:0-65535
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+
+ @note The API should be called before a voice call
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_rx_voice_spkr_gain(int32_t spkr_gain);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the speaker gain for voice call downlink.
+
+ @param[out] p_spkr_gain the current speaker gain for voice call downlink.
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_rx_voice_spkr_gain(int32_t *p_spkr_gain);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the mute state of voice call uplink.
+
+ @param[in] mute_state the mute state to be set.
+ QL_AUDIO_STATE_0: unmute, QL_AUDIO_STATE_1: mute
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+
+ @note The API should be called during the call
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_tx_voice_mute_state(int32_t mute_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the mute state of voice call uplink.
+
+ @param[out] p_mute_state the current mute state of voice call uplink. QL_AUDIO_STATE_0 or QL_AUDIO_STATE_1
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_tx_voice_mute_state(int32_t *p_mute_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the mute state of voice call downlink.
+
+ @param[in] mute_state the mute state to be set.
+ QL_AUDIO_STATE_0: unmute, QL_AUDIO_STATE_1: mute
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+
+ @note The API should be called during the call
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_rx_voice_mute_state(int32_t mute_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the mute state of voice call downlink.
+
+ @param[out] p_mute_state the current mute state of voice call downlink. QL_AUDIO_STATE_0 or QL_AUDIO_STATE_1
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_rx_voice_mute_state(int32_t *p_mute_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the uplink volume of a codec.
+
+ @param[in] up_volume the uplink volume to be set. range:0-100
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_codec_up_vol(int32_t up_volume);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the uplink volume of a codec.
+
+ @param[out] p_up_volume the current uplink volume of codec. range:0-100
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_codec_up_vol(int32_t *p_up_volume);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the downlink volume of a codec.
+
+ @param[in] down_volume the volume to be set. range:0-100
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_codec_down_vol(int32_t down_volume);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the downlink volume of a codec.
+
+ @param[out] p_down_volume the current downlink volume of codec. range:0-100
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_codec_down_vol(int32_t *p_down_volume);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the microphone mute state of a codec.
+
+ @param[in] mute_state the muute state to be set.
+ QL_AUDIO_STATE_0: unmute, QL_AUDIO_STATE_1: mute
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+
+ @note The API should be called during the call or audio playback
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_codec_mic_mute_state(int32_t mute_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the microphone mute state of a codec.
+
+ @param[out] p_mute_state the current microphone mute state of codec. QL_AUDIO_STATE_0 or QL_AUDIO_STATE_1
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_codec_mic_mute_state(int32_t *p_mute_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the speaker mute state of a codec.
+
+ @param[in] mute_state the mute state to be set.
+ QL_AUDIO_STATE_0: unmute, QL_AUDIO_STATE_1: mute
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+
+ @note The API should be called during the call or audio playback
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_codec_spk_mute_state(int32_t mute_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the speaker mute state of a codec.
+
+ @param[out] p_mute_state the current speaker mute state of codec. QL_AUDIO_STATE_0 or QL_AUDIO_STATE_1
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_codec_spk_mute_state(int32_t *p_mute_state);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function enables/disables loopback.
+
+ @param[in] enable_state enable/disable the loopback to be set.
+ QL_AUDIO_STATE_0: disable, QL_AUDIO_STATE_1: enable
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_loopback_enable_state(int32_t enable_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief The function gets the loopback state.
+
+ @param[out] p_enable_state the current loopback state. QL_AUDIO_STATE_0 or QL_AUDIO_STATE_1
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_loopback_enable_state(int32_t *p_enable_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the sidetone gain.
+
+ @param[in] sidetone_gain sidetone gain to be set. range: 0-65535
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_sidetone_gain(int32_t sidetone_gain);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the sidetone gain.
+
+ @param[out] p_sidetone_gain the current sidetone gain. range: 0-65535, default value: 1298
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_sidetone_gain(int32_t *p_sidetone_gain);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the voice call manager state. By default, voice call services such as ringtones, ringback
+tones, third-party ringtones and voice stream status control are all implemented by ql_audiod program
+automatically.
+
+ @param[in] manager_state The manager state to be set. Voice call services include ringtones, ringback tones, the third-party
+ringtones and voice stream status control. range: QL_AUDIO_STATE_0 and QL_AUDIO_STATE_1
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+
+ @note The voice service, such as call ring, beep tone, will not work during a voice call
+ If the manager_state is set to QL_AUDIO_STATE_1
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_voice_call_manager_state(int32_t manager_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the voice call manager state.
+
+ @param[out] p_manager_state the current voice call manager state.
+ QL_AUDIO_STATE_0: close, QL_AUDIO_STATE_1:open
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_voice_call_manager_state(int32_t *p_manager_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the voice stream state.
+
+ @param[in] stream_state voice stream state to be set.
+ QL_AUDIO_STATE_0: close, QL_AUDIO_STATE_1:open
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+
+ @note After the voice call manager state is set to QL_AUDIO_STATE_1 by calling
+ql_audio_set_voice_call_manager_state(), the service program ql_audiod will not enable voice stream
+while establishing a voice call. In such a case, call ql_audio_set_voice_stream_state() to enable voice
+stream state by setting stream_state to QL_AUDIO_STATE_1, and then the voice stream can be disabled
+by setting stream_state to QL_AUDIO_STATE_0.*/
+/*-----------------------------------------------------------------------------------------------*/
+//int ql_audio_set_voice_stream_state(int32_t stream_state);
+int ql_audio_set_voice_stream_state(int32_t stream_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief The function gets the voice stream state.
+
+ @param[out] p_stream_state the current voice stream state. QL_AUDIO_STATE_0 or QL_AUDIO_STATE_1
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+//int ql_audio_get_voice_stream_state(int32_t *p_stream_state);
+int ql_audio_get_voice_stream_state(int32_t *p_stream_state);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the callback function for audio service errors.
+ @param[in] cb The callback function for audio service errors.Only when the audioservice exit abnormally,the callback function is executed.
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_service_error_cb(ql_audio_service_error_cb_f cb);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function switch codec.
+
+ @param[in] codec_switch the which codec to be switch.
+ 0:GSSP 1:internal codec
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_codec_switch(int32_t codec_switch);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the tone state.
+
+ @param[out] p_codec_switch which codec has switch.
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_codec_switch(int32_t *p_codec_switch);
+
+
+typedef struct ql_audio_tone_config_struct
+{
+ int32_t low_fre;
+ int32_t high_fre;
+ int32_t on_duration;
+ int32_t off_duration;
+ int32_t volume;
+ int32_t count;
+}ql_audio_tone_config_t;
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set tone enable state
+
+ @param[in] low_fre low frequency, range: 100~4000
+ @param[in] high_fre high frequency, range: 100~4000
+ @param[in] on_duration tone play time, unit is millisecond
+ @param[in] off_duration tone pause time, unit is millisecond
+ @param[in] volume tone play volume, range: 0~5000
+ @param[in] count tone play count
+
+ @return QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other errorcode defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_tone_enable_state(int32_t enable_state,ql_audio_tone_config_t *p_tone_config);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get tone enable state
+
+ @param[out] p_enable_state tone enable state,
+ QL_AUDIO_STATE_0: close, QL_AUDIO_STATE_1:open
+
+ @return QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_tone_enable_state(int32_t *p_enable_state);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+