{
if (NULL == engine_id || NULL == language) {
SLOG(LOG_ERROR, stt_tag(), "[ERROR] Input parameter is NULL");
- return false;
+ return STT_CONFIG_ERROR_INVALID_PARAMETER;
}
GSList *iter = NULL;
if (0 >= g_slist_length(g_engine_list)) {
SLOG(LOG_ERROR, stt_tag(), "[ERROR] There is no engine!!");
- return false;
+ return STT_CONFIG_ERROR_OPERATION_FAILED;
}
/* Get a first item */
if (NULL == engine_info) {
SLOG(LOG_ERROR, stt_tag(), "engine info is NULL");
- return false;
+ iter = g_slist_next(iter);
+ continue;
}
if (0 != strcmp(engine_id, engine_info->uuid)) {
continue;
}
- GSList *iter_lang = NULL;
- char* engine_lang = NULL;
- if (g_slist_length(engine_info->languages) > 0) {
- /* Get a first item */
- iter_lang = g_slist_nth(engine_info->languages, 0);
-
- while (NULL != iter_lang) {
- engine_lang = iter_lang->data;
- if (NULL != engine_lang) {
- /* Default language is STT_BASE_LANGUAGE */
- if (0 == strcmp(STT_BASE_LANGUAGE, engine_lang)) {
- *language = strdup(engine_lang);
- SLOG(LOG_DEBUG, stt_tag(), "Selected language : %s", (NULL == *language) ? "NULL" : *language);
- return 0;
- }
- }
+ if (NULL == engine_info->default_lang) {
+ SLOG(LOG_ERROR, stt_tag(), "[ERROR] Default language of the engine info is NULL");
+ return STT_CONFIG_ERROR_INVALID_LANGUAGE;
+ }
- iter_lang = g_slist_next(iter_lang);
- }
+ *language = strdup(engine_info->default_lang);
- /* Not support STT_BASE_LANGUAGE */
- if (NULL != engine_lang) {
- *language = strdup(engine_lang);
- SLOG(LOG_DEBUG, stt_tag(), "Selected language : %s", (NULL == *language) ? "NULL" : *language);
- return 0;
- }
+ if (NULL != *language) {
+ SLOG(LOG_DEBUG, stt_tag(), "Selected language : %s", *language);
+ return STT_CONFIG_ERROR_NONE;
}
- break;
}
- return -1;
+ return STT_CONFIG_ERROR_OPERATION_FAILED;
}
Eina_Bool stt_config_mgr_inotify_event_cb(void* data, Ecore_Fd_Handler *fd_handler)
#define STT_TAG_ENGINE_ID "id"
#define STT_TAG_ENGINE_SETTING "setting"
#define STT_TAG_ENGINE_AGREEMENT "agreement"
+#define STT_TAG_ENGINE_DEFAULT "default"
#define STT_TAG_ENGINE_LANGUAGE_SET "languages"
#define STT_TAG_ENGINE_LANGUAGE "lang"
#define STT_TAG_ENGINE_SILENCE_SUPPORT "silence-detection-support"
temp->uuid = NULL;
temp->setting = NULL;
temp->agreement = NULL;
+ temp->default_lang = NULL;
temp->languages = NULL;
temp->support_silence_detection = false;
temp->need_credential = false;
+ bool is_default_lang_set = false;
+
while (cur != NULL) {
if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_ENGINE_NAME)) {
key = xmlNodeGetContent(cur);
} else {
SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_AGREEMENT);
}
+ } else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_ENGINE_DEFAULT)) {
+ key = xmlNodeGetContent(cur);
+ if (NULL != key) {
+ SLOG(LOG_DEBUG, stt_tag(), "Engine agreement : %s", (char *)key);
+ if (NULL != temp->default_lang) free(temp->default_lang);
+ temp->default_lang = strdup((char*)key);
+
+ is_default_lang_set = true;
+ xmlFree(key);
+ } else {
+ SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_DEFAULT);
+ }
} else if (0 == xmlStrcmp(cur->name, (const xmlChar *)STT_TAG_ENGINE_LANGUAGE_SET)) {
xmlNodePtr lang_node = NULL;
char* temp_lang = NULL;
/* SLOG(LOG_DEBUG, stt_tag(), "language : %s", (char *)key); */
temp_lang = strdup((char*)key);
temp->languages = g_slist_append(temp->languages, temp_lang);
+
+ if (false == is_default_lang_set) {
+ if (NULL != temp->default_lang) free(temp->default_lang);
+ temp->default_lang = strdup((char*)key);
+
+ is_default_lang_set = true;
+ }
xmlFree(key);
} else {
SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_ENGINE_LANGUAGE);
char* uuid;
char* setting;
char* agreement;
+ char* default_lang;
GSList* languages;
bool support_silence_detection;
bool need_credential;
#define STT_DOWNLOAD_BASE tzplatform_mkpath(TZ_USER_HOME, "share/.voice/stt/1.0")
#define STT_DOWNLOAD_ENGINE_INFO tzplatform_mkpath(TZ_USER_HOME, "share/.voice/stt/1.0/engine-info")
-#define STT_BASE_LANGUAGE "en_US"
-
#define STT_RETRY_COUNT 5
#define STT_FEATURE_PATH "tizen.org/feature/speech.recognition"