From 984f15f1d17c1d3d9e58df0ef5b620d0dc2b3059 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 21 Apr 2020 16:59:08 +0900 Subject: Remove voicetyping feature Change-Id: I2d07ab7c29957eba6906eac71bc85ab6e8d1088d Signed-off-by: Jihoon Kim --- CMakeLists.txt | 27 --- ise-default.xml | 1 - lib/armv7l/libsamsung-ai.so | Bin 92032 -> 0 bytes lib/i586/libsamsung-ai.so | Bin 104264 -> 0 bytes packaging/ise-default.spec | 8 - src/include/samsung_ai_voicetyping.h | 400 ----------------------------------- src/include/voicetyping.h | 61 ------ src/ise-stt-mode.cpp | 199 +---------------- src/ise.cpp | 35 +-- src/voicetyping.cpp | 234 -------------------- 10 files changed, 10 insertions(+), 955 deletions(-) delete mode 100755 lib/armv7l/libsamsung-ai.so delete mode 100755 lib/i586/libsamsung-ai.so delete mode 100644 src/include/samsung_ai_voicetyping.h delete mode 100644 src/include/voicetyping.h delete mode 100644 src/voicetyping.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ce580c..0d3dae8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,6 @@ SET(ISE_SRCS src/candidate/efl/candidate-efl.cpp src/candidate/efl/candidate-multiline-efl.cpp src/autofill.cpp - src/voicetyping.cpp src/ise-emoticon-list.cpp src/ise-emoticon-mode.cpp @@ -45,20 +44,6 @@ SET(ISE_SETTING_SRCS src/autofill.cpp ) -FIND_PROGRAM(UNAME NAMES uname) -EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") -MESSAGE(STATUS "======================================") -IF("${ARCH}" MATCHES "^arm.*") -#MESSAGE(STATUS "Arch - arm") -SET(SRC_LIB_DIR "${CMAKE_SOURCE_DIR}/lib/armv7l") -ELSEIF("${ARCH}" MATCHES "^i586.*") -#MESSAGE(STATUS "Arch - i586") -SET(SRC_LIB_DIR "${CMAKE_SOURCE_DIR}/lib/i586") -ELSEIF("${ARCH}" MATCHES "^i686.*") -#MESSAGE(STATUS "Arch - 686") -SET(SRC_LIB_DIR "${CMAKE_SOURCE_DIR}/lib/i586") -ENDIF() - SET(ISE_PACKAGE ${PROJECT_NAME}) SET(ISE_PKGNAME ${PACKAGE}) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) @@ -95,9 +80,6 @@ SET(PKGS_CHECK_MODULES smartreply key-manager ode - bundle - rpc-port - json-glib-1.0 ) IF (with_cbhm) @@ -139,11 +121,6 @@ ADD_DEFINITIONS("-DLAYOUTDIR=\"${ISE_LAYOUTDIR}\"") ADD_DEFINITIONS(-DISE_NAME=\"/ise-default\") ADD_DEFINITIONS(-DSUPPORTS_EMOTICONS) -IF(NOT "${SRC_LIB_DIR}" STREQUAL "") - ADD_DEFINITIONS(-DSUPPORT_VOICETYPING) - LINK_DIRECTORIES(${SRC_LIB_DIR}) -ENDIF() - ADD_EXECUTABLE(${PROJECT_NAME} ${ISE_SRCS}) ADD_EXECUTABLE(${PROJECT_NAME}-setting ${ISE_SETTING_SRCS}) @@ -311,10 +288,6 @@ ${ISE_RESDIR}/edje/mobile) endif() # For edc File end -IF(NOT "${SRC_LIB_DIR}" STREQUAL "") - INSTALL(FILES ${SRC_LIB_DIR}/libsamsung-ai.so DESTINATION ${ISE_LIBDIR}) - SET(ISE_PKGS_LDFLAGS -Llib -lsamsung-ai ${ISE_PKGS_LDFLAGS}) -ENDIF() TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${ISE_PKGS_LDFLAGS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME}-setting ${ISE_SETTING_PKGS_LDFLAGS}) diff --git a/ise-default.xml b/ise-default.xml index e2bf0af..19af4f7 100644 --- a/ise-default.xml +++ b/ise-default.xml @@ -103,6 +103,5 @@ http://tizen.org/privilege/externalstorage http://tizen.org/privilege/mediastorage http://tizen.org/privilege/keymanager - http://tizen.org/privilege/datasharing diff --git a/lib/armv7l/libsamsung-ai.so b/lib/armv7l/libsamsung-ai.so deleted file mode 100755 index 8459555..0000000 Binary files a/lib/armv7l/libsamsung-ai.so and /dev/null differ diff --git a/lib/i586/libsamsung-ai.so b/lib/i586/libsamsung-ai.so deleted file mode 100755 index 067fe6f..0000000 Binary files a/lib/i586/libsamsung-ai.so and /dev/null differ diff --git a/packaging/ise-default.spec b/packaging/ise-default.spec index f1ef147..3e19a78 100644 --- a/packaging/ise-default.spec +++ b/packaging/ise-default.spec @@ -25,9 +25,6 @@ BuildRequires: pkgconfig(smartreply) BuildRequires: pkgconfig(key-manager) BuildRequires: pkgconfig(ode) BuildRequires: pkgconfig(capi-system-system-settings) -BuildRequires: pkgconfig(bundle) -BuildRequires: pkgconfig(rpc-port) -BuildRequires: pkgconfig(json-glib-1.0) Requires: ise-engine-tables Requires: ise-engine-tables-zh Requires: ise-engine-hangul @@ -156,8 +153,6 @@ export CFLAGS_BASE="${CFLAGS} -DTIZEN_DEBUG_ENABLE -fvisibility=hidden" export CXXFLAGS_BASE="${CXXFLAGS} -DTIZEN_DEBUG_ENABLE -std=c++11 -fvisibility-inlines-hidden -fvisibility=hidden" export FFLAGS+=" -DTIZEN_DEBUG_ENABLE" -export LD_LIBRARY_PATH=%{TZ_SYS_RO_APP}/ise-default/lib - rm -rf CMakeFiles rm -rf CMakeCache.txt @@ -348,9 +343,6 @@ popd %files -f %{name}.lang %manifest %{name}.manifest %defattr(-,root,root,-) -%ifarch armv7l %{ix86} -%{TZ_SYS_RO_APP}/ise-default/lib/* -%endif %{TZ_SYS_RO_PACKAGES}/%{name}.xml %license LICENSE diff --git a/src/include/samsung_ai_voicetyping.h b/src/include/samsung_ai_voicetyping.h deleted file mode 100644 index b7f0d92..0000000 --- a/src/include/samsung_ai_voicetyping.h +++ /dev/null @@ -1,400 +0,0 @@ -/* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved - * - * PROPRIETARY/CONFIDENTIAL - * - * This software is the confidential and proprietary information of - * Samsung Electronics Co., Ltd. ("Confidential Information"). - * You shall not disclose such Confidential Information and shall - * use it only in accordance with the terms of the license agreement - * you entered into with Samsung Electronics Co., Ltd. ("SAMSUNG"). - * - * SAMSUNG MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY - * OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT - * LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR - * A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SAMSUNG SHALL NOT BE - * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, - * MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. - */ - -#ifndef __SAMSUNG_EXPERIENCE_SERVICE_SAMSUNG_AI_VOICETYPING_H__ -#define __SAMSUNG_EXPERIENCE_SERVICE_SAMSUNG_AI_VOICETYPING_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - - -/** - * @addtogroup CAPI_SAMSUNG_AI_VOICETYPING_MODULE - * @{ - */ - - - -/** - * @brief Enumeration for Samsung AI Voice typing function error codes. - * @since_ses 6 - */ -typedef enum { - SAMSUNG_AI_VOICETYPING_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ - SAMSUNG_AI_VOICETYPING_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ - SAMSUNG_AI_VOICETYPING_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ - SAMSUNG_AI_VOICETYPING_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< No answer from Samsung AI Voice typing service */ - SAMSUNG_AI_VOICETYPING_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ - SAMSUNG_AI_VOICETYPING_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */ - SAMSUNG_AI_VOICETYPING_ERROR_SERVICE_UNAVAILABLE = TIZEN_ERROR_UNKNOWN - 1, /**< Service unavailable */ - SAMSUNG_AI_VOICETYPING_ERROR_NOT_CONNECTED = TIZEN_ERROR_UNKNOWN - 2, /**< Not connected */ - SAMSUNG_AI_VOICETYPING_ERROR_OPERATION_FAILED = TIZEN_ERROR_UNKNOWN - 3, /**< Operation failed */ - SAMSUNG_AI_VOICETYPING_ERROR_INVALID_STATE = TIZEN_ERROR_UNKNOWN - 4, /**< Invalid state */ - SAMSUNG_AI_VOICETYPING_ERROR_LOWER_VERSION = TIZEN_ERROR_UNKNOWN - 5 /**< Lower version */ -} samsung_ai_voicetyping_error_e; - -/** - * @brief Enumeration of connection status. - * @since_ses 6 - */ -typedef enum { - SAMSUNG_AI_VOICETYPING_CONNECTION_STATUS_CONNECTED = 0, /**< Connected */ - SAMSUNG_AI_VOICETYPING_CONNECTION_STATUS_DISCONNECTED, /**< Disconnected */ - SAMSUNG_AI_VOICETYPING_CONNECTION_STATUS_REJECTED, /**< Rejected */ -} samsung_ai_voicetyping_connection_status_e; - -/** - * @brief Enumeration of Samsung AI Voice typing client state. - * @since_ses 6 - */ -typedef enum { - SAMSUNG_AI_VOICETYPING_STATE_NONE = 0, /**< None state */ - SAMSUNG_AI_VOICETYPING_STATE_READY, /**< Ready state */ - SAMSUNG_AI_VOICETYPING_STATE_RECORDING, /**< Recording state */ - SAMSUNG_AI_VOICETYPING_STATE_PROCESSING /**< Processing state */ -} samsung_ai_voicetyping_state_e; - -/** - * @brief Enumeration of silence detection. - * @since_ses 6 - */ -typedef enum { - SAMSUNG_AI_VOICETYPING_SILENCE_DETECTION_FALSE = 0, /**< Silence detection false */ - SAMSUNG_AI_VOICETYPING_SILENCE_DETECTION_TRUE /**< Silence detection true */ -} samsung_ai_voicetyping_silence_detection_e; - - -/** - * @brief Called when the connection status is changed. - * @details The following error codes can be received: \n - * #SAMSUNG_AI_VOICETYPING_ERROR_NONE: Success \n - * #SAMSUNG_AI_VOICETYPING_ERROR_PERMISSION_DENIED: Permission denied \n - * #SAMSUNG_AI_VOICETYPING_ERROR_SERVICE_UNAVAILABLE: Service unavailable \n - * @since_ses 6 - * - * @param[in] result The connection result - * @param[in] status The connection status - * @param[in] user_data The user data passed from the callback function - * @see samsung_ai_voicetyping_initialize() - */ -typedef void (*samsung_ai_voicetyping_connection_status_changed_cb)(samsung_ai_voicetyping_error_e result, samsung_ai_voicetyping_connection_status_e status, void* user_data); - -/** - * @brief Called to retrieve the supported languages. - * @since_ses 6 - * @remarks The @a language can be used only in the callback. To use outside, make a copy. - * - * @param[in] language The supported language (e.g. "ko-KR" and "en-US") - * @param[in] user_data The user data passed from the callback function - * @see samsung_ai_voicetyping_foreach_supported_languages() - */ -typedef bool (*samsung_ai_voicetyping_supported_language_cb)(const char* language, void* user_data); - -/** - * @brief Called when the state of Voice typing client is changed. - * @since_ses 6 - * - * @param[in] previous The previous state - * @param[in] current The current state - * @param[in] user_data The user data passed from the callback function - * @see samsung_ai_voicetyping_set_state_changed_cb() - * @see samsung_ai_voicetyping_unset_state_changed_cb() - */ -typedef void (*samsung_ai_voicetyping_state_changed_cb)(samsung_ai_voicetyping_state_e previous, samsung_ai_voicetyping_state_e current, void* user_data); - -/** - * @brief Called when Voice typing client gets the result from the agent. - * @since_ses 6 - * @remarks The voice typing client can get ASR and NLU results by this callback. \n - * The @a asr_result is a text recognized by ASR agent from the speech data. \n - * And, the @a nlu_result is a response for @a asr_result. The format of the @a nlu_result is JSON. \n - * If the @a asr_result is a alphabet(e.g. a, b, c) or a symbol(e.g. ?, !), the @a nlu_result will be NULL. - * If the @a asr_result is a simple command(e.g. "Delete all"), the @a nlu_result will be a JSON data \n - * If the @a asr_result is a command which cannot be handled in NLU agent, the @a nlu_result will be NULL. - * For example, if the user speaks "Delete all", the @a asr_result will be "Delete all" and the @a nlu_result will be "{"goal":{"node":"bixby.voiceTyping.DeleteAll"},"values":[]}" - * - * @remarks The @a asr_result and @a nlu_result can be used only in the callback. To use outside, make a copy. - * - * @param[in] asr_result The ASR result - * @param[in] nlu_result The NLU result - * @param[in] user_data The user data passed from the callback function - * @see samsung_ai_voicetyping_set_recognition_result_cb() - * @see samsung_ai_voicetyping_unset_recognition_result_cb() - */ -typedef void (*samsung_ai_voicetyping_result_cb)(const char* asr_result, const char* nlu_result, void* user_data); - -/** - * @brief Called when an error is occurred. - * @details The following error codes can be received: \n - * #SAMSUNG_AI_VOICETYPING_ERROR_NONE: Success \n - * #SAMSUNG_AI_VOICETYPING_ERROR_PERMISSION_DENIED: Permission denied \n - * #SAMSUNG_AI_VOICETYPING_ERROR_SERVICE_UNAVAILABLE: Service unavailable \n - * @since_ses 6 - * @remarks The @a err_msg can be used only in the callback. To use outside, make a copy. - * - * @param[in] reason The error type - * @param[in] err_msg The error message - * @param[in] user_data The user data passed from the callback function - * @see samsung_ai_voicetyping_set_error_cb() - * @see samsung_ai_voicetyping_unset_error_cb() - */ -typedef void (*samsung_ai_voicetyping_error_cb)(samsung_ai_voicetyping_error_e reason, const char* err_msg, void* user_data); - - -/** - * @brief Creates a client for Samsung AI Voice typing and Connects to Samsung AI services. - * @since_ses 6 - * @privlevel public - * @privilege %http://tizen.org/privilege/recorder \n - * %http://tizen.org/privilege/appmanager.launch \n - * %http://tizen.org/privilege/datasharing - * - * @param[in] callback The connection status changed callback function - * @param[in] user_data The user data passed to the callback function - * @return 0 on success, otherwise a negative error value - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NONE No error - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NOT_SUPPORTED Not supported - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_PERMISSION_DENIED Permission denied - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_SERVICE_UNAVAILABLE Service unavailable - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_OUT_OF_MEMORY Out of memory - * @see samsung_ai_voicetyping_deinitialize() - */ -int samsung_ai_voicetyping_initialize(samsung_ai_voicetyping_connection_status_changed_cb callback, void* user_data); - -/** - * @brief Destroys an Samsung AI Voice typing client. - * @since_ses 6 - * - * @return 0 on success, otherwise a negative error value - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NONE No error - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_SERVICE_UNAVAILABLE Service unavailable - * @see samsung_ai_voicetyping_initialize() - */ -int samsung_ai_voicetyping_deinitialize(void); - -/** - * @brief Retrieves all supported languages of Samsung AI Voice typing service using callback function. - * @since_ses 6 - * - * @param[in] callback The supported language callback function - * @param[in] user_data The user data passed to the callback function - * @return 0 on success, otherwise a negative error value - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NONE No error - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_OPERATION_FAILED Operation failed - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NOT_CONNECTED Not connected - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_SERVICE_UNAVAILABLE Service unavailable - * @post This function invokes samsung_ai_voicetyping_supported_language_cb() repeatedly for getting languages. - * @see samsung_ai_voicetyping_supported_language_cb() - */ -int samsung_ai_voicetyping_foreach_supported_languages(samsung_ai_voicetyping_supported_language_cb callback, void* user_data); - -/** - * @brief Gets the current Voice typing state. - * @since_ses 6 - * @param[out] state The current state - * @return 0 on success, otherwise a negative error value - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NONE No error - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_OPERATION_FAILED Operation failed - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NOT_CONNECTED Not connected - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_SERVICE_UNAVAILABLE Service unavailable - * @see samsung_ai_voicetyping_state_changed_cb() - */ -int samsung_ai_voicetyping_get_state(samsung_ai_voicetyping_state_e* state); - -/** - * @brief Sets the silence detection. - * @since_ses 6 - * @param[in] silence The option of silence detection - * @return 0 on success, otherwise a negative error value - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NONE No error - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_OPERATION_FAILED Operation failed - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NOT_CONNECTED Not connected - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_SERVICE_UNAVAILABLE Service unavailable - */ -int samsung_ai_voicetyping_set_silence_detection(samsung_ai_voicetyping_silence_detection_e silence); - -/** - * @brief Sets the locale. - * @since_ses 6 - * @remarks The @a locale has the same format as the language received through the supported language callback function. - * - * @param[in] locale The locale (e.g. "ko-KR" and "en-US") - * @return 0 on success, otherwise a negative error value - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NONE No error - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_OPERATION_FAILED Operation failed - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NOT_CONNECTED Not connected - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_SERVICE_UNAVAILABLE Service unavailable - */ -int samsung_ai_voicetyping_set_locale(char* locale); - -/** - * @brief Starts recording and recognition asynchronously. - * @since_ses 6 - * @remarks This function starts recording voice in the Samsung AI Voice typing service. - * This continues until samsung_ai_voicetyping_stop() or samsung_ai_voicetyping_cancel() is called, or silence is detected by the service. - * - * @return 0 on success, otherwise a negative error value - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NONE No error - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_OPERATION_FAILED Operation failed - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NOT_CONNECTED Not connected - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_SERVICE_UNAVAILABLE Service unavailable - * @see samsung_ai_voicetyping_stop() - * @see samsung_ai_voicetyping_cancel() - */ -int samsung_ai_voicetyping_start(void); - -/** - * @brief Stops recording and recognition asynchronously. - * @since_ses 6 - * @remarks This function stops recording voice in the Samsung AI Voice typing service. - * - * @return 0 on success, otherwise a negative error value - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NONE No error - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_OPERATION_FAILED Operation failed - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NOT_CONNECTED Not connected - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_SERVICE_UNAVAILABLE Service unavailable - * @pre The state should be #SAMSUNG_AI_VOICETYPING_STATE_RECORDING. - * @post samsung_ai_voicetyping_state_changed_cb() will be invoked, if you register a callback with samsung_ai_voicetyping_set_state_changed_cb(). - * If this function succeeds, the state will be #SAMSUNG_AI_VOICETYPING_STATE_PROCESSING. - * After processing, if the samsung_ai_voicetyping_result_cb() is registered by samsung_ai_voicetyping_set_result_cb(), it will be invoked. - * @see samsung_ai_voicetyping_start() - * @see samsung_ai_voicetyping_cancel() - */ -int samsung_ai_voicetyping_stop(void); - -/** - * @brief Cancels recording and processing recognition asynchronously. - * @since_ses 6 - * @remarks This function cancels recording voice in the Samsung AI Voice typing service, or processing to recognize the voice. - * - * @return 0 on success, otherwise a negative error value - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NONE No error - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_OPERATION_FAILED Operation failed - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NOT_CONNECTED Not connected - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_SERVICE_UNAVAILABLE Service unavailable - * @pre The state should be #SAMSUNG_AI_VOICETYPING_STATE_RECORDING or #SAMSUNG_AI_VOICETYPING_STATE_PROCESSING. - * @post samsung_ai_voicetyping_state_changed_cb() will be invoked, if you register a callback with samsung_ai_voicetyping_set_state_changed_cb(). - * If this function succeeds, the state will be #SAMSUNG_AI_VOICETYPING_STATE_READY. - * @see samsung_ai_voicetyping_start() - * @see samsung_ai_voicetyping_stop() - */ -int samsung_ai_voicetyping_cancel(void); - -/** - * @brief Sets a callback function to be called when the state is changed. - * @since_ses 6 - * - * @param[in] callback The callback function to register - * @param[in] user_data The user data to be passed to the callback function - * @return 0 on success, otherwise a negative error value - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NONE No error - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_SERVICE_UNAVAILABLE Service unavailable - * @pre The state should be #SAMSUNG_AI_VOICETYPING_STATE_NONE or #SAMSUNG_AI_VOICETYPING_STATE_READY. - * @see samsung_ai_voicetyping_state_changed_cb() - * @see samsung_ai_voicetyping_unset_state_changed_cb() - */ -int samsung_ai_voicetyping_set_state_changed_cb(samsung_ai_voicetyping_state_changed_cb callback, void* user_data); - -/** - * @brief Unsets a callback function to be called when the state is changed. - * @since_ses 6 - * - * @return 0 on success, otherwise a negative error value - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NONE No error - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_SERVICE_UNAVAILABLE Service unavailable - * @pre The state should be #SAMSUNG_AI_VOICETYPING_STATE_NONE or #SAMSUNG_AI_VOICETYPING_STATE_READY. - * @see samsung_ai_voicetyping_state_changed_cb() - * @see samsung_ai_voicetyping_set_state_changed_cb() - */ -int samsung_ai_voicetyping_unset_state_changed_cb(void); - -/** - * @brief Sets a callback function to get the result. - * @since_ses 6 - * - * @param[in] callback The callback function to register - * @param[in] user_data The user data to be passed to the callback function - * @return 0 on success, otherwise a negative error value - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NONE No error - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_SERVICE_UNAVAILABLE Service unavailable - * @pre The state should be #SAMSUNG_AI_VOICETYPING_STATE_NONE or #SAMSUNG_AI_VOICETYPING_STATE_READY. - * @see samsung_ai_voicetyping_result_cb() - * @see samsung_ai_voicetyping_unset_result_cb() - */ -int samsung_ai_voicetyping_set_result_cb(samsung_ai_voicetyping_result_cb callback, void* user_data); - -/** - * @brief Unsets a callback function to get the result. - * @since_ses 6 - * - * @return 0 on success, otherwise a negative error value - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NONE No error - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_SERVICE_UNAVAILABLE Service unavailable - * @pre The state should be #SAMSUNG_AI_VOICETYPING_STATE_NONE or #SAMSUNG_AI_VOICETYPING_STATE_READY. - * @see samsung_ai_voicetyping_result_cb() - * @see samsung_ai_voicetyping_set_result_cb() - */ -int samsung_ai_voicetyping_unset_result_cb(void); - -/** - * @brief Sets a callback function to get the error. - * @since_ses 6 - * - * @param[in] callback The callback function to register - * @param[in] user_data The user data to be passed to the callback function - * @return 0 on success, otherwise a negative error value - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NONE No error - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_SERVICE_UNAVAILABLE Service unavailable - * @pre The state should be #SAMSUNG_AI_VOICETYPING_STATE_NONE or #SAMSUNG_AI_VOICETYPING_STATE_READY. - * @see samsung_ai_voicetyping_error_cb() - * @see samsung_ai_voicetyping_unset_error_cb() - */ -int samsung_ai_voicetyping_set_error_cb(samsung_ai_voicetyping_error_cb callback, void* user_data); - -/** - * @brief Unsets a callback function to get the error. - * @since_ses 6 - * - * @return 0 on success, otherwise a negative error value - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_NONE No error - * @retval #SAMSUNG_AI_VOICETYPING_ERROR_SERVICE_UNAVAILABLE Service unavailable - * @pre The state should be #SAMSUNG_AI_VOICETYPING_STATE_NONE or #SAMSUNG_AI_VOICETYPING_STATE_READY. - * @see samsung_ai_voicetyping_error_cb() - * @see samsung_ai_voicetyping_set_error_cb() - */ -int samsung_ai_voicetyping_unset_error_cb(void); - - -#ifdef __cplusplus -} -#endif - -#endif /* __SAMSUNG_EXPERIENCE_SERVICE_SAMSUNG_AI_VOICETYPING_H__ */ diff --git a/src/include/voicetyping.h b/src/include/voicetyping.h deleted file mode 100644 index 298f7ee..0000000 --- a/src/include/voicetyping.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved - * - * 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. - */ - -#pragma once - -#include "samsung_ai_voicetyping.h" - -typedef void (*voicetyping_connection_status_changed_cb)(samsung_ai_voicetyping_error_e result, samsung_ai_voicetyping_connection_status_e status, void* user_data); -typedef void (*voicetyping_result_cb)(const char* asr_result, const char* nlu_result, void* user_data); -typedef void (*voicetyping_error_cb)(samsung_ai_voicetyping_error_e reason, const char* err_msg, void* user_data); -typedef void (*voicetyping_state_changed_cb)(samsung_ai_voicetyping_state_e previous, samsung_ai_voicetyping_state_e current, void* user_data); - -class VoiceTyping -{ -public: - static VoiceTyping* getInstance() { - if (_instance == nullptr) { - _instance = new VoiceTyping; - } - - return _instance; - } - int init(voicetyping_connection_status_changed_cb callback, void *user_data); - int shutdown(); - int set_locale(const char *locale); - int start(); - int stop(); - int cancel(); - int set_result_cb(voicetyping_result_cb callback, void *user_data); - int set_error_cb(voicetyping_error_cb callback, void *user_data); - int set_state_changed_cb(voicetyping_state_changed_cb callback, void *user_data); - - int get_connection_status(samsung_ai_voicetyping_connection_status_e *connection_status); - int get_state(samsung_ai_voicetyping_state_e *state); -private: - VoiceTyping(); - ~VoiceTyping(); - - static VoiceTyping *_instance; - - samsung_ai_voicetyping_connection_status_e vt_connection_status; - - // connection status - voicetyping_connection_status_changed_cb connection_status_callback; - void *connection_status_user_data; - - static void vt_connection_status_changed_cb(samsung_ai_voicetyping_error_e result, samsung_ai_voicetyping_connection_status_e status, void* user_data); -}; diff --git a/src/ise-stt-mode.cpp b/src/ise-stt-mode.cpp index 57422a3..71e74c8 100644 --- a/src/ise-stt-mode.cpp +++ b/src/ise-stt-mode.cpp @@ -22,9 +22,6 @@ #include #include #include -#include -#include -#include #include "ise.h" #include "utils.h" @@ -33,9 +30,6 @@ #include "ise-stt-mode.h" #include "ise-stt-option.h" #include "ise-stt-common.h" -#include "voicetyping.h" - -using namespace std; #define _EDJ(x) elm_layout_edje_get(x) @@ -53,16 +47,6 @@ extern CSCLUI *g_ui; extern Candidate *g_candidate; extern CONFIG_VALUES g_config_values; -static bool g_voicetyping_mode = false; - -extern bool g_support_voicetyping; - -extern sclu32 _context_layout; -extern sclu32 _context_layout_variation; - -extern sclu32 _context_layout; -extern sclu32 _context_layout_variation; - #ifndef _TV static void set_guide_text(VoiceData *vd, const char* text, bool translatable = false); #endif @@ -198,37 +182,6 @@ static void on_mic_button_press_cb(void *data, Evas_Object *obj, void *event_inf VoiceData *voicedata = (VoiceData *)data; if (!voicedata) return; -#ifdef SUPPORT_VOICETYPING - if (g_voicetyping_mode) { - samsung_ai_voicetyping_state_e state = SAMSUNG_AI_VOICETYPING_STATE_NONE; - VoiceTyping::getInstance()->get_state(&state); - - switch (state) { - case SAMSUNG_AI_VOICETYPING_STATE_READY: - { - LOGD("Start voice typing"); - VoiceTyping::getInstance()->start(); - } - break; - case SAMSUNG_AI_VOICETYPING_STATE_RECORDING: - { - LOGD("Stop voice typing"); - VoiceTyping::getInstance()->stop(); - } - break; - case SAMSUNG_AI_VOICETYPING_STATE_PROCESSING: - { - LOGD("processing state"); - } - break; - default: - LOGD("voicetyping state : %d", state); - break; - } - return; - } -#endif - if (voicedata->sttmanager != NULL && (voicedata->sttmanager->GetCurrent() == STT_STATE_RECORDING || voicedata->sttmanager->GetCurrent() == STT_STATE_PROCESSING)) { @@ -350,15 +303,13 @@ static Eina_Bool _idler_cb(void *data) VoiceData *voicedata = (VoiceData *)data; - if (!g_voicetyping_mode) { - if (true == _app_stt_initialize(voicedata)) { - LOGD("_app_stt_initialize None Error"); - voicedata->voicefw_state = 1; - voicedata->state = STT_STATE_VAL_INIT; - } else { - voicedata->voicefw_state = 0; - LOGD("Initialization Fail!
Check STT-daemon is running"); - } + if (true == _app_stt_initialize(voicedata)) { + LOGD("_app_stt_initialize None Error"); + voicedata->voicefw_state = 1; + voicedata->state = STT_STATE_VAL_INIT; + } else { + voicedata->voicefw_state = 0; + LOGD("Initialization Fail!
Check STT-daemon is running"); } Evas_Object *canvas = elm_object_part_content_get(voicedata->layout_main, "EFFECT_BG"); @@ -677,100 +628,6 @@ int init_voice(Evas_Object *parent, const char *lang, VoiceData *r_voicedata) return TRUE; } -void -vt_result_cb(const char* asr_result, const char* nlu_result, void *user_data) -{ - if (NULL == asr_result) - return ; - - SECURE_LOGD("asr result - (%s), nlu result - (%s)", asr_result, nlu_result); - - if (nlu_result == NULL) { - ise_send_string(asr_result); - } - else { - JsonParser *parser = json_parser_new(); - JsonNode *root = NULL; - JsonObject *root_obj = NULL, *goal_obj = NULL; - const char *node_text = NULL; - GError *err_msg = NULL; - - json_parser_load_from_data(parser, (char *)nlu_result, strlen(nlu_result), &err_msg); - if (err_msg) { - LOGE("failed to load json file. error message: %s", err_msg->message); - goto cleanup; - } - - root = json_parser_get_root(parser); - if (root == NULL) { - LOGE("failed to get root"); - goto cleanup; - } - - root_obj = json_node_get_object(root); - if (root_obj == NULL) { - LOGE("failed to get root object"); - goto cleanup; - } - - goal_obj = json_object_get_object_member(root_obj, "goal"); - if (goal_obj == NULL) { - LOGE("failed to get goal object"); - goto cleanup; - } - - node_text = json_object_get_string_member(goal_obj, "node"); - SECURE_LOGI("node : %s", node_text); - if (node_text) { - if (string(node_text) == "bixby.voiceTyping.DeleteAll") { - LOGI("Delete all text"); - ime_delete_surrounding_text(INT_MIN/2, INT_MAX); - } - else { - LOGW("Unknown command : %s", node_text); - } - } - -cleanup: - if (err_msg) - g_error_free(err_msg); - - g_object_unref(parser); - } -} - -void -vt_state_changed_cb(samsung_ai_voicetyping_state_e previous, samsung_ai_voicetyping_state_e current, void* user_data) -{ -#ifndef _TV - VoiceData *voicedata = (VoiceData *)user_data; - - switch (current) { - case SAMSUNG_AI_VOICETYPING_STATE_READY: - { - LOGD("ready state"); - set_guide_text(voicedata, SK_TAP_TO_SPEAK, true); - } - break; - case SAMSUNG_AI_VOICETYPING_STATE_RECORDING: - { - LOGD("recording state"); - set_guide_text(voicedata, SK_SPEAK_NOW, true); - } - break; - case SAMSUNG_AI_VOICETYPING_STATE_PROCESSING: - { - LOGD("processing state"); - set_guide_text(voicedata, "Processing..."); - } - break; - default: - LOGD("voicetyping state : %d", current); - break; - } -#endif -} - Evas_Object *create_fullview(Evas_Object *win, VoiceData *r_voicedata) { LOGD("create_fullview"); @@ -837,43 +694,6 @@ Evas_Object *create_fullview(Evas_Object *win, VoiceData *r_voicedata) voicedata->btn_disabling_timer = ecore_timer_add(2.0, _mic_button_enable_cb, voicedata); } - LOGD("layout : %d", _context_layout); - - if (_context_layout == ISE_LAYOUT_STYLE_EMAIL || - _context_layout == ISE_LAYOUT_STYLE_PASSWORD) { -#ifdef SUPPORT_VOICETYPING - if (g_support_voicetyping) { - LOGD("voicetyping mode"); - g_voicetyping_mode = true; - - ret = VoiceTyping::getInstance()->set_locale("ko-KR"); - if (ret != SAMSUNG_AI_VOICETYPING_ERROR_NONE) { - LOGE("Failed to set locale (%d)", ret); - } - - VoiceTyping::getInstance()->set_result_cb(vt_result_cb, NULL); - if (ret != SAMSUNG_AI_VOICETYPING_ERROR_NONE) { - LOGE("Failed to set result callback (%d)", ret); - } - - VoiceTyping::getInstance()->set_state_changed_cb(vt_state_changed_cb, voicedata); - - samsung_ai_voicetyping_state_e state = SAMSUNG_AI_VOICETYPING_STATE_NONE; - VoiceTyping::getInstance()->get_state(&state); - if (SAMSUNG_AI_VOICETYPING_STATE_READY == state) { - VoiceTyping::getInstance()->start(); - } - } - else - g_voicetyping_mode = false; -#else - LOGD("non voice typing mode"); -#endif - } - else { - g_voicetyping_mode = false; - } - if (voicedata->init_timer == NULL) { voicedata->init_timer = ecore_timer_add(0.6, _idler_cb, voicedata); } @@ -1053,11 +873,6 @@ void destroy_voice() on_destroy(my_voicedata); my_voicedata = NULL; } - -#ifdef SUPPORT_VOICETYPING - if (g_voicetyping_mode) - VoiceTyping::getInstance()->cancel(); -#endif } void show_voice_input(Evas_Object *parent, const char *lang, void (*get_string)(char *, int)) diff --git a/src/ise.cpp b/src/ise.cpp index d606b6c..fa6144a 100644 --- a/src/ise.cpp +++ b/src/ise.cpp @@ -48,7 +48,6 @@ #include "modeindicator.h" #include "w-input-smartreply.h" #include "ise-floating-mode.h" -#include "voicetyping.h" #define EDJ_FILE RESDIR"/edje/mobile/customised_ctxpopup.edj" @@ -69,7 +68,6 @@ static sclboolean g_set_mime_type = FALSE; #endif int g_imdata_state = 0; -bool g_support_voicetyping = false; extern emoticon_group_t current_emoticon_group; extern std::vector emoticon_list_recent; @@ -141,8 +139,8 @@ static const char *_sig_dec[SIG_DEC_SIZE] = {".", "-"}; static scluint _sig_dec_event[SIG_DEC_SIZE] = {'.', '-'}; static Ecore_Timer *_commit_timer = NULL; -sclu32 _context_layout = ISE_LAYOUT_STYLE_NORMAL; -sclu32 _context_layout_variation = 0; +static sclu32 _context_layout = ISE_LAYOUT_STYLE_NORMAL; +static sclu32 _context_layout_variation = 0; Candidate *g_candidate = NULL; @@ -1160,6 +1158,7 @@ SCLEventReturnType CUIEventCallback::on_event_key_clicked(SclUIEventDesc event_d } else if (strcmp(event_desc.key_value, USER_KEYSTRING_VOICE) == 0) { g_keyboard_state.layout = ISE_LAYOUT_STYLE_VOICE; g_ui->set_input_mode("STT_3X4"); + } else if (strcmp(event_desc.key_value, USER_KEYSTRING_OPTION) == 0) { launch_option(); @@ -1880,24 +1879,6 @@ static void ise_mount_changed_cb(void *user_data) register_preference_changed_callback(); } -#ifdef SUPPORT_VOICETYPING -void vt_connection_status_changed_cb(samsung_ai_voicetyping_error_e result, samsung_ai_voicetyping_connection_status_e status, void* user_data) -{ - LOGD("[connection] result : %d, status : %d", result, status); - switch(status) { - case SAMSUNG_AI_VOICETYPING_CONNECTION_STATUS_CONNECTED: - LOGD("[connection] connected"); - break; - case SAMSUNG_AI_VOICETYPING_CONNECTION_STATUS_DISCONNECTED: - LOGD("[connection] disconnected"); - break; - case SAMSUNG_AI_VOICETYPING_CONNECTION_STATUS_REJECTED: - LOGD("[connection] rejected"); - break; - } -} -#endif - void ise_create() { @@ -2002,12 +1983,6 @@ ise_create() LOGW("Failed to get encryption_state"); } } - -#ifdef SUPPORT_VOICETYPING - if (VoiceTyping::getInstance()->init(vt_connection_status_changed_cb, NULL) == SAMSUNG_AI_VOICETYPING_ERROR_NONE) - g_support_voicetyping = true; -#endif - init_recent_used_punctuation(); } @@ -2016,10 +1991,6 @@ ise_destroy() { ise_hide_stt_mode(); -#ifdef SUPPORT_VOICETYPING - VoiceTyping::getInstance()->shutdown(); -#endif - if (g_ui) { LOGD("calling g_ui->fini()\n"); g_ui->fini(); diff --git a/src/voicetyping.cpp b/src/voicetyping.cpp deleted file mode 100644 index 8ad8bbd..0000000 --- a/src/voicetyping.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved - * - * 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. - */ - - -#include "voicetyping.h" - -#include - -#undef LOG_TAG -#define LOG_TAG "ISE_DEFAULT" - -VoiceTyping* VoiceTyping::_instance = nullptr; - -void VoiceTyping::vt_connection_status_changed_cb(samsung_ai_voicetyping_error_e result, samsung_ai_voicetyping_connection_status_e status, void* user_data) -{ - LOGD("[connection] result : %d, status : %d", result, status); - switch(status) { - case SAMSUNG_AI_VOICETYPING_CONNECTION_STATUS_CONNECTED: - LOGD("[connection] connected"); - break; - case SAMSUNG_AI_VOICETYPING_CONNECTION_STATUS_DISCONNECTED: - LOGD("[connection] disconnected"); - break; - case SAMSUNG_AI_VOICETYPING_CONNECTION_STATUS_REJECTED: - LOGD("[connection] rejected"); - break; - } - - auto self = static_cast(user_data); - self->vt_connection_status = status; - - if (self->connection_status_callback) - self->connection_status_callback(result, status, self->connection_status_user_data); -} - -VoiceTyping::VoiceTyping() -{ - vt_connection_status = SAMSUNG_AI_VOICETYPING_CONNECTION_STATUS_DISCONNECTED; - - connection_status_callback = NULL; - connection_status_user_data = NULL; -} - -VoiceTyping::~VoiceTyping() -{ - shutdown(); -} - -int VoiceTyping::init(voicetyping_connection_status_changed_cb callback, void *user_data) -{ - int ret = SAMSUNG_AI_VOICETYPING_ERROR_NOT_SUPPORTED; - -#ifdef SUPPORT_VOICETYPING - connection_status_callback = callback; - connection_status_user_data = user_data; - - ret = samsung_ai_voicetyping_initialize(vt_connection_status_changed_cb, this); -#endif - switch(ret) { - case SAMSUNG_AI_VOICETYPING_ERROR_NONE: - LOGD("[VT] Succeed to initialize voice typing"); - break; - case SAMSUNG_AI_VOICETYPING_ERROR_NOT_SUPPORTED: - LOGE("[VT] Not support"); - break; - case SAMSUNG_AI_VOICETYPING_ERROR_INVALID_PARAMETER: - LOGE("[VT] Invalid parameter"); - break; - case SAMSUNG_AI_VOICETYPING_ERROR_PERMISSION_DENIED: - LOGE("[VT] Permission denied"); - break; - case SAMSUNG_AI_VOICETYPING_ERROR_SERVICE_UNAVAILABLE: - LOGE("[VT] Service unavilable"); - break; - case SAMSUNG_AI_VOICETYPING_ERROR_OUT_OF_MEMORY: - LOGE("[VT] Out of memory"); - break; - case SAMSUNG_AI_VOICETYPING_ERROR_OPERATION_FAILED: - LOGE("[VT] Operation failed"); - break; - default: - LOGE("[VT] Failed to initialize voice typing. error: %d", ret); - break; - } - - return ret; -} - -int VoiceTyping::shutdown() -{ - int ret = SAMSUNG_AI_VOICETYPING_ERROR_NOT_SUPPORTED; -#ifdef SUPPORT_VOICETYPING - ret = samsung_ai_voicetyping_deinitialize(); -#endif - if (ret != SAMSUNG_AI_VOICETYPING_ERROR_NONE) { - LOGW("Failed to deinitialize. error : %d", ret); - } - - return ret; -} - -int VoiceTyping::start() -{ - int ret = SAMSUNG_AI_VOICETYPING_ERROR_NOT_SUPPORTED; -#ifdef SUPPORT_VOICETYPING - ret = samsung_ai_voicetyping_start(); -#endif - if (0 != ret) { - LOGE("Fail to start voice typing"); - } - else { - LOGD("Succeed to start voice typing"); - } - - - return ret; -} - -int VoiceTyping::stop() -{ - int ret = SAMSUNG_AI_VOICETYPING_ERROR_NOT_SUPPORTED; -#ifdef SUPPORT_VOICETYPING - ret = samsung_ai_voicetyping_stop(); -#endif - - if (0 != ret) { - LOGE("Fail to stop voice typing"); - } - else { - LOGD("Succeed to stop voice typing"); - } - return ret; -} - -int VoiceTyping::cancel() -{ - int ret = SAMSUNG_AI_VOICETYPING_ERROR_NOT_SUPPORTED; -#ifdef SUPPORT_VOICETYPING - ret = samsung_ai_voicetyping_cancel(); -#endif - - if (0 != ret) { - LOGE("Fail to cancel voice typing"); - } - else { - LOGD("Succeed to cancel voice typing"); - } - return ret; -} - -int VoiceTyping::set_locale(const char *locale) -{ - int ret = SAMSUNG_AI_VOICETYPING_ERROR_NOT_SUPPORTED; -#ifdef SUPPORT_VOICETYPING - ret = samsung_ai_voicetyping_set_locale((char *)locale); -#endif - if (ret != SAMSUNG_AI_VOICETYPING_ERROR_NONE) { - LOGE("Failed to set locale (%d)", ret); - } - - return ret; -} - -int VoiceTyping::set_result_cb(voicetyping_result_cb callback, void *user_data) -{ - int ret = SAMSUNG_AI_VOICETYPING_ERROR_NOT_SUPPORTED; -#ifdef SUPPORT_VOICETYPING - ret = samsung_ai_voicetyping_set_result_cb(callback, user_data); -#endif - if (ret != SAMSUNG_AI_VOICETYPING_ERROR_NONE) { - LOGE("Failed to set result callback (%d)", ret); - } - - return ret; -} - -int VoiceTyping::set_error_cb(voicetyping_error_cb callback, void *user_data) -{ - int ret = SAMSUNG_AI_VOICETYPING_ERROR_NOT_SUPPORTED; -#ifdef SUPPORT_VOICETYPING - ret = samsung_ai_voicetyping_set_error_cb(callback, user_data); -#endif - if (ret != SAMSUNG_AI_VOICETYPING_ERROR_NONE) { - LOGE("Failed to set error callback (%d)", ret); - } - - return ret; -} - -int VoiceTyping::set_state_changed_cb(voicetyping_state_changed_cb callback, void *user_data) -{ - int ret = SAMSUNG_AI_VOICETYPING_ERROR_NOT_SUPPORTED; -#ifdef SUPPORT_VOICETYPING - ret = samsung_ai_voicetyping_set_state_changed_cb(callback, user_data); -#endif - if (ret != SAMSUNG_AI_VOICETYPING_ERROR_NONE) { - LOGE("Failed to set state changed callback (%d)", ret); - } - - return ret; -} - -int VoiceTyping::get_connection_status(samsung_ai_voicetyping_connection_status_e *connection_state) -{ -#ifdef SUPPORT_VOICETYPING - *connection_state = vt_connection_status; - - return SAMSUNG_AI_VOICETYPING_ERROR_NONE; -#else - return SAMSUNG_AI_VOICETYPING_ERROR_NOT_SUPPORTED; -#endif -} - -int VoiceTyping::get_state(samsung_ai_voicetyping_state_e *state) -{ - int ret = SAMSUNG_AI_VOICETYPING_ERROR_NOT_SUPPORTED; -#ifdef SUPPORT_VOICETYPING - ret = samsung_ai_voicetyping_get_state(state); -#endif - return ret; -} \ No newline at end of file -- cgit v1.2.3