Make assistant-specific commands to be delivered to appropriate engine 41/201841/5
authorJi-hoon Lee <dalton.lee@samsung.com>
Wed, 20 Mar 2019 05:03:04 +0000 (14:03 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Tue, 26 Mar 2019 07:25:25 +0000 (16:25 +0900)
Change-Id: I96eabef58a1a22e982efffb8da9e53b56d757f6b

plugins/wakeup-manager/src/wakeup_manager.cpp

index 2aa267a87ce55bc6a83e10abadf2951699d15267..9e4c766b2da44bab1aae573e2fc1c8ba6d177e4b 100644 (file)
@@ -751,11 +751,14 @@ int wakeup_manager_send_assistant_specific_command(const char* appid, const char
        }
 
        for (int loop = 0;loop < g_engine_count;loop++) {
-               /* Need to find the appropriate engine for this assistant,
-                  for now assuming 0 is the one */
-               if(loop == 0) {
+               auto iter = std::find(
+                       g_wakeup_engine_info[loop].assistant_list.begin(),
+                       g_wakeup_engine_info[loop].assistant_list.end(),
+                       std::string{appid});
+               if (iter != g_wakeup_engine_info[loop].assistant_list.end()) {
                        if (g_wakeup_engine_info[loop].interface.set_assistant_specific_command) {
-                               g_wakeup_engine_info[loop].interface.set_assistant_specific_command(appid, command);
+                               g_wakeup_engine_info[loop].interface.set_assistant_specific_command(
+                                       appid, command);
                        }
                }
        }