From: Jihoon Kim Date: Mon, 6 Apr 2020 09:27:47 +0000 (+0900) Subject: Add the way to notify through event publish X-Git-Tag: accepted/tizen/5.5/unified/20200407.015544~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=965796b7cb2aa923a11553cf981ac24c564bdc72;p=platform%2Fcore%2Fuifw%2Fcapi-ui-sticker.git Add the way to notify through event publish Change-Id: Ie2c4ee63ddfa278b65fd775d813814934350795d Signed-off-by: Jihoon Kim --- diff --git a/packaging/capi-ui-sticker.spec b/packaging/capi-ui-sticker.spec index 8f3c329..3ad6b90 100644 --- a/packaging/capi-ui-sticker.spec +++ b/packaging/capi-ui-sticker.spec @@ -11,6 +11,7 @@ Source3: capi-ui-sticker.conf BuildRequires: cmake, coreutils BuildRequires: pkgconfig(capi-appfw-app-common) BuildRequires: pkgconfig(capi-appfw-package-manager) +BuildRequires: pkgconfig(capi-appfw-event) BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(cynara-client) BuildRequires: pkgconfig(cynara-session) diff --git a/receiver/CMakeLists.txt b/receiver/CMakeLists.txt index 49b6d42..d415064 100644 --- a/receiver/CMakeLists.txt +++ b/receiver/CMakeLists.txt @@ -18,6 +18,7 @@ pkg_check_modules(pkgs_test REQUIRED capi-message-port capi-appfw-app-common capi-appfw-alarm + capi-appfw-event capi-system-device sap-client-stub-api json-glib-1.0 diff --git a/receiver/src/message.cpp b/receiver/src/message.cpp index 0ca7d32..79b04fd 100644 --- a/receiver/src/message.cpp +++ b/receiver/src/message.cpp @@ -15,11 +15,14 @@ */ #include +#include #include "message.h" #include "log.h" #include "config.h" +#define EVENT_NAME "event.org.tizen.sticker-receiver.user_event" + static int port_id = -1; bool message_sink_init(message_port_message_cb callback, void *user_data) @@ -62,24 +65,39 @@ bool send_message(const char *cmd, const char *data) 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"); - return false; - } - bundle *b = bundle_create(); bundle_add_str(b, "command", cmd); if (data) bundle_add_str(b, "data", data); - ret = message_port_send_message(REMOTE_APP_ID, MESSAGE_PORT_REMOTE_NAME, b); - if (ret != MESSAGE_PORT_ERROR_NONE) { - LOGW("message port send message error. err : %d", ret); + + message_port_check_remote_port(REMOTE_APP_ID, MESSAGE_PORT_REMOTE_NAME, &found); + if (found) { + ret = message_port_send_message(REMOTE_APP_ID, MESSAGE_PORT_REMOTE_NAME, b); + if (ret != MESSAGE_PORT_ERROR_NONE) + { + LOGW("message port send message error. err : %d", ret); + result = false; + } + else + { + LOGI("Succeed to send message."); + result = true; + } + } + else + { + LOGW("Can't find remote port"); + result = false; + } + + ret = event_publish_app_event(EVENT_NAME, b); + if (ret != EVENT_ERROR_NONE) { result = false; + LOGE("Failed to send message by event publish. error : %d", ret); } else { - LOGI("Succeed to send message."); + LOGD("Succeed to send message through event publish"); result = true; }