Add message-port to check recording status 90/190890/7
authorsooyeon.kim <sooyeon.kim@samsung.com>
Mon, 8 Oct 2018 09:46:38 +0000 (18:46 +0900)
committersooyeon.kim <sooyeon.kim@samsung.com>
Mon, 8 Oct 2018 14:39:47 +0000 (23:39 +0900)
Change-Id: I53b20d97fa5afdc83adbd628618ccd7df7129096
Signed-off-by: sooyeon.kim <sooyeon.kim@samsung.com>
CMakeLists.txt
lib/armv7l/libmulti-wakeup-recognizer.so
lib/i586/libmulti-wakeup-recognizer.so
packaging/org.tizen.multi-assistant-service.spec
src/multi_assistant_service.c

index dc8d3fd..df62d67 100644 (file)
@@ -25,6 +25,7 @@ pkg_check_modules(pkgs REQUIRED
        ecore
        dbus-1
        glib-2.0
+       message-port
 )
 
 
index d7ac9b5..a42c30c 100644 (file)
Binary files a/lib/armv7l/libmulti-wakeup-recognizer.so and b/lib/armv7l/libmulti-wakeup-recognizer.so differ
index 08f8de8..a7c7fa2 100644 (file)
Binary files a/lib/i586/libmulti-wakeup-recognizer.so and b/lib/i586/libmulti-wakeup-recognizer.so differ
index 5b617aa..cf338bd 100644 (file)
@@ -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
index f7ad1f6..6359402 100644 (file)
@@ -20,6 +20,7 @@
 #include <app.h>
 #include <malloc.h>
 #include <Ecore.h>
+#include <message_port.h>
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -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) {