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)
*/
#include <stdlib.h>
+#include <app_event.h>
#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)
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;
}