From: sooyeon.kim Date: Mon, 8 Oct 2018 09:46:38 +0000 (+0900) Subject: Add message-port to check recording status X-Git-Tag: submit/tizen/20181008.150624~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a288a0acf3d8acd11912ee6aec0c4d80b99af71f;p=platform%2Fcore%2Fuifw%2Fwakeup-engine-default.git Add message-port to check recording status Change-Id: I53b20d97fa5afdc83adbd628618ccd7df7129096 Signed-off-by: sooyeon.kim --- diff --git a/CMakeLists.txt b/CMakeLists.txt index dc8d3fd..df62d67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,7 @@ pkg_check_modules(pkgs REQUIRED ecore dbus-1 glib-2.0 + message-port ) diff --git a/lib/armv7l/libmulti-wakeup-recognizer.so b/lib/armv7l/libmulti-wakeup-recognizer.so index d7ac9b5..a42c30c 100644 Binary files a/lib/armv7l/libmulti-wakeup-recognizer.so and b/lib/armv7l/libmulti-wakeup-recognizer.so differ diff --git a/lib/i586/libmulti-wakeup-recognizer.so b/lib/i586/libmulti-wakeup-recognizer.so index 08f8de8..a7c7fa2 100644 Binary files a/lib/i586/libmulti-wakeup-recognizer.so and b/lib/i586/libmulti-wakeup-recognizer.so differ diff --git a/packaging/org.tizen.multi-assistant-service.spec b/packaging/org.tizen.multi-assistant-service.spec index 5b617aa..cf338bd 100644 --- a/packaging/org.tizen.multi-assistant-service.spec +++ b/packaging/org.tizen.multi-assistant-service.spec @@ -20,6 +20,7 @@ BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(dbus-1) BuildRequires: pkgconfig(libtzplatform-config) +BuildRequires: pkgconfig(message-port) BuildRequires: boost-system BuildRequires: boost-thread diff --git a/src/multi_assistant_service.c b/src/multi_assistant_service.c index f7ad1f6..6359402 100644 --- a/src/multi_assistant_service.c +++ b/src/multi_assistant_service.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -32,7 +33,7 @@ #include "multi_assistant_dbus.h" static const char *g_current_lang = "en_US"; - +static int g_local_port_id = -1; int mas_client_initialize(int pid) { @@ -119,6 +120,39 @@ int mas_ui_client_change_assistant(char* app_id) return 0; } +/* for message port - receiver */ +void __message_port_cb(int local_port_id, const char* remote_app_id, const char* remote_port, bool trusted_remote_port, bundle* message, void* user_data) +{ + char *command = NULL; + MAS_LOGD("Message from %s, command: %s", remote_app_id, command); + + bundle_get_str(message, "command", &command); + + if (!strncmp(command, "start", strlen(command))) { + multi_assistant_service_plugin_start_recording(); + } else if (!strncmp(command, "cancel", strlen(command))) { + multi_assistant_service_plugin_cancel_recording(); + } else { + MAS_LOGE("[ERROR] command is wrong, command(%s)", command); + } +} + +static void init_message_port(void) +{ + MAS_LOGD("[Enter] init_message_port"); + + g_local_port_id = message_port_register_local_port("multi_assistant_service_message_port", __message_port_cb, NULL); + if (g_local_port_id < 0) + MAS_LOGE("[ERROR] message port register error: %d", g_local_port_id); + else + MAS_LOGD("[DEBUG] port id: %d", g_local_port_id); +} + +static void deinit_message_port(void) +{ + message_port_unregister_local_port(g_local_port_id); +} + static int init_wakeup(void) { MAS_LOGD("[Enter] init_wakeup "); @@ -163,6 +197,8 @@ static int init_wakeup(void) return -1; } + init_message_port(); + return 0; } @@ -175,6 +211,7 @@ static void deinit_wakeup(void) g_current_lang = NULL; } */ + deinit_message_port(); int ret = mas_dbus_close_connection(); if (0 != ret) {