A temporary replacement for ma_request_speech_data() logic 87/190987/6
authorJi-hoon Lee <dalton.lee@samsung.com>
Wed, 10 Oct 2018 08:02:47 +0000 (17:02 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Mon, 15 Oct 2018 01:59:56 +0000 (10:59 +0900)
The MA client should ask for speech data when it's ready,
but currently such a call like "ma_request_speech_data()"
has not been prepared yet.
Thus, as a workaround solution, we add a timer to spend
enough time until the client receives service state ready
message from the voice control engine and is able to
send speech data to it.

Change-Id: I6dd13a9146a7455b219b796301d4b803d05b9095

src/multi_assistant_service.c

index 078a4dad75fbd979711ec820c6f37968cc3c7ed1..4e8ef50985f5703bb55670d2bdf109c962b2fbfb 100644 (file)
@@ -186,6 +186,24 @@ ma_client_s* ma_client_find_by_pid(int pid)
        return NULL;
 }
 
+Eina_Bool __request_speech_data_timer(void *data)
+{
+       MAS_LOGD("[ENTER]");
+
+       int pid = (int)(data);
+       char appid[MAX_APPID_LEN] = {'\0',};
+       if (AUL_R_OK == aul_app_get_appid_bypid(pid, appid, sizeof(appid))) {
+               appid[MAX_APPID_LEN - 1] = '\0';
+               if (strncmp(g_launching_maclient_appid, appid, MAX_APPID_LEN) == 0) {
+                       g_launching_maclient_appid[0] = '\0';
+                       mas_client_request_speech_data(pid);
+               }
+       }
+
+       MAS_LOGD("END");
+       return EINA_FALSE;
+}
+
 int mas_client_initialize(int pid)
 {
        MAS_LOGD("[Enter] pid(%d)", pid);
@@ -224,10 +242,7 @@ int mas_client_initialize(int pid)
                        /* Since the ma_request_speech_data() is not available, we will request speech data here.
                           Need to remove below code when ma_request_speech_data() get implemented.
                        */
-                       if (0 == strncmp(g_launching_maclient_appid, appid, MAX_APPID_LEN)) {
-                               g_launching_maclient_appid[0] = '\0';
-                               mas_client_request_speech_data(pid);
-                       }
+                       ecore_timer_add(3.0f, __request_speech_data_timer, (void*)(pid));
                }
        }