#include <app.h>
#include <malloc.h>
#include <Ecore.h>
+#include <message_port.h>
#include <stdio.h>
#include <stdlib.h>
#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)
{
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 ");
return -1;
}
+ init_message_port();
+
return 0;
}
g_current_lang = NULL;
}
*/
+ deinit_message_port();
int ret = mas_dbus_close_connection();
if (0 != ret) {