From: Jihoon Kim Date: Mon, 9 Mar 2020 04:02:06 +0000 (+0900) Subject: Send response and result to requester application X-Git-Tag: accepted/tizen/5.5/unified/20200309.124451~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=effe5a7d5011fbb42eaa5bc2cec7ab5ac2ab22b3;p=platform%2Fcore%2Fuifw%2Fcapi-ui-sticker.git Send response and result to requester application Change-Id: I7860eaee2dc6fe3253fed0d4b6324e83797fe521 Signed-off-by: Jihoon Kim --- diff --git a/receiver/src/ft.cpp b/receiver/src/ft.cpp index 764d552..c8d83eb 100644 --- a/receiver/src/ft.cpp +++ b/receiver/src/ft.cpp @@ -82,6 +82,12 @@ static struct sap_info_s priv_data = { 0 }; static struct sticker_info sticker_data; static struct sync_request pending_sync_request; +enum { + SYNC_START_RSP_SUCCESS = 1000, + SYNC_START_RSP_NO_STICKER = 1001, + SYNC_START_RSP_EXIST_STICKER = 1002 +}; + gboolean file_on_progress = 0; static string incoming_file_name; static int t_id = 0; @@ -406,6 +412,22 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in string result = string(json_result ? json_result : ""); int result_code = json_object_get_int_member(root_obj, "resultCode"); LOGD("result : %s, resultCode : %d", result.c_str(), result_code); + + string response_to_app; + switch (result_code) { + case SYNC_START_RSP_SUCCESS: + case SYNC_START_RSP_EXIST_STICKER: + response_to_app = "success"; + break; + case SYNC_START_RSP_NO_STICKER: + response_to_app = "no_sticker"; + break; + default: + response_to_app = "unknown_error"; + break; + } + + send_message("sync_start_response", response_to_app.c_str()); } else if (msg_id == STICKER_SEND_START_REQ) { LOGD("msg : %s", msg_id.c_str()); total_file_count = 0; @@ -502,6 +524,8 @@ on_data_received(sap_socket_h socket, unsigned short int channel_id, unsigned in if (_send_json_data(j_object) == FALSE) LOGE("Failed to send message"); + send_message("sync_stop_result", reason.c_str()); + json_object_unref(j_object); } else LOGW("unknown msg id : %s", msg_id.c_str()); diff --git a/receiver/src/message.cpp b/receiver/src/message.cpp index 4513000..f67b29e 100644 --- a/receiver/src/message.cpp +++ b/receiver/src/message.cpp @@ -62,6 +62,8 @@ bool send_message(const char *cmd, const char *data) int ret; bool found = false; + LOGD("command: %s, data: %s", cmd, data); + message_port_check_remote_port(REMOTE_APP_ID, MESSAGE_PORT_REMOTE_NAME, &found); if (!found) { LOGW("Can't find remote port"); @@ -78,7 +80,7 @@ bool send_message(const char *cmd, const char *data) } else { - LOGI("send message done"); + LOGI("Succeed to send message."); result = true; }