#ifndef __MULTI_ASSISTANT_CONFIG_H__
#define __MULTI_ASSISTANT_CONFIG_H__
+#include <tizen.h>
#include <tzplatform_config.h>
#ifdef __cplusplus
const char* supported_lang[MAX_SUPPORTED_LANGUAGE_NUM];
int cnt_lang;
const char* wakeup_engine;
+ bool custom_ui_option;
} ma_assistant_info_s;
-typedef int (*mas_config_assistant_info_cb)(const char* appid, const char* name, const char* icon_path, const char* wakeup_list[], int cnt_wakeup, const char* supported_lang[], int cnt_lang, const char* wakeup_engine, void* user_data);
+typedef int (*mas_config_assistant_info_cb)(const char* appid, const char* name, const char* icon_path, const char* wakeup_list[], int cnt_wakeup, const char* supported_lang[], int cnt_lang, const char* wakeup_engine, bool custom_ui_option, void* user_data);
int mas_config_get_assistant_info(mas_config_assistant_info_cb callback, void* user_data);
#ifdef __cplusplus
#define MAS_UI_METHOD_CHANGE_ASSISTANT "mas_ui_method_change_assistant"
#define MAS_UI_METHOD_ERROR "mas_ui_method_error"
#define MAS_UI_METHOD_SEND_RECOGNITION_RESULT "mas_ui_method_send_recognition_result"
+#define MAS_UI_METHOD_ENABLE_COMMON_UI "mas_ui_method_enable_common_ui"
#endif /* __MULTI_ASSISTANT_SERVICE_H__ */
int mas_get_client_pid_by_appid(const char *appid);
+bool mas_get_client_custom_ui_option_by_appid(const char *appid);
+
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);
memset(temp->supported_lang, 0x00, sizeof(temp->supported_lang));
temp->cnt_lang = 0;
temp->wakeup_engine = NULL;
+ temp->custom_ui_option = false;
while (cur != NULL) {
if (cur->name && 0 == xmlStrcmp(cur->name, (const xmlChar *)MA_TAG_ASSISTANT_LANGUAGE_SET)) {
MAS_LOGD("Wakeup Engine : %s", key);
xmlFree(key);
}
+ } else if (cur->name && 0 == xmlStrcmp(cur->name, (const xmlChar*)MA_TAG_ASSISTANT_CUSTOM_UI)) {
+ key = xmlNodeGetContent(cur);
+ if (key) {
+ if (0 == xmlStrcasecmp(key, "true")) {
+ temp->custom_ui_option = true;
+ }
+ MAS_LOGD("Use custom UI : %d", temp->custom_ui_option);
+ xmlFree(key);
+ }
}
cur = cur->next;
if (callback) {
callback(temp->app_id, temp->name, temp->icon_path,
temp->wakeup_list, temp->cnt_wakeup, temp->supported_lang,
- temp->cnt_lang, temp->wakeup_engine, user_data);
+ temp->cnt_lang, temp->wakeup_engine, temp->custom_ui_option, user_data);
}
if (temp->app_id) {
return 0;
}
+int masc_ui_dbus_enable_common_ui(int enable)
+{
+ if (0 != __dbus_check()) {
+ return -1; //MAS_ERROR_OPERATION_FAILED;
+ }
+
+ DBusMessage* msg;
+
+ msg = dbus_message_new_method_call(
+ MA_UI_CLIENT_SERVICE_NAME,
+ MA_UI_CLIENT_SERVICE_OBJECT_PATH,
+ MA_UI_CLIENT_SERVICE_INTERFACE,
+ MAS_UI_METHOD_ENABLE_COMMON_UI);
+
+ if (NULL == msg) {
+ MAS_LOGE("@@ Request multi-assistant enable common ui : Fail to make message");
+ return -1; //MA_ERROR_OPERATION_FAILED;
+ } else {
+ MAS_LOGD("[DEBUG] multi-assistant enable common ui (%d)", enable);
+ }
+
+ dbus_message_append_args(msg,
+ DBUS_TYPE_INT32, &enable,
+ DBUS_TYPE_INVALID);
+
+ dbus_message_set_no_reply(msg, TRUE);
+
+ if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) {
+ MAS_LOGE("[Dbus ERROR] Fail to Send");
+ return -1; // MAS_ERROR_OPERATION_FAILED;
+ } else {
+ MAS_LOGD("[Dbus DEBUG] Success to Send ASR result");
+ dbus_connection_flush(g_conn_sender);
+ }
+
+ dbus_message_unref(msg);
+
+ return 0;
+}
+
static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handler)
{
if (NULL == g_conn_listener) return ECORE_CALLBACK_RENEW;
int masc_ui_dbus_send_error_message(int reason, const char* err_msg);
+int masc_ui_dbus_send_recognition_result(int pid, int result);
+
+int masc_ui_dbus_enable_common_ui(int enable);
#ifdef __cplusplus
}
#define MAX_WAKEUP_WORDS_NUM 4
#define MAX_WAKEUP_WORD_LEN 255
typedef struct {
- Eina_Bool used;
+ bool used;
char appid[MAX_APPID_LEN];
char wakeup_word[MAX_WAKEUP_WORDS_NUM][MAX_WAKEUP_WORD_LEN];
char wakeup_engine[MAX_APPID_LEN];
+ bool custom_ui_option;
} ma_client_info;
static ma_client_info g_maclient_info[MAX_MACLIENT_INFO_NUM];
return -1;
}
+ bool use_custom_ui = mas_get_client_custom_ui_option_by_appid(appid);
+ masc_ui_dbus_enable_common_ui(!use_custom_ui);
+
mas_set_current_client_by_appid(appid);
int pid = mas_get_client_pid_by_appid(appid);
if (pid != -1) {
int __mas_assistant_info_cb(const char* appid, const char* name,
const char* icon_path, const char* wakeup_list[], int cnt_wakeup,
const char* supported_lang[], int cnt_lang, const char* wakeup_engine,
- void* user_data) {
+ bool custom_ui_option, void* user_data) {
MAS_LOGD("__mas_assistant_info_cb called");
if (NULL == appid) {
int index = -1;
int loop = 0;
while(-1 == index && loop < MAX_MACLIENT_INFO_NUM) {
- if (EINA_FALSE == g_maclient_info[loop].used) {
+ if (false == g_maclient_info[loop].used) {
index = loop;
}
loop++;
}
if (-1 != index) {
- g_maclient_info[index].used = EINA_TRUE;
+ g_maclient_info[index].used = true;
MAS_LOGD("app_id(%s)", appid);
strncpy(g_maclient_info[index].appid, appid, MAX_APPID_LEN);
g_maclient_info[index].appid[MAX_APPID_LEN - 1] = '\0';
g_maclient_info[index].wakeup_engine[0] = '\0';
MAS_LOGW("Wakeup engine information not provided for : %s", appid);
}
+ g_maclient_info[index].custom_ui_option = custom_ui_option;
} else {
MAS_LOGD("Couldn't find an empty slot for storing assistant info");
}
return ret;
}
+bool mas_get_client_custom_ui_option_by_appid(const char *appid)
+{
+ bool ret = false;
+ for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) {
+ if (g_maclient_info[loop].used &&
+ 0 < strlen(g_maclient_info[loop].appid) &&
+ 0 < strlen(g_maclient_info[loop].wakeup_word[0])) {
+ if (strncmp(appid, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) {
+ ret = g_maclient_info[loop].custom_ui_option;
+ }
+ }
+ }
+ 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);
int pid = -1;
if (!appid) return ECORE_CALLBACK_CANCEL;
+ bool use_custom_ui = mas_get_client_custom_ui_option_by_appid(appid);
+ masc_ui_dbus_enable_common_ui(!use_custom_ui);
+
mas_set_current_client_by_appid(appid);
masc_ui_dbus_change_assistant(appid);
if ((pid = mas_get_client_pid_by_appid(appid)) != -1) {