[Feature][T108][task-view-1499] change gsw .h file

Only Configure: No
Affected branch: GSW_V1453
Affected module: libgsw
Is it affected on IC: only ASR
Self-test: yes
Doc Update: no

Change-Id: I678871907e2be939e6673ee09bfed88992013348
diff --git a/mbtk/include/gsw/gsw_voice_interface.h b/mbtk/include/gsw/gsw_voice_interface.h
new file mode 100755
index 0000000..4ba5b30
--- /dev/null
+++ b/mbtk/include/gsw/gsw_voice_interface.h
@@ -0,0 +1,246 @@
+/**

+*  @file  : gsw_voice_interface.h

+*  @brief : voice mic and rtp

+*  @date : 2022-06-29

+*  @author : 

+*  @version : v1.0

+*  @copyright copyright Copyright (c) 2022 www.gosuncn.com

+*/

+#ifndef GSW_VOICE_INTERFACE_H

+#define GSW_VOICE_INTERFACE_H

+

+#include <stdint.h>

+#include <stdbool.h>

+#include "gsw_hal_errcode.h"

+

+#ifdef __cplusplus

+extern "C" {

+#endif

+

+#define INVALID_CALL_HANDLE (-1)

+#define GSW_VOICE_SUCCESS      GSW_HAL_SUCCESS

+#define GSW_VOICE_ERROR        GSW_HAL_NORMAL_FAIL

+#define ERR_FAILED         GSW_HAL_NORMAL_FAIL

+#define ERR_SUCCESS        GSW_HAL_SUCCESS

+

+#define GSW_VOICE_MAX_SPEAKER_VOLUME (7)

+#define GSW_VOICE_MIN_SPEAKER_VOLUME (1)

+#define GSW_VOICE_MAX_MIC_VOLUME     (7)

+#define GSW_VOICE_MIN_MIC_VOLUME     (1)

+

+typedef int CallHandle;

+

+typedef enum {

+    GSW_VOICE_CALL_HOLDING = 0, /**< holding */

+    GSW_VOICE_CALL_DIALING,     /**< dialing */

+    GSW_VOICE_CALL_ALERTING,    /**< alerting */

+    GSW_VOICE_CALL_CONNECTED,   /**< connected */

+    GSW_VOICE_CALL_INCOMING,    /**< incoming */

+    GSW_VOICE_CALL_WAITING,     /**< waiting */

+    GSW_VOICE_CALL_END,         /**< call end */

+} VoiceCallState;

+

+typedef enum {

+    GSW_AUDIO_MODE_CODEC = 0,   /**< Codec */

+    GSW_AUDIO_MODE_RTP = 1,     /**< RTP */

+} AudioMode;

+

+typedef enum {

+    GSW_RTP_CLIENT = 0, /**< rtp client */

+    GSW_RTP_SERVER,     /**< rtp server */

+} RTPMode;

+

+typedef void (*CallStateInd)(CallHandle, VoiceCallState);

+

+/**

+ * @brief voice sdk init function

+ * @param  [in] ind callback function to handle new voice call state

+ * @retval 0: success

+ * @retval other: fail

+ */

+int32_t gsw_voice_sdk_init(CallStateInd ind);

+

+/**

+ * @brief voice sdk deinit function

+ * @retval 0: success

+ * @retval other: fail

+ */

+void gsw_voice_sdk_deinit(void);

+

+/**

+ * @brief normal voice start

+ * @param  [in] handle

+ * @param  [in] callNumber

+ * @retval 0: success

+ * @retval other: fail

+ */

+int32_t gsw_voice_normal_voice_start(CallHandle *handle, const char *callNumber);

+

+/**

+ * @brief hangup voice

+ * @param  [in] handle

+ * @retval 0: success

+ * @retval other: fail

+ */

+int32_t gsw_voice_hangup(CallHandle handle);

+

+/**

+ * @brief answer voice

+ * @param  [in] handle

+ * @retval 0: success

+ * @retval other: fail

+ */

+int32_t gsw_voice_answer(CallHandle handle);

+

+/**

+ * @brief auto answer mode

+ * @param  [in] mode: ture/false

+ * @retval 0: success

+ * @retval other: fail

+ */

+int32_t gsw_voice_set_auto_answer_mode(int32_t mode);

+

+/**

+ * @brief get current call state

+ * @param  [in] handle

+ * @param  [in] state

+ * @retval 0: success

+ * @retval other: fail

+ */

+int32_t gsw_voice_get_current_call_state(CallHandle handle, VoiceCallState *state);

+

+/**

+ * @brief get speaker volume

+ * @param  [out] volume: 0 ~ 7

+ * @retval 0: success

+ * @retval other: fail

+ */

+int32_t gsw_voice_get_speaker_volume(int32_t *volume);

+

+/**

+ * @brief set speaker volume

+ * @param  [in] volume: 0 ~ 7

+ * @retval 0: success

+ * @retval other: fail

+ */

+int32_t gsw_voice_set_speaker_volume(int32_t volume);

+

+/**

+ * @brief set mic volume

+ * @param  [out] volume: 0 ~ 7

+ * @retval 0: success

+ * @retval other: fail

+ */

+int32_t gsw_voice_get_mic_volume(int32_t *volume);

+

+/**

+ * @brief set mic volume

+ * @param  [in] volume: 0 ~ 7

+ * @retval 0: success

+ * @retval other: fail

+ */

+int32_t gsw_voice_set_mic_volume(int32_t volume);

+

+/**

+ * @brief set audio mode. 

+ * @details mode change from GSW_AUDIO_MODE_RTP to GSW_AUDIO_MODE_CODEC, should close RTP immediately and change to codec mode.  

+ * change from GSW_AUDIO_MODE_CODEC to GSW_AUDIO_MODE_RTP, should close codec immediately and change to RTP mode.

+ * 

+ * @param  [in] audioMode

+ * @retval 0: success

+ * @retval other: fail

+ */

+int32_t gsw_voice_set_audio_mode(AudioMode audioMode);

+

+/**

+ * @brief get audio mode

+ * @param  [out] audioMode

+ * @retval 0: success

+ * @retval other: fail

+ */

+int32_t gsw_voice_get_audio_mode(AudioMode *audioMode);

+

+/**

+ * @brief set rtp ip

+ * @param  [in] ip rtp ip

+ * @param  [in] len rtp ip length

+ * @retval 0: success

+ * @retval other: fail

+ */

+int32_t gsw_voice_set_remote_rtp_ip(const char *ip, int32_t len);

+

+/**

+ * @brief get rtp ip

+ * @param  [out] ip rtp ip

+ * @param  [out] len rtp ip length

+ * @retval 0: success

+ * @retval other: fail

+ */

+int32_t gsw_voice_get_remote_rtp_ip(char *ip, int32_t len);

+

+/**

+ * @brief set rtp port

+ * @param  [in] RTPMode rtp mode

+ * @param  [in] port rtp port

+ * @retval 0: success

+ * @retval other: fail

+ */

+int32_t gsw_voice_set_rtp_port(RTPMode rtpMode, int32_t port);

+

+/**

+ * @brief get rtp port

+ * @param  [out] RTPMode rtp mode

+ * @param  [out] port rtp port

+ * @retval 0: success

+ * @retval other: fail

+ */

+int32_t gsw_voice_get_rtp_port(RTPMode rtpMode, int32_t *port);

+

+/**

+ * @brief set rtp port

+ * @param  [in] clockRate rtp clock rate

+ * @param  [in] channel rtp channel

+ * @param  [in] latency rtp latency

+ * @retval 0: success

+ * @retval other: fail

+ */

+int32_t gsw_voice_set_rtp_param(int32_t clockRate, int32_t channel, int32_t latency);

+

+/**

+ * @brief get rtp param

+ * @param  [out] clockRate rtp clock rate

+ * @param  [out] channel rtp channel

+ * @param  [out] latency rtp latency

+ * @retval 0: success

+ * @retval other: fail

+ */

+int32_t gsw_voice_get_rtp_param(int32_t *clockRate, int32_t *channel, int32_t *latency);

+

+/**

+ * @brief set rtp vlan

+ * @param  [in] interfaceName network interface name

+ * @retval 0: success

+ * @retval other: fail

+ */

+int32_t gsw_voice_set_rtp_vlan_info(const char *interfaceName);

+

+/**

+ * @brief get rtp vlan

+ * @param  [out] interfaceName network interface name

+ * @param  [out] len network interface name length

+ * @retval 0: success

+ * @retval other: fail

+ */

+int32_t gsw_voice_get_rtp_vlan_info(char *interfaceName, uint32_t len);

+

+/**

+ * @brief get current call end reason

+ * @param  [in] handle

+ * @retval call_end_reason

+ */

+int32_t gsw_voice_get_current_call_end_reason(CallHandle handle);

+

+#ifdef __cplusplus

+}

+#endif

+#endif /* GSW_VOICE_INTERFACE_H */