X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=test%2Ftest_main.c;h=5eef8d38e2a234419968bf56ff622e53d2600f44;hb=a0640209263d5040910591f9b496f824272bef01;hp=cb74bd7dedb6b26da16658020ce72c659afe682e;hpb=b6f36bfc2a673deeacc6b3d6527870f02567a7fb;p=platform%2Fcore%2Fuifw%2Fstt.git diff --git a/test/test_main.c b/test/test_main.c index cb74bd7..5eef8d3 100644 --- a/test/test_main.c +++ b/test/test_main.c @@ -1,5 +1,5 @@ /* -* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved +* Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include @@ -138,6 +138,20 @@ static Eina_Bool __file_start(void *data) return EINA_FALSE; } +static Eina_Bool __stt_get_volume(void *data) +{ + float volume = 0.0; + int ret = stt_get_recording_volume(g_stt, &volume); + if (STT_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_STT_TEST, "[ERROR] Fail to get volume"); + return EINA_FALSE; + } + + SLOG(LOG_DEBUG, TAG_STT_TEST, "Get volume : %f", volume); + + return EINA_TRUE; +} + static Eina_Bool __stt_start(void *data) { int ret; @@ -152,6 +166,9 @@ static Eina_Bool __stt_start(void *data) if (STT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_STT_TEST, "[ERROR] Fail to start"); } + + ecore_timer_add(0.1, __stt_get_volume, NULL); + return EINA_FALSE; } @@ -184,19 +201,21 @@ static void __stt_recognition_result_cb(stt_h stt, stt_result_event_e event, con SLOG(LOG_DEBUG, TAG_STT_TEST, "( %s )", data[0]); } + if (STT_RESULT_EVENT_FINAL_RESULT == event) { ecore_timer_add(0, __stt_finalize, NULL); + } } int main(int argc, char *argv[]) { - if (2 < argc) { + if (2 > argc) { SLOG(LOG_DEBUG, TAG_STT_TEST, "Please check parameter"); SLOG(LOG_DEBUG, TAG_STT_TEST, "Ex> stt-test -f "); SLOG(LOG_DEBUG, TAG_STT_TEST, "Ex> stt-test -m"); return 0; } - if (strcmp("-f", argv[1]) && strcmp("-m", argv[1])) { + if (0 != strcmp("-f", argv[1]) && 0 != strcmp("-m", argv[1])) { SLOG(LOG_DEBUG, TAG_STT_TEST, "Please check parameter"); SLOG(LOG_DEBUG, TAG_STT_TEST, "Ex> stt-test -f "); SLOG(LOG_DEBUG, TAG_STT_TEST, "Ex> stt-test -m"); @@ -275,6 +294,13 @@ int main(int argc, char *argv[]) return 0; } + SLOG(LOG_DEBUG, TAG_STT_TEST, "STT set credential"); + ret = stt_set_credential(g_stt, "1Q2W3E4R5T"); + if (STT_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_STT_TEST, "Fail to set credential"); + return 0; + } + SLOG(LOG_DEBUG, TAG_STT_TEST, "STT prepare"); ret = stt_prepare(g_stt); if (STT_ERROR_NONE != ret) {