From: Ji-hoon Lee Date: Wed, 4 Dec 2019 06:27:01 +0000 (+0900) Subject: Use internal log functions for log customization X-Git-Tag: submit/tizen/20200113.120709~3^2~2^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6db646ed632bd02c82ad9a0e60e491de94bc62e9;p=platform%2Fcore%2Fuifw%2Fmulti-assistant.git Use internal log functions for log customization Change-Id: Icb368c03a80857aa8f6296cc691ec0c318ca09f4 --- diff --git a/client/ma.c b/client/ma.c index c7e4c18..c62d2fd 100644 --- a/client/ma.c +++ b/client/ma.c @@ -61,7 +61,7 @@ static int __ma_get_feature_enabled() { if (0 == g_feature_enabled) { //LCOV_EXCL_START - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Multi-assistant feature NOT supported"); + MA_SLOGE("[ERROR] Multi-assistant feature NOT supported"); return MA_ERROR_NOT_SUPPORTED; //LCOV_EXCL_STOP } else if (-1 == g_feature_enabled) { @@ -70,18 +70,18 @@ static int __ma_get_feature_enabled() if (0 == system_info_get_platform_bool(MA_FEATURE_PATH, &ma_supported)) { if (0 == system_info_get_platform_bool(MA_MIC_FEATURE_PATH, &mic_supported)) { if (false == ma_supported || false == mic_supported) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Multi-assistant feature NOT supported"); + MA_SLOGE("[ERROR] Multi-assistant feature NOT supported"); g_feature_enabled = 0; return MA_ERROR_NOT_SUPPORTED; } g_feature_enabled = 1; } else { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to get feature value"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Fail to get feature value"); //LCOV_EXCL_LINE return MA_ERROR_NOT_SUPPORTED; } } else { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to get feature value"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Fail to get feature value"); //LCOV_EXCL_LINE return MA_ERROR_NOT_SUPPORTED; } } @@ -92,7 +92,7 @@ static int __check_privilege_initialize() { int ret = cynara_initialize(&p_cynara, NULL); if (CYNARA_API_SUCCESS != ret) - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] fail to initialize"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] fail to initialize"); //LCOV_EXCL_LINE return ret == CYNARA_API_SUCCESS; } @@ -110,7 +110,7 @@ static int __check_privilege(const char* uid, const char * privilege) fp = fopen(label_path, "r"); if (fp != NULL) { if (0 >= fread(smack_label, 1, sizeof(smack_label), fp)) - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] fail to fread"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] fail to fread"); //LCOV_EXCL_LINE fclose(fp); } @@ -118,7 +118,7 @@ static int __check_privilege(const char* uid, const char * privilege) pid_t pid = getpid(); char *session = cynara_session_from_pid(pid); int ret = cynara_check(p_cynara, smack_label, session, uid, privilege); - SLOG(LOG_DEBUG, TAG_MAC, "[Client]cynara_check returned %d(%s)", ret, (CYNARA_API_ACCESS_ALLOWED == ret) ? "Allowed" : "Denied"); + MA_SLOGD("[Client]cynara_check returned %d(%s)", ret, (CYNARA_API_ACCESS_ALLOWED == ret) ? "Allowed" : "Denied"); if (session) free(session); @@ -140,17 +140,17 @@ static int __ma_check_recorder_privilege() if (0 == g_recorder_privilege_allowed) { //LCOV_EXCL_START - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Permission for recording is denied"); + MA_SLOGE("[ERROR] Permission for recording is denied"); return MA_ERROR_PERMISSION_DENIED; //LCOV_EXCL_STOP } else if (-1 == g_recorder_privilege_allowed) { if (false == __check_privilege_initialize()) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] privilege initialize is failed"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] privilege initialize is failed"); //LCOV_EXCL_LINE return MA_ERROR_PERMISSION_DENIED; } snprintf(uid, 16, "%d", getuid()); if (false == __check_privilege(uid, MA_RECORDER_PRIVILEGE)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Permission for recording is denied"); + MA_SLOGE("[ERROR] Permission for recording is denied"); g_recorder_privilege_allowed = 0; __check_privilege_deinitialize(); return MA_ERROR_PERMISSION_DENIED; @@ -168,17 +168,17 @@ static int __ma_check_volume_set_privilege() if (0 == g_volume_set_privilege_allowed) { //LCOV_EXCL_START - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Permission for volume set is denied"); + MA_SLOGE("[ERROR] Permission for volume set is denied"); return MA_ERROR_PERMISSION_DENIED; //LCOV_EXCL_STOP } else if (-1 == g_volume_set_privilege_allowed) { if (false == __check_privilege_initialize()) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] privilege initialize is failed"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] privilege initialize is failed"); //LCOV_EXCL_LINE return MA_ERROR_PERMISSION_DENIED; } snprintf(uid, 16, "%d", getuid()); if (false == __check_privilege(uid, MA_VOLUME_SET_PRIVILEGE)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Permission for volume set is denied"); + MA_SLOGE("[ERROR] Permission for volume set is denied"); g_volume_set_privilege_allowed = 0; __check_privilege_deinitialize(); return MA_ERROR_PERMISSION_DENIED; @@ -200,40 +200,39 @@ int ma_initialize(void) return MA_ERROR_PERMISSION_DENIED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Initialize"); - + MA_SLOGI("[Client DEBUG] Initialize"); /* check handle */ if (true == ma_client_is_valid(g_ma)) { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Already initialized"); //LCOV_EXCL_LINE + MA_SLOGD("[DEBUG] Already initialized"); //LCOV_EXCL_LINE return MA_ERROR_NONE; //LCOV_EXCL_LINE } if (0 < ma_client_get_count()) { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Already initialized"); //LCOV_EXCL_LINE + MA_SLOGD("[DEBUG] Already initialized"); //LCOV_EXCL_LINE return MA_ERROR_NONE; //LCOV_EXCL_LINE } if (0 != ma_dbus_open_connection()) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to open connection"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Fail to open connection"); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } if (0 != ma_client_create(&g_ma)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to create client!!!!!"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Fail to create client!!!!!"); //LCOV_EXCL_LINE return MA_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE } /* int ret = ma_config_mgr_initialize(g_ma->handle); if (0 != ret) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to init config manager"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Fail to init config manager"); //LCOV_EXCL_LINE ma_client_destroy(g_ma); //LCOV_EXCL_LINE return ret; //LCOV_EXCL_LINE } ret = ma_config_mgr_set_lang_cb(g_ma->handle, __ma_lang_changed_cb); if (0 != ret) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to set config changed : %d", ret); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Fail to set config changed : %d", ret); //LCOV_EXCL_LINE ma_config_mgr_deinitialize(g_ma->handle); //LCOV_EXCL_LINE ma_client_destroy(g_ma); //LCOV_EXCL_LINE return ret; @@ -246,7 +245,7 @@ static void __ma_internal_unprepare(void) { int ret = ma_dbus_request_deinitialize(g_ma->handle); if (0 != ret) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to request finalize"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Fail to request finalize"); //LCOV_EXCL_LINE } return; @@ -262,16 +261,16 @@ int ma_deinitialize(void) return MA_ERROR_PERMISSION_DENIED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Deinitialize"); + MA_SLOGI("[Client DEBUG] Deinitialize"); if (false == ma_client_is_valid(g_ma)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] NOT initialized"); + MA_SLOGE("[ERROR] NOT initialized"); return MA_ERROR_INVALID_STATE; } ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE } /* check state */ @@ -297,17 +296,17 @@ int ma_deinitialize(void) do { ma_client_pop_preprocessing_audio_data(g_ma, &data); if (data) { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Audio streaming callback is called, event(%d)", data->event); + MA_SLOGD("[DEBUG] Audio streaming callback is called, event(%d)", data->event); free(data->buffer); free(data); } } while (data); #endif - SLOG(LOG_DEBUG, TAG_MAC, "Success: destroy"); + MA_SLOGD("Success: destroy"); if (0 != ma_dbus_close_connection()) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to close connection"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Fail to close connection"); //LCOV_EXCL_LINE } return MA_ERROR_NONE; @@ -315,7 +314,7 @@ int ma_deinitialize(void) static Eina_Bool __ma_connect_daemon(void *data) { - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Connect daemon"); + MA_SLOGD("[Client DEBUG] Connect daemon"); /* request initialization */ int ret = -1; @@ -323,12 +322,12 @@ static Eina_Bool __ma_connect_daemon(void *data) /* check handle */ if (true == ma_client_is_valid(g_ma)) { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] g_ma is valid"); + MA_SLOGD("[DEBUG] g_ma is valid"); ret = ma_dbus_request_initialize(g_ma->handle); //LCOV_EXCL_START if (MA_ERROR_ENGINE_NOT_FOUND == ret) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to initialize"); + MA_SLOGE("[ERROR] Fail to initialize"); ma_client_set_error(g_ma, MA_ERROR_ENGINE_NOT_FOUND); __ma_notify_error(g_ma); @@ -336,7 +335,7 @@ static Eina_Bool __ma_connect_daemon(void *data) return EINA_FALSE; //LCOV_EXCL_STOP } else if (0 != ret) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to initialize"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Fail to initialize"); //LCOV_EXCL_LINE ma_client_set_error(g_ma, MA_ERROR_TIMED_OUT); __ma_notify_error(g_ma); @@ -344,7 +343,7 @@ static Eina_Bool __ma_connect_daemon(void *data) return EINA_TRUE; } else { /* Success to connect */ - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Success to connect daemon"); + MA_SLOGI("[Client DEBUG] Success to connect daemon"); } ma_state_e prev_state; @@ -352,15 +351,15 @@ static Eina_Bool __ma_connect_daemon(void *data) int ret = MA_ERROR_NONE; ret = ma_client_get_client_state(g_ma, &prev_state); if (MA_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to get client state : %d", ret); + MA_SLOGE("[ERROR] Fail to get client state : %d", ret); } ret = ma_client_get_client_active_state(g_ma, &active_state); if (MA_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to get client active state : %d", ret); + MA_SLOGE("[ERROR] Fail to get client active state : %d", ret); } ret = ma_client_set_client_state(g_ma, MA_STATE_READY); if (MA_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to set client state : %d", ret); + MA_SLOGE("[ERROR] Fail to set client state : %d", ret); } __ma_notify_state_changed(g_ma); @@ -369,11 +368,11 @@ static Eina_Bool __ma_connect_daemon(void *data) if (prev_state == MA_STATE_INITIALIZED && active_state == MA_ACTIVE_STATE_ACTIVE) { /* This app was activated but was not in ready state, meaning we should start receiving audio stream data */ - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Start requesting audio data"); + MA_SLOGD("[Client DEBUG] Start requesting audio data"); ma_start_receiving_audio_streaming_data(MA_AUDIO_STREAMING_DATA_TYPE_CURRENT_UTTERANCE); } } else { - SLOG(LOG_ERROR, TAG_MAC, "[Not ERROR] g_ma is not valid. It is destroyed."); //LCOV_EXCL_LINE + MA_SLOGE("[Not ERROR] g_ma is not valid. It is destroyed."); //LCOV_EXCL_LINE return EINA_FALSE; } @@ -382,20 +381,20 @@ static Eina_Bool __ma_connect_daemon(void *data) static void __start_prepare_func() { - SLOG(LOG_ERROR, TAG_MAC, "[DEBUG] Start prepare func"); + MA_SLOGE("[DEBUG] Start prepare func"); int ret = -1; int retry_count = 0; /* Send hello */ while (0 != ret) { if (retry_count == 10) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to request hello !!"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Fail to request hello !!"); //LCOV_EXCL_LINE return; } ret = ma_dbus_request_hello(); if (ret == 0) { - SLOG(LOG_DEBUG, TAG_MAC, "Success to request hello. retry count(%d)", retry_count); + MA_SLOGD("Success to request hello. retry count(%d)", retry_count); break; } else { retry_count++; @@ -406,12 +405,12 @@ static void __start_prepare_func() retry_count = 0; while (0 != ret) { if (retry_count == 10) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to connect daemon !!"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Fail to connect daemon !!"); //LCOV_EXCL_LINE return; } ret = __ma_connect_daemon(NULL); if (ret == 0) { - SLOG(LOG_DEBUG, TAG_MAC, "Success to connect daemon. retry count(%d)", retry_count); + MA_SLOGD("Success to connect daemon. retry count(%d)", retry_count); break; } else { retry_count++; @@ -423,7 +422,7 @@ static void __start_prepare_func() static void __end_prepare_func() { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] End prepare func"); + MA_SLOGD("[DEBUG] End prepare func"); } int ma_prepare(void) @@ -436,18 +435,18 @@ int ma_prepare(void) return MA_ERROR_PERMISSION_DENIED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Prepare"); + MA_SLOGI("[Client DEBUG] Prepare"); ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'Initialized' (%d)", state); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized' (%d)", state); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -467,18 +466,18 @@ int ma_unprepare(void) return MA_ERROR_PERMISSION_DENIED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Unprepare"); + MA_SLOGI("[Client DEBUG] Unprepare"); ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_READY) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'READY' (%d)", state); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'READY' (%d)", state); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -508,10 +507,14 @@ static void __ma_notify_state_changed(void * data) ma_client_use_callback(ma); callback(previous_state, current_state, user_data); ma_client_not_use_callback(ma); - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] State changed callback is called"); + MA_SLOGD("[DEBUG] State changed callback is called : %d", current_state); } else { - SLOG(LOG_DEBUG, TAG_MAC, "[WARNING] State changed callback is NULL"); + MA_SLOGD("[WARNING] State changed callback is NULL"); } + MA_SLOGI( + "[INFO] previous : %d , current : %d state changed", + previous_state, current_state + ); } //LCOV_EXCL_START @@ -534,14 +537,14 @@ int __ma_cb_active_state_changed(int state) ma_client_use_callback(g_ma); callback(previous_state, current_state, user_data); ma_client_not_use_callback(g_ma); - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Active state changed callback is called %d", current_state); + MA_SLOGD("[DEBUG] Active state changed callback is called %d", current_state); } else { - SLOG(LOG_DEBUG, TAG_MAC, "[WARNING] Active state changed callback is NULL"); + MA_SLOGD("[WARNING] Active state changed callback is NULL"); } ma_client_get_previous_active_state(g_ma, ¤t_state, &previous_state); - SLOG(LOG_DEBUG, TAG_MAC, - "[DEBUG] previous : %d , current : %d Sending audio streaming request", + MA_SLOGD( + "[INFO] previous : %d , current : %d active state changed", previous_state, current_state ); ma_start_receiving_audio_streaming_data(MA_AUDIO_STREAMING_DATA_TYPE_CURRENT_UTTERANCE); @@ -597,9 +600,9 @@ int __ma_cb_audio_streaming(int event, char* buffer, int len) ma_client_use_callback(g_ma); callback((ma_audio_streaming_event_e)event, buffer, len, user_data); ma_client_not_use_callback(g_ma); - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Audio streaming callback is called, event(%d)", event); + MA_SLOGD("[DEBUG] Audio streaming callback is called, event(%d)", event); } else { - SLOG(LOG_DEBUG, TAG_MAC, "[WARNING] Audio streaming callback is NULL"); + MA_SLOGD("[WARNING] Audio streaming callback is NULL"); } return 0; @@ -609,32 +612,32 @@ int __ma_cb_error(int reason, char* msg) { ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid client"); + MA_SLOGE("[ERROR] Invalid client"); return MA_ERROR_INVALID_PARAMETER; } /* check state */ if (state != MA_STATE_READY) { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Current state is not 'READY'"); //LCOV_EXCL_LINE + MA_SLOGD("[DEBUG] Current state is not 'READY'"); //LCOV_EXCL_LINE if (MA_ERROR_SERVICE_RESET != reason) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] client is not connected yet"); + MA_SLOGE("[ERROR] client is not connected yet"); return MA_ERROR_INVALID_STATE; } return MA_ERROR_NONE; } if (MA_ERROR_SERVICE_RESET == reason) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] multi-assistant service reset"); + MA_SLOGE("[ERROR] multi-assistant service reset"); ma_client_set_client_state(g_ma, MA_STATE_INITIALIZED); __ma_notify_state_changed((void*)g_ma); if (0 != ma_prepare()) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to prepare"); + MA_SLOGE("[ERROR] Fail to prepare"); } } - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Error reason(%d), msg(%s)", reason, msg); + MA_SLOGE("[ERROR] Error reason(%d), msg(%s)", reason, msg); ma_client_set_error(g_ma, reason); __ma_notify_error((void*)g_ma); @@ -657,9 +660,9 @@ static void __ma_notify_error(void* data) ma_client_use_callback(ma); callback(reason, user_data); ma_client_not_use_callback(ma); - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Error callback is called"); + MA_SLOGD("[DEBUG] Error callback is called"); } else { - SLOG(LOG_DEBUG, TAG_MAC, "[WARNING] Error callback is NULL"); + MA_SLOGD("[WARNING] Error callback is NULL"); } } @@ -675,9 +678,9 @@ static void __ma_lang_changed_cb(const char* previous_lang, const char* current_ ma_client_use_callback(g_ma); callback(previous_lang, current_lang, user_data); ma_client_not_use_callback(g_ma); - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Language changed callback is called"); + MA_SLOGD("[DEBUG] Language changed callback is called"); } else { - SLOG(LOG_DEBUG, TAG_MAC, "[WARNING] Language changed callback is NULL"); + MA_SLOGD("[WARNING] Language changed callback is NULL"); } } */ @@ -692,9 +695,9 @@ int __ma_cb_wakeup_engine_command(const char* command) ma_client_use_callback(g_ma); callback(command, user_data); ma_client_not_use_callback(g_ma); - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Wakeup engine command callback is called, (%s)", (command ? command : "NULL")); + MA_SLOGD("[DEBUG] Wakeup engine command callback is called, (%s)", (command ? command : "NULL")); } else { - SLOG(LOG_DEBUG, TAG_MAC, "[WARNING] Wakeup engine command callback is NULL"); + MA_SLOGD("[WARNING] Wakeup engine command callback is NULL"); } return 0; @@ -711,9 +714,9 @@ int __ma_cb_preprocessing_information_changed(const char* app_id) ma_client_use_callback(g_ma); callback(app_id, user_data); ma_client_not_use_callback(g_ma); - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Preprocessing information changed callback is called, (%s)", app_id); + MA_SLOGD("[DEBUG] Preprocessing information changed callback is called, (%s)", app_id); } else { - SLOG(LOG_DEBUG, TAG_MAC, "[WARNING] Preprocessing information changed callback is NULL"); + MA_SLOGD("[WARNING] Preprocessing information changed callback is NULL"); } return 0; @@ -730,9 +733,9 @@ int __ma_cb_audio_streaming_data_section_changed(ma_audio_streaming_data_section ma_client_use_callback(g_ma); callback(section, user_data); ma_client_not_use_callback(g_ma); - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Audio streaming data section changed callback is called, (%d)", section); + MA_SLOGD("[DEBUG] Audio streaming data section changed callback is called, (%d)", section); } else { - SLOG(LOG_DEBUG, TAG_MAC, "[WARNING] Audio streaming data section changed callback is NULL"); + MA_SLOGD("[WARNING] Audio streaming data section changed callback is NULL"); } return 0; @@ -748,7 +751,7 @@ int __flush_preprocessing_audio_data() if (NULL != callback) { int event_filter = -1; - SLOG(LOG_DEBUG, TAG_MAC, "Flush audio data"); + MA_SLOGD("Flush audio data"); ma_client_use_callback(g_ma); // Flush audio data speech_data* data = NULL; @@ -757,7 +760,7 @@ int __flush_preprocessing_audio_data() if (data) { callback((ma_audio_streaming_event_e)data->event, data->buffer, data->len, user_data); if (event_filter != data->event) { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Audio streaming callback is called, event(%d)", data->event); + MA_SLOGD("[DEBUG] Audio streaming callback is called, event(%d)", data->event); event_filter = data->event; } free(data->buffer); @@ -766,7 +769,7 @@ int __flush_preprocessing_audio_data() } while (data); ma_client_not_use_callback(g_ma); } else { - SLOG(LOG_DEBUG, TAG_MAC, "[WARNING] Audio streaming callback is NULL"); + MA_SLOGD("[WARNING] Audio streaming callback is NULL"); } return 0; } @@ -783,9 +786,9 @@ int __ma_cb_preprocessing_result_received(bool result) ma_client_use_callback(g_ma); callback(result, user_data); ma_client_not_use_callback(g_ma); - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Preprocessing result received callback is called, (%d)", result); + MA_SLOGD("[DEBUG] Preprocessing result received callback is called, (%d)", result); } else { - SLOG(LOG_DEBUG, TAG_MAC, "[WARNING] Preprocessing result received callback is NULL"); + MA_SLOGD("[WARNING] Preprocessing result received callback is NULL"); } #ifdef MA_PREPROCESSING_SEQUENTIAL_MODE @@ -828,17 +831,17 @@ int ma_get_state(ma_state_e* state) return MA_ERROR_PERMISSION_DENIED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Get current state"); + MA_SLOGD("[Client DEBUG] Get current state"); if (NULL == state) { - SLOG(LOG_ERROR, TAG_MAC, "[Client ERROR] Invalid parameter"); + MA_SLOGE("[Client ERROR] Invalid parameter"); return MA_ERROR_INVALID_PARAMETER; } ma_state_e tmp_state; if (0 != ma_client_get_client_state(g_ma, &tmp_state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -857,18 +860,18 @@ int ma_get_current_language(char** language) return MA_ERROR_PERMISSION_DENIED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Get current language"); + MA_SLOGD("[Client DEBUG] Get current language"); if (NULL == language) { - SLOG(LOG_ERROR, TAG_MAC, "[Client ERROR] Invalid parameter"); + MA_SLOGE("[Client ERROR] Invalid parameter"); return MA_ERROR_INVALID_PARAMETER; } int ret = -1; /* ret = ma_config_mgr_get_default_language(language); if (0 != ret) { - SLOG(LOG_ERROR, TAG_MAC, "[Client ERROR] Fail to get current language"); + MA_SLOGE("[Client ERROR] Fail to get current language"); } */ *language = strdup("en-US"); @@ -890,23 +893,23 @@ int ma_get_recording_audio_format(int *rate, ma_audio_channel_e *channel, ma_aud } if (NULL == rate || NULL == channel || NULL == audio_type) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid parameter"); + MA_SLOGE("[ERROR] Invalid parameter"); return MA_ERROR_INVALID_PARAMETER; } ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_READY) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Get recording audio format"); + MA_SLOGI("[Client DEBUG] Get recording audio format"); int count = 0; int ret = -1; @@ -915,14 +918,14 @@ int ma_get_recording_audio_format(int *rate, ma_audio_channel_e *channel, ma_aud ret = ma_dbus_get_recording_audio_format(pid, rate, channel, audio_type); if (0 != ret) { if (MA_ERROR_TIMED_OUT != ret) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to get audio format"); + MA_SLOGE("[ERROR] Fail to get audio format"); break; } else { - SLOG(LOG_WARN, TAG_MAC, "[WARNING] Retry to get audio format"); + MA_SLOGW("[WARNING] Retry to get audio format"); usleep(10000); count++; if (MA_RETRY_COUNT == count) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to get audio format"); + MA_SLOGE("[ERROR] Fail to get audio format"); break; } } @@ -938,24 +941,24 @@ int ma_set_state_changed_cb(ma_state_changed_cb callback, void* user_data) return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Set Multi-assistant client state changed cb"); + MA_SLOGD("[Client DEBUG] Set Multi-assistant client state changed cb"); if (NULL == callback) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid parameter"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid parameter"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_PARAMETER; } ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'Initialized' (%d)", state); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized' (%d)", state); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -970,18 +973,18 @@ int ma_unset_state_changed_cb(void) return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Unset Multi-assistant client state changed cb"); + MA_SLOGD("[Client DEBUG] Unset Multi-assistant client state changed cb"); ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'Initialized' (%d)", state); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized' (%d)", state); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -996,24 +999,24 @@ int ma_set_error_cb(ma_error_cb callback, void* user_data) return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Set Multi-assistant client error cb"); + MA_SLOGD("[Client DEBUG] Set Multi-assistant client error cb"); if (NULL == callback) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid parameter"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid parameter"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_PARAMETER; } ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'Initialized' (%d)", state); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized' (%d)", state); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -1028,18 +1031,18 @@ int ma_unset_error_cb(void) return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Unset Multi-assistant client error cb"); + MA_SLOGD("[Client DEBUG] Unset Multi-assistant client error cb"); ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'Initialized' (%d)", state); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized' (%d)", state); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -1054,24 +1057,24 @@ int ma_set_language_changed_cb(ma_language_changed_cb callback, void* user_data) return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Set Multi-assistant language changed cb"); + MA_SLOGD("[Client DEBUG] Set Multi-assistant language changed cb"); if (NULL == callback) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid parameter"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid parameter"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_PARAMETER; } ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -1086,18 +1089,18 @@ int ma_unset_language_changed_cb(void) return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Unset Multi-assistant language changed cb"); + MA_SLOGD("[Client DEBUG] Unset Multi-assistant language changed cb"); ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -1112,23 +1115,23 @@ int ma_set_audio_streaming_cb(ma_audio_streaming_cb callback, void* user_data) return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Set Multi-assistant audio streaming cb"); + MA_SLOGD("[Client DEBUG] Set Multi-assistant audio streaming cb"); if (NULL == callback) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid parameter"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid parameter"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_PARAMETER; } ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'Initialized' (%d)", state); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized' (%d)", state); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -1143,18 +1146,18 @@ int ma_unset_audio_streaming_cb(void) return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Unset Multi-assistant audio streaming cb"); + MA_SLOGD("[Client DEBUG] Unset Multi-assistant audio streaming cb"); ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -1174,36 +1177,37 @@ int ma_send_asr_result(ma_asr_result_event_e event, const char* asr_result) } if (event < MA_ASR_RESULT_EVENT_PARTIAL_RESULT || event > MA_ASR_RESULT_EVENT_ERROR) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid parameter"); + MA_SLOGE("[ERROR] Invalid parameter"); return MA_ERROR_INVALID_PARAMETER; } ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_READY) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } if (NULL == asr_result) { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Input parameter is NULL. (no result)"); + MA_SLOGD("[DEBUG] Input parameter is NULL. (no result)"); return MA_ERROR_INVALID_PARAMETER; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Send ASR result to the Multi-assistant service"); + MA_SLOGI("[Client DEBUG] Send ASR result to the Multi-assistant service : %d %s", + event, asr_result); int ret = -1; int pid = getpid(); ret = ma_dbus_send_asr_result(pid, event, asr_result); if (0 != ret) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to send ASR result"); + MA_SLOGE("[ERROR] Fail to send ASR result"); } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Success to send ASR result"); + MA_SLOGD("[DEBUG] Success to send ASR result"); } return ret; @@ -1221,29 +1225,30 @@ int ma_send_result(const char* display_text, const char* utterance_text, const c ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_READY) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Send result to the Multi-assistant"); + MA_SLOGI("[Client DEBUG] Send result to the Multi-assistant : %s %s %s", + display_text, utterance_text, result_json); if (NULL == display_text || NULL == utterance_text || NULL == result_json) { - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Input parameter is NULL."); + MA_SLOGD("[Client DEBUG] Input parameter is NULL."); } int ret = -1; int pid = getpid(); ret = ma_dbus_send_result(pid, display_text, utterance_text, result_json); if (0 != ret) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to send result"); + MA_SLOGE("[ERROR] Fail to send result"); } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Success to send result"); + MA_SLOGD("[DEBUG] Success to send result"); } return ret; @@ -1261,25 +1266,25 @@ int ma_send_recognition_result(ma_recognition_result_event_e result) ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_READY) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Send recognition result to the Multi-assistant"); + MA_SLOGI("[Client DEBUG] Send recognition result to the Multi-assistant : %d", result); int ret = -1; int pid = getpid(); ret = ma_dbus_send_recognition_result(pid, result); if (0 != ret) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to send result"); + MA_SLOGE("[ERROR] Fail to send result"); } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Success to send result"); + MA_SLOGD("[DEBUG] Success to send result"); } return ret; @@ -1291,23 +1296,23 @@ int ma_set_active_state_changed_cb(ma_active_state_changed_cb callback, void* us return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Set Multi-assistant active state changed cb"); + MA_SLOGD("[Client DEBUG] Set Multi-assistant active state changed cb"); if (NULL == callback) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid parameter"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid parameter"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_PARAMETER; } ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'Initialized' (%d)", state); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized' (%d)", state); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -1322,18 +1327,18 @@ int ma_unset_active_state_changed_cb(void) return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Unset Multi-assistant active state changed cb"); + MA_SLOGD("[Client DEBUG] Unset Multi-assistant active state changed cb"); ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -1354,17 +1359,17 @@ int ma_start_receiving_audio_streaming_data(ma_audio_streaming_data_type_e type) ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_READY) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Send streaming request to the Multi-assistant"); + MA_SLOGI("[Client DEBUG] Send streaming request to the Multi-assistant : %d", type); #ifdef MA_PREPROCESSING_SEQUENTIAL_MODE ma_client_set_audio_streaming_data_type(g_ma, type); @@ -1375,9 +1380,9 @@ int ma_start_receiving_audio_streaming_data(ma_audio_streaming_data_type_e type) int pid = getpid(); ret = ma_dbus_start_streaming_audio_data(pid, type); if (0 != ret) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to send request"); + MA_SLOGE("[ERROR] Fail to send request"); } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Success to send request"); + MA_SLOGD("[DEBUG] Success to send request"); } return ret; @@ -1395,25 +1400,25 @@ int ma_stop_receiving_audio_streaming_data(ma_audio_streaming_data_type_e type) ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_READY) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Send streaming stop request to the Multi-assistant"); + MA_SLOGI("[Client DEBUG] Send streaming stop request to the Multi-assistant : %d", type); int ret = -1; int pid = getpid(); ret = ma_dbus_stop_streaming_audio_data(pid, type); if (0 != ret) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to send request"); + MA_SLOGE("[ERROR] Fail to send request"); } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Success to send request"); + MA_SLOGD("[DEBUG] Success to send request"); } return ret; @@ -1431,25 +1436,25 @@ int ma_update_voice_feedback_state(ma_voice_feedback_state_e feedback_state) ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_READY) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Update voice feedback state to the Multi-assistant"); + MA_SLOGI("[Client DEBUG] Update voice feedback state to the Multi-assistant : %d", feedback_state); int ret = -1; int pid = getpid(); ret = ma_dbus_update_voice_feedback_state(pid, feedback_state); if (0 != ret) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to update voice feedback state"); + MA_SLOGE("[ERROR] Fail to update voice feedback state"); } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Success to update voice feedback state"); + MA_SLOGD("[DEBUG] Success to update voice feedback state"); } return ret; @@ -1467,25 +1472,25 @@ int ma_send_assistant_specific_command(const char* command) ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_READY) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Send assistant specific command to the Multi-assistant"); + MA_SLOGI("[Client DEBUG] Send assistant specific command to the Multi-assistant : %s", command); int ret = -1; int pid = getpid(); ret = ma_dbus_send_assistant_specific_command(pid, command); if (0 != ret) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to send assistant specific command"); + MA_SLOGE("[ERROR] Fail to send assistant specific command"); } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Success to send assistant specific command"); + MA_SLOGD("[DEBUG] Success to send assistant specific command"); } return ret; @@ -1497,23 +1502,23 @@ int ma_set_wakeup_engine_command_cb(ma_wakeup_engine_command_cb callback, void* return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Set Multi-assistant wakeup engine command cb"); + MA_SLOGD("[Client DEBUG] Set Multi-assistant wakeup engine command cb"); if (NULL == callback) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid parameter"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid parameter"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_PARAMETER; } ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'Initialized' (%d)", state); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized' (%d)", state); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -1528,18 +1533,18 @@ int ma_unset_wakeup_engine_command_cb(void) return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Unset Multi-assistant wakeup engine command cb"); + MA_SLOGD("[Client DEBUG] Unset Multi-assistant wakeup engine command cb"); ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -1564,9 +1569,9 @@ bool __get_assistant_enable_status(const char* app_id, char* assistants) { int __get_assistant_info_cb(const char* app_id, const char* name, const char* icon_path, const char* wakeup_list[], int cnt_wakeup, const char* supported_lang[], int cnt_lang, void* user_data) { - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] get assistant info cb start"); + MA_SLOGD("[Client DEBUG] get assistant info cb start"); if (NULL == app_id) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR]app_id NULL, returning"); + MA_SLOGE("[ERROR]app_id NULL, returning"); return -1; } else if (0 <= _assistant_info_index && MAX_ASSISTANT_NUM > _assistant_info_index ) { strncpy(__assistant_info[_assistant_info_index].app_id, app_id, MAX_ASSISTANT_INFO_STR_LEN); @@ -1578,7 +1583,7 @@ int __get_assistant_info_cb(const char* app_id, const char* name, } else { return -1; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] get assistant info cb end"); + MA_SLOGD("[Client DEBUG] get assistant info cb end"); return 0; } //LCOV_EXCL_STOP @@ -1589,7 +1594,7 @@ int ma_assistant_info_foreach_assistants(ma_assistant_info_list_cb callback, voi } int res; - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] get assistant info start"); + MA_SLOGD("[Client DEBUG] get assistant info start"); if (NULL != callback) { _assistant_info_index = 0; res = ma_config_mgr_get_assistant_info(__get_assistant_info_cb, user_data); @@ -1603,7 +1608,7 @@ int ma_assistant_info_foreach_assistants(ma_assistant_info_list_cb callback, voi } else { res = MA_ERROR_INVALID_PARAMETER; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] get assistant info end"); + MA_SLOGD("[Client DEBUG] get assistant info end"); return res; } @@ -1648,23 +1653,23 @@ int ma_get_recording_audio_source_type(char** type) { } if (NULL == type) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid parameter"); + MA_SLOGE("[ERROR] Invalid parameter"); return MA_ERROR_INVALID_PARAMETER; } ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_READY) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'READY'"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Get recording audio source type"); + MA_SLOGI("[Client DEBUG] Get recording audio source type"); int count = 0; int ret = -1; @@ -1673,14 +1678,14 @@ int ma_get_recording_audio_source_type(char** type) { ret = ma_dbus_get_recording_audio_source_type(pid, type); if (0 != ret) { if (MA_ERROR_TIMED_OUT != ret) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to get audio source type"); + MA_SLOGE("[ERROR] Fail to get audio source type"); break; } else { - SLOG(LOG_WARN, TAG_MAC, "[WARNING] Retry to get audio source type"); + MA_SLOGW("[WARNING] Retry to get audio source type"); usleep(10000); count++; if (MA_RETRY_COUNT == count) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to get audio source type"); + MA_SLOGE("[ERROR] Fail to get audio source type"); break; } } @@ -1692,10 +1697,10 @@ int ma_get_recording_audio_source_type(char** type) { int ma_set_background_volume(double ratio) { - SLOG(LOG_DEBUG, TAG_MAC, "[Manager] Set background volume"); + MA_SLOGD("[Manager] Set background volume"); if (0 != __ma_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAC, "@@@ [Manager] not supported"); + MA_SLOGD("@@@ [Manager] not supported"); return MA_ERROR_NOT_SUPPORTED; } @@ -1705,35 +1710,37 @@ int ma_set_background_volume(double ratio) ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); - SLOG(LOG_DEBUG, TAG_MAC, "@@@"); + MA_SLOGE("[ERROR] A handle is not available"); + MA_SLOGD("@@@"); return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_READY) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'READY', state(%d)", state); - SLOG(LOG_DEBUG, TAG_MAC, "@@@"); + MA_SLOGE("[ERROR] Invalid State: Current state is not 'READY', state(%d)", state); + MA_SLOGD("@@@"); return MA_ERROR_INVALID_STATE; } + MA_SLOGI("[Client DEBUG] Set background volume : %f", ratio); + /* change system volume */ int pid = getpid(); int ret = ma_dbus_set_background_volume(pid, ratio); if (0 != ret) { - SLOG(LOG_WARN, TAG_MAC, "[WARNING] retry to set background volume"); + MA_SLOGW("[WARNING] retry to set background volume"); } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Success to send"); + MA_SLOGD("[DEBUG] Success to send"); } return ret; } int ma_set_preprocessing_allow_mode(ma_preprocessing_allow_mode_e mode, const char* app_id) { - SLOG(LOG_DEBUG, TAG_MAC, "[Manager] Set preprocessing allow mode"); + MA_SLOGD("[Manager] Set preprocessing allow mode"); if (0 != __ma_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAC, "@@@ [Manager] not supported"); + MA_SLOGD("@@@ [Manager] not supported"); return MA_ERROR_NOT_SUPPORTED; } @@ -1743,29 +1750,30 @@ int ma_set_preprocessing_allow_mode(ma_preprocessing_allow_mode_e mode, const ch ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); - SLOG(LOG_DEBUG, TAG_MAC, "@@@"); + MA_SLOGE("[ERROR] A handle is not available"); + MA_SLOGD("@@@"); return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_READY) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'READY', state(%d)", state); - SLOG(LOG_DEBUG, TAG_MAC, "@@@"); + MA_SLOGE("[ERROR] Invalid State: Current state is not 'READY', state(%d)", state); + MA_SLOGD("@@@"); return MA_ERROR_INVALID_STATE; } #ifdef MA_PREPROCESSING_SEQUENTIAL_MODE ma_client_set_preprocessing_allow_mode(g_ma, mode); #endif + MA_SLOGI("[Client DEBUG] Set preprocessing allow mode : %d %s", mode, app_id); /* change system volume */ int pid = getpid(); int ret = ma_dbus_set_preprocessing_allow_mode(pid, mode, app_id); if (0 != ret) { - SLOG(LOG_WARN, TAG_MAC, "[WARNING] retry to set preprocessing allow mode"); + MA_SLOGW("[WARNING] retry to set preprocessing allow mode"); } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Success to send"); + MA_SLOGD("[DEBUG] Success to send"); } return ret; } @@ -1776,23 +1784,23 @@ int ma_set_preprocessing_information_changed_cb(ma_preprocessing_information_cha return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Set Multi-assistant preprocessing information changed cb"); + MA_SLOGD("[Client DEBUG] Set Multi-assistant preprocessing information changed cb"); if (NULL == callback) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid parameter"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid parameter"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_PARAMETER; } ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'Initialized' (%d)", state); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized' (%d)", state); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -1807,18 +1815,18 @@ int ma_unset_preprocessing_information_changed_cb(void) return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Unset Multi-assistant preprocessing information changed cb"); + MA_SLOGD("[Client DEBUG] Unset Multi-assistant preprocessing information changed cb"); ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -1829,10 +1837,10 @@ int ma_unset_preprocessing_information_changed_cb(void) int ma_send_preprocessing_result(bool is_success) { - SLOG(LOG_DEBUG, TAG_MAC, "[Manager] Send preprocessing result"); + MA_SLOGD("[Manager] Send preprocessing result"); if (0 != __ma_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAC, "@@@ [Manager] not supported"); + MA_SLOGD("@@@ [Manager] not supported"); return MA_ERROR_NOT_SUPPORTED; } @@ -1842,57 +1850,61 @@ int ma_send_preprocessing_result(bool is_success) ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); - SLOG(LOG_DEBUG, TAG_MAC, "@@@"); + MA_SLOGE("[ERROR] A handle is not available"); + MA_SLOGD("@@@"); return MA_ERROR_INVALID_STATE; } if (state != MA_STATE_READY) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'READY', state(%d)", state); - SLOG(LOG_DEBUG, TAG_MAC, "@@@"); + MA_SLOGE("[ERROR] Invalid State: Current state is not 'READY', state(%d)", state); + MA_SLOGD("@@@"); return MA_ERROR_INVALID_STATE; } + MA_SLOGI("[Client DEBUG] Send preprocessing result : %d", is_success); + /* Send preprocessing result */ int pid = getpid(); int ret = ma_dbus_send_preprocessing_result(pid, is_success); if (0 != ret) { - SLOG(LOG_WARN, TAG_MAC, "[WARNING] retry to send preprocessing result"); + MA_SLOGW("[WARNING] retry to send preprocessing result"); } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Success to send"); + MA_SLOGD("[DEBUG] Success to send"); } return ret; } int ma_set_wake_word_audio_require_flag(bool require) { - SLOG(LOG_DEBUG, TAG_MAC, "[Manager] Set wake word audio require flag"); + MA_SLOGD("[Manager] Set wake word audio require flag"); if (0 != __ma_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAC, "@@@ [Manager] not supported"); + MA_SLOGD("@@@ [Manager] not supported"); return MA_ERROR_NOT_SUPPORTED; } ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); - SLOG(LOG_DEBUG, TAG_MAC, "@@@"); + MA_SLOGE("[ERROR] A handle is not available"); + MA_SLOGD("@@@"); return MA_ERROR_INVALID_STATE; } if (state != MA_STATE_READY) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'READY', state(%d)", state); - SLOG(LOG_DEBUG, TAG_MAC, "@@@"); + MA_SLOGE("[ERROR] Invalid State: Current state is not 'READY', state(%d)", state); + MA_SLOGD("@@@"); return MA_ERROR_INVALID_STATE; } + MA_SLOGI("[Client DEBUG] Set wake word audio require flag : %d", require); + /* Set wake word audio require flag */ int pid = getpid(); int ret = ma_dbus_set_wake_word_audio_require_flag(pid, require); if (0 != ret) { - SLOG(LOG_WARN, TAG_MAC, "[WARNING] retry to set wake word audio require flag"); + MA_SLOGW("[WARNING] retry to set wake word audio require flag"); } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Success to set"); + MA_SLOGD("[DEBUG] Success to set"); } return ret; } @@ -1903,23 +1915,23 @@ int ma_set_audio_streaming_data_section_changed_cb(ma_audio_streaming_data_secti return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Set Multi-assistant audio streaming data section changed cb"); + MA_SLOGD("[Client DEBUG] Set Multi-assistant audio streaming data section changed cb"); if (NULL == callback) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid parameter"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid parameter"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_PARAMETER; } ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'Initialized' (%d)", state); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized' (%d)", state); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -1934,18 +1946,18 @@ int ma_unset_audio_streaming_data_section_changed_cb(void) return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Unset Multi-assistant audio streaming data section changed cb"); + MA_SLOGD("[Client DEBUG] Unset Multi-assistant audio streaming data section changed cb"); ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -1961,23 +1973,23 @@ int ma_set_preprocessing_result_received_cb(ma_preprocessing_result_received_cb return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Set Multi-assistant preprocessing result received cb"); + MA_SLOGD("[Client DEBUG] Set Multi-assistant preprocessing result received cb"); if (NULL == callback) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid parameter"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid parameter"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_PARAMETER; } ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'Initialized' (%d)", state); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized' (%d)", state); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -1992,18 +2004,18 @@ int ma_unset_preprocessing_result_received_cb(void) return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAC, "[Client DEBUG] Unset Multi-assistant preprocessing result received cb"); + MA_SLOGD("[Client DEBUG] Unset Multi-assistant preprocessing result received cb"); ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -2014,33 +2026,35 @@ int ma_unset_preprocessing_result_received_cb(void) int ma_set_assistant_language(const char* language) { - SLOG(LOG_DEBUG, TAG_MAC, "[Manager] Set assistant language"); + MA_SLOGD("[Manager] Set assistant language"); if (0 != __ma_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAC, "@@@ [Manager] not supported"); + MA_SLOGD("@@@ [Manager] not supported"); return MA_ERROR_NOT_SUPPORTED; } ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] A handle is not available"); - SLOG(LOG_DEBUG, TAG_MAC, "@@@"); + MA_SLOGE("[ERROR] A handle is not available"); + MA_SLOGD("@@@"); return MA_ERROR_INVALID_STATE; } if (state != MA_STATE_READY) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Invalid State: Current state is not 'READY', state(%d)", state); - SLOG(LOG_DEBUG, TAG_MAC, "@@@"); + MA_SLOGE("[ERROR] Invalid State: Current state is not 'READY', state(%d)", state); + MA_SLOGD("@@@"); return MA_ERROR_INVALID_STATE; } + MA_SLOGI("[Client DEBUG] Set assistant language : %s", language); + /* Set assistant language */ int pid = getpid(); int ret = ma_dbus_set_assistant_language(pid, language); if (0 != ret) { - SLOG(LOG_WARN, TAG_MAC, "[WARNING] Failed to set assistant language"); + MA_SLOGW("[WARNING] Failed to set assistant language"); } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Success to set"); + MA_SLOGD("[DEBUG] Success to set"); } return ret; } diff --git a/client/ma_client.c b/client/ma_client.c index 9b82fed..cab8913 100644 --- a/client/ma_client.c +++ b/client/ma_client.c @@ -77,7 +77,7 @@ static GSList* g_audio_data_list = NULL; static ma_client_s* __client_get(ma_h ma) { if (NULL == ma) { - SLOG(LOG_ERROR, TAG_MAC, "[DEBUG] Handle is NULL"); + MA_SLOGE("[DEBUG] Handle is NULL"); return NULL; } @@ -104,13 +104,13 @@ int ma_client_create(ma_h* ma) client = (ma_client_s*)calloc(1, sizeof(ma_client_s)); if (NULL == client) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to allocate memory"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Fail to allocate memory"); //LCOV_EXCL_LINE return MA_ERROR_OUT_OF_MEMORY; } ma_h temp = (ma_h)calloc(1, sizeof(struct ma_s)); if (NULL == temp) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to allocate memory"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Fail to allocate memory"); //LCOV_EXCL_LINE free(client); return MA_ERROR_OUT_OF_MEMORY; } @@ -165,7 +165,7 @@ int ma_client_create(ma_h* ma) int ma_client_destroy(ma_h ma) { if (ma == NULL) { - SLOG(LOG_ERROR, TAG_MAC, "Input parameter is NULL"); //LCOV_EXCL_LINE + MA_SLOGE("Input parameter is NULL"); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; } @@ -193,7 +193,7 @@ int ma_client_destroy(ma_h ma) } } - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] client Not found"); + MA_SLOGE("[ERROR] client Not found"); return -1; } @@ -204,7 +204,7 @@ bool ma_client_is_valid(ma_h ma) /* check handle */ if (NULL == client) { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] multi-assistant client is not valid"); + MA_SLOGD("[DEBUG] multi-assistant client is not valid"); return false; } @@ -688,14 +688,14 @@ int ma_client_push_preprocessing_audio_data(ma_h ma, speech_data* data) { speech_data *new_data = (speech_data*)calloc(1, sizeof(speech_data)); if (NULL == new_data) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to allocate memory"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Fail to allocate memory"); //LCOV_EXCL_LINE return MA_ERROR_OUT_OF_MEMORY; } new_data->event = data->event; new_data->len = data->len; new_data->buffer = (void*)calloc(data->len, sizeof(unsigned char)); if (NULL == new_data->buffer) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to allocate memory"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Fail to allocate memory"); //LCOV_EXCL_LINE free(new_data); return MA_ERROR_OUT_OF_MEMORY; } diff --git a/client/ma_dbus.c b/client/ma_dbus.c index f0713ec..1c0ccd6 100644 --- a/client/ma_dbus.c +++ b/client/ma_dbus.c @@ -59,22 +59,22 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler* fd_handle snprintf(if_name, 64, "%s", MA_CLIENT_SERVICE_INTERFACE); if (dbus_message_is_method_call(msg, if_name, MAS_METHOD_HELLO)) { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Get Hello"); + MA_SLOGD("[DEBUG] Get Hello"); int pid = 0; int response = -1; dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Dbus Error (%s)", err.message); + MA_SLOGE("[ERROR] Dbus Error (%s)", err.message); dbus_error_free(&err); } if (pid > 0) { - SLOG(LOG_DEBUG, TAG_MAC, "@@ ma client get hello : pid(%d) ", pid); + MA_SLOGD("@@ ma client get hello : pid(%d) ", pid); response = 1; } else { - SLOG(LOG_ERROR, TAG_MAC, "@@ ma client get hello : invalid pid "); + MA_SLOGE("@@ ma client get hello : invalid pid "); } DBusMessage* reply = NULL; @@ -84,20 +84,19 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler* fd_handle dbus_message_append_args(reply, DBUS_TYPE_INT32, &response, DBUS_TYPE_INVALID); if (!dbus_connection_send(g_conn_listener, reply, NULL)) - SLOG(LOG_ERROR, TAG_MAC, "@@ multi-assistant get hello : fail to send reply"); + MA_SLOGE("@@ multi-assistant get hello : fail to send reply"); else - SLOG(LOG_DEBUG, TAG_MAC, "@@ multi-assistant get hello : result(%d)", response); + MA_SLOGD("@@ multi-assistant get hello : result(%d)", response); dbus_connection_flush(g_conn_listener); dbus_message_unref(reply); } else { - SLOG(LOG_ERROR, TAG_MAC, "@@ multi-assistant get hello : fail to create reply message"); + MA_SLOGE("@@ multi-assistant get hello : fail to create reply message"); } } /* MAS_METHOD_HELLO */ else if (dbus_message_is_method_call(msg, if_name, MAS_METHOD_STREAMING_AUDIO_DATA)) { - SLOG(LOG_INFO, TAG_MAC, "@@@ Send speech data"); int event; char* buffer = NULL; int len; @@ -111,7 +110,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler* fd_handle DBUS_TYPE_INVALID); /* Just in case CONTINUE is received without START */ - SLOG(LOG_INFO, TAG_MAC, "@@@ Send streaming data org event(%d)", event); + MA_SLOGD("@@@ Send streaming data org event(%d)", event); if (event == MA_AUDIO_STREAMING_EVENT_CONTINUE && !start_received) event = MA_AUDIO_STREAMING_EVENT_START; @@ -119,60 +118,60 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler* fd_handle /* Reset if FINISHED received */ if (event == MA_AUDIO_STREAMING_EVENT_FINISH) start_received = false; - SLOG(LOG_INFO, TAG_MAC, "@@@ Send streaming data event(%d) %d", event, count++); + MA_SLOGD("@@@ Send streaming data event(%d) %d", event, count++); __ma_cb_audio_streaming(event, buffer, len); - SLOG(LOG_INFO, TAG_MAC, "@@@"); + MA_SLOGD("@@@"); } /* MAS_METHOD_SEND_SPEECH_DATA */ else if (dbus_message_is_method_call(msg, if_name, MAS_METHOD_ACTIVE_STATE_CHANGE)) { - SLOG(LOG_INFO, TAG_MAC, "@@@ Activate"); int state; dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &state, DBUS_TYPE_INVALID); + MA_SLOGI("@@@ Active state : %d", state); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Get arguments error (%s)", err.message); + MA_SLOGE("@@ Get arguments error (%s)", err.message); dbus_error_free(&err); } else { - SLOG(LOG_DEBUG, TAG_MAC, "@@ state(%d)", state); + MA_SLOGD("@@ state(%d)", state); __ma_cb_active_state_changed(state); } - SLOG(LOG_INFO, TAG_MAC, "@@@"); + MA_SLOGI("@@@"); } /* MAS_METHOD_ACTIVE_STATE_CHANGE */ else if (dbus_message_is_method_call(msg, if_name, MAS_METHOD_WAKEUP_ENGINE_COMMAND)) { - SLOG(LOG_INFO, TAG_MAC, "@@@ Activate"); char* command = NULL; dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &command, DBUS_TYPE_INVALID); + MA_SLOGI("@@@ Engine Command : %s", command); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Get arguments error (%s)", err.message); + MA_SLOGE("@@ Get arguments error (%s)", err.message); dbus_error_free(&err); } else { - SLOG(LOG_DEBUG, TAG_MAC, "@@ command(%s)", (command ? command : "NULL")); + MA_SLOGD("@@ command(%s)", (command ? command : "NULL")); __ma_cb_wakeup_engine_command(command); } - SLOG(LOG_INFO, TAG_MAC, "@@@"); + MA_SLOGI("@@@"); } /* MAS_METHOD_WAKEUP_ENGINE_COMMAND */ else if (dbus_message_is_method_call(msg, if_name, MAS_METHOD_SEND_PREPROCESSING_INFORMATION)) { - SLOG(LOG_INFO, TAG_MAC, "@@@ Activate"); char* app_id = NULL; dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &app_id, DBUS_TYPE_INVALID); + MA_SLOGI("@@@ Preprocessing appid : %s", app_id); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Get arguments error (%s)", err.message); + MA_SLOGE("@@ Get arguments error (%s)", err.message); dbus_error_free(&err); } else { char* temp_app_id = NULL; @@ -184,47 +183,47 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler* fd_handle free(temp_app_id); } - SLOG(LOG_INFO, TAG_MAC, "@@@"); + MA_SLOGI("@@@"); } /* MAS_METHOD_SEND_PREPROCESSING_INFORMATION */ else if (dbus_message_is_method_call(msg, if_name, MAS_METHOD_AUDIO_STREAMING_DATA_SECTION)) { - SLOG(LOG_INFO, TAG_MAC, "@@@ Activate"); int section; dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, §ion, DBUS_TYPE_INVALID); + MA_SLOGI("@@@ Data Section : %d", section); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Get arguments error (%s)", err.message); + MA_SLOGE("@@ Get arguments error (%s)", err.message); dbus_error_free(&err); } else { __ma_cb_audio_streaming_data_section_changed(section); } - SLOG(LOG_INFO, TAG_MAC, "@@@"); + MA_SLOGI("@@@"); } /* MAS_METHOD_AUDIO_STREAMING_DATA_SECTION */ else if (dbus_message_is_method_call(msg, if_name, MAS_METHOD_SEND_PREPROCESSING_RESULT)) { - SLOG(LOG_INFO, TAG_MAC, "@@@ Activate"); int result; dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &result, DBUS_TYPE_INVALID); + MA_SLOGI("@@@ Preprocessing Result : %d", result); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Get arguments error (%s)", err.message); + MA_SLOGE("@@ Get arguments error (%s)", err.message); dbus_error_free(&err); } else { __ma_cb_preprocessing_result_received(result); } - SLOG(LOG_INFO, TAG_MAC, "@@@"); + MA_SLOGI("@@@"); } /* MAS_METHOD_SEND_PREPROCESSING_RESULT */ else if (dbus_message_is_method_call(msg, if_name, MAS_METHOD_SEND_WAKEUP_ENGINE_COMMAND)) { - SLOG(LOG_INFO, TAG_MAC, "@@@ Activate"); + MA_SLOGI("@@@ Activate"); char* command = NULL; dbus_message_get_args(msg, &err, @@ -232,17 +231,16 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler* fd_handle DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Get arguments error (%s)", err.message); + MA_SLOGE("@@ Get arguments error (%s)", err.message); dbus_error_free(&err); } else { __ma_cb_wakeup_engine_command(command); } - SLOG(LOG_INFO, TAG_MAC, "@@@"); + MA_SLOGI("@@@"); } /* MAS_METHOD_SEND_WAKEUP_ENGINE_COMMAND */ else if (dbus_message_is_signal(msg, if_name, MAS_METHOD_ERROR)) { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Get Error"); int reason; char* err_msg; @@ -251,18 +249,19 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler* fd_handle DBUS_TYPE_STRING, &err_msg, DBUS_TYPE_INVALID); + MA_SLOGE("[DEBUG] Get Error : %d %s", reason, err_msg); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAC, "@@ multi-assistant Get Error message : Get arguments error (%s)", err.message); + MA_SLOGE("@@ multi-assistant Get Error message : Get arguments error (%s)", err.message); dbus_error_free(&err); } else { - SLOG(LOG_DEBUG, TAG_MAC, "@@ multi-assistant Get Error message : reason(%d), msg(%s)", reason, err_msg); + MA_SLOGD("@@ multi-assistant Get Error message : reason(%d), msg(%s)", reason, err_msg); __ma_cb_error(reason, err_msg); } } /* MAS_METHOD_ERROR */ else if (dbus_message_is_signal(msg, "org.freedesktop.DBus", "NameOwnerChanged")) { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Owner Changed"); + MA_SLOGD("[DEBUG] Owner Changed"); DBusError err; dbus_error_init(&err); /* remove a rule for daemon error */ @@ -272,7 +271,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler* fd_handle dbus_connection_flush(g_conn_listener); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAC, "Match Error (%s)", err.message); + MA_SLOGE("Match Error (%s)", err.message); dbus_error_free(&err); } @@ -280,7 +279,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler* fd_handle } /* NameOwnerChanged */ else { - SLOG(LOG_DEBUG, TAG_MAC, "Message is NOT valid"); + MA_SLOGD("Message is NOT valid"); dbus_message_unref(msg); break; } @@ -309,7 +308,7 @@ static void __ma_dbus_connection_free() int ma_dbus_open_connection() { if (NULL != g_conn_sender && NULL != g_conn_listener) { - SLOG(LOG_WARN, TAG_MAC, "already existed connection "); //LCOV_EXCL_LINE + MA_SLOGW("already existed connection "); //LCOV_EXCL_LINE return 0; } @@ -323,12 +322,12 @@ int ma_dbus_open_connection() g_conn_sender = dbus_bus_get_private(DBUS_BUS_SESSION, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAC, "Dbus Connection Error (%s)", err.message); //LCOV_EXCL_LINE + MA_SLOGE("Dbus Connection Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } if (NULL == g_conn_sender) { - SLOG(LOG_ERROR, TAG_MAC, "Fail to get dbus connection "); //LCOV_EXCL_LINE + MA_SLOGE("Fail to get dbus connection "); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; } @@ -337,12 +336,12 @@ int ma_dbus_open_connection() g_conn_listener = dbus_bus_get_private(DBUS_BUS_SESSION, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAC, "Dbus Connection Error (%s)", err.message); //LCOV_EXCL_LINE + MA_SLOGE("Dbus Connection Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } if (NULL == g_conn_listener) { - SLOG(LOG_ERROR, TAG_MAC, "Fail to get dbus connection "); //LCOV_EXCL_LINE + MA_SLOGE("Fail to get dbus connection "); //LCOV_EXCL_LINE __ma_dbus_connection_free(); return MA_ERROR_OPERATION_FAILED; } @@ -355,24 +354,24 @@ int ma_dbus_open_connection() memset(service_name, '\0', 64); snprintf(service_name, 64, "%s_%d", MA_CLIENT_SERVICE_NAME, pid); - SLOG(LOG_DEBUG, TAG_MAC, "service name is %s", service_name); + MA_SLOGD("service name is %s", service_name); /* register our name on the bus, and check for errors */ ret = dbus_bus_request_name(g_conn_listener, service_name, DBUS_NAME_FLAG_REPLACE_EXISTING, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAC, "Name Error (%s)", err.message); //LCOV_EXCL_LINE + MA_SLOGE("Name Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) { - SLOG(LOG_ERROR, TAG_MAC, "fail dbus_bus_request_name()"); //LCOV_EXCL_LINE + MA_SLOGE("fail dbus_bus_request_name()"); //LCOV_EXCL_LINE __ma_dbus_connection_free(); return -2; } if (NULL != g_fd_handler) { - SLOG(LOG_WARN, TAG_MAC, "The handler already exists."); //LCOV_EXCL_LINE + MA_SLOGW("The handler already exists."); //LCOV_EXCL_LINE __ma_dbus_connection_free(); return 0; } @@ -389,7 +388,7 @@ int ma_dbus_open_connection() dbus_bus_add_match(g_conn_listener, rule, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAC, "Match Error (%s)", err.message); //LCOV_EXCL_LINE + MA_SLOGE("Match Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); __ma_dbus_connection_free(); return MA_ERROR_OPERATION_FAILED; @@ -397,21 +396,22 @@ int ma_dbus_open_connection() int fd = 0; if (1 != dbus_connection_get_unix_fd(g_conn_listener, &fd)) { - SLOG(LOG_ERROR, TAG_MAC, "fail to get fd from dbus "); //LCOV_EXCL_LINE + MA_SLOGE("fail to get fd from dbus "); //LCOV_EXCL_LINE __ma_dbus_connection_free(); return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "Get fd from dbus : %d", fd); + MA_SLOGD("Get fd from dbus : %d", fd); } g_fd_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, (Ecore_Fd_Cb)listener_event_callback, g_conn_listener, NULL, NULL); if (NULL == g_fd_handler) { - SLOG(LOG_ERROR, TAG_MAC, "fail to get fd handler from ecore "); //LCOV_EXCL_LINE + MA_SLOGE("fail to get fd handler from ecore "); //LCOV_EXCL_LINE __ma_dbus_connection_free(); return MA_ERROR_OPERATION_FAILED; } - return 0;} + return 0; +} int ma_dbus_close_connection() { @@ -433,7 +433,7 @@ int ma_dbus_close_connection() dbus_bus_release_name(g_conn_listener, service_name, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } } @@ -450,28 +450,28 @@ int ma_dbus_reconnect() ma_dbus_close_connection(); if (0 != ma_dbus_open_connection()) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to reconnect"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Fail to reconnect"); //LCOV_EXCL_LINE return -1; } - SLOG(LOG_DEBUG, TAG_MAC, "[DBUS] Reconnect"); //LCOV_EXCL_LINE + MA_SLOGD("[DBUS] Reconnect"); //LCOV_EXCL_LINE return 0; } bool sender_connected = dbus_connection_get_is_connected(g_conn_sender); bool listener_connected = dbus_connection_get_is_connected(g_conn_listener); - SLOG(LOG_WARN, TAG_MAC, "[DBUS] Sender(%s) Listener(%s)", + MA_SLOGW("[DBUS] Sender(%s) Listener(%s)", sender_connected ? "Connected" : "Not connected", listener_connected ? "Connected" : "Not connected"); //LCOV_EXCL_LINE if (false == sender_connected || false == listener_connected) { ma_dbus_close_connection(); if (0 != ma_dbus_open_connection()) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to reconnect"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Fail to reconnect"); //LCOV_EXCL_LINE return -1; } - SLOG(LOG_DEBUG, TAG_MAC, "[DBUS] Reconnect"); //LCOV_EXCL_LINE + MA_SLOGD("[DBUS] Reconnect"); //LCOV_EXCL_LINE } return 0; @@ -481,7 +481,7 @@ int ma_dbus_reconnect() static int __dbus_check() { if (NULL == g_conn_sender) { - SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Null connection"); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Null connection"); //LCOV_EXCL_LINE return ma_dbus_reconnect(); } @@ -503,7 +503,7 @@ int ma_dbus_request_hello() MA_METHOD_HELLO); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Request multi-assistant hello : Fail to make message"); //LCOV_EXCL_LINE + MA_SLOGE("@@ Request multi-assistant hello : Fail to make message"); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; } @@ -516,7 +516,7 @@ int ma_dbus_request_hello() result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, -1, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_DEBUG, TAG_MAC, "[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE + MA_SLOGD("[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } @@ -547,10 +547,10 @@ int ma_dbus_request_initialize(int pid) MA_METHOD_INITIALIZE); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Request multi-assistant initialize : Fail to make message"); //LCOV_EXCL_LINE + MA_SLOGE("@@ Request multi-assistant initialize : Fail to make message"); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] multi-assistant initialize : pid(%d)", pid); + MA_SLOGD("[DEBUG] multi-assistant initialize : pid(%d)", pid); } dbus_message_append_args(msg, @@ -563,10 +563,10 @@ int ma_dbus_request_initialize(int pid) dbus_message_set_no_reply(msg, TRUE); if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[Dbus DEBUG] Success to Send"); + MA_SLOGD("[Dbus DEBUG] Success to Send"); dbus_connection_flush(g_conn_sender); } @@ -578,7 +578,7 @@ int ma_dbus_request_initialize(int pid) dbus_bus_add_match(g_conn_listener, rule, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAC, "Match Error (%s)", err.message); //LCOV_EXCL_LINE + MA_SLOGE("Match Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } @@ -601,7 +601,7 @@ int ma_dbus_request_deinitialize(int pid) dbus_connection_flush(g_conn_listener); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAC, "Match Error (%s)", err.message); //LCOV_EXCL_LINE + MA_SLOGE("Match Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } @@ -614,10 +614,10 @@ int ma_dbus_request_deinitialize(int pid) MA_METHOD_DEINITIALIZE); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Request multi-assistant deinitialize : Fail to make message"); //LCOV_EXCL_LINE + MA_SLOGE("@@ Request multi-assistant deinitialize : Fail to make message"); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] multi-assistant deinitialize : pid(%d)", pid); + MA_SLOGD("[DEBUG] multi-assistant deinitialize : pid(%d)", pid); } dbus_message_append_args(msg, @@ -631,7 +631,7 @@ int ma_dbus_request_deinitialize(int pid) dbus_message_unref(msg); if (dbus_error_is_set(&err)) { - SLOG(LOG_DEBUG, TAG_MAC, "[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE + MA_SLOGD("[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } @@ -641,7 +641,7 @@ int ma_dbus_request_deinitialize(int pid) DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Get arguments error (%s)", err.message); //LCOV_EXCL_LINE + MA_SLOGE("@@ Get arguments error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); result = MA_ERROR_OPERATION_FAILED; } @@ -649,12 +649,12 @@ int ma_dbus_request_deinitialize(int pid) dbus_message_unref(result_msg); if (0 == result) { - SLOG(LOG_DEBUG, TAG_MAC, "@@ multi-assistant finalize : result = %d", result); + MA_SLOGD("@@ multi-assistant finalize : result = %d", result); } else { - SLOG(LOG_ERROR, TAG_MAC, "@@ multi-assistant finalize : result = %d", result); + MA_SLOGE("@@ multi-assistant finalize : result = %d", result); } } else { - SLOG(LOG_ERROR, TAG_MAC, "@@ Result message is NULL "); //LCOV_EXCL_LINE + MA_SLOGE("@@ Result message is NULL "); //LCOV_EXCL_LINE ma_dbus_reconnect(); result = MA_ERROR_TIMED_OUT; } @@ -678,10 +678,10 @@ int ma_dbus_get_recording_audio_format(int pid, int *rate, ma_audio_channel_e *c MA_METHOD_GET_RECORDING_AUDIO_FORMAT); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Request multi-assistant recording audio format : Fail to make message"); //LCOV_EXCL_LINE + MA_SLOGE("@@ Request multi-assistant recording audio format : Fail to make message"); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] multi-assistant recording audio format"); + MA_SLOGD("[DEBUG] multi-assistant recording audio format"); } dbus_message_append_args(msg, @@ -698,7 +698,7 @@ int ma_dbus_get_recording_audio_format(int pid, int *rate, ma_audio_channel_e *c dbus_message_unref(msg); if (dbus_error_is_set(&err)) { - SLOG(LOG_DEBUG, TAG_MAC, "[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE + MA_SLOGD("[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } @@ -715,7 +715,7 @@ int ma_dbus_get_recording_audio_format(int pid, int *rate, ma_audio_channel_e *c DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Get arguments error (%s)", err.message); + MA_SLOGE("@@ Get arguments error (%s)", err.message); dbus_error_free(&err); result = MA_ERROR_OPERATION_FAILED; } @@ -725,12 +725,12 @@ int ma_dbus_get_recording_audio_format(int pid, int *rate, ma_audio_channel_e *c *rate = tmp_rate; *channel = tmp_channel; *audio_type = tmp_audio_type; - SLOG(LOG_DEBUG, TAG_MAC, "@@ multi-assistant get recording audio format : result = %d, rate = %d, channel = %d, audio_type = %d", result, *rate, *channel, *audio_type); + MA_SLOGD("@@ multi-assistant get recording audio format : result = %d, rate = %d, channel = %d, audio_type = %d", result, *rate, *channel, *audio_type); } else { - SLOG(LOG_ERROR, TAG_MAC, "@@ multi-assistant get recordingaudio format : result = %d", result); + MA_SLOGE("@@ multi-assistant get recording audio format : result = %d", result); } } else { - SLOG(LOG_ERROR, TAG_MAC, "@@ Result message is NULL"); + MA_SLOGE("@@ Result message is NULL"); ma_dbus_reconnect(); result = MA_ERROR_TIMED_OUT; } @@ -753,10 +753,10 @@ int ma_dbus_get_recording_audio_source_type(int pid, char** type) MA_METHOD_GET_RECORDING_AUDIO_SOURCE_TYPE); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Request multi-assistant recording audio source type : Fail to make message"); //LCOV_EXCL_LINE + MA_SLOGE("@@ Request multi-assistant recording audio source type : Fail to make message"); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] multi-assistant recording audio source type"); + MA_SLOGD("[DEBUG] multi-assistant recording audio source type"); } dbus_message_append_args(msg, @@ -773,7 +773,7 @@ int ma_dbus_get_recording_audio_source_type(int pid, char** type) dbus_message_unref(msg); if (dbus_error_is_set(&err)) { - SLOG(LOG_DEBUG, TAG_MAC, "[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE + MA_SLOGD("[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); } @@ -786,7 +786,7 @@ int ma_dbus_get_recording_audio_source_type(int pid, char** type) DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Get arguments error (%s)", err.message); + MA_SLOGE("@@ Get arguments error (%s)", err.message); dbus_error_free(&err); result = MA_ERROR_OPERATION_FAILED; } @@ -794,12 +794,12 @@ int ma_dbus_get_recording_audio_source_type(int pid, char** type) if (0 == result && NULL != type) { *type = strdup(tmp_type); - SLOG(LOG_DEBUG, TAG_MAC, "@@ multi-assistant get recording audio source type : result = %d, type = %s", result, *type); + MA_SLOGD("@@ multi-assistant get recording audio source type : result = %d, type = %s", result, *type); } else { - SLOG(LOG_ERROR, TAG_MAC, "@@ multi-assistant get recording audio source type : result = %d, type(%p)", result, type); + MA_SLOGE("@@ multi-assistant get recording audio source type : result = %d, type(%p)", result, type); } } else { - SLOG(LOG_ERROR, TAG_MAC, "@@ Result message is NULL"); + MA_SLOGE("@@ Result message is NULL"); ma_dbus_reconnect(); result = MA_ERROR_TIMED_OUT; } @@ -822,10 +822,10 @@ int ma_dbus_send_asr_result(int pid, ma_asr_result_event_e event, const char* as MA_METHOD_SEND_ASR_RESULT); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Request multi-assistant send ASR result : Fail to make message"); //LCOV_EXCL_LINE + MA_SLOGE("@@ Request multi-assistant send ASR result : Fail to make message"); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] multi-assistant send ASR result"); + MA_SLOGD("[DEBUG] multi-assistant send ASR result"); } dbus_message_append_args(msg, @@ -837,10 +837,10 @@ int ma_dbus_send_asr_result(int pid, ma_asr_result_event_e event, const char* as dbus_message_set_no_reply(msg, TRUE); if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[Dbus DEBUG] Success to Send"); + MA_SLOGD("[Dbus DEBUG] Success to Send"); dbus_connection_flush(g_conn_sender); } @@ -864,10 +864,10 @@ int ma_dbus_send_result(int pid, const char* display_text, const char* utterance MA_METHOD_SEND_RESULT); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Request multi-assistant send result : Fail to make message"); //LCOV_EXCL_LINE + MA_SLOGE("@@ Request multi-assistant send result : Fail to make message"); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] multi-assistant send result"); + MA_SLOGD("[DEBUG] multi-assistant send result"); } char* tmp_disp_text = NULL; @@ -902,7 +902,7 @@ int ma_dbus_send_result(int pid, const char* display_text, const char* utterance dbus_message_set_no_reply(msg, TRUE); if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE if (NULL != tmp_disp_text) { free(tmp_disp_text); tmp_disp_text = NULL; @@ -917,7 +917,7 @@ int ma_dbus_send_result(int pid, const char* display_text, const char* utterance } return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[Dbus DEBUG] Success to Send"); + MA_SLOGD("[Dbus DEBUG] Success to Send"); dbus_connection_flush(g_conn_sender); } @@ -954,10 +954,10 @@ int ma_dbus_send_recognition_result(int pid, ma_recognition_result_event_e resul MA_METHOD_SEND_RECOGNITION_RESULT); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Request multi-assistant send recognition result : Fail to make message"); //LCOV_EXCL_LINE + MA_SLOGE("@@ Request multi-assistant send recognition result : Fail to make message"); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] multi-assistant send recognition result"); + MA_SLOGD("[DEBUG] multi-assistant send recognition result"); } dbus_message_append_args(msg, @@ -971,14 +971,14 @@ int ma_dbus_send_recognition_result(int pid, ma_recognition_result_event_e resul dbus_error_init (&error); if (!dbus_connection_send(g_conn_sender, msg, NULL)) { if (dbus_error_is_set (&error)) { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE dbus_error_free (&error); } else { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE } return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[Dbus DEBUG] Success to Send"); + MA_SLOGD("[Dbus DEBUG] Success to Send"); dbus_connection_flush(g_conn_sender); } @@ -1002,10 +1002,10 @@ int ma_dbus_start_streaming_audio_data(int pid, ma_audio_streaming_data_type_e t MA_METHOD_START_STREAMING_AUDIO_DATA); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_MAC, "@@ multi-assistant send streaming request : Fail to make message"); //LCOV_EXCL_LINE + MA_SLOGE("@@ multi-assistant send streaming request : Fail to make message"); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] multi-assistant send streaming request"); + MA_SLOGD("[DEBUG] multi-assistant send streaming request"); } dbus_message_append_args(msg, @@ -1019,14 +1019,14 @@ int ma_dbus_start_streaming_audio_data(int pid, ma_audio_streaming_data_type_e t dbus_error_init (&error); if (!dbus_connection_send(g_conn_sender, msg, NULL)) { if (dbus_error_is_set (&error)) { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE dbus_error_free (&error); } else { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE } return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[Dbus DEBUG] Success to Send"); + MA_SLOGD("[Dbus DEBUG] Success to Send"); dbus_connection_flush(g_conn_sender); } @@ -1050,10 +1050,10 @@ int ma_dbus_stop_streaming_audio_data(int pid, ma_audio_streaming_data_type_e ty MA_METHOD_STOP_STREAMING_AUDIO_DATA); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Request multi-assistant stop streaming audio data : Fail to make message"); //LCOV_EXCL_LINE + MA_SLOGE("@@ Request multi-assistant stop streaming audio data : Fail to make message"); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] multi-assistant stop streaming audio data"); + MA_SLOGD("[DEBUG] multi-assistant stop streaming audio data"); } dbus_message_append_args(msg, @@ -1067,14 +1067,14 @@ int ma_dbus_stop_streaming_audio_data(int pid, ma_audio_streaming_data_type_e ty dbus_error_init (&error); if (!dbus_connection_send(g_conn_sender, msg, NULL)) { if (dbus_error_is_set (&error)) { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE dbus_error_free (&error); } else { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE } return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[Dbus DEBUG] Success to Send"); + MA_SLOGD("[Dbus DEBUG] Success to Send"); dbus_connection_flush(g_conn_sender); } @@ -1098,10 +1098,10 @@ int ma_dbus_update_voice_feedback_state(int pid, ma_voice_feedback_state_e state MA_METHOD_UPDATE_VOICE_FEEDBACK_STATE); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Request multi-assistant update voice feedback state : Fail to make message"); //LCOV_EXCL_LINE + MA_SLOGE("@@ Request multi-assistant update voice feedback state : Fail to make message"); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] multi-assistant update voice feedback state"); + MA_SLOGD("[DEBUG] multi-assistant update voice feedback state"); } dbus_message_append_args(msg, @@ -1115,14 +1115,14 @@ int ma_dbus_update_voice_feedback_state(int pid, ma_voice_feedback_state_e state dbus_error_init (&error); if (!dbus_connection_send(g_conn_sender, msg, NULL)) { if (dbus_error_is_set (&error)) { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE dbus_error_free (&error); } else { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE } return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[Dbus DEBUG] Success to Send"); + MA_SLOGD("[Dbus DEBUG] Success to Send"); dbus_connection_flush(g_conn_sender); } @@ -1146,10 +1146,10 @@ int ma_dbus_send_assistant_specific_command(int pid, const char* command) MA_METHOD_SEND_ASSISTANT_SPECIFIC_COMMAND); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Request multi-assistant send assistant specific command : Fail to make message"); //LCOV_EXCL_LINE + MA_SLOGE("@@ Request multi-assistant send assistant specific command : Fail to make message"); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] multi-assistant send assistant specific command"); + MA_SLOGD("[DEBUG] multi-assistant send assistant specific command"); } char* tmp_command = NULL; @@ -1176,14 +1176,14 @@ int ma_dbus_send_assistant_specific_command(int pid, const char* command) } if (dbus_error_is_set (&error)) { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE dbus_error_free (&error); } else { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE } return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[Dbus DEBUG] Success to Send"); + MA_SLOGD("[Dbus DEBUG] Success to Send"); dbus_connection_flush(g_conn_sender); } @@ -1212,10 +1212,10 @@ int ma_dbus_set_background_volume(int pid, double ratio) MA_METHOD_SET_BACKGROUND_VOLUME); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Request multi-assistant set background system volume : Fail to make message"); //LCOV_EXCL_LINE + MA_SLOGE("@@ Request multi-assistant set background system volume : Fail to make message"); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] multi-assistant set background system volume"); + MA_SLOGD("[DEBUG] multi-assistant set background system volume"); } dbus_message_append_args(msg, @@ -1230,14 +1230,14 @@ int ma_dbus_set_background_volume(int pid, double ratio) if (!dbus_connection_send(g_conn_sender, msg, NULL)) { if (dbus_error_is_set (&error)) { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE dbus_error_free (&error); } else { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE } return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[Dbus DEBUG] Success to Send"); + MA_SLOGD("[Dbus DEBUG] Success to Send"); dbus_connection_flush(g_conn_sender); } @@ -1261,10 +1261,10 @@ int ma_dbus_set_preprocessing_allow_mode(int pid, ma_preprocessing_allow_mode_e MA_METHOD_SET_PREPROCESSING_ALLOW_MODE); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Request multi-assistant set preprocessing allow mode : Fail to make message"); //LCOV_EXCL_LINE + MA_SLOGE("@@ Request multi-assistant set preprocessing allow mode : Fail to make message"); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] multi-assistant set preprocessing allow mode"); + MA_SLOGD("[DEBUG] multi-assistant set preprocessing allow mode"); } char* tmp_app_id = NULL; @@ -1287,10 +1287,10 @@ int ma_dbus_set_preprocessing_allow_mode(int pid, ma_preprocessing_allow_mode_e if (!dbus_connection_send(g_conn_sender, msg, NULL)) { if (dbus_error_is_set (&error)) { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE dbus_error_free (&error); } else { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE } if (NULL != tmp_app_id) { free(tmp_app_id); @@ -1298,7 +1298,7 @@ int ma_dbus_set_preprocessing_allow_mode(int pid, ma_preprocessing_allow_mode_e } return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[Dbus DEBUG] Success to Send"); + MA_SLOGD("[Dbus DEBUG] Success to Send"); dbus_connection_flush(g_conn_sender); } @@ -1327,10 +1327,10 @@ int ma_dbus_send_preprocessing_result(int pid, bool result) MA_METHOD_SEND_PREPROCESSING_RESULT); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Request multi-assistant send preprocessing result : Fail to make message"); //LCOV_EXCL_LINE + MA_SLOGE("@@ Request multi-assistant send preprocessing result : Fail to make message"); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] multi-assistant send preprocessing result"); + MA_SLOGD("[DEBUG] multi-assistant send preprocessing result"); } int tmp_result = (result ? 1 : 0); @@ -1345,14 +1345,14 @@ int ma_dbus_send_preprocessing_result(int pid, bool result) dbus_error_init (&error); if (!dbus_connection_send(g_conn_sender, msg, NULL)) { if (dbus_error_is_set (&error)) { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE dbus_error_free (&error); } else { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE } return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[Dbus DEBUG] Success to Send"); + MA_SLOGD("[Dbus DEBUG] Success to Send"); dbus_connection_flush(g_conn_sender); } @@ -1376,10 +1376,10 @@ int ma_dbus_set_wake_word_audio_require_flag(int pid, bool require) MA_METHOD_SET_WAKE_WORD_AUDIO_REQUIRE_FLAG); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Request multi-assistant set wake word audio require flag : Fail to make message"); //LCOV_EXCL_LINE + MA_SLOGE("@@ Request multi-assistant set wake word audio require flag : Fail to make message"); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] multi-assistant set wake word audio require flag"); + MA_SLOGD("[DEBUG] multi-assistant set wake word audio require flag"); } int tmp_require = (require ? 1 : 0); @@ -1394,14 +1394,14 @@ int ma_dbus_set_wake_word_audio_require_flag(int pid, bool require) dbus_error_init (&error); if (!dbus_connection_send(g_conn_sender, msg, NULL)) { if (dbus_error_is_set (&error)) { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE dbus_error_free (&error); } else { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE } return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[Dbus DEBUG] Success to Send"); + MA_SLOGD("[Dbus DEBUG] Success to Send"); dbus_connection_flush(g_conn_sender); } @@ -1425,10 +1425,10 @@ int ma_dbus_set_assistant_language(int pid, const char* language) MA_METHOD_SET_ASSISTANT_LANGUAGE); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_MAC, "@@ Request multi-assistant set assistant language : Fail to make message"); //LCOV_EXCL_LINE + MA_SLOGE("@@ Request multi-assistant set assistant language : Fail to make message"); //LCOV_EXCL_LINE return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] multi-assistant set assistant language"); + MA_SLOGD("[DEBUG] multi-assistant set assistant language"); } char* tmp_language = NULL; @@ -1449,10 +1449,10 @@ int ma_dbus_set_assistant_language(int pid, const char* language) dbus_error_init (&error); if (!dbus_connection_send(g_conn_sender, msg, NULL)) { if (dbus_error_is_set (&error)) { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE dbus_error_free (&error); } else { - SLOG(LOG_ERROR, TAG_MAC, "[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE + MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE } if (NULL != tmp_language) { free(tmp_language); @@ -1460,7 +1460,7 @@ int ma_dbus_set_assistant_language(int pid, const char* language) } return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAC, "[Dbus DEBUG] Success to Send"); + MA_SLOGD("[Dbus DEBUG] Success to Send"); dbus_connection_flush(g_conn_sender); } diff --git a/client/ma_ui.c b/client/ma_ui.c index e0ddc9f..4bb992d 100644 --- a/client/ma_ui.c +++ b/client/ma_ui.c @@ -50,7 +50,7 @@ static int __ma_ui_get_feature_enabled() /* if (0 == g_feature_enabled) { //LCOV_EXCL_START - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Multi-assistant feature NOT supported"); + MAUI_SLOGE("[ERROR] Multi-assistant feature NOT supported"); return MA_ERROR_NOT_SUPPORTED; //LCOV_EXCL_STOP } else if (-1 == g_feature_enabled) { @@ -59,18 +59,18 @@ static int __ma_ui_get_feature_enabled() if (0 == system_info_get_platform_bool(MA_FEATURE_PATH, &ma_supported)) { if (0 == system_info_get_platform_bool(MA_MIC_FEATURE_PATH, &mic_supported)) { if (false == ma_supported || false == mic_supported) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Multi-assistant feature NOT supported"); + MAUI_SLOGE("[ERROR] Multi-assistant feature NOT supported"); g_feature_enabled = 0; return MA_ERROR_NOT_SUPPORTED; } g_feature_enabled = 1; } else { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Fail to get feature value"); //LCOV_EXCL_LINE + MAUI_SLOGE("[ERROR] Fail to get feature value"); //LCOV_EXCL_LINE return MA_ERROR_NOT_SUPPORTED; } } else { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Fail to get feature value"); //LCOV_EXCL_LINE + MAUI_SLOGE("[ERROR] Fail to get feature value"); //LCOV_EXCL_LINE return MA_ERROR_NOT_SUPPORTED; } } @@ -82,7 +82,7 @@ static int __check_privilege_initialize() { int ret = cynara_initialize(&p_cynara, NULL); if (CYNARA_API_SUCCESS != ret) - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] fail to initialize"); //LCOV_EXCL_LINE + MAUI_SLOGE("[ERROR] fail to initialize"); //LCOV_EXCL_LINE return ret == CYNARA_API_SUCCESS; } @@ -100,7 +100,7 @@ static int __check_privilege(const char* uid, const char * privilege) fp = fopen(label_path, "r"); if (fp != NULL) { if (0 >= fread(smack_label, 1, sizeof(smack_label), fp)) - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] fail to fread"); //LCOV_EXCL_LINE + MAUI_SLOGE("[ERROR] fail to fread"); //LCOV_EXCL_LINE fclose(fp); } @@ -108,7 +108,7 @@ static int __check_privilege(const char* uid, const char * privilege) pid_t pid = getpid(); char *session = cynara_session_from_pid(pid); int ret = cynara_check(p_cynara, smack_label, session, uid, privilege); - SLOG(LOG_DEBUG, TAG_MAUI, "[Client]cynara_check returned %d(%s)", ret, (CYNARA_API_ACCESS_ALLOWED == ret) ? "Allowed" : "Denied"); + MAUI_SLOGD("[Client]cynara_check returned %d(%s)", ret, (CYNARA_API_ACCESS_ALLOWED == ret) ? "Allowed" : "Denied"); if (session) free(session); @@ -130,17 +130,17 @@ static int __ma_ui_check_privilege() if (0 == g_privilege_allowed) { //LCOV_EXCL_START - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Permission is denied"); + MAUI_SLOGE("[ERROR] Permission is denied"); return MA_ERROR_PERMISSION_DENIED; //LCOV_EXCL_STOP } else if (-1 == g_privilege_allowed) { if (false == __check_privilege_initialize()) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] privilege initialize is failed"); //LCOV_EXCL_LINE + MAUI_SLOGE("[ERROR] privilege initialize is failed"); //LCOV_EXCL_LINE return MA_ERROR_PERMISSION_DENIED; } snprintf(uid, 16, "%d", getuid()); if (false == __check_privilege(uid, MA_RECORDER_PRIVILEGE)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Permission is denied"); + MAUI_SLOGE("[ERROR] Permission is denied"); g_privilege_allowed = 0; __check_privilege_deinitialize(); return MA_ERROR_PERMISSION_DENIED; @@ -157,7 +157,7 @@ static int __ma_ui_check_privilege() int ma_ui_initialize(void) { if (0 != __ma_ui_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAUI, "[UI] not supported"); + MAUI_SLOGD("[UI] not supported"); return MA_ERROR_NOT_SUPPORTED; } @@ -165,41 +165,41 @@ int ma_ui_initialize(void) return MA_ERROR_PERMISSION_DENIED; } - SLOG(LOG_ERROR, TAG_MAUI, "[UI] Initialize"); + MAUI_SLOGE("[UI] Initialize"); /* check handle */ if (true == ma_ui_client_is_valid(g_ma_ui)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Already initialized"); + MAUI_SLOGE("[ERROR] Already initialized"); return MA_ERROR_NONE; } if (0 != ma_ui_dbus_open_connection()) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Fail to open connection"); + MAUI_SLOGE("[ERROR] Fail to open connection"); return MA_ERROR_OPERATION_FAILED; } if (0 != ma_ui_client_create(&g_ma_ui)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Fail to create client!!!!!"); + MAUI_SLOGE("[ERROR] Fail to create client!!!!!"); return MA_ERROR_OUT_OF_MEMORY; } /* int ret = ma_config_mgr_initialize(g_ma_ui->handle + MA_UI_CONFIG_HANDLE); if (0 != ret) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Fail to init config manager : %d", ret); + MAUI_SLOGE("[ERROR] Fail to init config manager : %d", ret); ma_ui_client_destroy(g_ma_ui); return MA_ERROR_OPERATION_FAILED; } ret = ma_config_mgr_set_lang_cb(g_ma_ui->handle + MA_UI_CONFIG_HANDLE, __ma_ui_lang_changed_cb); if (0 != ret) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Fail to set callback : %d", ret); + MAUI_SLOGE("[ERROR] Fail to set callback : %d", ret); ma_config_mgr_deinitialize(g_ma_ui->handle + MA_UI_CONFIG_HANDLE); ma_ui_client_destroy(g_ma_ui); return MA_ERROR_OPERATION_FAILED; } */ - SLOG(LOG_ERROR, TAG_MAUI, "[Success] pid(%d)", g_ma_ui->handle); + MAUI_SLOGE("[Success] pid(%d)", g_ma_ui->handle); return MA_ERROR_NONE; } @@ -208,7 +208,7 @@ static void __ma_ui_internal_unprepare(void) { int ret = ma_ui_dbus_request_deinitialize(g_ma_ui->handle); if (0 != ret) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Fail to request deinitialize"); + MAUI_SLOGE("[ERROR] Fail to request deinitialize"); } return ; @@ -217,7 +217,7 @@ static void __ma_ui_internal_unprepare(void) int ma_ui_deinitialze(void) { if (0 != __ma_ui_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAUI, "@@@ [UI] not supported"); + MAUI_SLOGD("@@@ [UI] not supported"); return MA_ERROR_NOT_SUPPORTED; } @@ -225,16 +225,16 @@ int ma_ui_deinitialze(void) return MA_ERROR_PERMISSION_DENIED; } - SLOG(LOG_ERROR, TAG_MAUI, "@@@ [UI] Deinitialize"); + MAUI_SLOGE("@@@ [UI] Deinitialize"); if (false == ma_ui_client_is_valid(g_ma_ui)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] NOT initialized"); + MAUI_SLOGE("[ERROR] NOT initialized"); return MA_ERROR_INVALID_STATE; } ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] A handle is not available"); + MAUI_SLOGE("[UI ERROR] A handle is not available"); } /* check state */ @@ -254,13 +254,13 @@ int ma_ui_deinitialze(void) break; } - SLOG(LOG_DEBUG, TAG_MAUI, "Success: destroy"); + MAUI_SLOGD("Success: destroy"); if (0 != ma_ui_dbus_close_connection()) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Fail to close connection"); + MAUI_SLOGE("[ERROR] Fail to close connection"); } - SLOG(LOG_ERROR, TAG_MAUI, "@@@"); + MAUI_SLOGE("@@@"); return MA_ERROR_NONE; } @@ -273,7 +273,7 @@ static Eina_Bool __ma_ui_connect_daemon(void *data) ret = ma_ui_dbus_request_initialize(g_ma_ui->handle); if (MA_ERROR_ENGINE_NOT_FOUND == ret) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Fail to initialize"); + MAUI_SLOGE("[ERROR] Fail to initialize"); ma_ui_client_set_error(g_ma_ui, MA_ERROR_ENGINE_NOT_FOUND); ecore_main_loop_thread_safe_call_async(__ma_ui_notify_error, (void*)g_ma_ui); @@ -281,14 +281,14 @@ static Eina_Bool __ma_ui_connect_daemon(void *data) return EINA_FALSE; } else if (0 != ret) { - SLOG(LOG_ERROR, TAG_MAUI, "[WARNING] Fail to connection. Retry to connect"); + MAUI_SLOGE("[WARNING] Fail to connection. Retry to connect"); return EINA_TRUE; } else { /* Success to connect */ } - SLOG(LOG_ERROR, TAG_MAUI, "[SUCCESS] Connected daemon"); + MAUI_SLOGE("[SUCCESS] Connected daemon"); /* Set client state */ ma_ui_client_set_client_state(g_ma_ui, MA_STATE_READY); @@ -306,9 +306,9 @@ static Eina_Bool __ma_ui_connect_daemon(void *data) ma_ui_client_use_callback(g_ma_ui); changed_callback(previous_state, current_state, user_data); ma_ui_client_not_use_callback(g_ma_ui); - SLOG(LOG_DEBUG, TAG_MAUI, "State changed callback is called"); + MAUI_SLOGD("State changed callback is called"); } else { - SLOG(LOG_WARN, TAG_MAUI, "[WARNING] State changed callback is null"); + MAUI_SLOGW("[WARNING] State changed callback is null"); } return EINA_FALSE; @@ -316,19 +316,19 @@ static Eina_Bool __ma_ui_connect_daemon(void *data) static void __start_prepare_thread(void *data, Ecore_Thread *thread) { - SLOG(LOG_ERROR, TAG_MAUI, "@@@ Start prepare thread"); + MAUI_SLOGE("@@@ Start prepare thread"); int ret = 1, retry_count = 0; /* Send hello */ while (0 != ret) { if (retry_count == 10) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Fail to request hello !!"); + MAUI_SLOGE("[ERROR] Fail to request hello !!"); return; } ret = ma_ui_dbus_request_hello(); if (ret == 0) { - SLOG(LOG_DEBUG, TAG_MAUI, "Success to request hello. retry count(%d)", retry_count); + MAUI_SLOGD("Success to request hello. retry count(%d)", retry_count); break; } else { retry_count++; @@ -339,7 +339,7 @@ static void __start_prepare_thread(void *data, Ecore_Thread *thread) retry_count = 0; while (0 != ret) { if (retry_count == 10) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Fail to connect daemon !!"); + MAUI_SLOGE("[ERROR] Fail to connect daemon !!"); return; } ret = __ma_ui_connect_daemon(NULL); @@ -354,13 +354,13 @@ static void __start_prepare_thread(void *data, Ecore_Thread *thread) static void __end_prepare_thread(void *data, Ecore_Thread *thread) { - SLOG(LOG_DEBUG, TAG_MAUI, "@@@ End prepare thread"); + MAUI_SLOGD("@@@ End prepare thread"); } int ma_ui_prepare(void) { if (0 != __ma_ui_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAUI, "@@@ [UI] not supported"); + MAUI_SLOGD("@@@ [UI] not supported"); return MA_ERROR_NOT_SUPPORTED; } @@ -368,17 +368,17 @@ int ma_ui_prepare(void) return MA_ERROR_PERMISSION_DENIED; } - SLOG(LOG_DEBUG, TAG_MAUI, "[UI] Prepare"); + MAUI_SLOGD("[UI] Prepare"); ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] A handle is not available"); + MAUI_SLOGE("[UI ERROR] A handle is not available"); return MA_ERROR_INVALID_STATE; } /* check state */ if (MA_STATE_INITIALIZED != state) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); + MAUI_SLOGE("[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); return MA_ERROR_INVALID_STATE; } @@ -390,7 +390,7 @@ int ma_ui_prepare(void) int ma_ui_unprepare(void) { if (0 != __ma_ui_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAUI, "@@@ [UI] not supported"); + MAUI_SLOGD("@@@ [UI] not supported"); return MA_ERROR_NOT_SUPPORTED; } @@ -398,17 +398,17 @@ int ma_ui_unprepare(void) return MA_ERROR_PERMISSION_DENIED; } - SLOG(LOG_DEBUG, TAG_MAUI, "[UI] Unprepare"); + MAUI_SLOGD("[UI] Unprepare"); ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] A handle is not available"); + MAUI_SLOGE("[UI ERROR] A handle is not available"); return MA_ERROR_INVALID_STATE; } /* check state */ if (MA_STATE_READY != state) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid state: Current state is not 'READY' (%d)", state); + MAUI_SLOGE("[UI ERROR] Invalid state: Current state is not 'READY' (%d)", state); return MA_ERROR_INVALID_STATE; } @@ -436,9 +436,9 @@ static Eina_Bool __ma_ui_notify_state_changed(void* data) ma_ui_client_use_callback(g_ma_ui); callback(previous_state, current_state, user_data); ma_ui_client_not_use_callback(g_ma_ui); - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] State changed callback is called"); + MAUI_SLOGD("[DEBUG] State changed callback is called"); } else { - SLOG(LOG_DEBUG, TAG_MAUI, "[WARNING] State changed callback is NULL"); + MAUI_SLOGD("[WARNING] State changed callback is NULL"); } return EINA_FALSE; @@ -447,7 +447,7 @@ static Eina_Bool __ma_ui_notify_state_changed(void* data) /* static void __ma_ui_lang_changed_cb(const char* previous_lang, const char* current_lang) { - SLOG(LOG_DEBUG, TAG_MAUI, "[UI DEBUG] Language changed: prev(%s) curr(%s)", previous_lang, current_lang); + MAUI_SLOGD("[UI DEBUG] Language changed: prev(%s) curr(%s)", previous_lang, current_lang); ma_language_changed_cb callback = NULL; void* user_data; @@ -458,9 +458,9 @@ static void __ma_ui_lang_changed_cb(const char* previous_lang, const char* curre ma_ui_client_use_callback(g_ma_ui); callback(previous_lang, current_lang, user_data); ma_ui_client_not_use_callback(g_ma_ui); - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] Lang changed callback is called"); + MAUI_SLOGD("[DEBUG] Lang changed callback is called"); } else { - SLOG(LOG_DEBUG, TAG_MAUI, "[WARNING] Lang changed callback is NULL"); + MAUI_SLOGD("[WARNING] Lang changed callback is NULL"); } } */ @@ -476,9 +476,9 @@ static void __ma_ui_notify_send_asr_result(ma_asr_result_event_e event, char* as ma_ui_client_use_callback(g_ma_ui); callback(event, asr_result, user_data); ma_ui_client_not_use_callback(g_ma_ui); - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] asr result callback is called"); + MAUI_SLOGD("[DEBUG] asr result callback is called"); } else { - SLOG(LOG_DEBUG, TAG_MAUI, "[WARNING] asr result callback is NULL"); + MAUI_SLOGD("[WARNING] asr result callback is NULL"); } } @@ -486,17 +486,17 @@ int __ma_ui_cb_send_asr_result(int event, char* asr_result) { ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Invalid client"); + MAUI_SLOGE("[ERROR] Invalid client"); return MA_ERROR_INVALID_PARAMETER; } /* check state */ /* if (MA_STATE_READY != state) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid state: Current state is not 'READY' (%d)", state); + MAUI_SLOGE("[UI ERROR] Invalid state: Current state is not 'READY' (%d)", state); return MA_ERROR_INVALID_STATE; } */ - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] send asr result, event(%d), asr_result(%s)", event, asr_result); + MAUI_SLOGD("[DEBUG] send asr result, event(%d), asr_result(%s)", event, asr_result); __ma_ui_notify_send_asr_result((ma_asr_result_event_e)event, asr_result); @@ -514,9 +514,9 @@ static void __ma_ui_notify_send_result(const char* display_text, const char* utt ma_ui_client_use_callback(g_ma_ui); callback(display_text, utterance_text, result_json, user_data); ma_ui_client_not_use_callback(g_ma_ui); - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] result callback is called"); + MAUI_SLOGD("[DEBUG] result callback is called"); } else { - SLOG(LOG_DEBUG, TAG_MAUI, "[WARNING] result callback is NULL"); + MAUI_SLOGD("[WARNING] result callback is NULL"); } } @@ -524,17 +524,17 @@ int __ma_ui_cb_send_result(const char* display_text, const char* utterance_text, { ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Invalid client"); + MAUI_SLOGE("[ERROR] Invalid client"); return MA_ERROR_INVALID_PARAMETER; } /* check state */ /* if (MA_STATE_READY != state) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid state: Current state is not 'READY' (%d)", state); + MAUI_SLOGE("[UI ERROR] Invalid state: Current state is not 'READY' (%d)", state); return MA_ERROR_INVALID_STATE; } */ - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] send result, display_text(%s), utterance_text(%s), result_json(%s)", display_text, utterance_text, result_json); + MAUI_SLOGD("[DEBUG] send result, display_text(%s), utterance_text(%s), result_json(%s)", display_text, utterance_text, result_json); __ma_ui_notify_send_result(display_text, utterance_text, result_json); @@ -552,9 +552,9 @@ static void __ma_ui_notify_change_assistant(const char* app_id) ma_ui_client_use_callback(g_ma_ui); callback(app_id, user_data); ma_ui_client_not_use_callback(g_ma_ui); - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] result callback is called"); + MAUI_SLOGD("[DEBUG] result callback is called"); } else { - SLOG(LOG_DEBUG, TAG_MAUI, "[WARNING] result callback is NULL"); + MAUI_SLOGD("[WARNING] result callback is NULL"); } } @@ -562,11 +562,11 @@ int __ma_ui_cb_change_assistant(const char* app_id) { ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Invalid client"); + MAUI_SLOGE("[ERROR] Invalid client"); return MA_ERROR_INVALID_PARAMETER; } - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] change assistant, app_id(%s)", app_id); + MAUI_SLOGD("[DEBUG] change assistant, app_id(%s)", app_id); __ma_ui_notify_change_assistant(app_id); return MA_ERROR_NONE; @@ -576,27 +576,27 @@ int __ma_ui_cb_error(int reason, char* msg) { ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Invalid client"); + MAUI_SLOGE("[ERROR] Invalid client"); return MA_ERROR_INVALID_PARAMETER; } /* check state */ if (MA_STATE_READY != state) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid state: Current state is not 'READY' (%d)", state); + MAUI_SLOGE("[UI ERROR] Invalid state: Current state is not 'READY' (%d)", state); return MA_ERROR_INVALID_STATE; } if (MA_ERROR_SERVICE_RESET == reason) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] multi-assistant service reset"); + MAUI_SLOGE("[ERROR] multi-assistant service reset"); ma_ui_client_set_client_state(g_ma_ui, MA_STATE_INITIALIZED); __ma_ui_notify_state_changed(g_ma_ui); if (0 != ma_ui_prepare()) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Fail to prepare"); + MAUI_SLOGE("[ERROR] Fail to prepare"); } } - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] Error reason(%d), msg(%s)", reason, msg); + MAUI_SLOGD("[DEBUG] Error reason(%d), msg(%s)", reason, msg); ma_ui_client_set_error(g_ma_ui, reason); __ma_ui_notify_error(g_ma_ui); @@ -617,9 +617,9 @@ static void __ma_ui_notify_error(void* data) ma_ui_client_use_callback(g_ma_ui); callback(reason, user_data); ma_ui_client_not_use_callback(g_ma_ui); - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] Error callback is called"); + MAUI_SLOGD("[DEBUG] Error callback is called"); } else { - SLOG(LOG_DEBUG, TAG_MAUI, "[WARNING] Error callback is NULL"); + MAUI_SLOGD("[WARNING] Error callback is NULL"); } } @@ -634,9 +634,9 @@ static void __ma_ui_notify_send_recognition_result(ma_recognition_result_event_e ma_ui_client_use_callback(g_ma_ui); callback(result, user_data); ma_ui_client_not_use_callback(g_ma_ui); - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] recognition result callback is called"); + MAUI_SLOGD("[DEBUG] recognition result callback is called"); } else { - SLOG(LOG_DEBUG, TAG_MAUI, "[WARNING] recognition result callback is NULL"); + MAUI_SLOGD("[WARNING] recognition result callback is NULL"); } } @@ -644,11 +644,11 @@ int __ma_ui_cb_send_recognition_result(ma_recognition_result_event_e result) { ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Invalid client"); + MAUI_SLOGE("[ERROR] Invalid client"); return MA_ERROR_INVALID_PARAMETER; } - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] send recognition result, result(%d)", result); + MAUI_SLOGD("[DEBUG] send recognition result, result(%d)", result); __ma_ui_notify_send_recognition_result(result); @@ -667,9 +667,9 @@ int __ma_ui_cb_enable_common_ui(bool enable) ma_ui_client_use_callback(g_ma_ui); callback(enable, user_data); ma_ui_client_not_use_callback(g_ma_ui); - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] enable common UI callback is called"); + MAUI_SLOGD("[DEBUG] enable common UI callback is called"); } else { - SLOG(LOG_DEBUG, TAG_MAUI, "[WARNING] enable common UI callback is NULL"); + MAUI_SLOGD("[WARNING] enable common UI callback is NULL"); } return MA_ERROR_NONE; @@ -678,7 +678,7 @@ int __ma_ui_cb_enable_common_ui(bool enable) int ma_ui_get_state(ma_state_e* state) { if (0 != __ma_ui_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAUI, "@@@ [UI] not supported"); + MAUI_SLOGD("@@@ [UI] not supported"); return MA_ERROR_NOT_SUPPORTED; } @@ -686,17 +686,17 @@ int ma_ui_get_state(ma_state_e* state) return MA_ERROR_PERMISSION_DENIED; } - SLOG(LOG_DEBUG, TAG_MAUI, "[UI DEBUG] Get current state"); + MAUI_SLOGD("[UI DEBUG] Get current state"); if (NULL == state) { - SLOG(LOG_ERROR, TAG_MAUI, "[Client ERROR] Invalid parameter"); + MAUI_SLOGE("[Client ERROR] Invalid parameter"); return MA_ERROR_INVALID_PARAMETER; } ma_state_e tmp_state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &tmp_state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MAUI_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -708,7 +708,7 @@ int ma_ui_get_state(ma_state_e* state) int ma_ui_foreach_assistant_info(ma_ui_assistant_info_cb callback, void* user_data) { if (0 != __ma_ui_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAUI, "@@@ [UI] not supported"); + MAUI_SLOGD("@@@ [UI] not supported"); return MA_ERROR_NOT_SUPPORTED; } @@ -716,17 +716,17 @@ int ma_ui_foreach_assistant_info(ma_ui_assistant_info_cb callback, void* user_da return MA_ERROR_PERMISSION_DENIED; } - SLOG(LOG_DEBUG, TAG_MAUI, "[UI] Get foreach assistant info"); + MAUI_SLOGD("[UI] Get foreach assistant info"); if (NULL == callback) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid parameter"); + MAUI_SLOGE("[UI ERROR] Invalid parameter"); return MA_ERROR_INVALID_PARAMETER; } int ret = -1; ret = ma_config_mgr_get_assistant_info(callback, user_data); if (0 != ret) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Fail to get assistant info"); + MAUI_SLOGE("[UI ERROR] Fail to get assistant info"); } ret = 0; @@ -736,7 +736,7 @@ int ma_ui_foreach_assistant_info(ma_ui_assistant_info_cb callback, void* user_da int ma_ui_set_default_assistant(const char* app_id) { if (0 != __ma_ui_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAUI, "@@@ [UI] not supported"); + MAUI_SLOGD("@@@ [UI] not supported"); return MA_ERROR_NOT_SUPPORTED; } @@ -744,29 +744,29 @@ int ma_ui_set_default_assistant(const char* app_id) return MA_ERROR_PERMISSION_DENIED; } - SLOG(LOG_DEBUG, TAG_MAUI, "[UI] Set a default assistant"); + MAUI_SLOGD("[UI] Set a default assistant"); if (NULL == app_id) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid parameter"); + MAUI_SLOGE("[UI ERROR] Invalid parameter"); return MA_ERROR_INVALID_PARAMETER; } ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] A handle is not available"); + MAUI_SLOGE("[UI ERROR] A handle is not available"); return MA_ERROR_INVALID_STATE; } /* check state */ if (MA_STATE_INITIALIZED!= state) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); + MAUI_SLOGE("[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); return MA_ERROR_INVALID_STATE; } int ret = -1; /* ret = ma_config_mgr_set_default_assistant(app_id); if (0 != ret) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Fail to set default assistant")_; + MAUI_SLOGE("[UI ERROR] Fail to set default assistant")_; } */ ret = 0; @@ -776,7 +776,7 @@ int ma_ui_set_default_assistant(const char* app_id) int ma_ui_change_assistant(const char* app_id) { if (0 != __ma_ui_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAUI, "@@@ [UI] not supported"); + MAUI_SLOGD("@@@ [UI] not supported"); return MA_ERROR_NOT_SUPPORTED; } @@ -784,22 +784,22 @@ int ma_ui_change_assistant(const char* app_id) return MA_ERROR_PERMISSION_DENIED; } - SLOG(LOG_DEBUG, TAG_MAUI, "[UI] Change a assistant"); + MAUI_SLOGD("[UI] Change a assistant"); if (NULL == app_id) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid parameter"); + MAUI_SLOGE("[UI ERROR] Invalid parameter"); return MA_ERROR_INVALID_PARAMETER; } ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] A handle is not available"); + MAUI_SLOGE("[UI ERROR] A handle is not available"); return MA_ERROR_INVALID_STATE; } /* check state */ if (MA_STATE_READY != state) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); + MAUI_SLOGE("[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); return MA_ERROR_INVALID_STATE; } @@ -807,7 +807,7 @@ int ma_ui_change_assistant(const char* app_id) ma_ui_dbus_request_change_assistant(app_id); /* ret = ma_config_mgr_change_assistant(app_id); if (0 != ret) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Fail to set default assistant")_; + MAUI_SLOGE("[UI ERROR] Fail to set default assistant")_; } */ ret = 0; @@ -818,28 +818,28 @@ int ma_ui_change_assistant(const char* app_id) int ma_ui_set_state_changed_cb(ma_state_changed_cb callback, void* user_data) { if (0 != __ma_ui_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAUI, "@@@ [UI] not supported"); + MAUI_SLOGD("@@@ [UI] not supported"); return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAUI, "[Client DEBUG] Set Multi-assistant client state changed cb"); + MAUI_SLOGD("[Client DEBUG] Set Multi-assistant client state changed cb"); if (NULL == callback) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Invalid parameter"); //LCOV_EXCL_LINE + MAUI_SLOGE("[ERROR] Invalid parameter"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_PARAMETER; } ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MAUI_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE + MAUI_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -851,22 +851,22 @@ int ma_ui_set_state_changed_cb(ma_state_changed_cb callback, void* user_data) int ma_ui_unset_state_changed_cb(void) { if (0 != __ma_ui_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAUI, "@@@ [UI] not supported"); + MAUI_SLOGD("@@@ [UI] not supported"); return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAUI, "[UI DEBUG] Unset Multi-assistant client state changed cb"); + MAUI_SLOGD("[UI DEBUG] Unset Multi-assistant client state changed cb"); ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MAUI_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE + MAUI_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -878,28 +878,28 @@ int ma_ui_unset_state_changed_cb(void) int ma_ui_set_error_cb(ma_error_cb callback, void* user_data) { if (0 != __ma_ui_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAUI, "@@@ [UI] not supported"); + MAUI_SLOGD("@@@ [UI] not supported"); return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAUI, "[Client DEBUG] Set Multi-assistant UI client error cb"); + MAUI_SLOGD("[Client DEBUG] Set Multi-assistant UI client error cb"); if (NULL == callback) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Invalid parameter"); //LCOV_EXCL_LINE + MAUI_SLOGE("[ERROR] Invalid parameter"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_PARAMETER; } ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MAUI_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE + MAUI_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -911,22 +911,22 @@ int ma_ui_set_error_cb(ma_error_cb callback, void* user_data) int ma_ui_unset_error_cb(void) { if (0 != __ma_ui_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAUI, "@@@ [UI] not supported"); + MAUI_SLOGD("@@@ [UI] not supported"); return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAUI, "[UI DEBUG] Unset Multi-assistant UI client error cb"); + MAUI_SLOGD("[UI DEBUG] Unset Multi-assistant UI client error cb"); ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] A handle is not available"); //LCOV_EXCL_LINE + MAUI_SLOGE("[ERROR] A handle is not available"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } /* check state */ if (state != MA_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE + MAUI_SLOGE("[ERROR] Invalid State: Current state is not 'Initialized'"); //LCOV_EXCL_LINE return MA_ERROR_INVALID_STATE; } @@ -938,26 +938,26 @@ int ma_ui_unset_error_cb(void) int ma_ui_set_asr_result_cb(ma_ui_asr_result_cb callback, void* user_data) { if (0 != __ma_ui_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAUI, "@@@ [UI] not supported"); + MAUI_SLOGD("@@@ [UI] not supported"); return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAUI, "[UI] Set a ASR result callback"); + MAUI_SLOGD("[UI] Set a ASR result callback"); if (NULL == callback) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid parameter"); + MAUI_SLOGE("[UI ERROR] Invalid parameter"); return MA_ERROR_INVALID_PARAMETER; } ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] A handle is not available"); + MAUI_SLOGE("[UI ERROR] A handle is not available"); return MA_ERROR_INVALID_STATE; } /* check state */ if (MA_STATE_INITIALIZED!= state) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); + MAUI_SLOGE("[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); return MA_ERROR_INVALID_STATE; } @@ -969,21 +969,21 @@ int ma_ui_set_asr_result_cb(ma_ui_asr_result_cb callback, void* user_data) int ma_ui_unset_asr_result_cb(void) { if (0 != __ma_ui_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAUI, "@@@ [UI] not supported"); + MAUI_SLOGD("@@@ [UI] not supported"); return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAUI, "[UI] Set a default assistant"); + MAUI_SLOGD("[UI] Set a default assistant"); ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] A handle is not available"); + MAUI_SLOGE("[UI ERROR] A handle is not available"); return MA_ERROR_INVALID_STATE; } /* check state */ if (MA_STATE_INITIALIZED!= state) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); + MAUI_SLOGE("[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); return MA_ERROR_INVALID_STATE; } @@ -995,26 +995,26 @@ int ma_ui_unset_asr_result_cb(void) int ma_ui_set_result_cb(ma_ui_result_cb callback, void* user_data) { if (0 != __ma_ui_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAUI, "@@@ [UI] not supported"); + MAUI_SLOGD("@@@ [UI] not supported"); return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAUI, "[UI] Set a default assistant"); + MAUI_SLOGD("[UI] Set a default assistant"); if (NULL == callback) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid parameter"); + MAUI_SLOGE("[UI ERROR] Invalid parameter"); return MA_ERROR_INVALID_PARAMETER; } ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] A handle is not available"); + MAUI_SLOGE("[UI ERROR] A handle is not available"); return MA_ERROR_INVALID_STATE; } /* check state */ if (MA_STATE_INITIALIZED!= state) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); + MAUI_SLOGE("[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); return MA_ERROR_INVALID_STATE; } @@ -1026,21 +1026,21 @@ int ma_ui_set_result_cb(ma_ui_result_cb callback, void* user_data) int ma_ui_unset_result_cb(void) { if (0 != __ma_ui_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAUI, "@@@ [UI] not supported"); + MAUI_SLOGD("@@@ [UI] not supported"); return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAUI, "[UI] Set a default assistant"); + MAUI_SLOGD("[UI] Set a default assistant"); ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] A handle is not available"); + MAUI_SLOGE("[UI ERROR] A handle is not available"); return MA_ERROR_INVALID_STATE; } /* check state */ if (MA_STATE_INITIALIZED!= state) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); + MAUI_SLOGE("[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); return MA_ERROR_INVALID_STATE; } @@ -1052,26 +1052,26 @@ int ma_ui_unset_result_cb(void) int ma_ui_set_change_assistant_cb(ma_ui_change_assistant_cb callback, void* user_data) { if (0 != __ma_ui_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAUI, "@@@ [UI] not supported"); + MAUI_SLOGD("@@@ [UI] not supported"); return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAUI, "[UI] Set a default assistant"); + MAUI_SLOGD("[UI] Set a default assistant"); if (NULL == callback) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid parameter"); + MAUI_SLOGE("[UI ERROR] Invalid parameter"); return MA_ERROR_INVALID_PARAMETER; } ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] A handle is not available"); + MAUI_SLOGE("[UI ERROR] A handle is not available"); return MA_ERROR_INVALID_STATE; } /* check state */ if (MA_STATE_INITIALIZED!= state) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); + MAUI_SLOGE("[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); return MA_ERROR_INVALID_STATE; } @@ -1083,21 +1083,21 @@ int ma_ui_set_change_assistant_cb(ma_ui_change_assistant_cb callback, void* user int ma_ui_unset_change_assistant_cb(void) { if (0 != __ma_ui_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAUI, "@@@ [UI] not supported"); + MAUI_SLOGD("@@@ [UI] not supported"); return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAUI, "[UI] Set a default assistant"); + MAUI_SLOGD("[UI] Set a default assistant"); ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] A handle is not available"); + MAUI_SLOGE("[UI ERROR] A handle is not available"); return MA_ERROR_INVALID_STATE; } /* check state */ if (MA_STATE_INITIALIZED!= state) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); + MAUI_SLOGE("[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); return MA_ERROR_INVALID_STATE; } @@ -1109,24 +1109,24 @@ int ma_ui_unset_change_assistant_cb(void) int ma_ui_set_recognition_result_cb(ma_ui_recognition_result_cb callback, void* user_data) { if (0 != __ma_ui_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAUI, "@@@ [UI] not supported"); + MAUI_SLOGD("@@@ [UI] not supported"); return MA_ERROR_NOT_SUPPORTED; } if (NULL == callback) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid parameter"); + MAUI_SLOGE("[UI ERROR] Invalid parameter"); return MA_ERROR_INVALID_PARAMETER; } ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] A handle is not available"); + MAUI_SLOGE("[UI ERROR] A handle is not available"); return MA_ERROR_INVALID_STATE; } /* check state */ if (MA_STATE_INITIALIZED!= state) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); + MAUI_SLOGE("[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); return MA_ERROR_INVALID_STATE; } @@ -1138,21 +1138,21 @@ int ma_ui_set_recognition_result_cb(ma_ui_recognition_result_cb callback, void* int ma_ui_unset_recognition_result_cb(void) { if (0 != __ma_ui_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAUI, "@@@ [UI] not supported"); + MAUI_SLOGD("@@@ [UI] not supported"); return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAUI, "[UI] Set a default assistant"); + MAUI_SLOGD("[UI] Set a default assistant"); ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] A handle is not available"); + MAUI_SLOGE("[UI ERROR] A handle is not available"); return MA_ERROR_INVALID_STATE; } /* check state */ if (MA_STATE_INITIALIZED!= state) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); + MAUI_SLOGE("[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); return MA_ERROR_INVALID_STATE; } @@ -1164,24 +1164,24 @@ int ma_ui_unset_recognition_result_cb(void) int ma_ui_set_enable_common_ui_cb(ma_ui_enable_common_ui_cb callback, void* user_data) { if (0 != __ma_ui_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAUI, "@@@ [UI] not supported"); + MAUI_SLOGD("@@@ [UI] not supported"); return MA_ERROR_NOT_SUPPORTED; } if (NULL == callback) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid parameter"); + MAUI_SLOGE("[UI ERROR] Invalid parameter"); return MA_ERROR_INVALID_PARAMETER; } ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] A handle is not available"); + MAUI_SLOGE("[UI ERROR] A handle is not available"); return MA_ERROR_INVALID_STATE; } /* check state */ if (MA_STATE_INITIALIZED != state) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); + MAUI_SLOGE("[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); return MA_ERROR_INVALID_STATE; } @@ -1193,21 +1193,21 @@ int ma_ui_set_enable_common_ui_cb(ma_ui_enable_common_ui_cb callback, void* user int ma_ui_unset_enable_common_ui_cb(void) { if (0 != __ma_ui_get_feature_enabled()) { - SLOG(LOG_DEBUG, TAG_MAUI, "@@@ [UI] not supported"); + MAUI_SLOGD("@@@ [UI] not supported"); return MA_ERROR_NOT_SUPPORTED; } - SLOG(LOG_DEBUG, TAG_MAUI, "[UI] Set a default assistant"); + MAUI_SLOGD("[UI] Set a default assistant"); ma_state_e state; if (0 != ma_ui_client_get_client_state(g_ma_ui, &state)) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] A handle is not available"); + MAUI_SLOGE("[UI ERROR] A handle is not available"); return MA_ERROR_INVALID_STATE; } /* check state */ if (MA_STATE_INITIALIZED != state) { - SLOG(LOG_ERROR, TAG_MAUI, "[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); + MAUI_SLOGE("[UI ERROR] Invalid state: Current state is not 'Initialized' (%d)", state); return MA_ERROR_INVALID_STATE; } diff --git a/client/ma_ui_client.c b/client/ma_ui_client.c index 451e66d..5d40f8b 100644 --- a/client/ma_ui_client.c +++ b/client/ma_ui_client.c @@ -68,7 +68,7 @@ static GSList* g_ui_client_list = NULL; static ma_ui_client_s* __ui_client_get(ma_h ma) { if (NULL == ma) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Input parameter is NULL"); + MAUI_SLOGE("[ERROR] Input parameter is NULL"); return NULL; } @@ -86,7 +86,7 @@ static ma_ui_client_s* __ui_client_get(ma_h ma) } } - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] Fail to get ui client"); + MAUI_SLOGD("[DEBUG] Fail to get ui client"); return NULL; } @@ -96,13 +96,13 @@ int ma_ui_client_create(ma_h* ma) client = (ma_ui_client_s*)calloc(1, sizeof(ma_ui_client_s)); if (NULL == client) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Fail to allocate memory"); + MAUI_SLOGE("[ERROR] Fail to allocate memory"); return MA_ERROR_OUT_OF_MEMORY; } ma_h temp = (ma_h)calloc(1, sizeof(struct ma_s)); if (NULL == temp) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Fail to allocate memory"); + MAUI_SLOGE("[ERROR] Fail to allocate memory"); free(client); return MA_ERROR_OUT_OF_MEMORY; } @@ -158,7 +158,7 @@ int ma_ui_client_create(ma_h* ma) int ma_ui_client_destroy(ma_h ma) { if (ma == NULL) { - SLOG(LOG_ERROR, TAG_MAUI, "Input parameter is NULL"); + MAUI_SLOGE("Input parameter is NULL"); return 0; } @@ -201,7 +201,7 @@ int ma_ui_client_destroy(ma_h ma) } } - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] client Not found"); + MAUI_SLOGE("[ERROR] client Not found"); return -1;} @@ -210,7 +210,7 @@ bool ma_ui_client_is_valid(ma_h ma) ma_ui_client_s* client = __ui_client_get(ma); if (NULL == client) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] ma handle is not valid"); + MAUI_SLOGE("[ERROR] ma handle is not valid"); return false; } diff --git a/client/ma_ui_dbus.c b/client/ma_ui_dbus.c index 7bcfea4..668af38 100644 --- a/client/ma_ui_dbus.c +++ b/client/ma_ui_dbus.c @@ -51,7 +51,7 @@ static Eina_Bool ma_ui_listener_event_callback(void* data, Ecore_Fd_Handler* fd_ break; } - /* SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] Message is arrived"); */ + /* MAUI_SLOGD("[DEBUG] Message is arrived"); */ DBusError err; dbus_error_init(&err); @@ -60,7 +60,7 @@ static Eina_Bool ma_ui_listener_event_callback(void* data, Ecore_Fd_Handler* fd_ snprintf(if_name, 64, "%s", MA_UI_CLIENT_SERVICE_INTERFACE); if (dbus_message_is_method_call(msg, if_name, MAS_METHOD_HELLO)) { - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] Get Hello"); + MAUI_SLOGD("[DEBUG] Get Hello"); int response = -1; DBusMessage *reply = NULL; @@ -70,20 +70,20 @@ static Eina_Bool ma_ui_listener_event_callback(void* data, Ecore_Fd_Handler* fd_ dbus_message_append_args(reply, DBUS_TYPE_INT32, &response, DBUS_TYPE_INVALID); if (!dbus_connection_send(g_ui_conn_listener, reply, NULL)) - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] vc get hello : fail to send reply"); + MAUI_SLOGE("[ERROR] vc get hello : fail to send reply"); else - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] vc get hello : result(%d)", response); + MAUI_SLOGD("[DEBUG] vc get hello : result(%d)", response); dbus_connection_flush(g_ui_conn_listener); dbus_message_unref(reply); } else { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] multi-assistant ui get hello : fail to create reply message"); + MAUI_SLOGE("[ERROR] multi-assistant ui get hello : fail to create reply message"); } } /* MAS_METHOD_HELLO */ if (dbus_message_is_method_call(msg, if_name, MAS_UI_METHOD_SEND_ASR_RESULT)) { - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] Send asr result"); + MAUI_SLOGD("[DEBUG] Send asr result"); int pid = 0; int event = 0; char* asr_result = NULL; @@ -95,10 +95,10 @@ static Eina_Bool ma_ui_listener_event_callback(void* data, Ecore_Fd_Handler* fd_ DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Dbus Error (%s)", err.message); + MAUI_SLOGE("[ERROR] Dbus Error (%s)", err.message); dbus_error_free(&err); } else { - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] multi-assistant ui Send ASR result : pid(%d), event(%d), asr_result(%s)", pid, event, asr_result); + MAUI_SLOGD("[DEBUG] multi-assistant ui Send ASR result : pid(%d), event(%d), asr_result(%s)", pid, event, asr_result); char* temp_asr = NULL; if (NULL != asr_result && strcmp("#NULL", asr_result)) { temp_asr = strdup(asr_result); @@ -111,7 +111,7 @@ static Eina_Bool ma_ui_listener_event_callback(void* data, Ecore_Fd_Handler* fd_ } /* MAS_UI_METHOD_SEND_ASR_RESULT */ if (dbus_message_is_method_call(msg, if_name, MAS_UI_METHOD_SEND_RESULT)) { - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] Send asr result"); + MAUI_SLOGD("[DEBUG] Send asr result"); int pid = 0; char* display_text = NULL; char* utterance_text = NULL; @@ -125,10 +125,10 @@ static Eina_Bool ma_ui_listener_event_callback(void* data, Ecore_Fd_Handler* fd_ DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Dbus Error (%s)", err.message); + MAUI_SLOGE("[ERROR] Dbus Error (%s)", err.message); dbus_error_free(&err); } else { - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] multi-assistant ui Send result : pid(%d), display_text(%s), utterance_text(%s), result_json(%s)", pid, display_text, utterance_text, result_json); + MAUI_SLOGD("[DEBUG] multi-assistant ui Send result : pid(%d), display_text(%s), utterance_text(%s), result_json(%s)", pid, display_text, utterance_text, result_json); #if 0 __ma_ui_cb_send_result(display_text, utterance_text, result_json); #else @@ -156,7 +156,7 @@ static Eina_Bool ma_ui_listener_event_callback(void* data, Ecore_Fd_Handler* fd_ } /* MAS_UI_METHOD_SEND_RESULT */ if (dbus_message_is_method_call(msg, if_name, MAS_UI_METHOD_CHANGE_ASSISTANT)) { - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] Send change assistant request"); + MAUI_SLOGD("[DEBUG] Send change assistant request"); char* app_id = NULL; dbus_message_get_args(msg, &err, @@ -164,10 +164,10 @@ static Eina_Bool ma_ui_listener_event_callback(void* data, Ecore_Fd_Handler* fd_ DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Dbus Error (%s)", err.message); + MAUI_SLOGE("[ERROR] Dbus Error (%s)", err.message); dbus_error_free(&err); } else { - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] multi-assistant ui Send change assistant request : app_id(%s)", app_id); + MAUI_SLOGD("[DEBUG] multi-assistant ui Send change assistant request : app_id(%s)", app_id); __ma_ui_cb_change_assistant(app_id); } @@ -175,7 +175,7 @@ static Eina_Bool ma_ui_listener_event_callback(void* data, Ecore_Fd_Handler* fd_ } /* MAS_UI_METHOD_CHANGE_ASSISTANT */ else if (dbus_message_is_signal(msg, if_name, MAS_UI_METHOD_ERROR)) { - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] Get Error"); + MAUI_SLOGD("[DEBUG] Get Error"); int reason; char* err_msg = NULL; @@ -185,14 +185,14 @@ static Eina_Bool ma_ui_listener_event_callback(void* data, Ecore_Fd_Handler* fd_ DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] multi-assistant ui Get Error message : Get arguments error (%s)", err.message); + MAUI_SLOGE("[ERROR] multi-assistant ui Get Error message : Get arguments error (%s)", err.message); dbus_error_free(&err); } else { char* temp_msg = NULL; if (NULL != err_msg && strcmp("#NULL", err_msg)) { temp_msg = strdup(err_msg); } - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] multi-assistant ui Get Error message : reason(%d), msg(%s)", reason, temp_msg); + MAUI_SLOGE("[ERROR] multi-assistant ui Get Error message : reason(%d), msg(%s)", reason, temp_msg); __ma_ui_cb_error(reason, temp_msg); if (NULL != temp_msg) { free(temp_msg); @@ -202,7 +202,7 @@ static Eina_Bool ma_ui_listener_event_callback(void* data, Ecore_Fd_Handler* fd_ } /* MAD_MANAGER_METHOD_ERROR */ if (dbus_message_is_method_call(msg, if_name, MAS_UI_METHOD_SEND_RECOGNITION_RESULT)) { - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] Send recognition result"); + MAUI_SLOGD("[DEBUG] Send recognition result"); int pid = 0; int result = 0; @@ -212,10 +212,10 @@ static Eina_Bool ma_ui_listener_event_callback(void* data, Ecore_Fd_Handler* fd_ DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Dbus Error (%s)", err.message); + MAUI_SLOGE("[ERROR] Dbus Error (%s)", err.message); dbus_error_free(&err); } else { - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] multi-assistant ui Send recognition result : pid(%d), result(%d)", pid, result); + MAUI_SLOGD("[DEBUG] multi-assistant ui Send recognition result : pid(%d), result(%d)", pid, result); __ma_ui_cb_send_recognition_result(result); } @@ -223,7 +223,7 @@ static Eina_Bool ma_ui_listener_event_callback(void* data, Ecore_Fd_Handler* fd_ } /* MAS_UI_METHOD_SEND_RECOGNITION_RESULT */ if (dbus_message_is_method_call(msg, if_name, MAS_UI_METHOD_ENABLE_COMMON_UI)) { - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] Send recognition result"); + MAUI_SLOGD("[DEBUG] Send recognition result"); int enable = 0; dbus_message_get_args(msg, &err, @@ -231,10 +231,10 @@ static Eina_Bool ma_ui_listener_event_callback(void* data, Ecore_Fd_Handler* fd_ DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Dbus Error (%s)", err.message); + MAUI_SLOGE("[ERROR] Dbus Error (%s)", err.message); dbus_error_free(&err); } else { - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] multi-assistant ui Enable common UI : enable(%d)", enable); + MAUI_SLOGD("[DEBUG] multi-assistant ui Enable common UI : enable(%d)", enable); __ma_ui_cb_enable_common_ui((enable) ? true : false); } @@ -242,7 +242,7 @@ static Eina_Bool ma_ui_listener_event_callback(void* data, Ecore_Fd_Handler* fd_ } /* MAS_UI_METHOD_ENABLE_COMMON_UI */ else if (dbus_message_is_signal(msg, "org.freedesktop.DBus", "NameOwnerChanged")) { - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] Owner Changed"); + MAUI_SLOGD("[DEBUG] Owner Changed"); /* remove a rule for daemon error */ DBusError err; /* initialize the error value */ @@ -253,14 +253,14 @@ static Eina_Bool ma_ui_listener_event_callback(void* data, Ecore_Fd_Handler* fd_ dbus_connection_flush(g_ui_conn_listener); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "Match Error (%s)", err.message); + MAUI_SLOGE("Match Error (%s)", err.message); dbus_error_free(&err); } __ma_ui_cb_error(MA_ERROR_SERVICE_RESET, "Daemon Reset"); } /* NameOwnerChanged */ else { - SLOG(LOG_DEBUG, TAG_MAUI, "Message is NOT valid"); + MAUI_SLOGD("Message is NOT valid"); dbus_message_unref(msg); break; } @@ -289,7 +289,7 @@ static void __ma_ui_dbus_connection_free() int ma_ui_dbus_open_connection() { if (NULL != g_ui_conn_sender && NULL != g_ui_conn_listener) { - SLOG(LOG_WARN, TAG_MAUI, "already existed connection "); + MAUI_SLOGW("already existed connection "); return 0; } @@ -303,12 +303,12 @@ int ma_ui_dbus_open_connection() g_ui_conn_sender = dbus_bus_get_private(DBUS_BUS_SESSION, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "Dbus Connection Error (%s)", err.message); + MAUI_SLOGE("Dbus Connection Error (%s)", err.message); dbus_error_free(&err); } if (NULL == g_ui_conn_sender) { - SLOG(LOG_ERROR, TAG_MAUI, "Fail to get dbus connection "); + MAUI_SLOGE("Fail to get dbus connection "); return MA_ERROR_OPERATION_FAILED; } @@ -318,36 +318,36 @@ int ma_ui_dbus_open_connection() g_ui_conn_listener = dbus_bus_get_private(DBUS_BUS_SESSION, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "Dbus Connection Error (%s)", err.message); + MAUI_SLOGE("Dbus Connection Error (%s)", err.message); dbus_error_free(&err); } if (NULL == g_ui_conn_listener) { - SLOG(LOG_ERROR, TAG_MAUI, "Fail to get dbus connection "); + MAUI_SLOGE("Fail to get dbus connection "); __ma_ui_dbus_connection_free(); return MA_ERROR_OPERATION_FAILED; } dbus_connection_set_exit_on_disconnect(g_ui_conn_listener, false); - SLOG(LOG_DEBUG, TAG_MAUI, "service name is %s", MA_UI_CLIENT_SERVICE_NAME); + MAUI_SLOGD("service name is %s", MA_UI_CLIENT_SERVICE_NAME); /* register our name on the bus, and check for errors */ ret = dbus_bus_request_name(g_ui_conn_listener, MA_UI_CLIENT_SERVICE_NAME, DBUS_NAME_FLAG_REPLACE_EXISTING, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "Name Error (%s)", err.message); + MAUI_SLOGE("Name Error (%s)", err.message); dbus_error_free(&err); } if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) { - SLOG(LOG_ERROR, TAG_MAUI, "fail dbus_bus_request_name()"); + MAUI_SLOGE("fail dbus_bus_request_name()"); __ma_ui_dbus_connection_free(); return -2; } if (NULL != g_ui_fd_handler) { - SLOG(LOG_WARN, TAG_MAUI, "The handler already exists."); + MAUI_SLOGW("The handler already exists."); __ma_ui_dbus_connection_free(); return 0; } @@ -364,7 +364,7 @@ int ma_ui_dbus_open_connection() dbus_bus_add_match(g_ui_conn_listener, rule, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "Match Error (%s)", err.message); + MAUI_SLOGE("Match Error (%s)", err.message); dbus_error_free(&err); __ma_ui_dbus_connection_free(); return MA_ERROR_OPERATION_FAILED; @@ -372,17 +372,17 @@ int ma_ui_dbus_open_connection() int fd = 0; if (1 != dbus_connection_get_unix_fd(g_ui_conn_listener, &fd)) { - SLOG(LOG_ERROR, TAG_MAUI, "fail to get fd from dbus "); + MAUI_SLOGE("fail to get fd from dbus "); __ma_ui_dbus_connection_free(); return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAUI, "Get fd from dbus : %d", fd); + MAUI_SLOGD("Get fd from dbus : %d", fd); } g_ui_fd_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, (Ecore_Fd_Cb)ma_ui_listener_event_callback, g_ui_conn_listener, NULL, NULL); if (NULL == g_ui_fd_handler) { - SLOG(LOG_ERROR, TAG_MAUI, "fail to get fd handler from ecore "); + MAUI_SLOGE("fail to get fd handler from ecore "); __ma_ui_dbus_connection_free(); return MA_ERROR_OPERATION_FAILED; } @@ -410,7 +410,7 @@ int ma_ui_dbus_close_connection() dbus_bus_release_name(g_ui_conn_listener, service_name, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Dbus Error (%s)", err.message); + MAUI_SLOGE("[ERROR] Dbus Error (%s)", err.message); dbus_error_free(&err); } } @@ -426,29 +426,29 @@ int ma_ui_dbus_reconnect() ma_ui_dbus_close_connection(); if (0 != ma_ui_dbus_open_connection()) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Fail to reconnect"); + MAUI_SLOGE("[ERROR] Fail to reconnect"); return -1; } - SLOG(LOG_DEBUG, TAG_MAUI, "[DBUS] Reconnect"); + MAUI_SLOGD("[DBUS] Reconnect"); return 0; } bool sender_connected = dbus_connection_get_is_connected(g_ui_conn_sender); bool listener_connected = dbus_connection_get_is_connected(g_ui_conn_listener); - SLOG(LOG_DEBUG, TAG_MAUI, "[DBUS] Sender(%s) Listener(%s)", + MAUI_SLOGD("[DBUS] Sender(%s) Listener(%s)", sender_connected ? "Connected" : "Not connected", listener_connected ? "Connected" : "Not connected"); if (false == sender_connected || false == listener_connected) { ma_ui_dbus_close_connection(); if (0 != ma_ui_dbus_open_connection()) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Fail to reconnect"); + MAUI_SLOGE("[ERROR] Fail to reconnect"); return -1; } - SLOG(LOG_DEBUG, TAG_MAUI, "[DBUS] Reconnect"); + MAUI_SLOGD("[DBUS] Reconnect"); } return 0; @@ -465,7 +465,7 @@ int ma_ui_dbus_request_hello() MA_METHOD_HELLO); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Request vc hello : Fail to make message"); + MAUI_SLOGE("[ERROR] Request vc hello : Fail to make message"); return MA_ERROR_OPERATION_FAILED; } @@ -478,7 +478,7 @@ int ma_ui_dbus_request_hello() result_msg = dbus_connection_send_with_reply_and_block(g_ui_conn_sender, msg, -1, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_DEBUG, TAG_MAUI, "[ERROR] Dbus Error (%s)", err.message); + MAUI_SLOGD("[ERROR] Dbus Error (%s)", err.message); dbus_error_free(&err); } @@ -502,19 +502,19 @@ static int __dbus_restore_daemon() ret = ma_ui_dbus_request_hello(); if (0 != ret) { if (MA_ERROR_TIMED_OUT != ret) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Fail to restore daemon"); + MAUI_SLOGE("[ERROR] Fail to restore daemon"); break; } else { - SLOG(LOG_WARN, TAG_MAUI, "[WARNING] retry restore daemon"); + MAUI_SLOGW("[WARNING] retry restore daemon"); usleep(10000); count++; if (MA_RETRY_COUNT == count) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Fail to request"); + MAUI_SLOGE("[ERROR] Fail to request"); break; } } } else { - SLOG(LOG_ERROR, TAG_MAUI, "[SUCCESS] restore daemon"); + MAUI_SLOGE("[SUCCESS] restore daemon"); } } return ret; @@ -527,7 +527,7 @@ int ma_ui_dbus_request_initialize(int pid) bool exist = dbus_bus_name_has_owner(g_ui_conn_sender, MA_SERVER_SERVICE_NAME, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Dbus Error (%s)", err.message); + MAUI_SLOGE("[ERROR] Dbus Error (%s)", err.message); dbus_error_free(&err); } @@ -535,7 +535,7 @@ int ma_ui_dbus_request_initialize(int pid) if (false == exist) { ret = __dbus_restore_daemon(); if (MA_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Fail to restore daemon"); + MAUI_SLOGE("[ERROR] Fail to restore daemon"); return MA_ERROR_TIMED_OUT; } return MA_ERROR_OPERATION_FAILED; @@ -550,10 +550,10 @@ int ma_ui_dbus_request_initialize(int pid) MA_UI_METHOD_INITIALIZE); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] multi-assistant ui initialize : Fail to make message "); + MAUI_SLOGE("[ERROR] multi-assistant ui initialize : Fail to make message "); return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAUI, "[ERROR] multi-assistant ui initialize : pid(%d)", pid); + MAUI_SLOGD("[ERROR] multi-assistant ui initialize : pid(%d)", pid); } dbus_message_append_args(msg, @@ -567,7 +567,7 @@ int ma_ui_dbus_request_initialize(int pid) dbus_message_unref(msg); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Dbus Error (%s)", err.message); + MAUI_SLOGE("[ERROR] Dbus Error (%s)", err.message); dbus_error_free(&err); } @@ -577,7 +577,7 @@ int ma_ui_dbus_request_initialize(int pid) DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Get arguments error (%s)", err.message); + MAUI_SLOGE("[ERROR] Get arguments error (%s)", err.message); dbus_error_free(&err); result = MA_ERROR_OPERATION_FAILED; } @@ -591,16 +591,16 @@ int ma_ui_dbus_request_initialize(int pid) dbus_bus_add_match(g_ui_conn_listener, rule_err, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "Match Error (%s)", err.message); + MAUI_SLOGE("Match Error (%s)", err.message); dbus_error_free(&err); } - SLOG(LOG_DEBUG, TAG_MAUI, "[ERROR] multi-assistant ui initialize : result = %d", result); + MAUI_SLOGD("[ERROR] multi-assistant ui initialize : result = %d", result); } else { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] multi-assistant ui initialize : result = %d", result); + MAUI_SLOGE("[ERROR] multi-assistant ui initialize : result = %d", result); } } else { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Result message is NULL "); + MAUI_SLOGE("[ERROR] Result message is NULL "); ma_ui_dbus_reconnect(); result = MA_ERROR_TIMED_OUT; } @@ -614,7 +614,7 @@ int ma_ui_dbus_request_deinitialize(int pid) bool exist = dbus_bus_name_has_owner(g_ui_conn_sender, MA_SERVER_SERVICE_NAME, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Dbus Error (%s)", err.message); + MAUI_SLOGE("[ERROR] Dbus Error (%s)", err.message); dbus_error_free(&err); } @@ -622,7 +622,7 @@ int ma_ui_dbus_request_deinitialize(int pid) if (false == exist) { ret = __dbus_restore_daemon(); if (MA_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Fail to restore daemon"); + MAUI_SLOGE("[ERROR] Fail to restore daemon"); return MA_ERROR_TIMED_OUT; } return MA_ERROR_OPERATION_FAILED; @@ -635,7 +635,7 @@ int ma_ui_dbus_request_deinitialize(int pid) dbus_connection_flush(g_ui_conn_listener); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "Match Error (%s)", err.message); + MAUI_SLOGE("Match Error (%s)", err.message); dbus_error_free(&err); return MA_ERROR_OPERATION_FAILED; } @@ -649,10 +649,10 @@ int ma_ui_dbus_request_deinitialize(int pid) MA_UI_METHOD_DEINITIALIZE); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] multi-assistant ui finalize : Fail to make message "); + MAUI_SLOGE("[ERROR] multi-assistant ui finalize : Fail to make message "); return MA_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] multi-assistant ui finalize : pid(%d)", pid); + MAUI_SLOGD("[DEBUG] multi-assistant ui finalize : pid(%d)", pid); } dbus_message_append_args(msg, DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID); @@ -664,7 +664,7 @@ int ma_ui_dbus_request_deinitialize(int pid) dbus_message_unref(msg); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Dbus Error (%s)", err.message); + MAUI_SLOGE("[ERROR] Dbus Error (%s)", err.message); dbus_error_free(&err); } @@ -674,7 +674,7 @@ int ma_ui_dbus_request_deinitialize(int pid) DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Get arguments error (%s)", err.message); + MAUI_SLOGE("[ERROR] Get arguments error (%s)", err.message); dbus_error_free(&err); result = MA_ERROR_OPERATION_FAILED; } @@ -682,12 +682,12 @@ int ma_ui_dbus_request_deinitialize(int pid) dbus_message_unref(result_msg); if (0 == result) { - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] multi-assistant ui finalize : result = %d", result); + MAUI_SLOGD("[DEBUG] multi-assistant ui finalize : result = %d", result); } else { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] multi-assistant ui finalize : result = %d", result); + MAUI_SLOGE("[ERROR] multi-assistant ui finalize : result = %d", result); } } else { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Result message is NULL "); + MAUI_SLOGE("[ERROR] Result message is NULL "); ma_ui_dbus_reconnect(); result = MA_ERROR_TIMED_OUT; } @@ -702,7 +702,7 @@ int ma_ui_dbus_request_change_assistant(const char *appid) bool exist = dbus_bus_name_has_owner(g_ui_conn_sender, MA_SERVER_SERVICE_NAME, &err); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Dbus Error (%s)", err.message); + MAUI_SLOGE("[ERROR] Dbus Error (%s)", err.message); dbus_error_free(&err); } @@ -710,7 +710,7 @@ int ma_ui_dbus_request_change_assistant(const char *appid) if (false == exist) { ret = __dbus_restore_daemon(); if (MA_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Fail to restore daemon"); + MAUI_SLOGE("[ERROR] Fail to restore daemon"); return MA_ERROR_TIMED_OUT; } return MA_ERROR_OPERATION_FAILED; @@ -725,7 +725,7 @@ int ma_ui_dbus_request_change_assistant(const char *appid) MA_UI_METHOD_CHANGE_ASSISTANT); if (NULL == msg) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] multi-assistant ui change assistant : Fail to make message"); + MAUI_SLOGE("[ERROR] multi-assistant ui change assistant : Fail to make message"); return MA_ERROR_OPERATION_FAILED; } @@ -737,7 +737,7 @@ int ma_ui_dbus_request_change_assistant(const char *appid) dbus_message_unref(msg); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Dbus Error (%s)", err.message); + MAUI_SLOGE("[ERROR] Dbus Error (%s)", err.message); dbus_error_free(&err); } @@ -747,7 +747,7 @@ int ma_ui_dbus_request_change_assistant(const char *appid) DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Get arguments error (%s)", err.message); + MAUI_SLOGE("[ERROR] Get arguments error (%s)", err.message); dbus_error_free(&err); result = MA_ERROR_OPERATION_FAILED; } @@ -755,12 +755,12 @@ int ma_ui_dbus_request_change_assistant(const char *appid) dbus_message_unref(result_msg); if (0 == result) { - SLOG(LOG_DEBUG, TAG_MAUI, "[DEBUG] multi-assistant ui change assistant : result = %d", result); + MAUI_SLOGD("[DEBUG] multi-assistant ui change assistant : result = %d", result); } else { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] multi-assistant ui change assistant : result = %d", result); + MAUI_SLOGE("[ERROR] multi-assistant ui change assistant : result = %d", result); } } else { - SLOG(LOG_ERROR, TAG_MAUI, "[ERROR] Result message is NULL "); + MAUI_SLOGE("[ERROR] Result message is NULL "); ma_ui_dbus_reconnect(); result = MA_ERROR_TIMED_OUT; } diff --git a/common/ma_config_mgr.c b/common/ma_config_mgr.c index 2542d61..2b2c38c 100644 --- a/common/ma_config_mgr.c +++ b/common/ma_config_mgr.c @@ -63,7 +63,7 @@ int ma_config_mgr_parse_assistant_info(ma_ui_assistant_info_cb callback, void* u } if (MA_RETRY_COUNT == retry_count++) { - SLOG(LOG_ERROR, TAG_MACONFIG, "[ERROR] Fail to parse file error : %s", path); + MA_SLOGE("[ERROR] Fail to parse file error : %s", path); xmlCleanupParser(); return -1; } @@ -72,20 +72,20 @@ int ma_config_mgr_parse_assistant_info(ma_ui_assistant_info_cb callback, void* u cur = xmlDocGetRootElement(doc); if (cur == NULL) { - SLOG(LOG_ERROR, TAG_MACONFIG, "[ERROR] Empty document"); + MA_SLOGE("[ERROR] Empty document"); xmlFreeDoc(doc); return -1; } if (xmlStrcmp(cur->name, (const xmlChar *) MA_TAG_ASSISTANT_BASE)) { - SLOG(LOG_ERROR, TAG_MACONFIG, "[ERROR] The wrong type, root node is NOT %s", MA_TAG_ASSISTANT_BASE); + MA_SLOGE("[ERROR] The wrong type, root node is NOT %s", MA_TAG_ASSISTANT_BASE); xmlFreeDoc(doc); return -1; } cur = cur->xmlChildrenNode; if (cur == NULL) { - SLOG(LOG_ERROR, TAG_MACONFIG, "[ERROR] Empty document"); + MA_SLOGE("[ERROR] Empty document"); xmlFreeDoc(doc); return -1; } @@ -94,7 +94,7 @@ int ma_config_mgr_parse_assistant_info(ma_ui_assistant_info_cb callback, void* u ma_assistant_info_s* temp; temp = (ma_assistant_info_s*)calloc(1, sizeof(ma_assistant_info_s)); if (NULL == temp) { - SLOG(LOG_ERROR, TAG_MACONFIG, "[ERROR] Fail to allocate memory"); + MA_SLOGE("[ERROR] Fail to allocate memory"); xmlFreeDoc(doc); return MA_ERROR_OUT_OF_MEMORY; } @@ -115,7 +115,7 @@ int ma_config_mgr_parse_assistant_info(ma_ui_assistant_info_cb callback, void* u key = xmlNodeGetContent(child_node); if (key) { temp->supported_lang[temp->cnt_lang++] = strdup((const char*)key); - SLOG(LOG_DEBUG, TAG_MACONFIG, "Language : %s", key); + MA_SLOGD("Language : %s", key); xmlFree(key); } } @@ -129,7 +129,7 @@ int ma_config_mgr_parse_assistant_info(ma_ui_assistant_info_cb callback, void* u key = xmlNodeGetContent(child_node); if (key) { temp->wakeup_list[temp->cnt_wakeup++] = strdup((const char*)key); - SLOG(LOG_DEBUG, TAG_MACONFIG, "Wakeup Word : %s", key); + MA_SLOGD("Wakeup Word : %s", key); xmlFree(key); } } @@ -140,21 +140,21 @@ int ma_config_mgr_parse_assistant_info(ma_ui_assistant_info_cb callback, void* u key = xmlNodeGetContent(cur); if (key) { temp->name = strdup((const char*)key); - SLOG(LOG_DEBUG, TAG_MACONFIG, "Name : %s", key); + MA_SLOGD("Name : %s", key); xmlFree(key); } } else if (cur->name && 0 == xmlStrcmp(cur->name, (const xmlChar*)MA_TAG_ASSISTANT_APPID)) { key = xmlNodeGetContent(cur); if (key) { temp->app_id = strdup((const char*)key); - SLOG(LOG_DEBUG, TAG_MACONFIG, "ID : %s", key); + MA_SLOGD("ID : %s", key); xmlFree(key); } } else if (cur->name && 0 == xmlStrcmp(cur->name, (const xmlChar*)MA_TAG_ASSISTANT_ICON_PATH)) { key = xmlNodeGetContent(cur); if (key) { temp->icon_path = strdup((const char*)key); - SLOG(LOG_DEBUG, TAG_MACONFIG, "Icon Path : %s", key); + MA_SLOGD("Icon Path : %s", key); xmlFree(key); } } @@ -207,7 +207,7 @@ int ma_config_mgr_get_assistant_info(ma_ui_assistant_info_cb callback, void* use if (0 == strcmp(dir->d_name + strlen(dir->d_name) - strlen(suffix), suffix)) { char fullpath[_POSIX_PATH_MAX]; snprintf(fullpath, _POSIX_PATH_MAX - 1, "%s/%s", MA_ASSISTANT_INFO, dir->d_name); - SLOG(LOG_DEBUG, TAG_MAUI, "Parsing file : %s\n", fullpath); + MAUI_SLOGD("Parsing file : %s\n", fullpath); ma_config_mgr_parse_assistant_info(callback, user_data, fullpath); } } diff --git a/common/ma_main.h b/common/ma_main.h index 7ff215b..0027fbd 100644 --- a/common/ma_main.h +++ b/common/ma_main.h @@ -40,7 +40,39 @@ extern "C" *************************************************************************************/ #define TAG_MAC "mac" /* Multi-assistant client log tag */ #define TAG_MAUI "maui" /* Multi-assistant UI client log tag */ -#define TAG_MACONFIG "mainfo" /* Multi-assistant config lib log tag */ + +/************************************************************************************** + *** Logging macros + *************************************************************************************/ +#define MA_SECURE_LOG_(prio, tag, fmt, arg...) \ + ({ do { \ + __dlog_print(LOG_ID_MAIN, prio, tag, "%s: %s(%d) > [SECURE_LOG] " fmt, __MODULE__, __func__, __LINE__, ##arg); \ + } while (0); }) + +#define MA_LOG_(prio, tag, fmt, arg...) \ + ({ do { \ + dlog_print(prio, tag, "%s: %s(%d) > " fmt, __MODULE__, __func__, __LINE__, ##arg); \ + } while (0); }) + +#define MA_LOGD(fmt, args...) MA_LOG_(DLOG_DEBUG, TAG_MAC, fmt, ##args) +#define MA_LOGI(fmt, args...) MA_LOG_(DLOG_INFO, TAG_MAC, fmt, ##args) +#define MA_LOGW(fmt, args...) MA_LOG_(DLOG_WARN, TAG_MAC, fmt, ##args) +#define MA_LOGE(fmt, args...) MA_LOG_(DLOG_ERROR, TAG_MAC, fmt, ##args) + +#define MA_SLOGD(fmt, args...) MA_SECURE_LOG_(DLOG_DEBUG, TAG_MAC, fmt, ##args) +#define MA_SLOGI(fmt, args...) MA_SECURE_LOG_(DLOG_INFO, TAG_MAC, fmt, ##args) +#define MA_SLOGW(fmt, args...) MA_SECURE_LOG_(DLOG_WARN, TAG_MAC, fmt, ##args) +#define MA_SLOGE(fmt, args...) MA_SECURE_LOG_(DLOG_ERROR, TAG_MAC, fmt, ##args) + +#define MAUI_LOGD(fmt, args...) MA_LOG_(DLOG_DEBUG, TAG_MAUI, fmt, ##args) +#define MAUI_LOGI(fmt, args...) MA_LOG_(DLOG_INFO, TAG_MAUI, fmt, ##args) +#define MAUI_LOGW(fmt, args...) MA_LOG_(DLOG_WARN, TAG_MAUI, fmt, ##args) +#define MAUI_LOGE(fmt, args...) MA_LOG_(DLOG_ERROR, TAG_MAUI, fmt, ##args) + +#define MAUI_SLOGD(fmt, args...) MA_SECURE_LOG_(DLOG_DEBUG, TAG_MAUI, fmt, ##args) +#define MAUI_SLOGI(fmt, args...) MA_SECURE_LOG_(DLOG_INFO, TAG_MAUI, fmt, ##args) +#define MAUI_SLOGW(fmt, args...) MA_SECURE_LOG_(DLOG_WARN, TAG_MAUI, fmt, ##args) +#define MAUI_SLOGE(fmt, args...) MA_SECURE_LOG_(DLOG_ERROR, TAG_MAUI, fmt, ##args) /************************************************************************************** *** Structures for multi-assistant handle