Directly link wakeup-manager code with executable file 36/304836/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Tue, 19 Dec 2023 07:50:43 +0000 (16:50 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Tue, 19 Dec 2023 07:50:43 +0000 (16:50 +0900)
Change-Id: Icb5ca3f5251e57307fb6c6e3741d76f24caaff46

39 files changed:
CMakeLists.txt
inc/service_plugin.h
inc/service_plugin_interface.h
packaging/org.tizen.multi-assistant-service.spec
plugins/CMakeLists.txt
plugins/dependency-default/CMakeLists.txt [moved from plugins/wakeup-manager/dependency-default/CMakeLists.txt with 90% similarity]
plugins/dependency-default/inc/dependency_default.h [moved from plugins/wakeup-manager/dependency-default/inc/dependency_default.h with 100% similarity]
plugins/dependency-default/inc/dependency_default_audio.h [moved from plugins/wakeup-manager/dependency-default/inc/dependency_default_audio.h with 100% similarity]
plugins/dependency-default/inc/dependency_default_button.h [moved from plugins/wakeup-manager/dependency-default/inc/dependency_default_button.h with 100% similarity]
plugins/dependency-default/src/dependency_default.cpp [moved from plugins/wakeup-manager/dependency-default/src/dependency_default.cpp with 100% similarity]
plugins/dependency-default/src/dependency_default_audio.cpp [moved from plugins/wakeup-manager/dependency-default/src/dependency_default_audio.cpp with 100% similarity]
plugins/dependency-default/src/dependency_default_button.cpp [moved from plugins/wakeup-manager/dependency-default/src/dependency_default_button.cpp with 100% similarity]
plugins/wakeup-manager/inc/wakeup_manager_wrapper.h [deleted file]
src/service_plugin.cpp
wakeup-manager/CMakeLists.txt [moved from plugins/wakeup-manager/CMakeLists.txt with 100% similarity]
wakeup-manager/inc/assistant_config_manager.h [moved from plugins/wakeup-manager/inc/assistant_config_manager.h with 100% similarity]
wakeup-manager/inc/dependency_resolver.h [moved from plugins/wakeup-manager/inc/dependency_resolver.h with 100% similarity]
wakeup-manager/inc/heap_tracer.h [moved from plugins/wakeup-manager/inc/heap_tracer.h with 100% similarity]
wakeup-manager/inc/wakeup_audio_manager.h [moved from plugins/wakeup-manager/inc/wakeup_audio_manager.h with 100% similarity]
wakeup-manager/inc/wakeup_engine_manager.h [moved from plugins/wakeup-manager/inc/wakeup_engine_manager.h with 100% similarity]
wakeup-manager/inc/wakeup_manager.h [moved from plugins/wakeup-manager/inc/wakeup_manager.h with 100% similarity]
wakeup-manager/inc/wakeup_manager_main.h [moved from plugins/wakeup-manager/inc/wakeup_manager_main.h with 100% similarity]
wakeup-manager/inc/wakeup_manager_wrapper.h [new file with mode: 0644]
wakeup-manager/inc/wakeup_policy.h [moved from plugins/wakeup-manager/inc/wakeup_policy.h with 100% similarity]
wakeup-manager/inc/wakeup_policy_default.h [moved from plugins/wakeup-manager/inc/wakeup_policy_default.h with 100% similarity]
wakeup-manager/inc/wakeup_policy_external.h [moved from plugins/wakeup-manager/inc/wakeup_policy_external.h with 100% similarity]
wakeup-manager/inc/wakeup_policy_impl.h [moved from plugins/wakeup-manager/inc/wakeup_policy_impl.h with 100% similarity]
wakeup-manager/inc/wakeup_settings.h [moved from plugins/wakeup-manager/inc/wakeup_settings.h with 100% similarity]
wakeup-manager/src/assistant_config_manager.cpp [moved from plugins/wakeup-manager/src/assistant_config_manager.cpp with 100% similarity]
wakeup-manager/src/dependency_resolver.cpp [moved from plugins/wakeup-manager/src/dependency_resolver.cpp with 100% similarity]
wakeup-manager/src/heap_tracer.cpp [moved from plugins/wakeup-manager/src/heap_tracer.cpp with 100% similarity]
wakeup-manager/src/wakeup_audio_manager.cpp [moved from plugins/wakeup-manager/src/wakeup_audio_manager.cpp with 100% similarity]
wakeup-manager/src/wakeup_engine_manager.cpp [moved from plugins/wakeup-manager/src/wakeup_engine_manager.cpp with 100% similarity]
wakeup-manager/src/wakeup_manager.cpp [moved from plugins/wakeup-manager/src/wakeup_manager.cpp with 100% similarity]
wakeup-manager/src/wakeup_manager_wrapper.cpp [moved from plugins/wakeup-manager/src/wakeup_manager_wrapper.cpp with 100% similarity]
wakeup-manager/src/wakeup_policy.cpp [moved from plugins/wakeup-manager/src/wakeup_policy.cpp with 100% similarity]
wakeup-manager/src/wakeup_policy_default.cpp [moved from plugins/wakeup-manager/src/wakeup_policy_default.cpp with 100% similarity]
wakeup-manager/src/wakeup_policy_external.cpp [moved from plugins/wakeup-manager/src/wakeup_policy_external.cpp with 100% similarity]
wakeup-manager/src/wakeup_settings.cpp [moved from plugins/wakeup-manager/src/wakeup_settings.cpp with 100% similarity]

index 816b812..40b8703 100644 (file)
@@ -29,6 +29,9 @@ pkg_check_modules(pkgs REQUIRED
        vconf
        pkgmgr-info
        jsoncpp
+       capi-media-audio-io
+       capi-media-sound-manager
+       eina
 )
 
 # SET FLAG ---------------------------------------------------------------------------------------
@@ -66,6 +69,7 @@ ENDIF()
 LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/wakeup-manager/inc)
 
 SET(SRCS
                src/service_config.cpp
@@ -78,6 +82,17 @@ SET(SRCS
                src/service_ipc_dbus.cpp
                src/service_ipc_dbus_dispatcher.cpp
                src/main.cpp
+               wakeup-manager/src/wakeup_manager.cpp
+               wakeup-manager/src/wakeup_settings.cpp
+               wakeup-manager/src/wakeup_policy.cpp
+               wakeup-manager/src/wakeup_policy_default.cpp
+               wakeup-manager/src/wakeup_policy_external.cpp
+               wakeup-manager/src/wakeup_audio_manager.cpp
+               wakeup-manager/src/wakeup_engine_manager.cpp
+               wakeup-manager/src/wakeup_manager_wrapper.cpp
+               wakeup-manager/src/dependency_resolver.cpp
+               wakeup-manager/src/heap_tracer.cpp
+               wakeup-manager/src/assistant_config_manager.cpp
 )
 ADD_EXECUTABLE(${BINNAME} ${SRCS})
 
index 6a4691d..776944b 100644 (file)
@@ -24,6 +24,8 @@
 #include "service_ipc_dbus.h"
 #include "service_plugin_interface.h"
 
+#include "wakeup_manager_wrapper.h"
+
 class CServiceMain;
 
 class CServicePlugin {
@@ -92,10 +94,6 @@ private:
        FILE* mDumpFile{NULL};
        int mDumpCount{1};
 #endif
-
-       void* mPluginHandle{NULL};
-
-       wakeup_manager_interface mWakeupManagerInterface{NULL, };
        ma_plugin_settings* mPluginSettings{NULL};
 
        CServiceIpcDbus* mServiceIpc{nullptr};
index ae2a74e..afce9f1 100644 (file)
 
 #include <tzplatform_config.h>
 
-typedef struct {
-       int plugin_version;
-       bool ui_panel_enabled;
-} ma_plugin_settings;
-
 #define MA_WAKEUP_MANAGER_PATH tzplatform_mkpath(tzplatform_getid("TZ_SYS_RO_SHARE"), "multiassistant/")
 
-#define MA_DEFAULT_WAKEUP_MANAGER_FILENAME "libma-wakeup-manager.so"
-
-#define MA_WAKEUP_MANAGER_FUNC_INITIALIZE "wakeup_manager_initialize"
-typedef int (*wakeup_manager_initialize)(void);
-#define MA_WAKEUP_MANAGER_FUNC_DEINITIALIZE "wakeup_manager_deinitialize"
-typedef int (*wakeup_manager_deinitialize)(void);
-#define MA_WAKEUP_MANAGER_FUNC_GET_SETTINGS "wakeup_manager_get_settings"
-typedef int (*wakeup_manager_get_settings)(ma_plugin_settings **settings, size_t *struct_size);
-#define MA_WAKEUP_MANAGER_FUNC_ADD_ASSISTANT_WAKEUP_WORD "wakeup_manager_add_assistant_wakeup_word"
-typedef int (*wakeup_manager_add_assistant_wakeup_word)(const char* appid, const char* wakeup_word, const char* language);
-#define MA_WAKEUP_MANAGER_FUNC_REMOVE_ASSISTANT_WAKEUP_WORD "wakeup_manager_remove_assistant_wakeup_word"
-typedef int (*wakeup_manager_remove_assistant_wakeup_word)(const char* appid, const char* wakeup_word, const char* language);
-#define MA_WAKEUP_MANAGER_FUNC_ADD_ASSISTANT_LANGUAGE "wakeup_manager_add_assistant_language"
-typedef int (*wakeup_manager_add_assistant_language)(const char* appid, const char* language);
-#define MA_WAKEUP_MANAGER_FUNC_ADD_ASSISTANT_WAKEUP_ENGINE "wakeup_manager_add_assistant_wakeup_engine"
-typedef int (*wakeup_manager_add_assistant_wakeup_engine)(const char* appid, const char* engine);
-#define MA_WAKEUP_MANAGER_FUNC_SET_DEFAULT_ASSISTANT "wakeup_manager_set_default_assistant"
-typedef int (*wakeup_manager_set_default_assistant)(const char* appid);
-#define MA_WAKEUP_MANAGER_FUNC_GET_DEFAULT_ASSISTANT "wakeup_manager_get_default_assistant"
-typedef int (*wakeup_manager_get_default_assistant)(const char** appid);
-#define MA_WAKEUP_MANAGER_FUNC_SET_LANGUAGE "wakeup_manager_set_language"
-typedef int (*wakeup_manager_set_language)(const char* language);
-#define MA_WAKEUP_MANAGER_FUNC_ACTIVATE "wakeup_manager_activate"
-typedef int (*wakeup_manager_activate)(void);
-#define MA_WAKEUP_MANAGER_FUNC_DEACTIVATE "wakeup_manager_deactivate"
-typedef int (*wakeup_manager_deactivate)(void);
-#define MA_WAKEUP_MANAGER_FUNC_UPDATE_VOICE_FEEDBACK_STATE "wakeup_manager_update_voice_feedback_state"
-typedef int (*wakeup_manager_update_voice_feedback_state)(const char* appid, int state);
-#define MA_WAKEUP_MANAGER_FUNC_SET_ASSISTANT_SPECIFIC_COMMAND "wakeup_manager_set_assistant_specific_command"
-typedef int (*wakeup_manager_set_assistant_specific_command)(const char* appid, const char* command);
-#define MA_WAKEUP_MANAGER_FUNC_SET_BACKGROUND_VOLUME "wakeup_manager_set_background_volume"
-typedef int (*wakeup_manager_set_background_volume)(const char* appid, double ratio);
-#define MA_WAKEUP_MANAGER_FUNC_UPDATE_RECOGNITION_RESULT "wakeup_manager_update_recognition_result"
-typedef int (*wakeup_manager_update_recognition_result)(const char* appid, int result);
-#define MA_WAKEUP_MANAGER_FUNC_PROCESS_PLUGIN_EVENT "wakeup_manager_process_plugin_event"
-typedef int (*wakeup_manager_process_plugin_event)(int event, void* data, int len);
-#define MA_WAKEUP_MANAGER_FUNC_START_STREAMING_UTTERANCE_DATA "wakeup_manager_start_streaming_utterance_data"
-typedef int (*wakeup_manager_start_streaming_utterance_data)(void);
-#define MA_WAKEUP_MANAGER_FUNC_STOP_STREAMING_UTTERANCE_DATA "wakeup_manager_stop_streaming_utterance_data"
-typedef int (*wakeup_manager_stop_streaming_utterance_data)(void);
-#define MA_WAKEUP_MANAGER_FUNC_START_STREAMING_PREVIOUS_UTTERANCE_DATA "wakeup_manager_start_streaming_previous_utterance_data"
-typedef int (*wakeup_manager_start_streaming_previous_utterance_data)(void);
-#define MA_WAKEUP_MANAGER_FUNC_STOP_STREAMING_PREVIOUS_UTTERANCE_DATA "wakeup_manager_stop_streaming_previous_utterance_data"
-typedef int (*wakeup_manager_stop_streaming_previous_utterance_data)(void);
-#define MA_WAKEUP_MANAGER_FUNC_START_STREAMING_FOLLOW_UP_DATA "wakeup_manager_start_streaming_follow_up_data"
-typedef int (*wakeup_manager_start_streaming_follow_up_data)(void);
-#define MA_WAKEUP_MANAGER_FUNC_STOP_STREAMING_FOLLOW_UP_DATA "wakeup_manager_stop_streaming_follow_up_data"
-typedef int (*wakeup_manager_stop_streaming_follow_up_data)(void);
-#define MA_WAKEUP_MANAGER_FUNC_GET_AUDIO_FORMAT "wakeup_manager_get_audio_format"
-typedef int (*wakeup_manager_get_audio_format)(int* rate, int* channel, int* audio_type);
-#define MA_WAKEUP_MANAGER_FUNC_GET_AUDIO_SOURCE_TYPE "wakeup_manager_get_audio_source_type"
-typedef int (*wakeup_manager_get_audio_source_type)(char** type);
-#define MA_WAKEUP_MANAGER_FUNC_SET_VOICE_KEY_TAP_DURATION "wakeup_manager_set_voice_key_tap_duration"
-typedef int (*wakeup_manager_set_voice_key_tap_duration)(float duration);
-#define MA_WAKEUP_MANAGER_FUNC_UNSET_VOICE_KEY_TAP_DURATION "wakeup_manager_unset_voice_key_tap_duration"
-typedef int (*wakeup_manager_unset_voice_key_tap_duration)();
-#define MA_WAKEUP_MANAGER_FUNC_SET_VOICE_KEY_SUPPORT_MODE "wakeup_manager_set_voice_key_support_mode"
-typedef int (*wakeup_manager_set_voice_key_support_mode)(int mode);
-#define MA_WAKEUP_MANAGER_FUNC_SET_WAKE_WORD_AUDIO_REQUIRE_FLAG "wakeup_manager_set_wake_word_audio_require_flag"
-typedef int (*wakeup_manager_set_wake_word_audio_require_flag)(bool require);
-#define MA_WAKEUP_MANAGER_FUNC_SET_ASSISTANT_LANGUAGE "wakeup_manager_set_assistant_language"
-typedef int (*wakeup_manager_set_assistant_language)(const char* appid, const char* language);
-#define MA_WAKEUP_MANAGER_FUNC_SET_WAKEUP_EVENT_CALLBACK "wakeup_manager_set_wakeup_event_callback"
-typedef int (*wakeup_manager_set_wakeup_event_callback)(wakeup_service_wakeup_event_cb callback, void* user_data);
-#define MA_WAKEUP_MANAGER_FUNC_SET_UTTERANCE_STREAMING_CALLBACK "wakeup_manager_set_utterance_streaming_callback"
-typedef int (*wakeup_manager_set_utterance_streaming_callback)(wakeup_service_speech_streaming_cb callback, void* user_data);
-#define MA_WAKEUP_MANAGER_FUNC_SET_PREVIOUS_UTTERANCE_STREAMING_CALLBACK "wakeup_manager_set_previous_utterance_streaming_callback"
-typedef int (*wakeup_manager_set_previous_utterance_streaming_callback)(wakeup_service_speech_streaming_cb callback, void* user_data);
-#define MA_WAKEUP_MANAGER_FUNC_SET_FOLLOW_UP_STREAMING_CALLBACK "wakeup_manager_set_follow_up_streaming_callback"
-typedef int (*wakeup_manager_set_follow_up_streaming_callback)(wakeup_service_speech_streaming_cb callback, void* user_data);
-#define MA_WAKEUP_MANAGER_FUNC_SET_SPEECH_STATUS_CALLBACK "wakeup_manager_set_speech_status_callback"
-typedef int (*wakeup_manager_set_speech_status_callback)(wakeup_service_speech_status_cb callback, void* user_data);
-#define MA_WAKEUP_MANAGER_FUNC_SET_SETTING_CHANGED_CALLBACK "wakeup_manager_set_setting_changed_callback"
-typedef int (*wakeup_manager_set_setting_changed_callback)(wakeup_service_setting_changed_cb callback, void* user_data);
-#define MA_WAKEUP_MANAGER_FUNC_SET_ERROR_CALLBACK "wakeup_manager_set_error_callback"
-typedef int (*wakeup_manager_set_error_callback)(wakeup_service_error_cb callback, void* user_data);
-#define MA_WAKEUP_MANAGER_FUNC_SET_STREAMING_SECTION_CHANGED_CALLBACK "wakeup_manager_set_streaming_section_changed_callback"
-typedef int (*wakeup_manager_set_streaming_section_changed_callback)(wakeup_service_streaming_section_changed_cb callback, void* user_data);
-#define MA_WAKEUP_MANAGER_FUNC_SET_WAKEUP_ENGINE_COMMAND_CALLBACK "wakeup_manager_set_wakeup_engine_command_callback"
-typedef int (*wakeup_manager_set_wakeup_engine_command_callback)(wakeup_service_wakeup_engine_command_cb callback, void* user_data);
-#define MA_WAKEUP_MANAGER_FUNC_SET_WAKEUP_SERVICE_STATE_CHANGED_CALLBACK "wakeup_manager_set_wakeup_service_state_changed_callback"
-typedef int (*wakeup_manager_set_wakeup_service_state_changed_callback)(wakeup_service_wakeup_service_state_changed_cb callback, void* user_data);
-#define MA_WAKEUP_MANAGER_FUNC_SET_VOICE_KEY_STATUS_CHANGED_CALLBACK "wakeup_manager_set_voice_key_status_changed_callback"
-typedef int (*wakeup_manager_set_voice_key_status_changed_callback)(wakeup_service_voice_key_status_changed_cb callback, void* user_data);
-#define MA_WAKEUP_MANAGER_FUNC_SET_LOADED_ENGINE_CHANGED_CALLBACK "wakeup_manager_set_loaded_engine_changed_callback"
-typedef int (*wakeup_manager_set_loaded_engine_changed_callback)(wakeup_service_loaded_engine_changed_cb callback, void* user_data);
-
-typedef struct {
-       wakeup_manager_initialize                                                                       initialize;
-       wakeup_manager_deinitialize                                                                     deinitialize;
-       wakeup_manager_get_settings                                                                     get_settings;
-       wakeup_manager_add_assistant_wakeup_word                                        add_assistant_wakeup_word;
-       wakeup_manager_remove_assistant_wakeup_word                                     remove_assistant_wakeup_word;
-       wakeup_manager_add_assistant_language                                           add_assistant_language;
-       wakeup_manager_add_assistant_wakeup_engine                                      add_assistant_wakeup_engine;
-       wakeup_manager_set_default_assistant                                            set_default_assistant;
-       wakeup_manager_get_default_assistant                                            get_default_assistant;
-       wakeup_manager_set_language                                                                     set_language;
-       wakeup_manager_activate                                                                         activate;
-       wakeup_manager_deactivate                                                                       deactivate;
-       wakeup_manager_update_voice_feedback_state                                      update_voice_feedback_state;
-       wakeup_manager_set_assistant_specific_command                           set_assistant_specific_command;
-       wakeup_manager_set_background_volume                                            set_background_volume;
-       wakeup_manager_update_recognition_result                                        update_recognition_result;
-       wakeup_manager_process_plugin_event                                                     process_plugin_event;
-       wakeup_manager_start_streaming_utterance_data                           start_streaming_utterance_data;
-       wakeup_manager_stop_streaming_utterance_data                            stop_streaming_utterance_data;
-       wakeup_manager_start_streaming_previous_utterance_data          start_streaming_previous_utterance_data;
-       wakeup_manager_stop_streaming_previous_utterance_data           stop_streaming_previous_utterance_data;
-       wakeup_manager_start_streaming_follow_up_data                           start_streaming_follow_up_data;
-       wakeup_manager_stop_streaming_follow_up_data                            stop_streaming_follow_up_data;
-       wakeup_manager_get_audio_format                                                         get_audio_format;
-       wakeup_manager_get_audio_source_type                                            get_audio_source_type;
-       wakeup_manager_set_voice_key_tap_duration                                       set_voice_key_tap_duration;
-       wakeup_manager_unset_voice_key_tap_duration                                     unset_voice_key_tap_duration;
-       wakeup_manager_set_voice_key_support_mode                                       set_voice_key_support_mode;
-       wakeup_manager_set_wake_word_audio_require_flag                         set_wake_word_audio_require_flag;
-       wakeup_manager_set_assistant_language                                           set_assistant_language;
-       wakeup_manager_set_wakeup_event_callback                                        set_wakeup_event_callback;
-       wakeup_manager_set_utterance_streaming_callback                         set_utterance_streaming_callback;
-       wakeup_manager_set_previous_utterance_streaming_callback        set_previous_utterance_streaming_callback;
-       wakeup_manager_set_follow_up_streaming_callback                         set_follow_up_streaming_callback;
-       wakeup_manager_set_speech_status_callback                                       set_speech_status_callback;
-       wakeup_manager_set_setting_changed_callback                                     set_setting_changed_callback;
-       wakeup_manager_set_error_callback                                                       set_error_callback;
-       wakeup_manager_set_streaming_section_changed_callback           set_streaming_section_changed_callback;
-       wakeup_manager_set_wakeup_engine_command_callback                       set_wakeup_engine_command_callback;
-       wakeup_manager_set_wakeup_service_state_changed_callback        set_wakeup_service_state_changed_callback;
-       wakeup_manager_set_voice_key_status_changed_callback            set_voice_key_status_changed_callback;
-       wakeup_manager_set_loaded_engine_changed_callback                       set_loaded_engine_changed_callback;
-} wakeup_manager_interface;
-
 #endif /* __SERVICE_PLUGIN_INTERFACE_H__ */
index 8049eed..c0d18b5 100644 (file)
@@ -104,7 +104,6 @@ exit 0
 %manifest %{name}.manifest
 %defattr(-,root,root,-)
 /usr/share/packages/org.tizen.multi-assistant-service.xml
-%{TZ_SYS_RO_SHARE}/multiassistant/libma-wakeup-manager.so
 %{TZ_SYS_RO_SHARE}/multiassistant/libma-dependency-default.so
 %{TZ_SYS_RO_APP}/%{name}/*
 #%{_appdir}/lib/*
index 2d6e382..9afc7fe 100644 (file)
@@ -1 +1 @@
-ADD_SUBDIRECTORY(wakeup-manager)
+ADD_SUBDIRECTORY(dependency-default)
@@ -56,4 +56,4 @@ ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS} )
 # Install libraries
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${ddpkgs_LDFLAGS} -ldl ${EXTRA_LDFLAGS})
 MESSAGE("LDFLAG : ${ddpkgs_LDFLAGS}")
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/plugins/wakeup-manager/dependency-default/lib${PACKAGE}.so DESTINATION ${TZ_SYS_RO_SHARE}/multiassistant/)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/plugins/dependency-default/lib${PACKAGE}.so DESTINATION ${TZ_SYS_RO_SHARE}/multiassistant/)
diff --git a/plugins/wakeup-manager/inc/wakeup_manager_wrapper.h b/plugins/wakeup-manager/inc/wakeup_manager_wrapper.h
deleted file mode 100644 (file)
index b34a8f2..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright 2018-2019 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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.
- */
-
-
-#ifndef _WAKEUP_MANAGER_WRAPPER_H_
-#define _WAKEUP_MANAGER_WRAPPER_H_
-
-#include <dlog.h>
-#include <stdbool.h>
-#include <tizen.h>
-#include <tzplatform_config.h>
-
-#include <multi_assistant_service.h>
-#include <multi_assistant_internal.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum {
-       WAKEUP_MANAGER_STATE_INACTIVE = 0,
-       WAKEUP_MANAGER_STATE_LISTENING = 1,
-       WAKEUP_MANAGER_STATE_UTTERANCE = 2,
-       WAKEUP_MANAGER_STATE_PROCESSING = 3,
-       WAKEUP_MANAGER_STATE_VOICE_FEEDBACK = 4
-} wakeup_manager_state_e;
-
-typedef void (*ma_audio_streaming_data_section_changed_cb)(ma_audio_streaming_data_section_e section, void* user_data);
-
-typedef void (*wakeup_service_wakeup_event_cb)(mas_wakeup_event_info wakeup_info, void* user_data);
-
-typedef void (*wakeup_service_speech_streaming_cb)(mas_speech_streaming_event_e event, void* buffer, int len, void *user_data);
-
-typedef void (*wakeup_service_speech_status_cb)(mas_speech_status_e status, void *user_data);
-
-typedef void (*wakeup_service_setting_changed_cb)( void *user_data);
-
-typedef void (*wakeup_service_error_cb)(int error, const char* err_msg, void* user_data);
-
-typedef void (*wakeup_service_audio_data_require_status_cb)(bool require, void* user_data);
-
-typedef void (*wakeup_service_streaming_section_changed_cb)(ma_audio_streaming_data_section_e section, void* user_data);
-
-typedef void (*wakeup_service_engine_command_cb)(mas_wakeup_engine_command_target_e target, const char* assistant_name, const char* command, void* user_data);
-
-typedef void (*wakeup_service_state_changed_cb)(ma_service_state_e state, void* user_data);
-
-typedef void (*wakeup_service_voice_key_status_changed_cb)(ma_voice_key_status_e state, void* user_data);
-
-typedef void (*wakeup_service_loaded_engine_changed_cb)(void* user_data);
-
-typedef struct {
-       int plugin_version;
-       bool ui_panel_enabled;
-} ma_plugin_settings;
-
-EXPORT_API int wakeup_manager_initialize(void);
-
-EXPORT_API int wakeup_manager_deinitialize(void);
-
-EXPORT_API int wakeup_manager_get_settings(ma_plugin_settings **settings, size_t *struct_size);
-
-EXPORT_API int wakeup_manager_add_assistant_wakeup_word(const char* appid, const char* wakeup_word, const char* language);
-
-EXPORT_API int wakeup_manager_remove_assistant_wakeup_word(const char* appid, const char* wakeup_word, const char* language);
-
-EXPORT_API int wakeup_manager_add_assistant_language(const char* appid, const char* language);
-
-EXPORT_API int wakeup_manager_add_assistant_wakeup_engine(const char* appid, const char *engine);
-
-EXPORT_API int wakeup_manager_set_default_assistant(const char* appid);
-
-EXPORT_API int wakeup_manager_get_default_assistant(const char** appid);
-
-EXPORT_API int wakeup_manager_set_language(const char* language);
-
-EXPORT_API int wakeup_manager_activate(void);
-
-EXPORT_API int wakeup_manager_deactivate(void);
-
-EXPORT_API int wakeup_manager_update_voice_feedback_state(const char *appid, int state);
-
-EXPORT_API int wakeup_manager_set_assistant_specific_command(const char* appid, const char* command);
-
-EXPORT_API int wakeup_manager_set_background_volume(const char *appid, double ratio);
-
-EXPORT_API int wakeup_manager_update_recognition_result(const char *appid, int result);
-
-EXPORT_API int wakeup_manager_process_plugin_event(mas_plugin_event_e event, void* data, int len);
-
-EXPORT_API int wakeup_manager_start_streaming_utterance_data(void);
-
-EXPORT_API int wakeup_manager_stop_streaming_utterance_data(void);
-
-EXPORT_API int wakeup_manager_start_streaming_previous_utterance_data(void);
-
-EXPORT_API int wakeup_manager_stop_streaming_previous_utterance_data(void);
-
-EXPORT_API int wakeup_manager_start_streaming_follow_up_data(void);
-
-EXPORT_API int wakeup_manager_stop_streaming_follow_up_data(void);
-
-EXPORT_API int wakeup_manager_get_audio_format(int *rate, int *channel, int *audio_type);
-
-EXPORT_API int wakeup_manager_get_audio_source_type(char** type);
-
-EXPORT_API int wakeup_manager_set_voice_key_tap_duration(float duration);
-
-EXPORT_API int wakeup_manager_unset_voice_key_tap_duration();
-
-EXPORT_API int wakeup_manager_set_voice_key_support_mode(int mode);
-
-EXPORT_API int wakeup_manager_set_wake_word_audio_require_flag(bool require);
-
-EXPORT_API int wakeup_manager_set_assistant_language(const char* appid, const char *language);
-
-EXPORT_API int wakeup_manager_set_wakeup_event_callback(wakeup_service_wakeup_event_cb callback, void* user_data);
-
-EXPORT_API int wakeup_manager_set_utterance_streaming_callback(wakeup_service_speech_streaming_cb callback, void* user_data);
-
-EXPORT_API int wakeup_manager_set_previous_utterance_streaming_callback(wakeup_service_speech_streaming_cb callback, void* user_data);
-
-EXPORT_API int wakeup_manager_set_follow_up_streaming_callback(wakeup_service_speech_streaming_cb callback, void* user_data);
-
-EXPORT_API int wakeup_manager_set_speech_status_callback(wakeup_service_speech_status_cb callback, void* user_data);
-
-EXPORT_API int wakeup_manager_set_setting_changed_callback(wakeup_service_setting_changed_cb callback, void* user_data);
-
-EXPORT_API int wakeup_manager_set_error_callback(wakeup_service_error_cb callback, void* user_data);
-
-EXPORT_API int wakeup_manager_set_streaming_section_changed_callback(wakeup_service_streaming_section_changed_cb callback, void* user_data);
-
-EXPORT_API int wakeup_manager_set_wakeup_engine_command_callback(wakeup_service_engine_command_cb callback, void* user_data);
-
-EXPORT_API int wakeup_manager_set_wakeup_service_state_changed_callback(wakeup_service_state_changed_cb callback, void* user_data);
-
-EXPORT_API int wakeup_manager_set_voice_key_status_changed_callback(wakeup_service_voice_key_status_changed_cb callback, void* user_data);
-
-EXPORT_API int wakeup_manager_set_loaded_engine_changed_callback(wakeup_service_loaded_engine_changed_cb callback, void* user_data);
-
-/* Internal API declarations for dependency modules */
-
-int wakeup_manager_feed_audio_data(mas_speech_streaming_event_e event, void* buffer, int len);
-
-int wakeup_manager_set_dependency_module_command(const char* engine_name, const char* command);
-
-int wakeup_manager_wakeup_assistant(const mas_wakeup_event_info* wakeup_info);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _WAKEUP_MANAGER_WRAPPER_H_ */
index 2b8e8da..0f0454b 100644 (file)
@@ -699,179 +699,20 @@ int CServicePlugin::initialize(void)
 {
        MAS_LOGD("[Enter]");
 
-       char filepath[512] = {'\0', };
-       const char *default_engine_path = MA_WAKEUP_MANAGER_PATH;
-       snprintf(filepath, 512, "%s/%s", default_engine_path, MA_DEFAULT_WAKEUP_MANAGER_FILENAME);
-
-       char *error;
-       mPluginHandle = nullptr;
-       mPluginHandle = dlopen(filepath, RTLD_LAZY);
-       if (nullptr != (error = dlerror())) {
-               MAS_LOGE("[ERROR] Fail to dlopen(%s), error(%s)", filepath, error);
-               if (mPluginHandle) dlclose(mPluginHandle);
-               mPluginHandle = nullptr;
-               return -1; //MAS_ERROR_OPERATION_FAILED;
-       }
-       if (nullptr == mPluginHandle) {
-               MAS_LOGE("[ERROR] Fail to dlopen(%s), error(%s)", filepath, error);
-               return -1; //MAS_ERROR_OPERATION_FAILED;
-       }
-
-       mWakeupManagerInterface.initialize =
-               (wakeup_manager_initialize)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_INITIALIZE);
-       mWakeupManagerInterface.deinitialize =
-               (wakeup_manager_deinitialize)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_DEINITIALIZE);
-       mWakeupManagerInterface.get_settings =
-               (wakeup_manager_get_settings)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_GET_SETTINGS);
-       mWakeupManagerInterface.add_assistant_wakeup_word =
-               (wakeup_manager_add_assistant_wakeup_word)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_ADD_ASSISTANT_WAKEUP_WORD);
-       mWakeupManagerInterface.remove_assistant_wakeup_word =
-               (wakeup_manager_remove_assistant_wakeup_word)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_REMOVE_ASSISTANT_WAKEUP_WORD);
-       mWakeupManagerInterface.add_assistant_language =
-               (wakeup_manager_add_assistant_language)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_ADD_ASSISTANT_LANGUAGE);
-       mWakeupManagerInterface.add_assistant_wakeup_engine =
-               (wakeup_manager_add_assistant_wakeup_engine)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_ADD_ASSISTANT_WAKEUP_ENGINE);
-       mWakeupManagerInterface.set_default_assistant =
-               (wakeup_manager_set_default_assistant)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_SET_DEFAULT_ASSISTANT);
-       mWakeupManagerInterface.get_default_assistant =
-               (wakeup_manager_get_default_assistant)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_GET_DEFAULT_ASSISTANT);
-       mWakeupManagerInterface.set_language =
-               (wakeup_manager_set_language)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_SET_LANGUAGE);
-       mWakeupManagerInterface.activate =
-               (wakeup_manager_activate)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_ACTIVATE);
-       mWakeupManagerInterface.deactivate =
-               (wakeup_manager_deactivate)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_DEACTIVATE);
-       mWakeupManagerInterface.update_voice_feedback_state =
-               (wakeup_manager_update_voice_feedback_state)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_UPDATE_VOICE_FEEDBACK_STATE);
-       mWakeupManagerInterface.set_assistant_specific_command =
-               (wakeup_manager_set_assistant_specific_command)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_SET_ASSISTANT_SPECIFIC_COMMAND);
-       mWakeupManagerInterface.set_background_volume =
-               (wakeup_manager_set_background_volume)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_SET_BACKGROUND_VOLUME);
-       mWakeupManagerInterface.update_recognition_result =
-               (wakeup_manager_update_recognition_result)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_UPDATE_RECOGNITION_RESULT);
-       mWakeupManagerInterface.process_plugin_event =
-               (wakeup_manager_process_plugin_event)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_PROCESS_PLUGIN_EVENT);
-       mWakeupManagerInterface.start_streaming_utterance_data =
-               (wakeup_manager_start_streaming_utterance_data)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_START_STREAMING_UTTERANCE_DATA);
-       mWakeupManagerInterface.stop_streaming_utterance_data =
-               (wakeup_manager_stop_streaming_utterance_data)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_STOP_STREAMING_UTTERANCE_DATA);
-       mWakeupManagerInterface.start_streaming_previous_utterance_data =
-               (wakeup_manager_start_streaming_previous_utterance_data)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_START_STREAMING_PREVIOUS_UTTERANCE_DATA);
-       mWakeupManagerInterface.stop_streaming_previous_utterance_data =
-               (wakeup_manager_stop_streaming_previous_utterance_data)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_STOP_STREAMING_PREVIOUS_UTTERANCE_DATA);
-       mWakeupManagerInterface.start_streaming_follow_up_data =
-               (wakeup_manager_start_streaming_follow_up_data)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_START_STREAMING_FOLLOW_UP_DATA);
-       mWakeupManagerInterface.stop_streaming_follow_up_data =
-               (wakeup_manager_stop_streaming_follow_up_data)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_STOP_STREAMING_FOLLOW_UP_DATA);
-       mWakeupManagerInterface.get_audio_format =
-               (wakeup_manager_get_audio_format)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_GET_AUDIO_FORMAT);
-       mWakeupManagerInterface.get_audio_source_type =
-               (wakeup_manager_get_audio_source_type)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_GET_AUDIO_SOURCE_TYPE);
-       mWakeupManagerInterface.set_wake_word_audio_require_flag =
-               (wakeup_manager_set_wake_word_audio_require_flag)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_SET_WAKE_WORD_AUDIO_REQUIRE_FLAG);
-       mWakeupManagerInterface.set_assistant_language =
-               (wakeup_manager_set_assistant_language)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_SET_ASSISTANT_LANGUAGE);
-       mWakeupManagerInterface.set_voice_key_tap_duration =
-               (wakeup_manager_set_voice_key_tap_duration)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_SET_VOICE_KEY_TAP_DURATION);
-       mWakeupManagerInterface.unset_voice_key_tap_duration =
-               (wakeup_manager_unset_voice_key_tap_duration)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_UNSET_VOICE_KEY_TAP_DURATION);
-       mWakeupManagerInterface.set_voice_key_support_mode =
-               (wakeup_manager_set_voice_key_support_mode)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_SET_VOICE_KEY_SUPPORT_MODE);
-       mWakeupManagerInterface.set_wakeup_event_callback =
-               (wakeup_manager_set_wakeup_event_callback)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_SET_WAKEUP_EVENT_CALLBACK);
-       mWakeupManagerInterface.set_utterance_streaming_callback =
-               (wakeup_manager_set_utterance_streaming_callback)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_SET_UTTERANCE_STREAMING_CALLBACK);
-       mWakeupManagerInterface.set_previous_utterance_streaming_callback =
-               (wakeup_manager_set_previous_utterance_streaming_callback)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_SET_PREVIOUS_UTTERANCE_STREAMING_CALLBACK);
-       mWakeupManagerInterface.set_follow_up_streaming_callback =
-               (wakeup_manager_set_follow_up_streaming_callback)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_SET_FOLLOW_UP_STREAMING_CALLBACK);
-       mWakeupManagerInterface.set_speech_status_callback =
-               (wakeup_manager_set_speech_status_callback)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_SET_SPEECH_STATUS_CALLBACK);
-       mWakeupManagerInterface.set_setting_changed_callback =
-               (wakeup_manager_set_setting_changed_callback)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_SET_SETTING_CHANGED_CALLBACK);
-       mWakeupManagerInterface.set_error_callback =
-               (wakeup_manager_set_error_callback)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_SET_ERROR_CALLBACK);
-       mWakeupManagerInterface.set_streaming_section_changed_callback =
-               (wakeup_manager_set_streaming_section_changed_callback)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_SET_STREAMING_SECTION_CHANGED_CALLBACK);
-       mWakeupManagerInterface.set_wakeup_engine_command_callback =
-               (wakeup_manager_set_wakeup_engine_command_callback)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_SET_WAKEUP_ENGINE_COMMAND_CALLBACK);
-       mWakeupManagerInterface.set_wakeup_service_state_changed_callback =
-               (wakeup_manager_set_wakeup_service_state_changed_callback)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_SET_WAKEUP_SERVICE_STATE_CHANGED_CALLBACK);
-       mWakeupManagerInterface.set_voice_key_status_changed_callback =
-               (wakeup_manager_set_voice_key_status_changed_callback)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_SET_VOICE_KEY_STATUS_CHANGED_CALLBACK);
-       mWakeupManagerInterface.set_loaded_engine_changed_callback =
-               (wakeup_manager_set_loaded_engine_changed_callback)dlsym(mPluginHandle,
-               MA_WAKEUP_MANAGER_FUNC_SET_LOADED_ENGINE_CHANGED_CALLBACK);
-
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_initialize func = mWakeupManagerInterface.initialize;
-
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_INITIALIZE);
-               } else {
-                       ret = func();
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to initialize, ret(%d)", ret);
-                       }
-               }
-
-               wakeup_manager_get_settings get_settings_func = mWakeupManagerInterface.get_settings;
+       ret = wakeup_manager_initialize();
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to initialize, ret(%d)", ret);
+               return ret;
+       }
 
-               if (NULL == get_settings_func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_GET_SETTINGS);
-               } else {
-                       size_t struct_size;
-                       ret = get_settings_func(&mPluginSettings, &struct_size);
-                       if (0 != ret || struct_size != sizeof(ma_plugin_settings)) {
-                               MAS_LOGE("[ERROR] Fail to get settings, ret(%d), size %zu", ret, struct_size);
-                               mPluginSettings = NULL;
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       size_t struct_size;
+       ret = wakeup_manager_get_settings(&mPluginSettings, &struct_size);
+       if (0 != ret || struct_size != sizeof(ma_plugin_settings)) {
+               MAS_LOGE("[ERROR] Fail to get settings, ret(%d), size %zu", ret, struct_size);
+               mPluginSettings = NULL;
        }
+
        return ret;
 }
 
@@ -892,21 +733,9 @@ int CServicePlugin::deinitialize(void)
        }
 
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_deinitialize func = mWakeupManagerInterface.deinitialize;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_DEINITIALIZE);
-               } else {
-                       ret = func();
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to deinitialize, ret(%d)", ret);
-                       }
-               }
-
-               dlclose(mPluginHandle);
-               mPluginHandle = NULL;
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_deinitialize();
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to deinitialize, ret(%d)", ret);
        }
 
        return ret;
@@ -915,18 +744,9 @@ int CServicePlugin::deinitialize(void)
 int CServicePlugin::get_settings(ma_plugin_settings **settings, size_t *struct_size)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_get_settings func = mWakeupManagerInterface.get_settings;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_GET_SETTINGS);
-               } else {
-                       ret = func(settings, struct_size);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to get settings, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_get_settings(settings, struct_size);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to get settings, ret(%d)", ret);
        }
        return ret;
 }
@@ -934,18 +754,9 @@ int CServicePlugin::get_settings(ma_plugin_settings **settings, size_t *struct_s
 int CServicePlugin::set_language(const char* language)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_set_language func = mWakeupManagerInterface.set_language;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_LANGUAGE);
-               } else {
-                       ret = func(language);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to set langauge(%s), ret(%d)", language, ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_set_language(language);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to set langauge(%s), ret(%d)", language, ret);
        }
        return ret;
 }
@@ -953,18 +764,9 @@ int CServicePlugin::set_language(const char* language)
 int CServicePlugin::add_assistant_wakeup_word(const char* appid, const char* wakeup_word, const char* language)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_add_assistant_wakeup_word func = mWakeupManagerInterface.add_assistant_wakeup_word;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_ADD_ASSISTANT_WAKEUP_WORD);
-               } else {
-                       ret = func(appid, wakeup_word, language);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to add wakeup word(%s)(%s)(%s), ret(%d)", appid, wakeup_word, language, ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_add_assistant_wakeup_word(appid, wakeup_word, language);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to add wakeup word(%s)(%s)(%s), ret(%d)", appid, wakeup_word, language, ret);
        }
        return ret;
 }
@@ -972,18 +774,9 @@ int CServicePlugin::add_assistant_wakeup_word(const char* appid, const char* wak
 int CServicePlugin::remove_assistant_wakeup_word(const char* appid, const char* wakeup_word, const char* language)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_remove_assistant_wakeup_word func = mWakeupManagerInterface.remove_assistant_wakeup_word;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_REMOVE_ASSISTANT_WAKEUP_WORD);
-               } else {
-                       ret = func(appid, wakeup_word, language);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to remove wakeup word(%s)(%s)(%s), ret(%d)", appid, wakeup_word, language, ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_remove_assistant_wakeup_word(appid, wakeup_word, language);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to remove wakeup word(%s)(%s)(%s), ret(%d)", appid, wakeup_word, language, ret);
        }
        return ret;
 }
@@ -991,18 +784,9 @@ int CServicePlugin::remove_assistant_wakeup_word(const char* appid, const char*
 int CServicePlugin::add_assistant_language(const char* appid, const char* language)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_add_assistant_language func = mWakeupManagerInterface.add_assistant_language;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_ADD_ASSISTANT_LANGUAGE);
-               } else {
-                       ret = func(appid, language);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to set wakeup word(%s)(%s), ret(%d)", appid, language, ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_add_assistant_language(appid, language);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to set wakeup word(%s)(%s), ret(%d)", appid, language, ret);
        }
        return ret;
 }
@@ -1010,18 +794,9 @@ int CServicePlugin::add_assistant_language(const char* appid, const char* langua
 int CServicePlugin::add_assistant_wakeup_engine(const char* appid, const char* engine)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_add_assistant_wakeup_engine func = mWakeupManagerInterface.add_assistant_wakeup_engine;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_ADD_ASSISTANT_WAKEUP_ENGINE);
-               } else {
-                       ret = func(appid, engine);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to set wakeup engine(%s)(%s), ret(%d)", appid, engine, ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_add_assistant_wakeup_engine(appid, engine);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to set wakeup engine(%s)(%s), ret(%d)", appid, engine, ret);
        }
        return ret;
 }
@@ -1029,18 +804,9 @@ int CServicePlugin::add_assistant_wakeup_engine(const char* appid, const char* e
 int CServicePlugin::set_default_assistant(const char* appid)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_set_default_assistant func = mWakeupManagerInterface.set_default_assistant;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_DEFAULT_ASSISTANT);
-               } else {
-                       ret = func(appid);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to set default assistant(%s), ret(%d)", appid, ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_set_default_assistant(appid);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to set default assistant(%s), ret(%d)", appid, ret);
        }
        return ret;
 }
@@ -1052,18 +818,9 @@ int CServicePlugin::get_default_assistant(const char** appid)
                MAS_LOGE("[ERROR] appid is not valid");
                return ret;
        }
-       if (NULL != mPluginHandle) {
-               wakeup_manager_get_default_assistant func = mWakeupManagerInterface.get_default_assistant;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_GET_DEFAULT_ASSISTANT);
-               } else {
-                       ret = func(appid);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to get default assistant, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_get_default_assistant(appid);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to get default assistant, ret(%d)", ret);
        }
        return ret;
 }
@@ -1071,18 +828,9 @@ int CServicePlugin::get_default_assistant(const char** appid)
 int CServicePlugin::activate(void)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_activate func = mWakeupManagerInterface.activate;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_ACTIVATE);
-               } else {
-                       ret = func();
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to start recording, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_activate();
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to start recording, ret(%d)", ret);
        }
        return ret;
 }
@@ -1090,18 +838,9 @@ int CServicePlugin::activate(void)
 int CServicePlugin::deactivate(void)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_deactivate func = mWakeupManagerInterface.deactivate;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_DEACTIVATE);
-               } else {
-                       ret = func();
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to stop recording, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_deactivate();
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to stop recording, ret(%d)", ret);
        }
        return ret;
 }
@@ -1109,18 +848,9 @@ int CServicePlugin::deactivate(void)
 int CServicePlugin::update_voice_feedback_state(const char* appid, int state)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_update_voice_feedback_state func = mWakeupManagerInterface.update_voice_feedback_state;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_UPDATE_VOICE_FEEDBACK_STATE);
-               } else {
-                       ret = func(appid, state);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to stop recording, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_update_voice_feedback_state(appid, state);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to stop recording, ret(%d)", ret);
        }
        return ret;
 }
@@ -1128,18 +858,9 @@ int CServicePlugin::update_voice_feedback_state(const char* appid, int state)
 int CServicePlugin::set_assistant_specific_command(const char* appid, const char* command)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_set_assistant_specific_command func = mWakeupManagerInterface.set_assistant_specific_command;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_ASSISTANT_SPECIFIC_COMMAND);
-               } else {
-                       ret = func(appid, command);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to stop recording, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_set_assistant_specific_command(appid, command);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to stop recording, ret(%d)", ret);
        }
        return ret;
 }
@@ -1147,18 +868,9 @@ int CServicePlugin::set_assistant_specific_command(const char* appid, const char
 int CServicePlugin::set_background_volume(const char* appid, double ratio)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_set_background_volume func = mWakeupManagerInterface.set_background_volume;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_BACKGROUND_VOLUME);
-               } else {
-                       ret = func(appid, ratio);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to set background volume, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_set_background_volume(appid, ratio);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to set background volume, ret(%d)", ret);
        }
        return ret;
 }
@@ -1166,18 +878,9 @@ int CServicePlugin::set_background_volume(const char* appid, double ratio)
 int CServicePlugin::update_recognition_result(const char* appid, int state)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_update_recognition_result func = mWakeupManagerInterface.update_recognition_result;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_UPDATE_RECOGNITION_RESULT);
-               } else {
-                       ret = func(appid, state);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to update result state, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_update_recognition_result(appid, state);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to update result state, ret(%d)", ret);
        }
        return ret;
 }
@@ -1185,18 +888,9 @@ int CServicePlugin::update_recognition_result(const char* appid, int state)
 int CServicePlugin::process_event(int event, void *data, int len)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_process_plugin_event func = mWakeupManagerInterface.process_plugin_event;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_PROCESS_PLUGIN_EVENT);
-               } else {
-                       ret = func((mas_plugin_event_e)event, data, len);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to stop recording, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_process_plugin_event((mas_plugin_event_e)event, data, len);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to stop recording, ret(%d)", ret);
        }
        return ret;
 }
@@ -1205,18 +899,9 @@ int CServicePlugin::start_streaming_utterance_data(void)
 {
        MAS_LOGI("[ENTER");
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_start_streaming_utterance_data func = mWakeupManagerInterface.start_streaming_utterance_data;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_START_STREAMING_UTTERANCE_DATA);
-               } else {
-                       ret = func();
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to request speech data, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_start_streaming_utterance_data();
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to request speech data, ret(%d)", ret);
        }
        return ret;
 }
@@ -1224,18 +909,9 @@ int CServicePlugin::start_streaming_utterance_data(void)
 int CServicePlugin::stop_streaming_utterance_data(void)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_stop_streaming_utterance_data func = mWakeupManagerInterface.stop_streaming_utterance_data;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_STOP_STREAMING_UTTERANCE_DATA);
-               } else {
-                       ret = func();
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to request speech data, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_stop_streaming_utterance_data();
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to request speech data, ret(%d)", ret);
        }
        return ret;
 }
@@ -1243,18 +919,9 @@ int CServicePlugin::stop_streaming_utterance_data(void)
 int CServicePlugin::start_streaming_previous_utterance_data(void)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_start_streaming_previous_utterance_data func = mWakeupManagerInterface.start_streaming_previous_utterance_data;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_START_STREAMING_PREVIOUS_UTTERANCE_DATA);
-               } else {
-                       ret = func();
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to request previous speech data, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_start_streaming_previous_utterance_data();
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to request previous speech data, ret(%d)", ret);
        }
        return ret;
 }
@@ -1262,18 +929,9 @@ int CServicePlugin::start_streaming_previous_utterance_data(void)
 int CServicePlugin::stop_streaming_previous_utterance_data(void)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_stop_streaming_previous_utterance_data func = mWakeupManagerInterface.stop_streaming_previous_utterance_data;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_STOP_STREAMING_PREVIOUS_UTTERANCE_DATA);
-               } else {
-                       ret = func();
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to request previous speech data, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_stop_streaming_previous_utterance_data();
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to request previous speech data, ret(%d)", ret);
        }
        return ret;
 }
@@ -1281,18 +939,9 @@ int CServicePlugin::stop_streaming_previous_utterance_data(void)
 int CServicePlugin::start_streaming_follow_up_data(void)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_start_streaming_follow_up_data func = mWakeupManagerInterface.start_streaming_follow_up_data;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_START_STREAMING_FOLLOW_UP_DATA);
-               } else {
-                       ret = func();
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to request speech data, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_start_streaming_follow_up_data();
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to request speech data, ret(%d)", ret);
        }
        return ret;
 }
@@ -1300,18 +949,9 @@ int CServicePlugin::start_streaming_follow_up_data(void)
 int CServicePlugin::stop_streaming_follow_up_data(void)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_stop_streaming_follow_up_data func = mWakeupManagerInterface.stop_streaming_follow_up_data;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_STOP_STREAMING_FOLLOW_UP_DATA);
-               } else {
-                       ret = func();
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to request speech data, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_stop_streaming_follow_up_data();
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to request speech data, ret(%d)", ret);
        }
        return ret;
 }
@@ -1319,18 +959,9 @@ int CServicePlugin::stop_streaming_follow_up_data(void)
 int CServicePlugin::get_recording_audio_format(int *rate, int *channel, int *audio_type)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_get_audio_format func = mWakeupManagerInterface.get_audio_format;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_GET_AUDIO_FORMAT);
-               } else {
-                       ret = func(rate, channel, audio_type);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to get recording audio format, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_get_audio_format(rate, channel, audio_type);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to get recording audio format, ret(%d)", ret);
        }
        return ret;
 }
@@ -1338,18 +969,9 @@ int CServicePlugin::get_recording_audio_format(int *rate, int *channel, int *aud
 int CServicePlugin::get_recording_audio_source_type(char** type)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_get_audio_source_type func = mWakeupManagerInterface.get_audio_source_type;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_GET_AUDIO_SOURCE_TYPE);
-               } else {
-                       ret = func(type);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to get recording audio source type, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_get_audio_source_type(type);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to get recording audio source type, ret(%d)", ret);
        }
        return ret;
 }
@@ -1357,18 +979,9 @@ int CServicePlugin::get_recording_audio_source_type(char** type)
 int CServicePlugin::set_voice_key_tap_duration(float duration)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_set_voice_key_tap_duration func = mWakeupManagerInterface.set_voice_key_tap_duration;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_VOICE_KEY_TAP_DURATION);
-               } else {
-                       ret = func(duration);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to set voice key tap duration, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_set_voice_key_tap_duration(duration);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to set voice key tap duration, ret(%d)", ret);
        }
        return ret;
 }
@@ -1376,18 +989,9 @@ int CServicePlugin::set_voice_key_tap_duration(float duration)
 int CServicePlugin::unset_voice_key_tap_duration()
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_unset_voice_key_tap_duration func = mWakeupManagerInterface.unset_voice_key_tap_duration;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_UNSET_VOICE_KEY_TAP_DURATION);
-               } else {
-                       ret = func();
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to unset voice key tap duration, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_unset_voice_key_tap_duration();
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to unset voice key tap duration, ret(%d)", ret);
        }
        return ret;
 }
@@ -1395,18 +999,9 @@ int CServicePlugin::unset_voice_key_tap_duration()
 int CServicePlugin::set_voice_key_support_mode(int mode)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_set_voice_key_support_mode func = mWakeupManagerInterface.set_voice_key_support_mode;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_VOICE_KEY_SUPPORT_MODE);
-               } else {
-                       ret = func(mode);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to set voice key support mode, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_set_voice_key_support_mode(mode);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to set voice key support mode, ret(%d)", ret);
        }
        return ret;
 }
@@ -1414,18 +1009,9 @@ int CServicePlugin::set_voice_key_support_mode(int mode)
 int CServicePlugin::set_wake_word_audio_require_flag(const char* appid, bool require)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_set_wake_word_audio_require_flag func = mWakeupManagerInterface.set_wake_word_audio_require_flag;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_WAKE_WORD_AUDIO_REQUIRE_FLAG);
-               } else {
-                       ret = func(require);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to set wake word audio require flag, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_set_wake_word_audio_require_flag(require);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to set wake word audio require flag, ret(%d)", ret);
        }
        return ret;
 }
@@ -1433,18 +1019,9 @@ int CServicePlugin::set_wake_word_audio_require_flag(const char* appid, bool req
 int CServicePlugin::set_assistant_language(const char* appid, const char* language)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_set_assistant_language func = mWakeupManagerInterface.set_assistant_language;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_ASSISTANT_LANGUAGE);
-               } else {
-                       ret = func(appid, language);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to set assistant language, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_set_assistant_language(appid, language);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to set assistant language, ret(%d)", ret);
        }
        return ret;
 }
@@ -1529,18 +1106,9 @@ int CServicePlugin::set_callbacks(void)
 int CServicePlugin::set_wakeup_event_callback(wakeup_service_wakeup_event_cb callback, void* user_data)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_set_wakeup_event_callback func = mWakeupManagerInterface.set_wakeup_event_callback;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_WAKEUP_EVENT_CALLBACK);
-               } else {
-                       ret = func(callback, user_data);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to set wakeup event callback, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_set_wakeup_event_callback(callback, user_data);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to set wakeup event callback, ret(%d)", ret);
        }
        return ret;
 }
@@ -1548,18 +1116,9 @@ int CServicePlugin::set_wakeup_event_callback(wakeup_service_wakeup_event_cb cal
 int CServicePlugin::set_utterance_streaming_callback(wakeup_service_speech_streaming_cb callback, void* user_data)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_set_utterance_streaming_callback func = mWakeupManagerInterface.set_utterance_streaming_callback;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_UTTERANCE_STREAMING_CALLBACK);
-               } else {
-                       ret = func(callback, user_data);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to set utterance streaming callback, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_set_utterance_streaming_callback(callback, user_data);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to set utterance streaming callback, ret(%d)", ret);
        }
        return ret;
 }
@@ -1567,18 +1126,9 @@ int CServicePlugin::set_utterance_streaming_callback(wakeup_service_speech_strea
 int CServicePlugin::set_previous_utterance_streaming_callback(wakeup_service_speech_streaming_cb callback, void* user_data)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_set_previous_utterance_streaming_callback func = mWakeupManagerInterface.set_previous_utterance_streaming_callback;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_PREVIOUS_UTTERANCE_STREAMING_CALLBACK);
-               } else {
-                       ret = func(callback, user_data);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to set utterance streaming callback, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_set_previous_utterance_streaming_callback(callback, user_data);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to set utterance streaming callback, ret(%d)", ret);
        }
        return ret;
 }
@@ -1586,18 +1136,9 @@ int CServicePlugin::set_previous_utterance_streaming_callback(wakeup_service_spe
 int CServicePlugin::set_follow_up_streaming_callback(wakeup_service_speech_streaming_cb callback, void* user_data)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_set_follow_up_streaming_callback func = mWakeupManagerInterface.set_follow_up_streaming_callback;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_FOLLOW_UP_STREAMING_CALLBACK);
-               } else {
-                       ret = func(callback, user_data);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to set follow-up streaming callback, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] mPluginHandle is not valid");
+       ret = wakeup_manager_set_follow_up_streaming_callback(callback, user_data);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to set follow-up streaming callback, ret(%d)", ret);
        }
        return ret;
 }
@@ -1605,16 +1146,9 @@ int CServicePlugin::set_follow_up_streaming_callback(wakeup_service_speech_strea
 int CServicePlugin::set_speech_status_callback(wakeup_service_speech_status_cb callback, void* user_data)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_set_speech_status_callback func = mWakeupManagerInterface.set_speech_status_callback;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_SPEECH_STATUS_CALLBACK);
-               } else {
-                       ret = func(callback, user_data);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to set speech status callback, ret(%d)", ret);
-                       }
-               }
+       ret = wakeup_manager_set_speech_status_callback(callback, user_data);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to set speech status callback, ret(%d)", ret);
        }
        return ret;
 }
@@ -1622,16 +1156,9 @@ int CServicePlugin::set_speech_status_callback(wakeup_service_speech_status_cb c
 int CServicePlugin::set_setting_changed_callback(wakeup_service_setting_changed_cb callback, void* user_data)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_set_setting_changed_callback func = mWakeupManagerInterface.set_setting_changed_callback;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_SETTING_CHANGED_CALLBACK);
-               } else {
-                       ret = func(callback, user_data);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to set setting_changed callback, ret(%d)", ret);
-                       }
-               }
+       ret = wakeup_manager_set_setting_changed_callback(callback, user_data);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to set setting_changed callback, ret(%d)", ret);
        }
        return ret;
 }
@@ -1639,16 +1166,9 @@ int CServicePlugin::set_setting_changed_callback(wakeup_service_setting_changed_
 int CServicePlugin::set_error_callback(wakeup_service_error_cb callback, void* user_data)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_set_error_callback func = mWakeupManagerInterface.set_error_callback;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_ERROR_CALLBACK);
-               } else {
-                       ret = func(callback, user_data);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to set error callback, ret(%d)", ret);
-                       }
-               }
+       ret = wakeup_manager_set_error_callback(callback, user_data);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to set error callback, ret(%d)", ret);
        }
        return ret;
 }
@@ -1656,16 +1176,9 @@ int CServicePlugin::set_error_callback(wakeup_service_error_cb callback, void* u
 int CServicePlugin::set_streaming_section_changed_callback(wakeup_service_streaming_section_changed_cb callback, void* user_data)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_set_streaming_section_changed_callback func = mWakeupManagerInterface.set_streaming_section_changed_callback;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_STREAMING_SECTION_CHANGED_CALLBACK);
-               } else {
-                       ret = func(callback, user_data);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to set streaming section changed callback, ret(%d)", ret);
-                       }
-               }
+       ret = wakeup_manager_set_streaming_section_changed_callback(callback, user_data);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to set streaming section changed callback, ret(%d)", ret);
        }
        return ret;
 }
@@ -1673,16 +1186,9 @@ int CServicePlugin::set_streaming_section_changed_callback(wakeup_service_stream
 int CServicePlugin::set_wakeup_engine_command_callback(wakeup_service_wakeup_engine_command_cb callback, void* user_data)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_set_wakeup_engine_command_callback func = mWakeupManagerInterface.set_wakeup_engine_command_callback;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_WAKEUP_ENGINE_COMMAND_CALLBACK);
-               } else {
-                       ret = func(callback, user_data);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to set error callback, ret(%d)", ret);
-                       }
-               }
+       ret = wakeup_manager_set_wakeup_engine_command_callback(callback, user_data);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to set error callback, ret(%d)", ret);
        }
        return ret;
 }
@@ -1690,16 +1196,9 @@ int CServicePlugin::set_wakeup_engine_command_callback(wakeup_service_wakeup_eng
 int CServicePlugin::set_wakeup_service_state_changed_callback(wakeup_service_wakeup_service_state_changed_cb callback, void* user_data)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_set_wakeup_service_state_changed_callback func = mWakeupManagerInterface.set_wakeup_service_state_changed_callback;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_WAKEUP_SERVICE_STATE_CHANGED_CALLBACK);
-               } else {
-                       ret = func(callback, user_data);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to set error callback, ret(%d)", ret);
-                       }
-               }
+       ret = wakeup_manager_set_wakeup_service_state_changed_callback(callback, user_data);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to set error callback, ret(%d)", ret);
        }
        return ret;
 }
@@ -1707,16 +1206,9 @@ int CServicePlugin::set_wakeup_service_state_changed_callback(wakeup_service_wak
 int CServicePlugin::set_voice_key_status_changed_callback(wakeup_service_voice_key_status_changed_cb callback, void* user_data)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_set_voice_key_status_changed_callback func = mWakeupManagerInterface.set_voice_key_status_changed_callback;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_VOICE_KEY_STATUS_CHANGED_CALLBACK);
-               } else {
-                       ret = func(callback, user_data);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to set error callback, ret(%d)", ret);
-                       }
-               }
+       ret = wakeup_manager_set_voice_key_status_changed_callback(callback, user_data);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to set error callback, ret(%d)", ret);
        }
        return ret;
 }
@@ -1724,16 +1216,9 @@ int CServicePlugin::set_voice_key_status_changed_callback(wakeup_service_voice_k
 int CServicePlugin::set_loaded_engine_changed_callback(wakeup_service_loaded_engine_changed_cb callback, void* user_data)
 {
        int ret = -1;
-       if (NULL != mPluginHandle) {
-               wakeup_manager_set_loaded_engine_changed_callback func = mWakeupManagerInterface.set_loaded_engine_changed_callback;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_LOADED_ENGINE_CHANGED_CALLBACK);
-               } else {
-                       ret = func(callback, user_data);
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to set error callback, ret(%d)", ret);
-                       }
-               }
+       ret = wakeup_manager_set_loaded_engine_changed_callback(callback, user_data);
+       if (0 != ret) {
+               MAS_LOGE("[ERROR] Fail to set error callback, ret(%d)", ret);
        }
        return ret;
 }
diff --git a/wakeup-manager/inc/wakeup_manager_wrapper.h b/wakeup-manager/inc/wakeup_manager_wrapper.h
new file mode 100644 (file)
index 0000000..7692580
--- /dev/null
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2018-2019 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+
+#ifndef _WAKEUP_MANAGER_WRAPPER_H_
+#define _WAKEUP_MANAGER_WRAPPER_H_
+
+#include <dlog.h>
+#include <stdbool.h>
+#include <tizen.h>
+#include <tzplatform_config.h>
+
+#include <multi_assistant_service.h>
+#include <multi_assistant_internal.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+       WAKEUP_MANAGER_STATE_INACTIVE = 0,
+       WAKEUP_MANAGER_STATE_LISTENING = 1,
+       WAKEUP_MANAGER_STATE_UTTERANCE = 2,
+       WAKEUP_MANAGER_STATE_PROCESSING = 3,
+       WAKEUP_MANAGER_STATE_VOICE_FEEDBACK = 4
+} wakeup_manager_state_e;
+
+typedef void (*ma_audio_streaming_data_section_changed_cb)(ma_audio_streaming_data_section_e section, void* user_data);
+
+typedef void (*wakeup_service_wakeup_event_cb)(mas_wakeup_event_info wakeup_info, void* user_data);
+
+typedef void (*wakeup_service_speech_streaming_cb)(mas_speech_streaming_event_e event, void* buffer, int len, void *user_data);
+
+typedef void (*wakeup_service_speech_status_cb)(mas_speech_status_e status, void *user_data);
+
+typedef void (*wakeup_service_setting_changed_cb)( void *user_data);
+
+typedef void (*wakeup_service_error_cb)(int error, const char* err_msg, void* user_data);
+
+typedef void (*wakeup_service_audio_data_require_status_cb)(bool require, void* user_data);
+
+typedef void (*wakeup_service_streaming_section_changed_cb)(ma_audio_streaming_data_section_e section, void* user_data);
+
+typedef void (*wakeup_service_engine_command_cb)(mas_wakeup_engine_command_target_e target, const char* assistant_name, const char* command, void* user_data);
+
+typedef void (*wakeup_service_state_changed_cb)(ma_service_state_e state, void* user_data);
+
+typedef void (*wakeup_service_voice_key_status_changed_cb)(ma_voice_key_status_e state, void* user_data);
+
+typedef void (*wakeup_service_loaded_engine_changed_cb)(void* user_data);
+
+typedef struct {
+       int plugin_version;
+       bool ui_panel_enabled;
+} ma_plugin_settings;
+
+int wakeup_manager_initialize(void);
+
+int wakeup_manager_deinitialize(void);
+
+int wakeup_manager_get_settings(ma_plugin_settings **settings, size_t *struct_size);
+
+int wakeup_manager_add_assistant_wakeup_word(const char* appid, const char* wakeup_word, const char* language);
+
+int wakeup_manager_remove_assistant_wakeup_word(const char* appid, const char* wakeup_word, const char* language);
+
+int wakeup_manager_add_assistant_language(const char* appid, const char* language);
+
+int wakeup_manager_add_assistant_wakeup_engine(const char* appid, const char *engine);
+
+int wakeup_manager_set_default_assistant(const char* appid);
+
+int wakeup_manager_get_default_assistant(const char** appid);
+
+int wakeup_manager_set_language(const char* language);
+
+int wakeup_manager_activate(void);
+
+int wakeup_manager_deactivate(void);
+
+int wakeup_manager_update_voice_feedback_state(const char *appid, int state);
+
+int wakeup_manager_set_assistant_specific_command(const char* appid, const char* command);
+
+int wakeup_manager_set_background_volume(const char *appid, double ratio);
+
+int wakeup_manager_update_recognition_result(const char *appid, int result);
+
+int wakeup_manager_process_plugin_event(mas_plugin_event_e event, void* data, int len);
+
+int wakeup_manager_start_streaming_utterance_data(void);
+
+int wakeup_manager_stop_streaming_utterance_data(void);
+
+int wakeup_manager_start_streaming_previous_utterance_data(void);
+
+int wakeup_manager_stop_streaming_previous_utterance_data(void);
+
+int wakeup_manager_start_streaming_follow_up_data(void);
+
+int wakeup_manager_stop_streaming_follow_up_data(void);
+
+int wakeup_manager_get_audio_format(int *rate, int *channel, int *audio_type);
+
+int wakeup_manager_get_audio_source_type(char** type);
+
+int wakeup_manager_set_voice_key_tap_duration(float duration);
+
+int wakeup_manager_unset_voice_key_tap_duration();
+
+int wakeup_manager_set_voice_key_support_mode(int mode);
+
+int wakeup_manager_set_wake_word_audio_require_flag(bool require);
+
+int wakeup_manager_set_assistant_language(const char* appid, const char *language);
+
+int wakeup_manager_set_wakeup_event_callback(wakeup_service_wakeup_event_cb callback, void* user_data);
+
+int wakeup_manager_set_utterance_streaming_callback(wakeup_service_speech_streaming_cb callback, void* user_data);
+
+int wakeup_manager_set_previous_utterance_streaming_callback(wakeup_service_speech_streaming_cb callback, void* user_data);
+
+int wakeup_manager_set_follow_up_streaming_callback(wakeup_service_speech_streaming_cb callback, void* user_data);
+
+int wakeup_manager_set_speech_status_callback(wakeup_service_speech_status_cb callback, void* user_data);
+
+int wakeup_manager_set_setting_changed_callback(wakeup_service_setting_changed_cb callback, void* user_data);
+
+int wakeup_manager_set_error_callback(wakeup_service_error_cb callback, void* user_data);
+
+int wakeup_manager_set_streaming_section_changed_callback(wakeup_service_streaming_section_changed_cb callback, void* user_data);
+
+int wakeup_manager_set_wakeup_engine_command_callback(wakeup_service_engine_command_cb callback, void* user_data);
+
+int wakeup_manager_set_wakeup_service_state_changed_callback(wakeup_service_state_changed_cb callback, void* user_data);
+
+int wakeup_manager_set_voice_key_status_changed_callback(wakeup_service_voice_key_status_changed_cb callback, void* user_data);
+
+int wakeup_manager_set_loaded_engine_changed_callback(wakeup_service_loaded_engine_changed_cb callback, void* user_data);
+
+/* Internal API declarations for dependency modules */
+
+int wakeup_manager_feed_audio_data(mas_speech_streaming_event_e event, void* buffer, int len);
+
+int wakeup_manager_set_dependency_module_command(const char* engine_name, const char* command);
+
+int wakeup_manager_wakeup_assistant(const mas_wakeup_event_info* wakeup_info);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _WAKEUP_MANAGER_WRAPPER_H_ */