}
}
-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;
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;
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);
}
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) {