typedef enum {
streaming_data_type_audio_data,
streaming_data_type_streaming_section
-} streaming_data_type_e;
+} ap_streaming_data_type_e;
typedef struct {
unsigned int streaming_data_size;
int streaming_data_type;
int streaming_data_serial;
-} streaming_data_header;
+} ap_streaming_data_header;
typedef struct {
int event;
unsigned int data_size;
-} streaming_data_audio_data_header;
+} ap_streaming_data_audio_data_header;
typedef struct {
int section;
-} streaming_data_streaming_section_header;
+} ap_streaming_data_streaming_section_header;
static const char *message_port = "ma_streaming_port";
static int g_local_port_id = -1;
bundle_get_byte(message, "content", (void**)(&v), &size);
if (size > STREAMING_BUFFER_SIZE) {
- MA_SLOGE("[ERROR] bundle contains data bigger than %d : %zu", STREAMING_BUFFER_SIZE, size);
+ MA_SLOGE("[AP_ERROR] bundle contains data bigger than %d : %zu", STREAMING_BUFFER_SIZE, size);
return;
} else {
if (v)
memcpy(pending_buffer + pending_buffer_size, buffer, size);
pending_buffer_size += size;
- while (pending_buffer_size >= sizeof(streaming_data_header)) {
- streaming_data_header header;
- memcpy(&header, pending_buffer, sizeof(streaming_data_header));
+ while (pending_buffer_size >= sizeof(ap_streaming_data_header)) {
+ ap_streaming_data_header header;
+ memcpy(&header, pending_buffer, sizeof(ap_streaming_data_header));
if (pending_buffer_size >= header.streaming_data_size) {
static int last_serial = 0;
if (header.streaming_data_serial != last_serial + 1) {
- MA_SLOGE("[ERROR] SERIAL MISMATCH in [%d] : %d => %d",
+ MA_SLOGE("[AP_ERROR] SERIAL MISMATCH in [%d] : %d => %d",
header.streaming_data_type, last_serial, header.streaming_data_serial);
}
last_serial = header.streaming_data_serial;
if (streaming_data_type_audio_data == header.streaming_data_type) {
- streaming_data_audio_data_header audio_data_header;
- memcpy(&audio_data_header, pending_buffer + sizeof(streaming_data_header),
- sizeof(streaming_data_audio_data_header));
+ ap_streaming_data_audio_data_header audio_data_header;
+ memcpy(&audio_data_header, pending_buffer + sizeof(ap_streaming_data_header),
+ sizeof(ap_streaming_data_audio_data_header));
static bool start_received = false;
if (audio_data_header.event == MA_AUDIO_STREAMING_EVENT_CONTINUE && !start_received) {
- MA_SLOGE("[ERROR] CONTINUE without START, forcing to emit START event");
+ MA_SLOGE("[AP_ERROR] CONTINUE without START, forcing to emit START event");
audio_data_header.event = MA_AUDIO_STREAMING_EVENT_START;
}
any useful information to the client application */
if (g_streaming_requested || MA_AUDIO_STREAMING_EVENT_CONTINUE != audio_data_header.event) {
__ma_ap_cb_audio_streaming(audio_data_header.event,
- pending_buffer + sizeof(streaming_data_header) + sizeof(streaming_data_audio_data_header),
+ pending_buffer + sizeof(ap_streaming_data_header) + sizeof(ap_streaming_data_audio_data_header),
audio_data_header.data_size);
if (0 == header.streaming_data_serial % 50 || MA_AUDIO_STREAMING_EVENT_CONTINUE != audio_data_header.event) {
- MA_SLOGE("__ma_ap_cb_audio_streaming() called, event and serial : %d %d",
+ MA_SLOGE("[AP_ERROR] __ma_ap_cb_audio_streaming() called, event and serial : %d %d",
audio_data_header.event, header.streaming_data_serial);
}
}
} else if (streaming_data_type_streaming_section == header.streaming_data_type) {
- streaming_data_streaming_section_header streaming_section_header;
- memcpy(&streaming_section_header, pending_buffer + sizeof(streaming_data_header),
- sizeof(streaming_data_streaming_section_header));
+ ap_streaming_data_streaming_section_header streaming_section_header;
+ memcpy(&streaming_section_header, pending_buffer + sizeof(ap_streaming_data_header),
+ sizeof(ap_streaming_data_streaming_section_header));
__ma_ap_cb_audio_streaming_data_section_changed(streaming_section_header.section);
}
}
}
-static int streaming_ipc_initialize()
+static int ap_streaming_ipc_initialize()
{
#if USE_TRUSTED_MESSAGE_PORT
int port_id = message_port_register_trusted_local_port(message_port, message_port_cb, NULL);
return 0;
}
-static int streaming_ipc_deinitialize()
+static int ap_streaming_ipc_deinitialize()
{
#if USE_TRUSTED_MESSAGE_PORT
if (-1 != g_local_port_id) message_port_unregister_trusted_local_port(g_local_port_id);
{
/* For now assume streaming is requested when initialized */
g_streaming_requested = true;
- return streaming_ipc_initialize();
+ return ap_streaming_ipc_initialize();
}
int ma_ap_dbus_close_connection()
{
g_streaming_requested = false;
- return streaming_ipc_deinitialize();
+ return ap_streaming_ipc_deinitialize();
}
//LCOV_EXCL_STOP
return result;
}
+static int __send_dbus_message(DBusMessage* msg)
+{
+ dbus_message_set_no_reply(msg, TRUE);
+
+ DBusError error;
+ dbus_error_init (&error);
+ if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
+ //LCOV_EXCL_START
+ if (dbus_error_is_set (&error)) {
+ MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE
+ dbus_error_free (&error);
+ } else {
+ MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE
+ }
+ return MA_ERROR_OPERATION_FAILED;
+ //LCOV_EXCL_STOP
+ } else {
+ MA_SLOGD("[Dbus DEBUG] Success to Send"); //LCOV_EXCL_LINE
+ dbus_connection_flush(g_conn_sender);
+ }
+
+ dbus_message_unref(msg);
+
+ return 0;
+}
+
int ma_dbus_request_initialize(int pid)
{
if (0 != __dbus_check()) {
DBUS_TYPE_INT32, &pid,
DBUS_TYPE_INVALID);
- DBusError err;
- dbus_error_init(&err);
-
- dbus_message_set_no_reply(msg, TRUE);
-
- if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) {
- //LCOV_EXCL_START
- MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE
+ if (MA_ERROR_OPERATION_FAILED == __send_dbus_message(msg))
return MA_ERROR_OPERATION_FAILED;
- //LCOV_EXCL_STOP
- } else {
- MA_SLOGD("[Dbus DEBUG] Success to Send"); //LCOV_EXCL_LINE
- dbus_connection_flush(g_conn_sender);
- }
-
- dbus_message_unref(msg);
/* add a rule for daemon error */
char rule[256] = {0, };
snprintf(rule, 256, "sender='org.freedesktop.DBus',path='/org/freedesktop/DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',type='signal',arg0='%s'", MA_SERVER_SERVICE_INTERFACE);
+
+ DBusError err;
+ dbus_error_init (&err);
dbus_bus_add_match(g_conn_listener, rule, &err);
if (dbus_error_is_set(&err)) {
DBUS_TYPE_STRING, &asr_result,
DBUS_TYPE_INVALID);
- dbus_message_set_no_reply(msg, TRUE);
-
- if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) {
- //LCOV_EXCL_START
- MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE
- return MA_ERROR_OPERATION_FAILED;
- //LCOV_EXCL_STOP
- } else {
- MA_SLOGD("[Dbus DEBUG] Success to Send"); //LCOV_EXCL_LINE
- dbus_connection_flush(g_conn_sender);
- }
-
- dbus_message_unref(msg);
-
- return 0;
+ return __send_dbus_message(msg);
}
int ma_dbus_send_result(int pid, const char* display_text, const char* utterance_text, const char* result_json)
DBUS_TYPE_STRING, &tmp_result_json,
DBUS_TYPE_INVALID);
- dbus_message_set_no_reply(msg, TRUE);
-
- if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) {
- //LCOV_EXCL_START
- MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE
- if (NULL != tmp_disp_text) {
- free(tmp_disp_text);
- tmp_disp_text = NULL;
- }
- if (NULL != tmp_utt_text) {
- free(tmp_utt_text);
- tmp_utt_text = NULL;
- }
- if (NULL != tmp_result_json) {
- free(tmp_result_json);
- tmp_result_json = NULL;
- }
- return MA_ERROR_OPERATION_FAILED;
- //LCOV_EXCL_STOP
- } else {
- MA_SLOGD("[Dbus DEBUG] Success to Send"); //LCOV_EXCL_LINE
- dbus_connection_flush(g_conn_sender);
- }
-
- dbus_message_unref(msg);
+ int ret = __send_dbus_message(msg);
if (NULL != tmp_disp_text) {
free(tmp_disp_text);
tmp_result_json = NULL;
}
- return 0;
+ return ret;
}
int ma_dbus_send_recognition_result(int pid, ma_recognition_result_event_e result)
DBUS_TYPE_INT32, &result,
DBUS_TYPE_INVALID);
- dbus_message_set_no_reply(msg, TRUE);
-
- DBusError error;
- dbus_error_init (&error);
- if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
- //LCOV_EXCL_START
- if (dbus_error_is_set (&error)) {
- MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE
- dbus_error_free (&error);
- } else {
- MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE
- }
- return MA_ERROR_OPERATION_FAILED;
- //LCOV_EXCL_STOP
- } else {
- MA_SLOGD("[Dbus DEBUG] Success to Send"); //LCOV_EXCL_LINE
- dbus_connection_flush(g_conn_sender);
- }
-
- dbus_message_unref(msg);
-
- return 0;
+ return __send_dbus_message(msg);
}
int ma_dbus_start_streaming_audio_data(int pid, ma_audio_streaming_data_type_e type)
DBUS_TYPE_INT32, &type,
DBUS_TYPE_INVALID);
- dbus_message_set_no_reply(msg, TRUE);
+ int ret = __send_dbus_message(msg);
- DBusError error;
- dbus_error_init (&error);
- if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
- //LCOV_EXCL_START
- if (dbus_error_is_set (&error)) {
- MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE
- dbus_error_free (&error);
- } else {
- MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE
- }
- return MA_ERROR_OPERATION_FAILED;
- //LCOV_EXCL_STOP
- } else {
- MA_SLOGD("[Dbus DEBUG] Success to Send"); //LCOV_EXCL_LINE
- dbus_connection_flush(g_conn_sender);
- }
-
- dbus_message_unref(msg);
+ if (MA_ERROR_OPERATION_FAILED != ret)
+ g_streaming_requested = true;
- g_streaming_requested = true;
-
- return 0;
+ return ret;
}
int ma_dbus_stop_streaming_audio_data(int pid, ma_audio_streaming_data_type_e type)
DBUS_TYPE_INT32, &type,
DBUS_TYPE_INVALID);
- dbus_message_set_no_reply(msg, TRUE);
-
- DBusError error;
- dbus_error_init (&error);
- if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
- //LCOV_EXCL_START
- if (dbus_error_is_set (&error)) {
- MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE
- dbus_error_free (&error);
- } else {
- MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE
- }
- return MA_ERROR_OPERATION_FAILED;
- //LCOV_EXCL_STOP
- } else {
- MA_SLOGD("[Dbus DEBUG] Success to Send"); //LCOV_EXCL_LINE
- dbus_connection_flush(g_conn_sender);
- }
-
- dbus_message_unref(msg);
+ int ret = __send_dbus_message(msg);
- g_streaming_requested = false;
+ if (MA_ERROR_OPERATION_FAILED != ret)
+ g_streaming_requested = false;
- return 0;
+ return ret;
}
int ma_dbus_update_voice_feedback_state(int pid, ma_voice_feedback_state_e state)
DBUS_TYPE_INT32, &state,
DBUS_TYPE_INVALID);
- dbus_message_set_no_reply(msg, TRUE);
-
- DBusError error;
- dbus_error_init (&error);
- if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
- //LCOV_EXCL_START
- if (dbus_error_is_set (&error)) {
- MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE
- dbus_error_free (&error);
- } else {
- MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE
- }
- return MA_ERROR_OPERATION_FAILED;
- //LCOV_EXCL_STOP
- } else {
- MA_SLOGD("[Dbus DEBUG] Success to Send"); //LCOV_EXCL_LINE
- dbus_connection_flush(g_conn_sender);
- }
-
- dbus_message_unref(msg);
-
- return 0;
+ return __send_dbus_message(msg);
}
int ma_dbus_send_assistant_specific_command(int pid, const char* command)
DBUS_TYPE_STRING, &tmp_command,
DBUS_TYPE_INVALID);
- dbus_message_set_no_reply(msg, TRUE);
-
- DBusError error;
- dbus_error_init (&error);
- if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
- //LCOV_EXCL_START
-
- if (NULL != tmp_command) {
- free(tmp_command);
- tmp_command = NULL;
- }
-
- if (dbus_error_is_set (&error)) {
- MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE
- dbus_error_free (&error);
- } else {
- MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE
- }
- return MA_ERROR_OPERATION_FAILED;
- //LCOV_EXCL_STOP
- } else {
- MA_SLOGD("[Dbus DEBUG] Success to Send"); //LCOV_EXCL_LINE
- dbus_connection_flush(g_conn_sender);
- }
+ int ret = __send_dbus_message(msg);
if (NULL != tmp_command) {
free(tmp_command);
tmp_command = NULL;
}
- dbus_message_unref(msg);
-
- return 0;
+ return ret;
}
int ma_dbus_set_background_volume(int pid, double ratio)
DBUS_TYPE_DOUBLE, &ratio,
DBUS_TYPE_INVALID);
- dbus_message_set_no_reply(msg, TRUE);
-
- DBusError error;
- dbus_error_init (&error);
- if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
- //LCOV_EXCL_START
-
- if (dbus_error_is_set (&error)) {
- MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE
- dbus_error_free (&error);
- } else {
- MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE
- }
- return MA_ERROR_OPERATION_FAILED;
- //LCOV_EXCL_STOP
- } else {
- MA_SLOGD("[Dbus DEBUG] Success to Send"); //LCOV_EXCL_LINE
- dbus_connection_flush(g_conn_sender);
- }
-
- dbus_message_unref(msg);
-
- return 0;
+ return __send_dbus_message(msg);
}
int ma_dbus_set_preprocessing_allow_mode(int pid, ma_preprocessing_allow_mode_e mode, const char *app_id)
DBUS_TYPE_STRING, &tmp_app_id,
DBUS_TYPE_INVALID);
- dbus_message_set_no_reply(msg, TRUE);
-
- DBusError error;
- dbus_error_init (&error);
- if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
- //LCOV_EXCL_START
-
- if (dbus_error_is_set (&error)) {
- MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE
- dbus_error_free (&error);
- } else {
- MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE
- }
- if (NULL != tmp_app_id) {
- free(tmp_app_id);
- tmp_app_id = NULL;
- }
- return MA_ERROR_OPERATION_FAILED;
- //LCOV_EXCL_STOP
- } else {
- MA_SLOGD("[Dbus DEBUG] Success to Send"); //LCOV_EXCL_LINE
- dbus_connection_flush(g_conn_sender);
- }
-
- dbus_message_unref(msg);
+ int ret = __send_dbus_message(msg);
if (NULL != tmp_app_id) {
free(tmp_app_id);
tmp_app_id = NULL;
}
- return 0;
+ return ret;
}
int ma_dbus_send_preprocessing_result(int pid, bool result)
DBUS_TYPE_INT32, &tmp_result,
DBUS_TYPE_INVALID);
- dbus_message_set_no_reply(msg, TRUE);
-
- DBusError error;
- dbus_error_init (&error);
- if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
- //LCOV_EXCL_START
- if (dbus_error_is_set (&error)) {
- MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE
- dbus_error_free (&error);
- } else {
- MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE
- }
- return MA_ERROR_OPERATION_FAILED;
- //LCOV_EXCL_STOP
- } else {
- MA_SLOGD("[Dbus DEBUG] Success to Send"); //LCOV_EXCL_LINE
- dbus_connection_flush(g_conn_sender);
- }
-
- dbus_message_unref(msg);
-
- return 0;
+ return __send_dbus_message(msg);
}
int ma_dbus_set_wake_word_audio_require_flag(int pid, bool require)
DBUS_TYPE_INT32, &tmp_require,
DBUS_TYPE_INVALID);
- dbus_message_set_no_reply(msg, TRUE);
-
- DBusError error;
- dbus_error_init (&error);
- if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
- //LCOV_EXCL_START
- if (dbus_error_is_set (&error)) {
- MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE
- dbus_error_free (&error);
- } else {
- MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE
- }
- return MA_ERROR_OPERATION_FAILED;
- //LCOV_EXCL_STOP
- } else {
- MA_SLOGD("[Dbus DEBUG] Success to Send"); //LCOV_EXCL_LINE
- dbus_connection_flush(g_conn_sender);
- }
-
- dbus_message_unref(msg);
-
- return 0;
+ return __send_dbus_message(msg);
}
int ma_dbus_set_assistant_wakeup_language(int pid, const char* language)
DBUS_TYPE_STRING, &tmp_language,
DBUS_TYPE_INVALID);
- dbus_message_set_no_reply(msg, TRUE);
-
- DBusError error;
- dbus_error_init (&error);
- if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
- //LCOV_EXCL_START
- if (dbus_error_is_set (&error)) {
- MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE
- dbus_error_free (&error);
- } else {
- MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE
- }
- if (NULL != tmp_language) {
- free(tmp_language);
- tmp_language = NULL;
- }
- return MA_ERROR_OPERATION_FAILED;
- //LCOV_EXCL_STOP
- } else {
- MA_SLOGD("[Dbus DEBUG] Success to Send"); //LCOV_EXCL_LINE
- dbus_connection_flush(g_conn_sender);
- }
+ int ret = __send_dbus_message(msg);
if (NULL != tmp_language) {
free(tmp_language);
tmp_language = NULL;
}
- dbus_message_unref(msg);
-
- return 0;
+ return ret;
}
-int ma_dbus_add_wake_word(int pid, const char* wake_word, const char* language)
+static int __send_wake_word_message(int pid, const char* wake_word, const char* language, bool is_add_message)
{
if (0 != __dbus_check()) {
return MA_ERROR_OPERATION_FAILED;
MA_SERVER_SERVICE_NAME,
MA_SERVER_SERVICE_OBJECT_PATH,
MA_SERVER_SERVICE_INTERFACE,
- MA_METHOD_ADD_WAKE_WORD);
+ is_add_message ? MA_METHOD_ADD_WAKE_WORD : MA_METHOD_REMOVE_WAKE_WORD);
if (NULL == msg) {
MA_SLOGE("@@ Request multi-assistant add wake word : Fail to make message"); //LCOV_EXCL_LINE
return MA_ERROR_OPERATION_FAILED;
} else {
- MA_SLOGD("[DEBUG] multi-assistant add wake word"); //LCOV_EXCL_LINE
+ if (is_add_message)
+ MA_SLOGD("[DEBUG] multi-assistant add wake word"); //LCOV_EXCL_LINE
+ else
+ MA_SLOGD("[DEBUG] multi-assistant remove wake word"); //LCOV_EXCL_LINE
}
char* tmp_wake_word = NULL;
DBUS_TYPE_STRING, &tmp_language,
DBUS_TYPE_INVALID);
- dbus_message_set_no_reply(msg, TRUE);
-
- DBusError error;
- dbus_error_init (&error);
- if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
- //LCOV_EXCL_START
- if (dbus_error_is_set (&error)) {
- MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE
- dbus_error_free (&error);
- } else {
- MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE
- }
- if (NULL != tmp_wake_word) {
- free(tmp_wake_word);
- tmp_wake_word = NULL;
- }
- if (NULL != tmp_language) {
- free(tmp_language);
- tmp_language = NULL;
- }
- return MA_ERROR_OPERATION_FAILED;
- //LCOV_EXCL_STOP
- } else {
- MA_SLOGD("[Dbus DEBUG] Success to Send"); //LCOV_EXCL_LINE
- dbus_connection_flush(g_conn_sender);
- }
+ int ret = __send_dbus_message(msg);
if (NULL != tmp_wake_word) {
free(tmp_wake_word);
tmp_language = NULL;
}
- dbus_message_unref(msg);
+ return ret;
+}
- return 0;
+int ma_dbus_add_wake_word(int pid, const char* wake_word, const char* language)
+{
+ return __send_wake_word_message(pid, wake_word, language, true);
}
int ma_dbus_remove_wake_word(int pid, const char* wake_word, const char* language)
{
- if (0 != __dbus_check()) {
- return MA_ERROR_OPERATION_FAILED;
- }
-
- DBusMessage* msg;
-
- msg = dbus_message_new_method_call(
- MA_SERVER_SERVICE_NAME,
- MA_SERVER_SERVICE_OBJECT_PATH,
- MA_SERVER_SERVICE_INTERFACE,
- MA_METHOD_REMOVE_WAKE_WORD);
-
- if (NULL == msg) {
- MA_SLOGE("@@ Request multi-assistant remove wake word : Fail to make message"); //LCOV_EXCL_LINE
- return MA_ERROR_OPERATION_FAILED;
- } else {
- MA_SLOGD("[DEBUG] multi-assistant remove wake word"); //LCOV_EXCL_LINE
- }
-
- char* tmp_wake_word = NULL;
- if (NULL != wake_word) {
- tmp_wake_word = strdup(wake_word);
- } else {
- tmp_wake_word = strdup("#NULL");
- }
-
- char* tmp_language = NULL;
- if (NULL != language) {
- tmp_language = strdup(language);
- } else {
- tmp_language = strdup("#NULL");
- }
-
- dbus_message_append_args(msg,
- DBUS_TYPE_INT32, &pid,
- DBUS_TYPE_STRING, &tmp_wake_word,
- DBUS_TYPE_STRING, &tmp_language,
- DBUS_TYPE_INVALID);
-
- dbus_message_set_no_reply(msg, TRUE);
-
- DBusError error;
- dbus_error_init (&error);
- if (!dbus_connection_send(g_conn_sender, msg, NULL)) {
- //LCOV_EXCL_START
- if (dbus_error_is_set (&error)) {
- MA_SLOGE("[Dbus ERROR] Fail to Send : %s", error.message); //LCOV_EXCL_LINE
- dbus_error_free (&error);
- } else {
- MA_SLOGE("[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE
- }
- if (NULL != tmp_wake_word) {
- free(tmp_wake_word);
- tmp_wake_word = NULL;
- }
- if (NULL != tmp_language) {
- free(tmp_language);
- tmp_language = NULL;
- }
- return MA_ERROR_OPERATION_FAILED;
- //LCOV_EXCL_STOP
- } else {
- MA_SLOGD("[Dbus DEBUG] Success to Send"); //LCOV_EXCL_LINE
- dbus_connection_flush(g_conn_sender);
- }
-
- if (NULL != tmp_wake_word) {
- free(tmp_wake_word);
- tmp_wake_word = NULL;
- }
- if (NULL != tmp_language) {
- free(tmp_language);
- tmp_language = NULL;
- }
-
- dbus_message_unref(msg);
-
- return 0;
+ return __send_wake_word_message(pid, wake_word, language, false);
}