From b7a929bb3fc1f65450f0d30b98842d8f38eb4630 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Tue, 31 Mar 2020 11:28:30 +0900 Subject: [PATCH] Change the name of variables moved into classes Change-Id: I4255ecf45266065f3333f4b141c5f1b59ab4412a --- inc/client_manager.h | 2 +- inc/service_ipc_dbus.h | 10 +- inc/service_main.h | 16 +- inc/service_plugin.h | 12 +- src/client_manager.cpp | 16 +- src/service_ipc_dbus.cpp | 186 +++++++++---------- src/service_main.cpp | 322 ++++++++++++++++----------------- src/service_plugin.cpp | 453 +++++++++++++++++++++++------------------------ 8 files changed, 508 insertions(+), 509 deletions(-) diff --git a/inc/client_manager.h b/inc/client_manager.h index d2c51e2..abcb770 100644 --- a/inc/client_manager.h +++ b/inc/client_manager.h @@ -57,7 +57,7 @@ private: private: IApplicationManager* mApplicationManager{nullptr}; - GSList* g_client_list{nullptr}; + GSList* mClientList{nullptr}; }; #ifdef __cplusplus diff --git a/inc/service_ipc_dbus.h b/inc/service_ipc_dbus.h index 8bd33de..8b29954 100644 --- a/inc/service_ipc_dbus.h +++ b/inc/service_ipc_dbus.h @@ -53,7 +53,7 @@ public: int masc_ui_dbus_send_recognition_result(int pid, int result); int masc_ui_dbus_enable_common_ui(int enable); - DBusConnection* get_connection_listener() { return g_conn_listener; } + DBusConnection* get_connection_listener() { return mConnectionListener; } CServiceIpcDbusDispatcher* get_dispatcher() { return &mDispatcher; } void set_client_manager(CClientManager* manager) { @@ -71,12 +71,12 @@ private: private: CServiceIpcDbusDispatcher mDispatcher; - DBusConnection* g_conn_sender{NULL}; - DBusConnection* g_conn_listener{NULL}; + DBusConnection* mConnectionSender{NULL}; + DBusConnection* mConnectionListener{NULL}; - Ecore_Fd_Handler* g_dbus_fd_handler{NULL}; + Ecore_Fd_Handler* mFdHandler{NULL}; - int g_streaming_data_serial{0}; + int mStreamingDataSerial{0}; CClientManager* mClientManager{nullptr}; }; diff --git a/inc/service_main.h b/inc/service_main.h index 5101be5..d97e68a 100644 --- a/inc/service_main.h +++ b/inc/service_main.h @@ -156,7 +156,7 @@ private: bool is_current_preprocessing_assistant(const char* appid); private: - std::string g_current_lang{"en_US"}; + std::string mCurrentLanguage{"en_US"}; typedef struct { bool used; @@ -173,15 +173,15 @@ private: char preprocessing_allow_appid[MAX_APPID_LEN]; } ma_client_info; - ma_client_info g_maclient_info[MAX_MACLIENT_INFO_NUM]; + ma_client_info mClientInfo[MAX_MACLIENT_INFO_NUM]; - int g_current_maclient_info{0}; - int g_current_preprocessing_maclient_info{-1}; - std::string g_wakeup_maclient_appid; - package_manager_h g_pkgmgr{NULL}; + int mCurrentClientInfo{0}; + int mCurrentPreprocessingClientInfo{-1}; + std::string mWakeupClientAppId; + package_manager_h mPackageManagerHandle{NULL}; - PREPROCESSING_STATE g_current_preprocessing_state{PREPROCESSING_STATE_NONE}; - ma_service_state_e g_current_service_state{MA_SERVICE_STATE_INACTIVE}; + PREPROCESSING_STATE mCurrentPreprocessingState{PREPROCESSING_STATE_NONE}; + ma_service_state_e mCurrentServiceState{MA_SERVICE_STATE_INACTIVE}; CServiceConfig mServiceConfig; CServicePlugin mServicePlugin; diff --git a/inc/service_plugin.h b/inc/service_plugin.h index b4d9da8..36ffd78 100644 --- a/inc/service_plugin.h +++ b/inc/service_plugin.h @@ -88,15 +88,15 @@ public: CServiceMain* get_service_main() { return mServiceMain; } private: #ifdef BUF_SAVE_MODE - char g_temp_file_name[128] = {'\0', }; - FILE* g_pFile = NULL; - int g_count = 1; + char mDumpFilename[128]{'\0', }; + FILE* mDumpFile{NULL}; + int mDumpCount{1}; #endif - void *g_handle = NULL; + void* mPluginHandle{NULL}; - wakeup_manager_interface _wakeup_manager_interface{NULL, }; - ma_plugin_settings* g_plugin_settings{NULL}; + wakeup_manager_interface mWakeupManagerInterface{NULL, }; + ma_plugin_settings* mPluginSettings{NULL}; CServiceIpcDbus* mServiceIpc{nullptr}; CServiceMain* mServiceMain{nullptr}; diff --git a/src/client_manager.cpp b/src/client_manager.cpp index 8175bb0..b91ab4a 100644 --- a/src/client_manager.cpp +++ b/src/client_manager.cpp @@ -37,7 +37,7 @@ int CClientManager::create_client(int pid, std::string appid) if (data) { data->pid = pid; data->appid = appid; - g_client_list = g_slist_append(g_client_list, data); + mClientList = g_slist_append(mClientList, data); } else { MAS_LOGE("[ERROR] data is NULL"); return -1;// MA_ERROR_OUT_OF_MEMORY; @@ -53,7 +53,7 @@ int CClientManager::destroy_client(ma_client_s* client) return -1;// MA_ERROR_OPERATION_FAILED; } - g_client_list = g_slist_remove(g_client_list, client); + mClientList = g_slist_remove(mClientList, client); delete client; @@ -76,11 +76,11 @@ ma_client_s* CClientManager::find_client_by_appid(std::string appid) { ma_client_s *data = NULL; - int count = g_slist_length(g_client_list); + int count = g_slist_length(mClientList); int i; for (i = 0; i < count; i++) { - data = static_cast(g_slist_nth_data(g_client_list, i)); + data = static_cast(g_slist_nth_data(mClientList, i)); if (NULL != data) { if (0 == appid.compare(data->appid)) { @@ -98,11 +98,11 @@ ma_client_s* CClientManager::find_client_by_pid(int pid) { ma_client_s *data = NULL; - int count = g_slist_length(g_client_list); + int count = g_slist_length(mClientList); int i; for (i = 0; i < count; i++) { - data = static_cast(g_slist_nth_data(g_client_list, i)); + data = static_cast(g_slist_nth_data(mClientList, i)); if (NULL != data) { if (data->pid == pid) { @@ -118,12 +118,12 @@ ma_client_s* CClientManager::find_client_by_pid(int pid) int CClientManager::get_client_num() { - return g_slist_length(g_client_list); + return g_slist_length(mClientList); } ma_client_s* CClientManager::get_client_by_index(unsigned int index) { - return static_cast(g_slist_nth_data(g_client_list, index)); + return static_cast(g_slist_nth_data(mClientList, index)); } int CClientManager::find_client_pid_by_index(unsigned int index) diff --git a/src/service_ipc_dbus.cpp b/src/service_ipc_dbus.cpp index 6888d0b..7848880 100644 --- a/src/service_ipc_dbus.cpp +++ b/src/service_ipc_dbus.cpp @@ -25,7 +25,7 @@ int CServiceIpcDbus::reconnect() { - if (!g_conn_sender || !g_conn_listener) { + if (!mConnectionSender || !mConnectionListener) { close_connection(); if (0 != open_connection()) { @@ -37,8 +37,8 @@ int CServiceIpcDbus::reconnect() return 0; } - bool sender_connected = dbus_connection_get_is_connected(g_conn_sender); - bool listener_connected = dbus_connection_get_is_connected(g_conn_listener); + bool sender_connected = dbus_connection_get_is_connected(mConnectionSender); + bool listener_connected = dbus_connection_get_is_connected(mConnectionListener); MAS_LOGW("[DBUS] Sender(%s) Listener(%s)", sender_connected ? "Connected" : "Not connected", listener_connected ? "Connected" : "Not connected"); @@ -58,7 +58,7 @@ int CServiceIpcDbus::reconnect() int CServiceIpcDbus::__dbus_check() { - if (NULL == g_conn_sender || NULL == g_conn_listener) { + if (NULL == mConnectionSender || NULL == mConnectionListener) { MAS_LOGE("[ERROR] NULL connection"); return reconnect(); } @@ -67,8 +67,8 @@ int CServiceIpcDbus::__dbus_check() int CServiceIpcDbus::mas_check_dbus_connection() { - if (NULL == g_conn_sender || NULL == g_conn_listener) { - MAS_LOGE("[ERROR] NULL connection sender(%p), listener(%p)", g_conn_sender, g_conn_listener); + if (NULL == mConnectionSender || NULL == mConnectionListener) { + MAS_LOGE("[ERROR] NULL connection sender(%p), listener(%p)", mConnectionSender, mConnectionListener); return -1; } return 0; @@ -97,7 +97,7 @@ int CServiceIpcDbus::send_hello(int pid) int result = -1; DBusMessage* result_msg = NULL; - result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, 500, &err); + result_msg = dbus_connection_send_with_reply_and_block(mConnectionSender, msg, 500, &err); if (dbus_error_is_set(&err)) { MAS_LOGE("[Dbus ERROR] Dbus Error (%s)", err.message); @@ -122,7 +122,7 @@ int CServiceIpcDbus::send_error_message(int reason, const char* err_msg) return -1; //MAS_ERROR_OPERATION_FAILED; } - if (NULL == g_conn_sender) { + if (NULL == mConnectionSender) { MAS_LOGE("[Dbus ERROR] Dbus connection is not available"); return -1; } @@ -154,11 +154,11 @@ int CServiceIpcDbus::send_error_message(int reason, const char* err_msg) dbus_message_set_no_reply(msg, TRUE); - if (!dbus_connection_send(g_conn_sender, msg, NULL)) { + if (!dbus_connection_send(mConnectionSender, msg, NULL)) { MAS_LOGE("[Dbus ERROR] <<<< error message : Out Of Memory !"); } else { MAS_LOGI("<<<< Send error message : reason(%d), err_msg(%s)", reason, temp_err_msg); - dbus_connection_flush(g_conn_sender); + dbus_connection_flush(mConnectionSender); } dbus_message_unref(msg); @@ -219,7 +219,7 @@ int CServiceIpcDbus::send_streaming_audio_data(int pid, int event, void* data, u streaming_data_header header; header.streaming_data_type = 0; header.streaming_data_size = sizeof(streaming_data_header) + sizeof(streaming_data_audio_data_header) + data_size; - header.streaming_data_serial = g_streaming_data_serial++; + header.streaming_data_serial = mStreamingDataSerial++; streaming_data_audio_data_header audio_data_header; audio_data_header.event = event; @@ -319,12 +319,12 @@ int CServiceIpcDbus::active_state_change(int pid, int state) dbus_message_set_no_reply(msg, TRUE); - if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { + if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) { MAS_LOGE("[Dbus ERROR] Fail to Send"); return -1; // MAS_ERROR_OPERATION_FAILED; } else { MAS_LOGI("[Dbus DEBUG] Success to Send activate message : %d %d", pid, state); - dbus_connection_flush(g_conn_sender); + dbus_connection_flush(mConnectionSender); } dbus_message_unref(msg); @@ -377,14 +377,14 @@ int CServiceIpcDbus::send_preprocessing_information(int pid, const char* app_id) dbus_message_set_no_reply(msg, TRUE); - if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { + if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) { MAS_LOGE("[Dbus ERROR] Fail to Send"); if (temp_app_id) free(temp_app_id); return -1; // MAS_ERROR_OPERATION_FAILED; } else { MAS_LOGI("[Dbus DEBUG] Success to Send preprocessing assistant information : %d %s", pid, app_id); - dbus_connection_flush(g_conn_sender); + dbus_connection_flush(mConnectionSender); } dbus_message_unref(msg); @@ -407,7 +407,7 @@ int CServiceIpcDbus::send_streaming_section_changed(int pid, int section) streaming_data_header header; header.streaming_data_type = 1; header.streaming_data_size = sizeof(streaming_data_header) + sizeof(streaming_data_streaming_section_header); - header.streaming_data_serial = g_streaming_data_serial++; + header.streaming_data_serial = mStreamingDataSerial++; streaming_data_streaming_section_header streaming_section_header; streaming_section_header.section = section; @@ -470,12 +470,12 @@ int CServiceIpcDbus::send_preprocessing_result(int pid, bool result) dbus_message_set_no_reply(msg, TRUE); - if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { + if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) { MAS_LOGE("[Dbus ERROR] Fail to Send"); return -1; // MAS_ERROR_OPERATION_FAILED; } else { MAS_LOGI("[Dbus DEBUG] Success to Send preprocessing result : %d %d", pid, temp_result); - dbus_connection_flush(g_conn_sender); + dbus_connection_flush(mConnectionSender); } dbus_message_unref(msg); @@ -529,14 +529,14 @@ int CServiceIpcDbus::send_wakeup_engine_command(int pid, const char* command) dbus_message_set_no_reply(msg, TRUE); - if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { + if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) { MAS_LOGE("[Dbus ERROR] Fail to Send"); if (temp_command) free(temp_command); return -1; // MAS_ERROR_OPERATION_FAILED; } else { MAS_LOGI("[Dbus DEBUG] Success to Send wakeup_engine_command : %d %s", pid, command); - dbus_connection_flush(g_conn_sender); + dbus_connection_flush(mConnectionSender); } dbus_message_unref(msg); @@ -585,12 +585,12 @@ int CServiceIpcDbus::service_state_change(int pid, int state) dbus_message_set_no_reply(msg, TRUE); - if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { + if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) { MAS_LOGE("[Dbus ERROR] Fail to Send"); return -1; // MAS_ERROR_OPERATION_FAILED; } else { MAS_LOGI("[Dbus DEBUG] Success to Send service state message : %d %d", pid, state); - dbus_connection_flush(g_conn_sender); + dbus_connection_flush(mConnectionSender); } dbus_message_unref(msg); @@ -635,12 +635,12 @@ int CServiceIpcDbus::voice_key_status_change(int pid, int status) dbus_message_set_no_reply(msg, TRUE); - if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { + if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) { MAS_LOGE("[Dbus ERROR] Fail to Send"); return -1; // MAS_ERROR_OPERATION_FAILED; } else { MAS_LOGI("[Dbus DEBUG] Success to Send voice key status change : %d %d", pid, status); - dbus_connection_flush(g_conn_sender); + dbus_connection_flush(mConnectionSender); } dbus_message_unref(msg); @@ -672,7 +672,7 @@ int CServiceIpcDbus::masc_ui_dbus_send_hello(void) DBusMessage* result_msg = NULL; int result = 0; - result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, 500, &err); + result_msg = dbus_connection_send_with_reply_and_block(mConnectionSender, msg, 500, &err); if (dbus_error_is_set(&err)) { MAS_LOGE("[Dbus ERROR] Dbus Error (%s)", err.message); @@ -726,7 +726,7 @@ int CServiceIpcDbus::masc_ui_dbus_send_asr_result(int pid, int event, const char dbus_message_set_no_reply(msg, TRUE); - if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { + if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) { MAS_LOGE("[Dbus ERROR] Fail to Send"); if (NULL != temp_asr_result) { free(temp_asr_result); @@ -735,7 +735,7 @@ int CServiceIpcDbus::masc_ui_dbus_send_asr_result(int pid, int event, const char return -1; // MAS_ERROR_OPERATION_FAILED; } else { MAS_LOGD("[Dbus DEBUG] Success to Send ASR result"); - dbus_connection_flush(g_conn_sender); + dbus_connection_flush(mConnectionSender); } dbus_message_unref(msg); @@ -779,12 +779,12 @@ int CServiceIpcDbus::masc_ui_dbus_send_result(int pid, const char* display_text, dbus_message_set_no_reply(msg, TRUE); - if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { + if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) { MAS_LOGE("[Dbus ERROR] Fail to Send"); return -1; //MA_ERROR_OPERATION_FAILED; } else { MAS_LOGD("[Dbus DEBUG] Success to Send result"); - dbus_connection_flush(g_conn_sender); + dbus_connection_flush(mConnectionSender); } dbus_message_unref(msg); @@ -811,7 +811,7 @@ int CServiceIpcDbus::masc_ui_dbus_send_result(int pid, const char* display_text, dbus_message_set_no_reply(msg, TRUE); - if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { + if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) { MAS_LOGE("[Dbus ERROR] Fail to Send"); if (temp_display_text) free(temp_display_text); @@ -822,7 +822,7 @@ int CServiceIpcDbus::masc_ui_dbus_send_result(int pid, const char* display_text, return -1; //MA_ERROR_OPERATION_FAILED; } else { MAS_LOGD("[Dbus DEBUG] Success to Send result"); - dbus_connection_flush(g_conn_sender); + dbus_connection_flush(mConnectionSender); } dbus_message_unref(msg); @@ -864,12 +864,12 @@ int CServiceIpcDbus::masc_ui_dbus_change_assistant(const char* app_id) dbus_message_set_no_reply(msg, TRUE); - if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { + if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) { MAS_LOGE("[Dbus ERROR] Fail to Send"); return -1; // MAS_ERROR_OPERATION_FAILED; } else { MAS_LOGD("[Dbus DEBUG] Success to Send change assistant request"); - dbus_connection_flush(g_conn_sender); + dbus_connection_flush(mConnectionSender); } dbus_message_unref(msg); @@ -879,7 +879,7 @@ int CServiceIpcDbus::masc_ui_dbus_change_assistant(const char* app_id) int CServiceIpcDbus::masc_ui_dbus_send_error_message(int reason, const char* err_msg) { - if (NULL == g_conn_sender) { + if (NULL == mConnectionSender) { MAS_LOGE("[Dbus ERROR] Dbus connection is not available"); return -1; } @@ -911,11 +911,11 @@ int CServiceIpcDbus::masc_ui_dbus_send_error_message(int reason, const char* err dbus_message_set_no_reply(msg, TRUE); - if (!dbus_connection_send(g_conn_sender, msg, NULL)) { + if (!dbus_connection_send(mConnectionSender, msg, NULL)) { MAS_LOGE("[Dbus ERROR] <<<< error message : Out Of Memory !"); } else { MAS_LOGD("<<<< Send error message : reason(%d), err_msg(%s)", reason, temp_err_msg); - dbus_connection_flush(g_conn_sender); + dbus_connection_flush(mConnectionSender); } dbus_message_unref(msg); @@ -953,12 +953,12 @@ int CServiceIpcDbus::masc_ui_dbus_send_recognition_result(int pid, int result) dbus_message_set_no_reply(msg, TRUE); - if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { + if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) { MAS_LOGE("[Dbus ERROR] Fail to Send"); return -1; // MAS_ERROR_OPERATION_FAILED; } else { MAS_LOGD("[Dbus DEBUG] Success to Send ASR result"); - dbus_connection_flush(g_conn_sender); + dbus_connection_flush(mConnectionSender); } dbus_message_unref(msg); @@ -993,12 +993,12 @@ int CServiceIpcDbus::masc_ui_dbus_enable_common_ui(int enable) dbus_message_set_no_reply(msg, TRUE); - if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { + if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) { MAS_LOGE("[Dbus ERROR] Fail to Send"); return -1; // MAS_ERROR_OPERATION_FAILED; } else { MAS_LOGD("[Dbus DEBUG] Success to Send ASR result"); - dbus_connection_flush(g_conn_sender); + dbus_connection_flush(mConnectionSender); } dbus_message_unref(msg); @@ -1014,9 +1014,9 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle return ECORE_CALLBACK_RENEW; } - DBusConnection* g_conn_listener = service_ipc->get_connection_listener(); - if (NULL == g_conn_listener) { - MAS_LOGE("Error : g_conn_listener NULL"); + DBusConnection* mConnectionListener = service_ipc->get_connection_listener(); + if (NULL == mConnectionListener) { + MAS_LOGE("Error : mConnectionListener NULL"); return ECORE_CALLBACK_RENEW; } @@ -1026,13 +1026,13 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle return ECORE_CALLBACK_RENEW; } - dbus_connection_read_write_dispatch(g_conn_listener, 50); + dbus_connection_read_write_dispatch(mConnectionListener, 50); while (1) { DBusMessage* msg = NULL; - msg = dbus_connection_pop_message(g_conn_listener); + msg = dbus_connection_pop_message(mConnectionListener); - if (true != dbus_connection_get_is_connected(g_conn_listener)) { + if (true != dbus_connection_get_is_connected(mConnectionListener)) { MAS_LOGE("[ERROR] Connection is disconnected"); return ECORE_CALLBACK_RENEW; } @@ -1044,70 +1044,70 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle /* client event */ if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_HELLO)) { - dispatcher->on_hello(g_conn_listener, msg); + dispatcher->on_hello(mConnectionListener, msg); } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_INITIALIZE)) { - dispatcher->on_initialize(g_conn_listener, msg); + dispatcher->on_initialize(mConnectionListener, msg); } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_DEINITIALIZE)) { - dispatcher->on_deinitialize(g_conn_listener, msg); + dispatcher->on_deinitialize(mConnectionListener, msg); } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_GET_RECORDING_AUDIO_FORMAT)) { - dispatcher->on_get_audio_format(g_conn_listener, msg); + dispatcher->on_get_audio_format(mConnectionListener, msg); } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_GET_RECORDING_AUDIO_SOURCE_TYPE)) { - dispatcher->on_get_audio_source_type(g_conn_listener, msg); + dispatcher->on_get_audio_source_type(mConnectionListener, msg); } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SEND_ASR_RESULT)) { - dispatcher->on_send_asr_result(g_conn_listener, msg); + dispatcher->on_send_asr_result(mConnectionListener, msg); } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SEND_RESULT)) { - dispatcher->on_send_result(g_conn_listener, msg); + dispatcher->on_send_result(mConnectionListener, msg); } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SEND_RECOGNITION_RESULT)) { - dispatcher->on_send_recognition_result(g_conn_listener, msg); + dispatcher->on_send_recognition_result(mConnectionListener, msg); } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_START_STREAMING_AUDIO_DATA)) { - dispatcher->on_start_streaming_audio_data(g_conn_listener, msg); + dispatcher->on_start_streaming_audio_data(mConnectionListener, msg); } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_STOP_STREAMING_AUDIO_DATA)) { - dispatcher->on_stop_streaming_audio_data(g_conn_listener, msg); + dispatcher->on_stop_streaming_audio_data(mConnectionListener, msg); } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_UPDATE_VOICE_FEEDBACK_STATE)) { - dispatcher->on_update_voice_feedback_state(g_conn_listener, msg); + dispatcher->on_update_voice_feedback_state(mConnectionListener, msg); } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SEND_ASSISTANT_SPECIFIC_COMMAND)) { - dispatcher->on_send_assistant_specific_command(g_conn_listener, msg); + dispatcher->on_send_assistant_specific_command(mConnectionListener, msg); } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SET_BACKGROUND_VOLUME)) { - dispatcher->on_set_background_volume(g_conn_listener, msg); + dispatcher->on_set_background_volume(mConnectionListener, msg); } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SET_PREPROCESSING_ALLOW_MODE)) { - dispatcher->on_set_preprocessing_allow_mode(g_conn_listener, msg); + dispatcher->on_set_preprocessing_allow_mode(mConnectionListener, msg); } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SEND_PREPROCESSING_RESULT)) { - dispatcher->on_send_preprocessing_result(g_conn_listener, msg); + dispatcher->on_send_preprocessing_result(mConnectionListener, msg); } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SET_WAKE_WORD_AUDIO_REQUIRE_FLAG)) { - dispatcher->on_set_wake_word_audio_require_flag(g_conn_listener, msg); + dispatcher->on_set_wake_word_audio_require_flag(mConnectionListener, msg); } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SET_ASSISTANT_LANGUAGE)) { - dispatcher->on_set_assistant_language(g_conn_listener, msg); + dispatcher->on_set_assistant_language(mConnectionListener, msg); } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_ADD_WAKE_WORD)) { - dispatcher->on_add_wake_word(g_conn_listener, msg); + dispatcher->on_add_wake_word(mConnectionListener, msg); } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_REMOVE_WAKE_WORD)) { - dispatcher->on_remove_wake_word(g_conn_listener, msg); + dispatcher->on_remove_wake_word(mConnectionListener, msg); } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_UI_METHOD_INITIALIZE)) { - dispatcher->on_ui_initialize(g_conn_listener, msg); + dispatcher->on_ui_initialize(mConnectionListener, msg); } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_UI_METHOD_DEINITIALIZE)) { - dispatcher->on_ui_deinitialize(g_conn_listener, msg); + dispatcher->on_ui_deinitialize(mConnectionListener, msg); } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_UI_METHOD_CHANGE_ASSISTANT)) { - dispatcher->on_ui_change_assistant(g_conn_listener, msg); + dispatcher->on_ui_change_assistant(mConnectionListener, msg); } else { MAS_LOGD("Message is NOT valid"); @@ -1122,15 +1122,15 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle void CServiceIpcDbus::connection_free() { - if (NULL != g_conn_listener) { - dbus_connection_close(g_conn_listener); - dbus_connection_unref(g_conn_listener); - g_conn_listener = NULL; + if (NULL != mConnectionListener) { + dbus_connection_close(mConnectionListener); + dbus_connection_unref(mConnectionListener); + mConnectionListener = NULL; } - if (NULL != g_conn_sender) { - dbus_connection_close(g_conn_sender); - dbus_connection_unref(g_conn_sender); - g_conn_sender = NULL; + if (NULL != mConnectionSender) { + dbus_connection_close(mConnectionSender); + dbus_connection_unref(mConnectionSender); + mConnectionSender = NULL; } } @@ -1142,38 +1142,38 @@ int CServiceIpcDbus::open_connection() int ret; /* Create connection for sender */ - g_conn_sender = dbus_bus_get_private(DBUS_BUS_SESSION, &err); + mConnectionSender = dbus_bus_get_private(DBUS_BUS_SESSION, &err); if (dbus_error_is_set(&err)) { MAS_LOGE("[Dbus ERROR] Fail dbus_bus_get : %s", err.message); dbus_error_free(&err); } - if (NULL == g_conn_sender) { + if (NULL == mConnectionSender) { MAS_LOGE("[Dbus ERROR] Fail to get dbus connection"); return -1; } - dbus_connection_set_exit_on_disconnect(g_conn_sender, false); + dbus_connection_set_exit_on_disconnect(mConnectionSender, false); /* connect to the bus and check for errors */ - g_conn_listener = dbus_bus_get_private(DBUS_BUS_SESSION, &err); + mConnectionListener = dbus_bus_get_private(DBUS_BUS_SESSION, &err); if (dbus_error_is_set(&err)) { MAS_LOGE("[Dbus ERROR] Fail dbus_bus_get : %s", err.message); dbus_error_free(&err); } - if (NULL == g_conn_listener) { + if (NULL == mConnectionListener) { MAS_LOGE("[Dbus ERROR] Fail to get dbus connection"); connection_free(); return -1; } - dbus_connection_set_exit_on_disconnect(g_conn_listener, false); + dbus_connection_set_exit_on_disconnect(mConnectionListener, false); /* request our name on the bus and check for errors */ - ret = dbus_bus_request_name(g_conn_listener, MA_SERVER_SERVICE_NAME, DBUS_NAME_FLAG_REPLACE_EXISTING, &err); + ret = dbus_bus_request_name(mConnectionListener, MA_SERVER_SERVICE_NAME, DBUS_NAME_FLAG_REPLACE_EXISTING, &err); if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) { printf("Fail to be primary owner in dbus request."); @@ -1190,7 +1190,7 @@ int CServiceIpcDbus::open_connection() } /* Flush messages which are received before fd event handler registration */ - while (DBUS_DISPATCH_DATA_REMAINS == dbus_connection_get_dispatch_status(g_conn_listener)) { + while (DBUS_DISPATCH_DATA_REMAINS == dbus_connection_get_dispatch_status(mConnectionListener)) { listener_event_callback(this, NULL); } @@ -1199,7 +1199,7 @@ int CServiceIpcDbus::open_connection() snprintf(rule, 128, "type='signal',interface='%s'", MA_SERVER_SERVICE_INTERFACE); /* add a rule for which messages we want to see */ - dbus_bus_add_match(g_conn_listener, rule, &err);/* see signals from the given interface */ + dbus_bus_add_match(mConnectionListener, rule, &err);/* see signals from the given interface */ if (dbus_error_is_set(&err)) { MAS_LOGE("[Dbus ERROR] dbus_bus_add_match() : %s", err.message); @@ -1209,7 +1209,7 @@ int CServiceIpcDbus::open_connection() } int fd = 0; - if (1 != dbus_connection_get_unix_fd(g_conn_listener, &fd)) { + if (1 != dbus_connection_get_unix_fd(mConnectionListener, &fd)) { MAS_LOGE("fail to get fd from dbus "); connection_free(); return -1; @@ -1217,9 +1217,9 @@ int CServiceIpcDbus::open_connection() MAS_LOGD("Get fd from dbus : %d", fd); } - g_dbus_fd_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, (Ecore_Fd_Cb)listener_event_callback, this, NULL, NULL); + mFdHandler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, (Ecore_Fd_Cb)listener_event_callback, this, NULL, NULL); - if (NULL == g_dbus_fd_handler) { + if (NULL == mFdHandler) { MAS_LOGE("[Dbus ERROR] Fail to get fd handler"); connection_free(); return -1; @@ -1233,12 +1233,12 @@ int CServiceIpcDbus::close_connection() DBusError err; dbus_error_init(&err); - if (NULL != g_dbus_fd_handler) { - ecore_main_fd_handler_del(g_dbus_fd_handler); - g_dbus_fd_handler = NULL; + if (NULL != mFdHandler) { + ecore_main_fd_handler_del(mFdHandler); + mFdHandler = NULL; } - dbus_bus_release_name(g_conn_listener, MA_SERVER_SERVICE_NAME, &err); + dbus_bus_release_name(mConnectionListener, MA_SERVER_SERVICE_NAME, &err); if (dbus_error_is_set(&err)) { MAS_LOGE("[Dbus ERROR] dbus_bus_release_name() : %s", err.message); @@ -1248,4 +1248,4 @@ int CServiceIpcDbus::close_connection() connection_free(); return 0; -} \ No newline at end of file +} diff --git a/src/service_main.cpp b/src/service_main.cpp index 6af73f6..0abb443 100644 --- a/src/service_main.cpp +++ b/src/service_main.cpp @@ -45,8 +45,8 @@ bool CServiceMain::check_preprocessing_assistant_exists() char* vconf_str = vconf_get_str(WAKEUP_SETTINGS_KEY_PREPROCESSING_ASSISTANT_APPID); if (vconf_str) { for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) { - if (g_maclient_info[loop].used && - strncmp(vconf_str, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) { + if (mClientInfo[loop].used && + strncmp(vconf_str, mClientInfo[loop].appid, MAX_APPID_LEN) == 0) { if (mClientManager.check_client_validity_by_appid(std::string{vconf_str})) { ret = true; } @@ -276,14 +276,14 @@ int CServiceMain::mas_client_set_preprocessing_allow_mode(int pid, ma_preprocess } for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) { - if (g_maclient_info[loop].used) { - if (pid_appid && strncmp(pid_appid, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) { - g_maclient_info[loop].preprocessing_allow_mode = mode; + if (mClientInfo[loop].used) { + if (pid_appid && strncmp(pid_appid, mClientInfo[loop].appid, MAX_APPID_LEN) == 0) { + mClientInfo[loop].preprocessing_allow_mode = mode; if (appid) { - strncpy(g_maclient_info[loop].preprocessing_allow_appid, appid, MAX_APPID_LEN); - g_maclient_info[loop].preprocessing_allow_appid[MAX_APPID_LEN - 1] = '\0'; + strncpy(mClientInfo[loop].preprocessing_allow_appid, appid, MAX_APPID_LEN); + mClientInfo[loop].preprocessing_allow_appid[MAX_APPID_LEN - 1] = '\0'; } else { - g_maclient_info[loop].preprocessing_allow_appid[0] = '\0'; + mClientInfo[loop].preprocessing_allow_appid[0] = '\0'; } } } @@ -305,8 +305,8 @@ int CServiceMain::mas_client_send_preprocessing_result(int pid, bool result) if (!is_current_preprocessing_assistant(pid_appid)) return -1; const char *current_maclient_appid = NULL; - if (g_current_maclient_info >= 0 && g_current_maclient_info < MAX_MACLIENT_INFO_NUM) { - current_maclient_appid = g_maclient_info[g_current_maclient_info].appid; + if (mCurrentClientInfo >= 0 && mCurrentClientInfo < MAX_MACLIENT_INFO_NUM) { + current_maclient_appid = mClientInfo[mCurrentClientInfo].appid; } if (result) { @@ -364,15 +364,15 @@ int CServiceMain::mas_client_add_wake_word(int pid, const char* wake_word, const } for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) { - if (g_maclient_info[loop].used && - 0 == strncmp(buf, g_maclient_info[loop].appid, MAX_APPID_LEN)) { + if (mClientInfo[loop].used && + 0 == strncmp(buf, mClientInfo[loop].appid, MAX_APPID_LEN)) { ret = mServiceConfig.add_custom_wake_word(wake_word, language, - g_maclient_info[loop].wakeup_word, - g_maclient_info[loop].wakeup_language); + mClientInfo[loop].wakeup_word, + mClientInfo[loop].wakeup_language); if (0 == ret) { mServiceConfig.save_custom_wake_words(pid_appid, - g_maclient_info[loop].wakeup_word, - g_maclient_info[loop].wakeup_language); + mClientInfo[loop].wakeup_word, + mClientInfo[loop].wakeup_language); } else { LOGE("add new wake word failed!"); return -1; @@ -395,15 +395,15 @@ int CServiceMain::mas_client_remove_wake_word(int pid, const char* wake_word, co } for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) { - if (g_maclient_info[loop].used && - 0 == strncmp(buf, g_maclient_info[loop].appid, MAX_APPID_LEN)) { + if (mClientInfo[loop].used && + 0 == strncmp(buf, mClientInfo[loop].appid, MAX_APPID_LEN)) { ret = mServiceConfig.remove_custom_wake_word(wake_word, language, - g_maclient_info[loop].wakeup_word, - g_maclient_info[loop].wakeup_language); + mClientInfo[loop].wakeup_word, + mClientInfo[loop].wakeup_language); if (0 == ret) { mServiceConfig.save_custom_wake_words(pid_appid, - g_maclient_info[loop].wakeup_word, - g_maclient_info[loop].wakeup_language); + mClientInfo[loop].wakeup_word, + mClientInfo[loop].wakeup_language); } } } @@ -459,13 +459,13 @@ int CServiceMain::mas_ui_client_change_assistant(const char* appid) // Appropriate MA Client not available, trying to launch new one MAS_LOGD("MA Client with appid %s does not exist, launching client", (appid ? appid : "NULL")); - /* The appid parameter might not exist after this function call, so we use appid string in our g_maclient_info */ + /* The appid parameter might not exist after this function call, so we use appid string in our mClientInfo */ for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) { - if (g_maclient_info[loop].used && - 0 < strlen(g_maclient_info[loop].appid) && - 0 < strlen(g_maclient_info[loop].wakeup_word[0])) { - if (strncmp(appid, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) { - mas_launch_client_by_appid(g_maclient_info[loop].appid, CLIENT_LAUNCH_MODE_ACTIVATION); + if (mClientInfo[loop].used && + 0 < strlen(mClientInfo[loop].appid) && + 0 < strlen(mClientInfo[loop].wakeup_word[0])) { + if (strncmp(appid, mClientInfo[loop].appid, MAX_APPID_LEN) == 0) { + mas_launch_client_by_appid(mClientInfo[loop].appid, CLIENT_LAUNCH_MODE_ACTIVATION); } } } @@ -498,63 +498,63 @@ int CServiceMain::add_assistant_info(ma_assistant_info_s* info) { int index = -1; int loop = 0; while(-1 == index && loop < MAX_MACLIENT_INFO_NUM) { - if (false == g_maclient_info[loop].used) { + if (false == mClientInfo[loop].used) { index = loop; } loop++; } if (-1 != index) { - g_maclient_info[index].used = true; - g_maclient_info[index].preprocessing_allow_mode = MA_PREPROCESSING_ALLOW_NONE; - g_maclient_info[index].preprocessing_allow_appid[0] = '\0'; + mClientInfo[index].used = true; + mClientInfo[index].preprocessing_allow_mode = MA_PREPROCESSING_ALLOW_NONE; + mClientInfo[index].preprocessing_allow_appid[0] = '\0'; MAS_LOGD("app_id(%s)", info->app_id); - strncpy(g_maclient_info[index].appid, info->app_id, MAX_APPID_LEN); - g_maclient_info[index].appid[MAX_APPID_LEN - 1] = '\0'; + strncpy(mClientInfo[index].appid, info->app_id, MAX_APPID_LEN); + mClientInfo[index].appid[MAX_APPID_LEN - 1] = '\0'; - if (is_current_preprocessing_assistant(g_maclient_info[index].appid)) { - g_current_preprocessing_maclient_info = index; + if (is_current_preprocessing_assistant(mClientInfo[index].appid)) { + mCurrentPreprocessingClientInfo = index; } for (loop = 0;loop < MAX_WAKEUP_WORDS_NUM;loop++) { if (loop < info->cnt_wakeup && info->wakeup_list[loop]) { MAS_LOGD("wakeup_list(%d)(%s)(%s)", loop, info->wakeup_list[loop], info->wakeup_language[loop]); - strncpy(g_maclient_info[index].wakeup_word[loop], info->wakeup_list[loop], MAX_WAKEUP_WORD_LEN); - g_maclient_info[index].wakeup_word[loop][MAX_WAKEUP_WORD_LEN - 1] = '\0'; + strncpy(mClientInfo[index].wakeup_word[loop], info->wakeup_list[loop], MAX_WAKEUP_WORD_LEN); + mClientInfo[index].wakeup_word[loop][MAX_WAKEUP_WORD_LEN - 1] = '\0'; if (info->wakeup_language[loop]) { - strncpy(g_maclient_info[index].wakeup_language[loop], info->wakeup_language[loop], MAX_SUPPORTED_LANGUAGE_LEN); - g_maclient_info[index].wakeup_language[loop][MAX_SUPPORTED_LANGUAGE_LEN - 1] = '\0'; + strncpy(mClientInfo[index].wakeup_language[loop], info->wakeup_language[loop], MAX_SUPPORTED_LANGUAGE_LEN); + mClientInfo[index].wakeup_language[loop][MAX_SUPPORTED_LANGUAGE_LEN - 1] = '\0'; } else { - strncpy(g_maclient_info[index].wakeup_language[loop], "", MAX_SUPPORTED_LANGUAGE_LEN); + strncpy(mClientInfo[index].wakeup_language[loop], "", MAX_SUPPORTED_LANGUAGE_LEN); } } else { - strncpy(g_maclient_info[index].wakeup_word[loop], "", MAX_WAKEUP_WORD_LEN); + strncpy(mClientInfo[index].wakeup_word[loop], "", MAX_WAKEUP_WORD_LEN); } } for (loop = 0;loop < MAX_SUPPORTED_LANGUAGES_NUM;loop++) { if (loop < info->cnt_lang && info->supported_lang[loop]) { MAS_LOGD("supported_lang(%d)(%s)", loop, info->supported_lang[loop]); - strncpy(g_maclient_info[index].supported_language[loop], info->supported_lang[loop], MAX_SUPPORTED_LANGUAGE_LEN); - g_maclient_info[index].supported_language[loop][MAX_SUPPORTED_LANGUAGE_LEN - 1] = '\0'; + strncpy(mClientInfo[index].supported_language[loop], info->supported_lang[loop], MAX_SUPPORTED_LANGUAGE_LEN); + mClientInfo[index].supported_language[loop][MAX_SUPPORTED_LANGUAGE_LEN - 1] = '\0'; } else { - strncpy(g_maclient_info[index].supported_language[loop], "", MAX_SUPPORTED_LANGUAGE_LEN); + strncpy(mClientInfo[index].supported_language[loop], "", MAX_SUPPORTED_LANGUAGE_LEN); } } MAS_LOGD("wakeup_engine(%s)", info->wakeup_engine); if (info->wakeup_engine) { - strncpy(g_maclient_info[index].wakeup_engine, info->wakeup_engine, MAX_APPID_LEN); - g_maclient_info[index].wakeup_engine[MAX_APPID_LEN - 1] = '\0'; + strncpy(mClientInfo[index].wakeup_engine, info->wakeup_engine, MAX_APPID_LEN); + mClientInfo[index].wakeup_engine[MAX_APPID_LEN - 1] = '\0'; } else { - g_maclient_info[index].wakeup_engine[0] = '\0'; + mClientInfo[index].wakeup_engine[0] = '\0'; MAS_LOGW("Wakeup engine information not provided for : %s", info->app_id); } - g_maclient_info[index].custom_ui_option = info->custom_ui_option; + mClientInfo[index].custom_ui_option = info->custom_ui_option; MAS_LOGD("voice_key_support_mode(%d)", info->voice_key_support_mode); - g_maclient_info[index].voice_key_support_mode = info->voice_key_support_mode; + mClientInfo[index].voice_key_support_mode = info->voice_key_support_mode; MAS_LOGD("voice_key_tap_duration(%f)", info->voice_key_tap_duration); - g_maclient_info[index].voice_key_tap_duration = info->voice_key_tap_duration; + mClientInfo[index].voice_key_tap_duration = info->voice_key_tap_duration; } else { MAS_LOGD("Couldn't find an empty slot for storing assistant info"); } @@ -593,7 +593,7 @@ int CServiceMain::initialize_service_plugin(void) return -1; } - if (0 != mServicePlugin.set_language(g_current_lang.c_str())) { + if (0 != mServicePlugin.set_language(mCurrentLanguage.c_str())) { MAS_LOGE("Fail to ws set language"); return -1; } @@ -601,34 +601,34 @@ int CServiceMain::initialize_service_plugin(void) if (0 == mServiceConfig.get_assistant_info(mas_assistant_info_cb, this)) { for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) { int inner_loop; - if (g_maclient_info[loop].used && - 0 < strlen(g_maclient_info[loop].appid)) { - mServiceConfig.load_custom_wake_words(g_maclient_info[loop].appid, - g_maclient_info[loop].wakeup_word, g_maclient_info[loop].wakeup_language); - if (0 < strlen(g_maclient_info[loop].wakeup_engine)) { + if (mClientInfo[loop].used && + 0 < strlen(mClientInfo[loop].appid)) { + mServiceConfig.load_custom_wake_words(mClientInfo[loop].appid, + mClientInfo[loop].wakeup_word, mClientInfo[loop].wakeup_language); + if (0 < strlen(mClientInfo[loop].wakeup_engine)) { mServicePlugin.set_assistant_wakeup_engine( - g_maclient_info[loop].appid, - g_maclient_info[loop].wakeup_engine); + mClientInfo[loop].appid, + mClientInfo[loop].wakeup_engine); } for (inner_loop = 0; inner_loop < MAX_WAKEUP_WORDS_NUM; inner_loop++) { - if (0 < strlen(g_maclient_info[loop].wakeup_word[inner_loop])) { + if (0 < strlen(mClientInfo[loop].wakeup_word[inner_loop])) { MAS_LOGD("Registering wakeup word %s for app %s", - g_maclient_info[loop].wakeup_word[inner_loop], g_maclient_info[loop].appid); + mClientInfo[loop].wakeup_word[inner_loop], mClientInfo[loop].appid); if (0 != mServicePlugin.add_assistant_wakeup_word( - g_maclient_info[loop].appid, - g_maclient_info[loop].wakeup_word[inner_loop], - g_maclient_info[loop].wakeup_language[inner_loop])) { + mClientInfo[loop].appid, + mClientInfo[loop].wakeup_word[inner_loop], + mClientInfo[loop].wakeup_language[inner_loop])) { MAS_LOGE("Fail to add assistant's wakeup word"); } } } for (inner_loop = 0; inner_loop < MAX_SUPPORTED_LANGUAGE_NUM; inner_loop++) { - if (0 < strlen(g_maclient_info[loop].supported_language[inner_loop])) { + if (0 < strlen(mClientInfo[loop].supported_language[inner_loop])) { MAS_LOGD("Adding language %s for app %s", - g_maclient_info[loop].supported_language[inner_loop], g_maclient_info[loop].appid); + mClientInfo[loop].supported_language[inner_loop], mClientInfo[loop].appid); if (0 != mServicePlugin.add_assistant_language( - g_maclient_info[loop].appid, - g_maclient_info[loop].supported_language[inner_loop])) { + mClientInfo[loop].appid, + mClientInfo[loop].supported_language[inner_loop])) { MAS_LOGE("Fail to add assistant's language"); } } @@ -672,8 +672,8 @@ int CServiceMain::process_activated_setting() const char *default_assistant = NULL; if (0 == mServicePlugin.get_default_assistant(&default_assistant)) { if (NULL == default_assistant) { - if (g_maclient_info[0].used) { - default_assistant = g_maclient_info[0].appid; + if (mClientInfo[0].used) { + default_assistant = mClientInfo[0].appid; MAS_LOGW("No default assistant, setting %s as default", default_assistant); mServicePlugin.set_default_assistant(default_assistant); } else { @@ -689,8 +689,8 @@ int CServiceMain::process_activated_setting() int CServiceMain::mas_get_current_client_pid() { int ret = -1; - if (g_current_maclient_info >= 0 && g_current_maclient_info < MAX_MACLIENT_INFO_NUM) { - const char *appid = g_maclient_info[g_current_maclient_info].appid; + if (mCurrentClientInfo >= 0 && mCurrentClientInfo < MAX_MACLIENT_INFO_NUM) { + const char *appid = mClientInfo[mCurrentClientInfo].appid; if (appid) { ret = mClientManager.find_client_pid_by_appid(std::string{appid}); } @@ -701,8 +701,8 @@ int CServiceMain::mas_get_current_client_pid() int CServiceMain::mas_get_current_preprocessing_client_pid() { int ret = -1; - if (g_current_preprocessing_maclient_info >= 0 && g_current_preprocessing_maclient_info < MAX_MACLIENT_INFO_NUM) { - const char *appid = g_maclient_info[g_current_preprocessing_maclient_info].appid; + if (mCurrentPreprocessingClientInfo >= 0 && mCurrentPreprocessingClientInfo < MAX_MACLIENT_INFO_NUM) { + const char *appid = mClientInfo[mCurrentPreprocessingClientInfo].appid; if (appid) { ret = mClientManager.find_client_pid_by_appid(std::string{appid}); } @@ -733,11 +733,11 @@ bool CServiceMain::mas_get_client_custom_ui_option_by_appid(const char *appid) { bool ret = false; for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) { - if (g_maclient_info[loop].used && - 0 < strlen(g_maclient_info[loop].appid) && - 0 < strlen(g_maclient_info[loop].wakeup_word[0])) { - if (strncmp(appid, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) { - ret = g_maclient_info[loop].custom_ui_option; + if (mClientInfo[loop].used && + 0 < strlen(mClientInfo[loop].appid) && + 0 < strlen(mClientInfo[loop].wakeup_word[0])) { + if (strncmp(appid, mClientInfo[loop].appid, MAX_APPID_LEN) == 0) { + ret = mClientInfo[loop].custom_ui_option; } } } @@ -758,12 +758,12 @@ const char* CServiceMain::mas_get_client_appid_by_wakeup_word(const char *wakeup if (NULL == wakeup_word) return NULL; for (loop = 0; loop < MAX_MACLIENT_INFO_NUM && NULL == appid; loop++) { - if (g_maclient_info[loop].used && - 0 < strlen(g_maclient_info[loop].appid)) { + if (mClientInfo[loop].used && + 0 < strlen(mClientInfo[loop].appid)) { for (int inner_loop = 0; inner_loop < MAX_WAKEUP_WORDS_NUM; inner_loop++) { - if (0 < strlen(g_maclient_info[loop].wakeup_word[inner_loop])) { - if (0 == strncmp(wakeup_word, g_maclient_info[loop].wakeup_word[inner_loop], MAX_WAKEUP_WORD_LEN)) { - appid = g_maclient_info[loop].appid; + if (0 < strlen(mClientInfo[loop].wakeup_word[inner_loop])) { + if (0 == strncmp(wakeup_word, mClientInfo[loop].wakeup_word[inner_loop], MAX_WAKEUP_WORD_LEN)) { + appid = mClientInfo[loop].appid; } } } @@ -773,19 +773,19 @@ const char* CServiceMain::mas_get_client_appid_by_wakeup_word(const char *wakeup /* Perform extended search, by eliminating blank characters */ if (NULL == appid) { for (loop = 0; loop < MAX_MACLIENT_INFO_NUM && NULL == appid; loop++) { - if (g_maclient_info[loop].used && - 0 < strlen(g_maclient_info[loop].appid)) { + if (mClientInfo[loop].used && + 0 < strlen(mClientInfo[loop].appid)) { for (int inner_loop = 0; inner_loop < MAX_WAKEUP_WORDS_NUM; inner_loop++) { - if (0 < strlen(g_maclient_info[loop].wakeup_word[inner_loop])) { + if (0 < strlen(mClientInfo[loop].wakeup_word[inner_loop])) { char comparand[MAX_WAKEUP_WORD_LEN]; int comparand_index = 0; for (int index = 0; index < MAX_WAKEUP_WORD_LEN; index++) { - if (' ' != g_maclient_info[loop].wakeup_word[inner_loop][index]) { - comparand[comparand_index++] = g_maclient_info[loop].wakeup_word[inner_loop][index]; + if (' ' != mClientInfo[loop].wakeup_word[inner_loop][index]) { + comparand[comparand_index++] = mClientInfo[loop].wakeup_word[inner_loop][index]; } } if (0 == strncmp(wakeup_word, comparand, MAX_WAKEUP_WORD_LEN)) { - appid = g_maclient_info[loop].appid; + appid = mClientInfo[loop].appid; } } } @@ -800,15 +800,15 @@ int CServiceMain::mas_set_current_client_by_wakeup_word(const char *wakeup_word) { int loop; int ret = -1; - int prev_selection = g_current_maclient_info; + int prev_selection = mCurrentClientInfo; for (loop = 0; loop < MAX_MACLIENT_INFO_NUM && -1 == ret; loop++) { - if (g_maclient_info[loop].used && - 0 < strlen(g_maclient_info[loop].appid)) { + if (mClientInfo[loop].used && + 0 < strlen(mClientInfo[loop].appid)) { for (int inner_loop = 0; inner_loop < MAX_WAKEUP_WORDS_NUM; inner_loop++) { - if (0 < strlen(g_maclient_info[loop].wakeup_word[inner_loop])) { - if (0 == strncmp(wakeup_word, g_maclient_info[loop].wakeup_word[inner_loop], MAX_WAKEUP_WORD_LEN)) { - g_current_maclient_info = loop; + if (0 < strlen(mClientInfo[loop].wakeup_word[inner_loop])) { + if (0 == strncmp(wakeup_word, mClientInfo[loop].wakeup_word[inner_loop], MAX_WAKEUP_WORD_LEN)) { + mCurrentClientInfo = loop; ret = 0; } } @@ -818,19 +818,19 @@ int CServiceMain::mas_set_current_client_by_wakeup_word(const char *wakeup_word) /* Perform extended search, by eliminating blank characters */ if (ret == -1) { for (loop = 0; loop < MAX_MACLIENT_INFO_NUM && -1 == ret; loop++) { - if (g_maclient_info[loop].used && - 0 < strlen(g_maclient_info[loop].appid)) { + if (mClientInfo[loop].used && + 0 < strlen(mClientInfo[loop].appid)) { for (int inner_loop = 0; inner_loop < MAX_WAKEUP_WORDS_NUM; inner_loop++) { - if (0 < strlen(g_maclient_info[loop].wakeup_word[inner_loop])) { + if (0 < strlen(mClientInfo[loop].wakeup_word[inner_loop])) { char comparand[MAX_WAKEUP_WORD_LEN]; int comparand_index = 0; for (int index = 0; index < MAX_WAKEUP_WORD_LEN; index++) { - if (' ' != g_maclient_info[loop].wakeup_word[inner_loop][index]) { - comparand[comparand_index++] = g_maclient_info[loop].wakeup_word[inner_loop][index]; + if (' ' != mClientInfo[loop].wakeup_word[inner_loop][index]) { + comparand[comparand_index++] = mClientInfo[loop].wakeup_word[inner_loop][index]; } } if (0 == strncmp(wakeup_word, comparand, MAX_WAKEUP_WORD_LEN)) { - g_current_maclient_info = loop; + mCurrentClientInfo = loop; ret = 0; } } @@ -839,9 +839,9 @@ int CServiceMain::mas_set_current_client_by_wakeup_word(const char *wakeup_word) } } - if (g_current_maclient_info != prev_selection) { + if (mCurrentClientInfo != prev_selection) { if (prev_selection >= 0 && prev_selection < MAX_MACLIENT_INFO_NUM) { - int pid = mas_get_client_pid_by_appid(g_maclient_info[prev_selection].appid); + int pid = mas_get_client_pid_by_appid(mClientInfo[prev_selection].appid); mServiceIpc.active_state_change(pid, MA_ACTIVE_STATE_INACTIVE); } } @@ -852,22 +852,22 @@ int CServiceMain::mas_set_current_client_by_wakeup_word(const char *wakeup_word) int CServiceMain::mas_set_current_client_by_appid(const char *appid) { int ret = -1; - int prev_selection = g_current_maclient_info; + int prev_selection = mCurrentClientInfo; for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) { - if (g_maclient_info[loop].used && - 0 < strlen(g_maclient_info[loop].appid) && - 0 < strlen(g_maclient_info[loop].wakeup_word[0])) { - if (strncmp(appid, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) { - g_current_maclient_info = loop; + if (mClientInfo[loop].used && + 0 < strlen(mClientInfo[loop].appid) && + 0 < strlen(mClientInfo[loop].wakeup_word[0])) { + if (strncmp(appid, mClientInfo[loop].appid, MAX_APPID_LEN) == 0) { + mCurrentClientInfo = loop; ret = 0; } } } - if (g_current_maclient_info != prev_selection) { + if (mCurrentClientInfo != prev_selection) { if (prev_selection >= 0 && prev_selection < MAX_MACLIENT_INFO_NUM) { - int pid = mas_get_client_pid_by_appid(g_maclient_info[prev_selection].appid); + int pid = mas_get_client_pid_by_appid(mClientInfo[prev_selection].appid); mServiceIpc.active_state_change(pid, MA_ACTIVE_STATE_INACTIVE); } } @@ -912,15 +912,15 @@ int CServiceMain::mas_launch_client_by_appid(const char *appid, CLIENT_LAUNCH_MO if (CLIENT_LAUNCH_MODE_ACTIVATION == launch_mode) { bool found = false; for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) { - if (g_maclient_info[loop].used && - 0 < strlen(g_maclient_info[loop].appid)) { - if (strncmp(appid, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) { - g_wakeup_maclient_appid = g_maclient_info[loop].appid; + if (mClientInfo[loop].used && + 0 < strlen(mClientInfo[loop].appid)) { + if (strncmp(appid, mClientInfo[loop].appid, MAX_APPID_LEN) == 0) { + mWakeupClientAppId = mClientInfo[loop].appid; found = true; } } } - MAS_LOGD("g_wakeup_maclient_appid : %s, %d", g_wakeup_maclient_appid.c_str(), found); + MAS_LOGD("mWakeupClientAppId : %s, %d", mWakeupClientAppId.c_str(), found); } if (b) bundle_free(b); @@ -986,17 +986,17 @@ int CServiceMain::mas_update_voice_key_support_mode() const char *default_assistant = NULL; if (0 == mServicePlugin.get_default_assistant(&default_assistant)) { for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) { - if (g_maclient_info[loop].used) { + if (mClientInfo[loop].used) { if (default_assistant && - strncmp(default_assistant, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) { - float duration = g_maclient_info[loop].voice_key_tap_duration; + strncmp(default_assistant, mClientInfo[loop].appid, MAX_APPID_LEN) == 0) { + float duration = mClientInfo[loop].voice_key_tap_duration; if (0.0f < duration) { mServicePlugin.set_voice_key_tap_duration(duration); } else { mServicePlugin.unset_voice_key_tap_duration(); } mServicePlugin.set_voice_key_support_mode( - g_maclient_info[loop].voice_key_support_mode); + mClientInfo[loop].voice_key_support_mode); successful = true; } } @@ -1013,9 +1013,9 @@ int CServiceMain::mas_update_voice_key_support_mode() ma_preprocessing_allow_mode_e CServiceMain::get_preprocessing_allow_mode(const char* appid) { for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) { - if (appid && g_maclient_info[loop].used) { - if (strncmp(appid, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) { - return g_maclient_info[loop].preprocessing_allow_mode; + if (appid && mClientInfo[loop].used) { + if (strncmp(appid, mClientInfo[loop].appid, MAX_APPID_LEN) == 0) { + return mClientInfo[loop].preprocessing_allow_mode; } } } @@ -1029,9 +1029,9 @@ int CServiceMain::mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVEN { const char* current_maclient_appid = NULL; const char* preprocessing_allow_appid = NULL; - if (g_current_maclient_info >= 0 && g_current_maclient_info < MAX_MACLIENT_INFO_NUM) { - current_maclient_appid = g_maclient_info[g_current_maclient_info].appid; - preprocessing_allow_appid = g_maclient_info[g_current_maclient_info].preprocessing_allow_appid; + if (mCurrentClientInfo >= 0 && mCurrentClientInfo < MAX_MACLIENT_INFO_NUM) { + current_maclient_appid = mClientInfo[mCurrentClientInfo].appid; + preprocessing_allow_appid = mClientInfo[mCurrentClientInfo].preprocessing_allow_appid; } ma_preprocessing_allow_mode_e mode = get_preprocessing_allow_mode(current_maclient_appid); @@ -1043,12 +1043,12 @@ int CServiceMain::mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVEN current_maclient should always be brought to front */ mas_bring_client_to_foreground(current_maclient_appid); #endif - g_current_preprocessing_state = PREPROCESSING_STATE_WAKEUP_PREPROCESS_DISABLED; + mCurrentPreprocessingState = PREPROCESSING_STATE_WAKEUP_PREPROCESS_DISABLED; if (check_preprocessing_assistant_exists()) { if (MA_PREPROCESSING_ALLOW_UTTERANCE == mode || MA_PREPROCESSING_ALLOW_ALL == mode) { if (is_current_preprocessing_assistant(preprocessing_allow_appid)) { - g_current_preprocessing_state = PREPROCESSING_STATE_WAKEUP_PREPROCESS_ENABLED; + mCurrentPreprocessingState = PREPROCESSING_STATE_WAKEUP_PREPROCESS_ENABLED; } } } else { @@ -1062,13 +1062,13 @@ int CServiceMain::mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVEN break; case PREPROCESSING_STATE_EVENT_PREPROCESSING_ALLOW_MODE_CHANGED: { - g_current_preprocessing_state = PREPROCESSING_STATE_WAKEUP_PREPROCESS_DISABLED; + mCurrentPreprocessingState = PREPROCESSING_STATE_WAKEUP_PREPROCESS_DISABLED; /* Enable preprocessing mode only if the preprocessing assistant exists */ if (check_preprocessing_assistant_exists()) { if (MA_PREPROCESSING_ALLOW_UTTERANCE == mode || MA_PREPROCESSING_ALLOW_ALL == mode) { if (is_current_preprocessing_assistant(preprocessing_allow_appid)) { - g_current_preprocessing_state = PREPROCESSING_STATE_WAKEUP_PREPROCESS_ENABLED; + mCurrentPreprocessingState = PREPROCESSING_STATE_WAKEUP_PREPROCESS_ENABLED; } } } @@ -1076,9 +1076,9 @@ int CServiceMain::mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVEN break; case PREPROCESSING_STATE_EVENT_UTTERANCE_STREAMING_STARTED: { - if (PREPROCESSING_STATE_WAKEUP_PREPROCESS_ENABLED == g_current_preprocessing_state) { - g_current_preprocessing_state = PREPROCESSING_STATE_PREPROCESSING_UTTERANCE; - } else if (PREPROCESSING_STATE_WAKEUP_PREPROCESS_DISABLED == g_current_preprocessing_state) { + if (PREPROCESSING_STATE_WAKEUP_PREPROCESS_ENABLED == mCurrentPreprocessingState) { + mCurrentPreprocessingState = PREPROCESSING_STATE_PREPROCESSING_UTTERANCE; + } else if (PREPROCESSING_STATE_WAKEUP_PREPROCESS_DISABLED == mCurrentPreprocessingState) { /* If preprocessing assistant does not exist, the current_maclient would have been brought to front already on wakeup event */ #ifdef BRING_PREPROCESSING_ASSISTANT_TO_FRONT @@ -1086,17 +1086,17 @@ int CServiceMain::mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVEN mas_bring_client_to_foreground(current_maclient_appid); } #endif - g_current_preprocessing_state = PREPROCESSING_STATE_NONE; + mCurrentPreprocessingState = PREPROCESSING_STATE_NONE; } } break; case PREPROCESSING_STATE_EVENT_FOLLOW_UP_STREAMING_STARTED: { - g_current_preprocessing_state = PREPROCESSING_STATE_NONE; + mCurrentPreprocessingState = PREPROCESSING_STATE_NONE; if (check_preprocessing_assistant_exists()) { if (MA_PREPROCESSING_ALLOW_FOLLOW_UP == mode || MA_PREPROCESSING_ALLOW_ALL == mode) { - g_current_preprocessing_state = PREPROCESSING_STATE_PREPROCESSING_FOLLOW_UP; + mCurrentPreprocessingState = PREPROCESSING_STATE_PREPROCESSING_FOLLOW_UP; } } } @@ -1104,8 +1104,8 @@ int CServiceMain::mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVEN case PREPROCESSING_STATE_EVENT_PREPROCESSING_SUCCEEDED: { #ifdef BRING_PREPROCESSING_ASSISTANT_TO_FRONT - if (PREPROCESSING_STATE_EVENT_UTTERANCE_STREAMING_STARTED == g_current_preprocessing_state || - PREPROCESSING_STATE_EVENT_FOLLOW_UP_STREAMING_STARTED == g_current_preprocessing_state) { + if (PREPROCESSING_STATE_EVENT_UTTERANCE_STREAMING_STARTED == mCurrentPreprocessingState || + PREPROCESSING_STATE_EVENT_FOLLOW_UP_STREAMING_STARTED == mCurrentPreprocessingState) { char* vconf_str = vconf_get_str(WAKEUP_SETTINGS_KEY_PREPROCESSING_ASSISTANT_APPID); MAS_LOGD("preprocessing_assistant_appid : %s", vconf_str); if (vconf_str) { @@ -1115,18 +1115,18 @@ int CServiceMain::mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVEN } } #endif - g_current_preprocessing_state = PREPROCESSING_STATE_NONE; + mCurrentPreprocessingState = PREPROCESSING_STATE_NONE; } break; case PREPROCESSING_STATE_EVENT_PREPROCESSING_FAILED: { #ifdef BRING_PREPROCESSING_ASSISTANT_TO_FRONT - if (PREPROCESSING_STATE_EVENT_UTTERANCE_STREAMING_STARTED == g_current_preprocessing_state || - PREPROCESSING_STATE_EVENT_FOLLOW_UP_STREAMING_STARTED == g_current_preprocessing_state) { + if (PREPROCESSING_STATE_EVENT_UTTERANCE_STREAMING_STARTED == mCurrentPreprocessingState || + PREPROCESSING_STATE_EVENT_FOLLOW_UP_STREAMING_STARTED == mCurrentPreprocessingState) { mas_bring_client_to_foreground(current_maclient_appid); } #endif - g_current_preprocessing_state = PREPROCESSING_STATE_NONE; + mCurrentPreprocessingState = PREPROCESSING_STATE_NONE; } break; } @@ -1135,7 +1135,7 @@ int CServiceMain::mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVEN int CServiceMain::mas_set_current_service_state(ma_service_state_e state) { - g_current_service_state = state; + mCurrentServiceState = state; ma_client_s *data = NULL; @@ -1157,15 +1157,15 @@ int CServiceMain::mas_set_current_service_state(ma_service_state_e state) ma_service_state_e CServiceMain::mas_get_current_service_state() { - return g_current_service_state; + return mCurrentServiceState; } bool CServiceMain::is_valid_wakeup_engine(const char* appid) { for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM;loop++) { - if (g_maclient_info[loop].used) { - LOGD("comparing appid : %s %s", g_maclient_info[loop].wakeup_engine, appid); - if (0 == strncmp(g_maclient_info[loop].wakeup_engine, appid, MAX_APPID_LEN)) { + if (mClientInfo[loop].used) { + LOGD("comparing appid : %s %s", mClientInfo[loop].wakeup_engine, appid); + if (0 == strncmp(mClientInfo[loop].wakeup_engine, appid, MAX_APPID_LEN)) { return true; } } @@ -1338,10 +1338,10 @@ bool CServiceMain::app_create(void *data) vconf_str = NULL; } - if (!g_pkgmgr) { - int ret = package_manager_create(&g_pkgmgr); + if (!mPackageManagerHandle) { + int ret = package_manager_create(&mPackageManagerHandle); if (ret == PACKAGE_MANAGER_ERROR_NONE) { - ret = package_manager_set_event_cb(g_pkgmgr, _package_manager_event_cb, this); + ret = package_manager_set_event_cb(mPackageManagerHandle, _package_manager_event_cb, this); if (ret == PACKAGE_MANAGER_ERROR_NONE) { LOGD("package_manager_set_event_cb succeeded."); } else { @@ -1358,10 +1358,10 @@ bool CServiceMain::app_create(void *data) void CServiceMain::app_terminate(void *data) { MAS_LOGI("[ENTER]"); - if (g_pkgmgr) { - package_manager_unset_event_cb(g_pkgmgr); - package_manager_destroy(g_pkgmgr); - g_pkgmgr = NULL; + if (mPackageManagerHandle) { + package_manager_unset_event_cb(mPackageManagerHandle); + package_manager_destroy(mPackageManagerHandle); + mPackageManagerHandle = NULL; } deinitialize_service_plugin(); @@ -1397,8 +1397,8 @@ int CServiceMain::on_initialize(int pid) { mClientManager.create_client(pid, appid); const char *current_maclient_appid = NULL; - if (g_current_maclient_info >= 0 && g_current_maclient_info < MAX_MACLIENT_INFO_NUM) { - current_maclient_appid = g_maclient_info[g_current_maclient_info].appid; + if (mCurrentClientInfo >= 0 && mCurrentClientInfo < MAX_MACLIENT_INFO_NUM) { + current_maclient_appid = mClientInfo[mCurrentClientInfo].appid; } mas_client_send_preprocessing_information(pid); @@ -1408,13 +1408,13 @@ int CServiceMain::on_initialize(int pid) { if (current_maclient_appid && 0 == strncmp(current_maclient_appid, appid, MAX_APPID_LEN)) { MAS_LOGD("MA client with current maclient appid connected!"); - if (0 == g_wakeup_maclient_appid.compare(appid)) { - g_wakeup_maclient_appid.clear(); + if (0 == mWakeupClientAppId.compare(appid)) { + mWakeupClientAppId.clear(); mServiceIpc.active_state_change(pid, MA_ACTIVE_STATE_ACTIVE); mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVENT_ASSISTANT_ACTIVATED); } else { - MAS_LOGE("[ERROR] g_wakeup_maclient_appid and appid differ : %s %s", - g_wakeup_maclient_appid.c_str(), appid); + MAS_LOGE("[ERROR] mWakeupClientAppId and appid differ : %s %s", + mWakeupClientAppId.c_str(), appid); } } else { MAS_LOGD("MA client connected, but its appid does not match with current maclient"); diff --git a/src/service_plugin.cpp b/src/service_plugin.cpp index b552823..6348c8a 100644 --- a/src/service_plugin.cpp +++ b/src/service_plugin.cpp @@ -46,8 +46,8 @@ bool CServicePlugin::is_ui_panel_enabled() { /* By default we assume the ui panel is always enabled unless explicitly turned off */ bool ret = true; - if (g_plugin_settings) { - ret = g_plugin_settings->ui_panel_enabled; + if (mPluginSettings) { + ret = mPluginSettings->ui_panel_enabled; } MAS_LOGD("UI Panel Enabled : %d", ret); return ret; @@ -189,39 +189,39 @@ static void __wakeup_event_cb(mas_wakeup_event_info wakeup_info, void* user_data } #ifdef BUF_SAVE_MODE - if (g_pFile) { - fclose(g_pFile); - g_pFile = NULL; + if (mDumpFile) { + fclose(mDumpFile); + mDumpFile = NULL; } else { MAS_LOGD("[Recorder Info] File not found!"); } while (1) { - snprintf(g_temp_file_name, sizeof(g_temp_file_name), "/tmp/ma_service_%d_%d", getpid(), g_count); - int ret = access(g_temp_file_name, 0); + snprintf(mDumpFilename, sizeof(mDumpFilename), "/tmp/ma_service_%d_%d", getpid(), mDumpCount); + int ret = access(mDumpFilename, 0); if (0 == ret) { MAS_LOGD("[Recorder ERROR] File is already exist"); - if (0 == remove(g_temp_file_name)) { + if (0 == remove(mDumpFilename)) { MAS_LOGD("[Recorder] Remove file"); break; } else { - g_count++; + mDumpCount++; } } else { break; } } - MAS_LOGD("[Recorder] Temp file name=[%s]", g_temp_file_name); + MAS_LOGD("[Recorder] Temp file name=[%s]", mDumpFilename); /* open test file */ - g_pFile = fopen(g_temp_file_name, "wb+x"); - if (!g_pFile) { + mDumpFile = fopen(mDumpFilename, "wb+x"); + if (!mDumpFile) { MAS_LOGD("[Recorder ERROR] File not found!"); return; } - g_count++; + mDumpCount++; #endif #if 0 /* + TEST_CODE */ @@ -374,15 +374,14 @@ static void __audio_streaming_cb(mas_speech_streaming_event_e event, void* buffe } } #ifdef BUF_SAVE_MODE - /* write pcm buffer */ - if (g_pFile) - fwrite(buffer, 1, len, g_pFile); + if (mDumpFile) + fwrite(speech_data->buffer, 1, speech_data->len, mDumpFile); if (MAS_SPEECH_STREAMING_EVENT_FINISH == event) { - if (g_pFile) { + if (mDumpFile) { MAS_LOGE("[Recorder SUCCESS] File Close"); - fclose(g_pFile); - g_pFile = NULL; + fclose(mDumpFile); + mDumpFile = NULL; } else { MAS_LOGE("[Recorder ERROR] File not found!"); } @@ -511,140 +510,140 @@ int CServicePlugin::initialize(void) snprintf(filepath, 512, "%s/%s", default_engine_path, MA_DEFAULT_WAKEUP_MANAGER_FILENAME); char *error; - g_handle = NULL; - g_handle = dlopen(filepath, RTLD_LAZY); + mPluginHandle = NULL; + mPluginHandle = dlopen(filepath, RTLD_LAZY); if (NULL != (error = dlerror())) { MAS_LOGE("[ERROR] Fail to dlopen(%s), error(%s)", filepath, error); return -1; //MAS_ERROR_OPERATION_FAILED; } - _wakeup_manager_interface.initialize = - (wakeup_manager_initialize)dlsym(g_handle, + mWakeupManagerInterface.initialize = + (wakeup_manager_initialize)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_INITIALIZE); - _wakeup_manager_interface.deinitialize = - (wakeup_manager_deinitialize)dlsym(g_handle, + mWakeupManagerInterface.deinitialize = + (wakeup_manager_deinitialize)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_DEINITIALIZE); - _wakeup_manager_interface.get_settings = - (wakeup_manager_get_settings)dlsym(g_handle, + mWakeupManagerInterface.get_settings = + (wakeup_manager_get_settings)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_GET_SETTINGS); - _wakeup_manager_interface.add_assistant_wakeup_word = - (wakeup_manager_add_assistant_wakeup_word)dlsym(g_handle, + mWakeupManagerInterface.add_assistant_wakeup_word = + (wakeup_manager_add_assistant_wakeup_word)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_ADD_ASSISTANT_WAKEUP_WORD); - _wakeup_manager_interface.remove_assistant_wakeup_word = - (wakeup_manager_remove_assistant_wakeup_word)dlsym(g_handle, + mWakeupManagerInterface.remove_assistant_wakeup_word = + (wakeup_manager_remove_assistant_wakeup_word)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_REMOVE_ASSISTANT_WAKEUP_WORD); - _wakeup_manager_interface.add_assistant_language = - (wakeup_manager_add_assistant_language)dlsym(g_handle, + mWakeupManagerInterface.add_assistant_language = + (wakeup_manager_add_assistant_language)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_ADD_ASSISTANT_LANGUAGE); - _wakeup_manager_interface.set_assistant_wakeup_engine = - (wakeup_manager_set_assistant_wakeup_engine)dlsym(g_handle, + mWakeupManagerInterface.set_assistant_wakeup_engine = + (wakeup_manager_set_assistant_wakeup_engine)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_SET_ASSISTANT_WAKEUP_ENGINE); - _wakeup_manager_interface.set_default_assistant = - (wakeup_manager_set_default_assistant)dlsym(g_handle, + mWakeupManagerInterface.set_default_assistant = + (wakeup_manager_set_default_assistant)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_SET_DEFAULT_ASSISTANT); - _wakeup_manager_interface.get_default_assistant = - (wakeup_manager_get_default_assistant)dlsym(g_handle, + mWakeupManagerInterface.get_default_assistant = + (wakeup_manager_get_default_assistant)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_GET_DEFAULT_ASSISTANT); - _wakeup_manager_interface.set_language = - (wakeup_manager_set_language)dlsym(g_handle, + mWakeupManagerInterface.set_language = + (wakeup_manager_set_language)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_SET_LANGUAGE); - _wakeup_manager_interface.activate = - (wakeup_manager_activate)dlsym(g_handle, + mWakeupManagerInterface.activate = + (wakeup_manager_activate)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_ACTIVATE); - _wakeup_manager_interface.deactivate = - (wakeup_manager_deactivate)dlsym(g_handle, + mWakeupManagerInterface.deactivate = + (wakeup_manager_deactivate)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_DEACTIVATE); - _wakeup_manager_interface.update_voice_feedback_state = - (wakeup_manager_update_voice_feedback_state)dlsym(g_handle, + mWakeupManagerInterface.update_voice_feedback_state = + (wakeup_manager_update_voice_feedback_state)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_UPDATE_VOICE_FEEDBACK_STATE); - _wakeup_manager_interface.set_assistant_specific_command = - (wakeup_manager_set_assistant_specific_command)dlsym(g_handle, + mWakeupManagerInterface.set_assistant_specific_command = + (wakeup_manager_set_assistant_specific_command)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_SET_ASSISTANT_SPECIFIC_COMMAND); - _wakeup_manager_interface.set_background_volume = - (wakeup_manager_set_background_volume)dlsym(g_handle, + mWakeupManagerInterface.set_background_volume = + (wakeup_manager_set_background_volume)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_SET_BACKGROUND_VOLUME); - _wakeup_manager_interface.update_recognition_result = - (wakeup_manager_update_recognition_result)dlsym(g_handle, + mWakeupManagerInterface.update_recognition_result = + (wakeup_manager_update_recognition_result)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_UPDATE_RECOGNITION_RESULT); - _wakeup_manager_interface.process_plugin_event = - (wakeup_manager_process_plugin_event)dlsym(g_handle, + mWakeupManagerInterface.process_plugin_event = + (wakeup_manager_process_plugin_event)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_PROCESS_PLUGIN_EVENT); - _wakeup_manager_interface.start_streaming_utterance_data = - (wakeup_manager_start_streaming_utterance_data)dlsym(g_handle, + mWakeupManagerInterface.start_streaming_utterance_data = + (wakeup_manager_start_streaming_utterance_data)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_START_STREAMING_UTTERANCE_DATA); - _wakeup_manager_interface.stop_streaming_utterance_data = - (wakeup_manager_stop_streaming_utterance_data)dlsym(g_handle, + mWakeupManagerInterface.stop_streaming_utterance_data = + (wakeup_manager_stop_streaming_utterance_data)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_STOP_STREAMING_UTTERANCE_DATA); - _wakeup_manager_interface.start_streaming_previous_utterance_data = - (wakeup_manager_start_streaming_previous_utterance_data)dlsym(g_handle, + mWakeupManagerInterface.start_streaming_previous_utterance_data = + (wakeup_manager_start_streaming_previous_utterance_data)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_START_STREAMING_PREVIOUS_UTTERANCE_DATA); - _wakeup_manager_interface.stop_streaming_previous_utterance_data = - (wakeup_manager_stop_streaming_previous_utterance_data)dlsym(g_handle, + mWakeupManagerInterface.stop_streaming_previous_utterance_data = + (wakeup_manager_stop_streaming_previous_utterance_data)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_STOP_STREAMING_PREVIOUS_UTTERANCE_DATA); - _wakeup_manager_interface.start_streaming_follow_up_data = - (wakeup_manager_start_streaming_follow_up_data)dlsym(g_handle, + mWakeupManagerInterface.start_streaming_follow_up_data = + (wakeup_manager_start_streaming_follow_up_data)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_START_STREAMING_FOLLOW_UP_DATA); - _wakeup_manager_interface.stop_streaming_follow_up_data = - (wakeup_manager_stop_streaming_follow_up_data)dlsym(g_handle, + mWakeupManagerInterface.stop_streaming_follow_up_data = + (wakeup_manager_stop_streaming_follow_up_data)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_STOP_STREAMING_FOLLOW_UP_DATA); - _wakeup_manager_interface.get_audio_format = - (wakeup_manager_get_audio_format)dlsym(g_handle, + mWakeupManagerInterface.get_audio_format = + (wakeup_manager_get_audio_format)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_GET_AUDIO_FORMAT); - _wakeup_manager_interface.get_audio_source_type = - (wakeup_manager_get_audio_source_type)dlsym(g_handle, + mWakeupManagerInterface.get_audio_source_type = + (wakeup_manager_get_audio_source_type)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_GET_AUDIO_SOURCE_TYPE); - _wakeup_manager_interface.set_wake_word_audio_require_flag = - (wakeup_manager_set_wake_word_audio_require_flag)dlsym(g_handle, + 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); - _wakeup_manager_interface.set_assistant_language = - (wakeup_manager_set_assistant_language)dlsym(g_handle, + mWakeupManagerInterface.set_assistant_language = + (wakeup_manager_set_assistant_language)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_SET_ASSISTANT_LANGUAGE); - _wakeup_manager_interface.set_voice_key_tap_duration = - (wakeup_manager_set_voice_key_tap_duration)dlsym(g_handle, + mWakeupManagerInterface.set_voice_key_tap_duration = + (wakeup_manager_set_voice_key_tap_duration)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_SET_VOICE_KEY_TAP_DURATION); - _wakeup_manager_interface.unset_voice_key_tap_duration = - (wakeup_manager_unset_voice_key_tap_duration)dlsym(g_handle, + mWakeupManagerInterface.unset_voice_key_tap_duration = + (wakeup_manager_unset_voice_key_tap_duration)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_UNSET_VOICE_KEY_TAP_DURATION); - _wakeup_manager_interface.set_voice_key_support_mode = - (wakeup_manager_set_voice_key_support_mode)dlsym(g_handle, + mWakeupManagerInterface.set_voice_key_support_mode = + (wakeup_manager_set_voice_key_support_mode)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_SET_VOICE_KEY_SUPPORT_MODE); - _wakeup_manager_interface.set_wakeup_event_callback = - (wakeup_manager_set_wakeup_event_callback)dlsym(g_handle, + mWakeupManagerInterface.set_wakeup_event_callback = + (wakeup_manager_set_wakeup_event_callback)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_SET_WAKEUP_EVENT_CALLBACK); - _wakeup_manager_interface.set_utterance_streaming_callback = - (wakeup_manager_set_utterance_streaming_callback)dlsym(g_handle, + mWakeupManagerInterface.set_utterance_streaming_callback = + (wakeup_manager_set_utterance_streaming_callback)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_SET_UTTERANCE_STREAMING_CALLBACK); - _wakeup_manager_interface.set_previous_utterance_streaming_callback = - (wakeup_manager_set_previous_utterance_streaming_callback)dlsym(g_handle, + mWakeupManagerInterface.set_previous_utterance_streaming_callback = + (wakeup_manager_set_previous_utterance_streaming_callback)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_SET_PREVIOUS_UTTERANCE_STREAMING_CALLBACK); - _wakeup_manager_interface.set_follow_up_streaming_callback = - (wakeup_manager_set_follow_up_streaming_callback)dlsym(g_handle, + mWakeupManagerInterface.set_follow_up_streaming_callback = + (wakeup_manager_set_follow_up_streaming_callback)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_SET_FOLLOW_UP_STREAMING_CALLBACK); - _wakeup_manager_interface.set_speech_status_callback = - (wakeup_manager_set_speech_status_callback)dlsym(g_handle, + mWakeupManagerInterface.set_speech_status_callback = + (wakeup_manager_set_speech_status_callback)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_SET_SPEECH_STATUS_CALLBACK); - _wakeup_manager_interface.set_setting_changed_callback = - (wakeup_manager_set_setting_changed_callback)dlsym(g_handle, + mWakeupManagerInterface.set_setting_changed_callback = + (wakeup_manager_set_setting_changed_callback)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_SET_SETTING_CHANGED_CALLBACK); - _wakeup_manager_interface.set_error_callback = - (wakeup_manager_set_error_callback)dlsym(g_handle, + mWakeupManagerInterface.set_error_callback = + (wakeup_manager_set_error_callback)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_SET_ERROR_CALLBACK); - _wakeup_manager_interface.set_streaming_section_changed_callback = - (wakeup_manager_set_streaming_section_changed_callback)dlsym(g_handle, + mWakeupManagerInterface.set_streaming_section_changed_callback = + (wakeup_manager_set_streaming_section_changed_callback)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_SET_STREAMING_SECTION_CHANGED_CALLBACK); - _wakeup_manager_interface.set_wakeup_engine_command_callback = - (wakeup_manager_set_wakeup_engine_command_callback)dlsym(g_handle, + mWakeupManagerInterface.set_wakeup_engine_command_callback = + (wakeup_manager_set_wakeup_engine_command_callback)dlsym(mPluginHandle, MA_WAKEUP_MANAGER_FUNC_SET_WAKEUP_ENGINE_COMMAND_CALLBACK); - _wakeup_manager_interface.set_wakeup_service_state_changed_callback = - (wakeup_manager_set_wakeup_service_state_changed_callback)dlsym(g_handle, + 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); - _wakeup_manager_interface.set_voice_key_status_changed_callback = - (wakeup_manager_set_voice_key_status_changed_callback)dlsym(g_handle, + 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); int ret = -1; - if (NULL != g_handle) { - wakeup_manager_initialize func = _wakeup_manager_interface.initialize; + if (NULL != mPluginHandle) { + wakeup_manager_initialize func = mWakeupManagerInterface.initialize; if (NULL == func) { MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_INITIALIZE); @@ -655,20 +654,20 @@ int CServicePlugin::initialize(void) } } - wakeup_manager_get_settings get_settings_func = _wakeup_manager_interface.get_settings; + wakeup_manager_get_settings get_settings_func = mWakeupManagerInterface.get_settings; 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(&g_plugin_settings, &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); - g_plugin_settings = NULL; + mPluginSettings = NULL; } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -676,17 +675,17 @@ int CServicePlugin::initialize(void) int CServicePlugin::deinitialize(void) { #ifdef BUF_SAVE_MODE - if (g_pFile) { - fclose(g_pFile); - g_pFile = NULL; + if (mDumpFile) { + fclose(mDumpFile); + mDumpFile = NULL; } else { MAS_LOGD("[Recorder ERROR] File not found!"); } #endif int ret = -1; - if (NULL != g_handle) { - wakeup_manager_deinitialize func = _wakeup_manager_interface.deinitialize; + 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 { @@ -696,10 +695,10 @@ int CServicePlugin::deinitialize(void) } } - dlclose(g_handle); - g_handle = NULL; + dlclose(mPluginHandle); + mPluginHandle = NULL; } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; @@ -708,8 +707,8 @@ int CServicePlugin::deinitialize(void) int CServicePlugin::get_settings(ma_plugin_settings **settings, size_t *struct_size) { int ret = -1; - if (NULL != g_handle) { - wakeup_manager_get_settings func = _wakeup_manager_interface.get_settings; + 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 { @@ -719,7 +718,7 @@ int CServicePlugin::get_settings(ma_plugin_settings **settings, size_t *struct_s } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -727,8 +726,8 @@ int CServicePlugin::get_settings(ma_plugin_settings **settings, size_t *struct_s int CServicePlugin::set_language(const char* language) { int ret = -1; - if (NULL != g_handle) { - wakeup_manager_set_language func = _wakeup_manager_interface.set_language; + 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 { @@ -738,7 +737,7 @@ int CServicePlugin::set_language(const char* language) } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -746,8 +745,8 @@ 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 != g_handle) { - wakeup_manager_add_assistant_wakeup_word func = _wakeup_manager_interface.add_assistant_wakeup_word; + 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 { @@ -757,7 +756,7 @@ int CServicePlugin::add_assistant_wakeup_word(const char* appid, const char* wak } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -765,8 +764,8 @@ 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 != g_handle) { - wakeup_manager_remove_assistant_wakeup_word func = _wakeup_manager_interface.remove_assistant_wakeup_word; + 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 { @@ -776,7 +775,7 @@ int CServicePlugin::remove_assistant_wakeup_word(const char* appid, const char* } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -784,8 +783,8 @@ 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 != g_handle) { - wakeup_manager_add_assistant_language func = _wakeup_manager_interface.add_assistant_language; + 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 { @@ -795,7 +794,7 @@ int CServicePlugin::add_assistant_language(const char* appid, const char* langua } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -803,8 +802,8 @@ int CServicePlugin::add_assistant_language(const char* appid, const char* langua int CServicePlugin::set_assistant_wakeup_engine(const char* appid, const char* engine) { int ret = -1; - if (NULL != g_handle) { - wakeup_manager_set_assistant_wakeup_engine func = _wakeup_manager_interface.set_assistant_wakeup_engine; + if (NULL != mPluginHandle) { + wakeup_manager_set_assistant_wakeup_engine func = mWakeupManagerInterface.set_assistant_wakeup_engine; if (NULL == func) { MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_ASSISTANT_WAKEUP_ENGINE); } else { @@ -814,7 +813,7 @@ int CServicePlugin::set_assistant_wakeup_engine(const char* appid, const char* e } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -822,8 +821,8 @@ int CServicePlugin::set_assistant_wakeup_engine(const char* appid, const char* e int CServicePlugin::set_default_assistant(const char* appid) { int ret = -1; - if (NULL != g_handle) { - wakeup_manager_set_default_assistant func = _wakeup_manager_interface.set_default_assistant; + 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 { @@ -833,7 +832,7 @@ int CServicePlugin::set_default_assistant(const char* appid) } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -845,8 +844,8 @@ int CServicePlugin::get_default_assistant(const char** appid) MAS_LOGE("[ERROR] appid is not valid"); return ret; } - if (NULL != g_handle) { - wakeup_manager_get_default_assistant func = _wakeup_manager_interface.get_default_assistant; + 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 { @@ -856,7 +855,7 @@ int CServicePlugin::get_default_assistant(const char** appid) } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -864,8 +863,8 @@ int CServicePlugin::get_default_assistant(const char** appid) int CServicePlugin::activate(void) { int ret = -1; - if (NULL != g_handle) { - wakeup_manager_activate func = _wakeup_manager_interface.activate; + 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 { @@ -875,7 +874,7 @@ int CServicePlugin::activate(void) } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -883,8 +882,8 @@ int CServicePlugin::activate(void) int CServicePlugin::deactivate(void) { int ret = -1; - if (NULL != g_handle) { - wakeup_manager_deactivate func = _wakeup_manager_interface.deactivate; + 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 { @@ -894,7 +893,7 @@ int CServicePlugin::deactivate(void) } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -902,8 +901,8 @@ int CServicePlugin::deactivate(void) int CServicePlugin::update_voice_feedback_state(const char* appid, int state) { int ret = -1; - if (NULL != g_handle) { - wakeup_manager_update_voice_feedback_state func = _wakeup_manager_interface.update_voice_feedback_state; + 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 { @@ -913,7 +912,7 @@ int CServicePlugin::update_voice_feedback_state(const char* appid, int state) } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -921,8 +920,8 @@ 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 != g_handle) { - wakeup_manager_set_assistant_specific_command func = _wakeup_manager_interface.set_assistant_specific_command; + 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 { @@ -932,7 +931,7 @@ int CServicePlugin::set_assistant_specific_command(const char* appid, const char } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -940,8 +939,8 @@ 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 != g_handle) { - wakeup_manager_set_background_volume func = _wakeup_manager_interface.set_background_volume; + 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 { @@ -951,7 +950,7 @@ int CServicePlugin::set_background_volume(const char* appid, double ratio) } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -959,8 +958,8 @@ 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 != g_handle) { - wakeup_manager_update_recognition_result func = _wakeup_manager_interface.update_recognition_result; + 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 { @@ -970,7 +969,7 @@ int CServicePlugin::update_recognition_result(const char* appid, int state) } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -978,8 +977,8 @@ 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 != g_handle) { - wakeup_manager_process_plugin_event func = _wakeup_manager_interface.process_plugin_event; + 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 { @@ -989,7 +988,7 @@ int CServicePlugin::process_event(int event, void *data, int len) } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -997,8 +996,8 @@ int CServicePlugin::process_event(int event, void *data, int len) int CServicePlugin::start_streaming_utterance_data(void) { int ret = -1; - if (NULL != g_handle) { - wakeup_manager_start_streaming_utterance_data func = _wakeup_manager_interface.start_streaming_utterance_data; + 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 { @@ -1008,7 +1007,7 @@ int CServicePlugin::start_streaming_utterance_data(void) } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -1016,8 +1015,8 @@ int CServicePlugin::start_streaming_utterance_data(void) int CServicePlugin::stop_streaming_utterance_data(void) { int ret = -1; - if (NULL != g_handle) { - wakeup_manager_stop_streaming_utterance_data func = _wakeup_manager_interface.stop_streaming_utterance_data; + 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 { @@ -1027,7 +1026,7 @@ int CServicePlugin::stop_streaming_utterance_data(void) } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -1035,8 +1034,8 @@ int CServicePlugin::stop_streaming_utterance_data(void) int CServicePlugin::start_streaming_previous_utterance_data(void) { int ret = -1; - if (NULL != g_handle) { - wakeup_manager_start_streaming_previous_utterance_data func = _wakeup_manager_interface.start_streaming_previous_utterance_data; + 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 { @@ -1046,7 +1045,7 @@ int CServicePlugin::start_streaming_previous_utterance_data(void) } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -1054,8 +1053,8 @@ int CServicePlugin::start_streaming_previous_utterance_data(void) int CServicePlugin::stop_streaming_previous_utterance_data(void) { int ret = -1; - if (NULL != g_handle) { - wakeup_manager_stop_streaming_previous_utterance_data func = _wakeup_manager_interface.stop_streaming_previous_utterance_data; + 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 { @@ -1065,7 +1064,7 @@ int CServicePlugin::stop_streaming_previous_utterance_data(void) } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -1073,8 +1072,8 @@ int CServicePlugin::stop_streaming_previous_utterance_data(void) int CServicePlugin::start_streaming_follow_up_data(void) { int ret = -1; - if (NULL != g_handle) { - wakeup_manager_start_streaming_follow_up_data func = _wakeup_manager_interface.start_streaming_follow_up_data; + 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 { @@ -1084,7 +1083,7 @@ int CServicePlugin::start_streaming_follow_up_data(void) } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -1092,8 +1091,8 @@ int CServicePlugin::start_streaming_follow_up_data(void) int CServicePlugin::stop_streaming_follow_up_data(void) { int ret = -1; - if (NULL != g_handle) { - wakeup_manager_stop_streaming_follow_up_data func = _wakeup_manager_interface.stop_streaming_follow_up_data; + 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 { @@ -1103,7 +1102,7 @@ int CServicePlugin::stop_streaming_follow_up_data(void) } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -1111,8 +1110,8 @@ 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 != g_handle) { - wakeup_manager_get_audio_format func = _wakeup_manager_interface.get_audio_format; + 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 { @@ -1122,7 +1121,7 @@ int CServicePlugin::get_recording_audio_format(int *rate, int *channel, int *aud } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -1130,8 +1129,8 @@ 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 != g_handle) { - wakeup_manager_get_audio_source_type func = _wakeup_manager_interface.get_audio_source_type; + 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 { @@ -1141,7 +1140,7 @@ int CServicePlugin::get_recording_audio_source_type(char** type) } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -1149,8 +1148,8 @@ int CServicePlugin::get_recording_audio_source_type(char** type) int CServicePlugin::set_voice_key_tap_duration(float duration) { int ret = -1; - if (NULL != g_handle) { - wakeup_manager_set_voice_key_tap_duration func = _wakeup_manager_interface.set_voice_key_tap_duration; + 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 { @@ -1160,7 +1159,7 @@ int CServicePlugin::set_voice_key_tap_duration(float duration) } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -1168,8 +1167,8 @@ int CServicePlugin::set_voice_key_tap_duration(float duration) int CServicePlugin::unset_voice_key_tap_duration() { int ret = -1; - if (NULL != g_handle) { - wakeup_manager_unset_voice_key_tap_duration func = _wakeup_manager_interface.unset_voice_key_tap_duration; + 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 { @@ -1179,7 +1178,7 @@ int CServicePlugin::unset_voice_key_tap_duration() } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -1187,8 +1186,8 @@ int CServicePlugin::unset_voice_key_tap_duration() int CServicePlugin::set_voice_key_support_mode(int mode) { int ret = -1; - if (NULL != g_handle) { - wakeup_manager_set_voice_key_support_mode func = _wakeup_manager_interface.set_voice_key_support_mode; + 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 { @@ -1198,7 +1197,7 @@ int CServicePlugin::set_voice_key_support_mode(int mode) } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -1206,8 +1205,8 @@ 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 != g_handle) { - wakeup_manager_set_wake_word_audio_require_flag func = _wakeup_manager_interface.set_wake_word_audio_require_flag; + 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 { @@ -1217,7 +1216,7 @@ int CServicePlugin::set_wake_word_audio_require_flag(const char* appid, bool req } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -1225,8 +1224,8 @@ 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 != g_handle) { - wakeup_manager_set_assistant_language func = _wakeup_manager_interface.set_assistant_language; + 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 { @@ -1236,7 +1235,7 @@ int CServicePlugin::set_assistant_language(const char* appid, const char* langua } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -1315,8 +1314,8 @@ 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 != g_handle) { - wakeup_manager_set_wakeup_event_callback func = _wakeup_manager_interface.set_wakeup_event_callback; + 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 { @@ -1327,7 +1326,7 @@ int CServicePlugin::set_wakeup_event_callback(wakeup_service_wakeup_event_cb cal } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -1335,8 +1334,8 @@ 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 != g_handle) { - wakeup_manager_set_utterance_streaming_callback func = _wakeup_manager_interface.set_utterance_streaming_callback; + 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 { @@ -1346,7 +1345,7 @@ int CServicePlugin::set_utterance_streaming_callback(wakeup_service_speech_strea } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -1354,8 +1353,8 @@ 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 != g_handle) { - wakeup_manager_set_previous_utterance_streaming_callback func = _wakeup_manager_interface.set_previous_utterance_streaming_callback; + 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 { @@ -1365,7 +1364,7 @@ int CServicePlugin::set_previous_utterance_streaming_callback(wakeup_service_spe } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -1373,8 +1372,8 @@ 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 != g_handle) { - wakeup_manager_set_follow_up_streaming_callback func = _wakeup_manager_interface.set_follow_up_streaming_callback; + 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 { @@ -1384,7 +1383,7 @@ int CServicePlugin::set_follow_up_streaming_callback(wakeup_service_speech_strea } } } else { - MAS_LOGE("[ERROR] g_handle is not valid"); + MAS_LOGE("[ERROR] mPluginHandle is not valid"); } return ret; } @@ -1392,8 +1391,8 @@ 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 != g_handle) { - wakeup_manager_set_speech_status_callback func = _wakeup_manager_interface.set_speech_status_callback; + 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 { @@ -1409,8 +1408,8 @@ 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 != g_handle) { - wakeup_manager_set_setting_changed_callback func = _wakeup_manager_interface.set_setting_changed_callback; + 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 { @@ -1426,8 +1425,8 @@ 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 != g_handle) { - wakeup_manager_set_error_callback func = _wakeup_manager_interface.set_error_callback; + 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 { @@ -1443,8 +1442,8 @@ 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 != g_handle) { - wakeup_manager_set_streaming_section_changed_callback func = _wakeup_manager_interface.set_streaming_section_changed_callback; + 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 { @@ -1460,8 +1459,8 @@ 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 != g_handle) { - wakeup_manager_set_wakeup_engine_command_callback func = _wakeup_manager_interface.set_wakeup_engine_command_callback; + 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 { @@ -1477,8 +1476,8 @@ 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 != g_handle) { - wakeup_manager_set_wakeup_service_state_changed_callback func = _wakeup_manager_interface.set_wakeup_service_state_changed_callback; + 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 { @@ -1494,8 +1493,8 @@ 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 != g_handle) { - wakeup_manager_set_voice_key_status_changed_callback func = _wakeup_manager_interface.set_voice_key_status_changed_callback; + 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 { -- 2.7.4