Add missing handler for preprocessing result message 35/214035/3
authorJi-hoon Lee <dalton.lee@samsung.com>
Tue, 17 Sep 2019 07:12:26 +0000 (16:12 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Wed, 18 Sep 2019 01:58:31 +0000 (10:58 +0900)
Change-Id: Ia462aab4a2665147ff307d3d7471bc7705de26ca

inc/multi_assistant_main.h
inc/multi_assistant_service.h
src/multi_assistant_dbus.c
src/multi_assistant_dbus_server.c
src/multi_assistant_dbus_server.h
src/multi_assistant_service.c

index 89cad535a88774f02338da6370396dc85e669401..4fcc7efa0186b54fd2c773a91af7b98d58146aff 100644 (file)
@@ -64,6 +64,7 @@
 #define MA_METHOD_SEND_ASSISTANT_SPECIFIC_COMMAND      "ma_method_send_assistant_specific_command"
 #define MA_METHOD_SET_BACKGROUND_VOLUME                                "ma_method_set_background_volume"
 #define MA_METHOD_SET_PREPROCESSING_ALLOW_MODE         "ma_method_set_preprocessing_allow_mode"
+#define MA_METHOD_SEND_PREPROCESSING_RESULT                    "ma_method_send_preprocessing_result"
 #define MA_METHOD_ERROR                                                                "ma_method_error"
 
 #define MA_UI_METHOD_INITIALIZE                                                "ma_ui_method_initialize"
index 60b036165b3157897a88f5e53b68dfcbba5dce76..862dcd15a35c9473fef4dae372a98bdbc74997dd 100644 (file)
@@ -55,6 +55,8 @@ int mas_client_set_background_volume(int pid, double ratio);
 
 int mas_client_set_preprocessing_allow_mode(int pid, int mode, const char* appid);
 
+int mas_client_send_preprocessing_result(int pid, bool result);
+
 int mas_client_update_recognition_result(int pid, int result);
 
 int mas_ui_client_initialize(int pid);
index fd8ffccc9416079480193e98820a03c8b1b5312f..cd9fb36b618849aa1ad2a330594a8d422fdc54ef 100644 (file)
@@ -763,6 +763,9 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
                } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SET_PREPROCESSING_ALLOW_MODE)) {
                        ma_service_dbus_set_preprocessing_allow_mode(g_conn_listener, msg);
 
+               } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SEND_PREPROCESSING_RESULT)) {
+                       ma_service_dbus_send_preprocessing_result(g_conn_listener, msg);
+
                } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_UI_METHOD_INITIALIZE)) {
                        ma_service_ui_dbus_initialize(g_conn_listener, msg);
 
index b79c157ab597ad6e02b79c6bd2340fd1635a43e5..c2bff181b9827e791e32bb2aeb388a463d0f35c4 100644 (file)
@@ -601,6 +601,37 @@ int ma_service_dbus_set_preprocessing_allow_mode(DBusConnection* conn, DBusMessa
        return 0;
 }
 
+int ma_service_dbus_send_preprocessing_result(DBusConnection* conn, DBusMessage* msg)
+{
+       DBusError err;
+       dbus_error_init(&err);
+
+       int pid;
+       int ret = 0;
+       int result;
+
+       dbus_message_get_args(msg, &err,
+               DBUS_TYPE_INT32, &pid,
+               DBUS_TYPE_INT32, &result,
+               DBUS_TYPE_INVALID);
+
+       MAS_LOGD("[DEBUG] MAS SEND PREPROCESSING RESULT");
+
+       if (dbus_error_is_set(&err)) {
+               MAS_LOGE("[IN ERROR] mas send preprocessing result : Get arguments error (%s)", err.message);
+               dbus_error_free(&err);
+               ret = -1; //MAS_ERROR_OPERATION_FAILED;
+       } else {
+               MAS_LOGD("[IN] mas send preprocessing result : pid(%d), result(%d)", pid, result);
+               ret =  mas_client_send_preprocessing_result(pid, (bool)result);
+       }
+
+       MAS_LOGD("<<<<<");
+       MAS_LOGD("  ");
+
+       return 0;
+}
+
 int ma_service_ui_dbus_initialize(DBusConnection* conn, DBusMessage* msg)
 {
        DBusError err;
index f988b183c75882d795cd1e39f085ea07456dec38..a205cac912067824c9c0b0eb4c934faae8fa9103 100644 (file)
@@ -51,6 +51,8 @@ int ma_service_dbus_set_background_volume(DBusConnection* conn, DBusMessage* msg
 
 int ma_service_dbus_set_preprocessing_allow_mode(DBusConnection* conn, DBusMessage* msg);
 
+int ma_service_dbus_send_preprocessing_result(DBusConnection* conn, DBusMessage* msg);
+
 int ma_service_ui_dbus_initialize(DBusConnection* conn, DBusMessage* msg);
 
 int ma_service_ui_dbus_deinitialize(DBusConnection* conn, DBusMessage* msg);
index 38d28f83a95ef35cc727bbdf1b2907abd25de2b6..1c4eff05e065b1898e47f420e967c78902f6bd09 100644 (file)
@@ -466,6 +466,24 @@ int mas_client_set_preprocessing_allow_mode(int pid, int mode, const char* appid
        return 0;
 }
 
+int mas_client_send_preprocessing_result(int pid, bool result)
+{
+       const char* pid_appid = NULL;
+       char buf[MAX_APPID_LEN] = {'\0',};
+       if (AUL_R_OK == aul_app_get_appid_bypid(pid, buf, sizeof(buf))) {
+               buf[MAX_APPID_LEN - 1] = '\0';
+               pid_appid = buf;
+       }
+       if (!is_current_preprocessing_assistant(pid_appid)) return -1;
+
+       if (result) {
+               mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVENT_PREPROCESSING_SUCCEEDED);
+       } else {
+               mas_process_preprocessing_state_event(PREPROCESSING_STATE_EVENT_PREPROCESSING_FAILED);
+       }
+       return 0;
+}
+
 int mas_client_update_recognition_result(int pid, int state)
 {
        multi_assistant_service_plugin_update_recognition_result(NULL, state);