Send change assistant request to panel on wakeup event
authorJi-hoon Lee <dalton.lee@samsung.com>
Wed, 24 Oct 2018 10:12:15 +0000 (19:12 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Wed, 24 Oct 2018 10:12:15 +0000 (19:12 +0900)
Change-Id: I1036df869fd8b5b3180d22c6c2f4eda4345a761a

inc/multi_assistant_service.h
src/multi_assistant_service.c
src/multi_assistant_service_plugin.c

index 017ec20..f530d11 100644 (file)
@@ -51,7 +51,7 @@ int mas_get_client_pid_by_wakeup_word(const char *wakeup_word);
 
 int mas_get_client_pid_by_appid(const char *appid);
 
-const char* mas_get_client_appid_by_pid(int pid);
+const char* mas_get_client_appid_by_wakeup_word(const char *wakeup_word);
 
 int mas_set_current_client_by_wakeup_word(const char *wakeup_word);
 
index 944923a..9b0ce1f 100644 (file)
@@ -513,7 +513,41 @@ static void deinit_wakeup(void)
        }
 }
 
-static const char* __get_client_appid_by_wakeup_word(const char *wakeup_word)
+int mas_get_current_client_pid()
+{
+       int ret = -1;
+       if (g_current_maclient_info >= 0 && g_current_maclient_info < MAX_MACLIENT_INFO_NUM) {
+               const char *current_maclient_appid = g_maclient_info[g_current_maclient_info].appid;
+               ma_client_s* client = ma_client_find_by_appid(current_maclient_appid);
+               if (client) {
+                       ret = client->pid;
+               }
+       }
+       return ret;
+}
+
+int mas_get_client_pid_by_appid(const char *appid)
+{
+       int ret = -1;
+
+       if (appid) {
+               ma_client_s *client = NULL;
+               client = ma_client_find_by_appid(appid);
+               if (client) {
+                       ret = client->pid;
+               }
+       }
+
+       return ret;
+}
+
+int mas_get_client_pid_by_wakeup_word(const char *wakeup_word)
+{
+       const char *appid = mas_get_client_appid_by_wakeup_word(wakeup_word);
+       return mas_get_client_pid_by_appid(appid);
+}
+
+const char* mas_get_client_appid_by_wakeup_word(const char *wakeup_word)
 {
        int loop;
        const char *appid = NULL;
@@ -559,51 +593,6 @@ static const char* __get_client_appid_by_wakeup_word(const char *wakeup_word)
        return appid;
 }
 
-int mas_get_current_client_pid()
-{
-       int ret = -1;
-       if (g_current_maclient_info >= 0 && g_current_maclient_info < MAX_MACLIENT_INFO_NUM) {
-               const char *current_maclient_appid = g_maclient_info[g_current_maclient_info].appid;
-               ma_client_s* client = ma_client_find_by_appid(current_maclient_appid);
-               if (client) {
-                       ret = client->pid;
-               }
-       }
-       return ret;
-}
-
-int mas_get_client_pid_by_appid(const char *appid)
-{
-       int ret = -1;
-
-       if (appid) {
-               ma_client_s *client = NULL;
-               client = ma_client_find_by_appid(appid);
-               if (client) {
-                       ret = client->pid;
-               }
-       }
-
-       return ret;
-}
-
-const char* mas_get_client_appid_by_pid(int pid)
-{
-       const char *ret = NULL;
-       ma_client_s *client = NULL;
-       client = ma_client_find_by_pid(pid);
-       if (client) {
-               ret = client->appid;
-       }
-       return ret;
-}
-
-int mas_get_client_pid_by_wakeup_word(const char *wakeup_word)
-{
-       const char *appid = __get_client_appid_by_wakeup_word(wakeup_word);
-       return mas_get_client_pid_by_appid(appid);
-}
-
 int mas_set_current_client_by_wakeup_word(const char *wakeup_word)
 {
        int loop;
@@ -719,7 +708,7 @@ int mas_launch_client_by_appid(const char *appid)
 
 int mas_launch_client_by_wakeup_word(const char *wakeup_word)
 {
-       const char *appid = __get_client_appid_by_wakeup_word(wakeup_word);
+       const char *appid = mas_get_client_appid_by_wakeup_word(wakeup_word);
        return mas_launch_client_by_appid(appid);
 }
 
index 7a75552..d56dbfa 100644 (file)
@@ -86,9 +86,9 @@ Eina_Bool __request_speech_data(void *data)
        if (!wakeup_word) return EINA_FALSE;
 
        mas_set_current_client_by_wakeup_word(wakeup_word);
+       masc_ui_dbus_change_assistant(mas_get_client_appid_by_wakeup_word(wakeup_word));
        if ((pid = mas_get_client_pid_by_wakeup_word(wakeup_word)) != -1) {
                MAS_LOGD("MA Client with wakeup word %s exists, requesting speech data", (wakeup_word ? wakeup_word : "NULL"));
-               masc_ui_dbus_change_assistant(mas_get_client_appid_by_pid(pid));
                ma_client_set_temp_speech_data_requested(1);
                int ret = wakeup_service_request_speech_data();
                if (0 != ret) {