From add39505d51b50f8044aefb402aae8d5bf639e32 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Tue, 27 Sep 2016 22:01:08 +0900 Subject: [PATCH] Add bux2ctl_get for getting buxton key and setting an engine by users Change-Id: I1e1fb105feb7339c2fef37c3426c0105a876374c Signed-off-by: sooyeon.kim --- CMakeLists.txt | 22 +- bin/aarch64/voice_getengine | Bin 0 -> 12336 bytes bin/armv7l/voice_getengine | Bin 0 -> 8748 bytes bin/i586/voice_getengine | Bin 0 -> 10212 bytes bin/x86_64/voice_getengine | Bin 0 -> 11984 bytes client/stt.c | 65 +++- client/stt_dbus.c | 536 ++++++++++++++++++++++++++++---- client/stt_dbus.h | 2 +- common/stt_config_mgr.c | 63 ++++ common/stt_defs.h | 10 + include/stt.h | 1 + org.tizen.voice.sttserver.service | 4 +- org.tizen.voice.sttservercustom.service | 4 + packaging/stt.spec | 14 +- server/sttd_dbus.c | 196 ++++++++++-- 15 files changed, 823 insertions(+), 94 deletions(-) create mode 100755 bin/aarch64/voice_getengine create mode 100755 bin/armv7l/voice_getengine create mode 100755 bin/i586/voice_getengine create mode 100755 bin/x86_64/voice_getengine create mode 100644 org.tizen.voice.sttservercustom.service diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ef8f9b..767b057 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,9 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(EXEC_PREFIX "${PREFIX}") SET(VERSION 0.2.56) +FIND_PROGRAM(UNAME NAMES uname) +EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") + ADD_DEFINITIONS("-DSTT_LIBDIR=\"${LIBDIR}\"") ADD_DEFINITIONS("-Werror") @@ -37,12 +40,12 @@ INCLUDE(FindPkgConfig) IF("${_TV_PRODUCT}" STREQUAL "TRUE") pkg_check_modules(pkgs REQUIRED aul capi-media-audio-io capi-media-wav-player capi-network-bluetooth capi-system-info cynara-client cynara-session - dbus-1 dlog ecore glib-2.0 libtzplatform-config libxml-2.0 vconf vconf-internal-keys + dbus-1 dlog ecore glib-2.0 libtzplatform-config libxml-2.0 vconf vconf-internal-keys buxton2 ) ELSE() pkg_check_modules(pkgs REQUIRED aul capi-media-audio-io capi-media-wav-player capi-system-info cynara-client cynara-session - dbus-1 dlog ecore glib-2.0 libtzplatform-config libxml-2.0 vconf vconf-internal-keys + dbus-1 dlog ecore glib-2.0 libtzplatform-config libxml-2.0 vconf vconf-internal-keys buxton2 ) ENDIF() @@ -70,7 +73,22 @@ INSTALL(FILES ${CMAKE_SOURCE_DIR}/stt-config.xml DESTINATION ${TZ_SYS_RO_SHARE}/ ## Dbus service ## INSTALL(FILES ${CMAKE_SOURCE_DIR}/org.tizen.voice.sttserver.service DESTINATION ${TZ_SYS_RO_SHARE}/dbus-1/services) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/org.tizen.voice.sttservercustom.service DESTINATION ${TZ_SYS_RO_SHARE}/dbus-1/services) INSTALL(FILES ${CMAKE_SOURCE_DIR}/stt-server.conf DESTINATION /etc/dbus-1/session.d) INSTALL(FILES ${CMAKE_SOURCE_DIR}/500.stt_upgrade_24to30.sh DESTINATION ${TZ_SYS_RO_SHARE}/upgrade/scripts) +## voice_getengine ## +IF("${ARCH}" MATCHES "^arm.*") +INSTALL(PROGRAMS ${CMAKE_SOURCE_DIR}/bin/armv7l/voice_getengine DESTINATION ${TZ_SYS_BIN}) +ELSEIF("${ARCH}" MATCHES "^i586.*") +INSTALL(PROGRAMS ${CMAKE_SOURCE_DIR}/bin/i586/voice_getengine DESTINATION ${TZ_SYS_BIN}) +ELSEIF("${ARCH}" MATCHES "^i686.*") +INSTALL(PROGRAMS ${CMAKE_SOURCE_DIR}/bin/i586/voice_getengine DESTINATION ${TZ_SYS_BIN}) +ELSEIF("${ARCH}" MATCHES "^aarch64.*") +INSTALL(PROGRAMS ${CMAKE_SOURCE_DIR}/bin/aarch64/voice_getengine DESTINATION ${TZ_SYS_BIN}) +ELSEIF("${ARCH}" MATCHES "^x86_64.*") +INSTALL(PROGRAMS ${CMAKE_SOURCE_DIR}/bin/x86_64/voice_getengine DESTINATION ${TZ_SYS_BIN}) +ENDIF() + + diff --git a/bin/aarch64/voice_getengine b/bin/aarch64/voice_getengine new file mode 100755 index 0000000000000000000000000000000000000000..9b9c2dec4640447b68a39c6390c2d004f262323a GIT binary patch literal 12336 zcmd^Fe{|He^oaGbv?VM9=o){sB!jl-}l|{ zGGvgRv;XbOdAaZYdiTEj?)Sa-ecyTDmbJIqZ8pKhA)XV2y;^2bT#8Y3ooWEM#Bx!D z|1-r5Q3!mLq*;8I1;DjRpX!=nk)k^Q3#e^Zgd8|Skr}dw1j$~$lALRC7z#NW>p%J0 zuK4Y9tsWVs$sv>@3bG!#MS2}duS4lEELMIqwOJ+2bsoU<{ zC^aZNqh-tDm!M5F;vabK-sgY5?WXDDwmiQ0nRoB}{&FDDOo=JBT_PyhS#$bUVL z{0cc=6GWA=+pfkoHP3v#Df^i)w2yKq)~J4-R~uUra#SYd>F3!ze*P!)MtUxuQg+j{ zaH3SH%`z_O7ES-Z56DPy{y2}_r}N0a1iFEmTkcZhEuaM+r3d{|c^!2myT|j`eLs)< zB*+`!<(8^E%CMc5lVWSLy=aPpk9KPO0@dpi4l5_hVB#IzuM}pQ@(g2{zL*UHhBY)kU#DX z#pAK~rM;28a8ooE4|&_7o1?M&qH54;a3c;4QEF&wPsXB4taF8hcq9I8p}3cNYzqg) zCB)>m)(}$z@sK|mvNVQhkr)Q1)SA%CR)3@|f!^Sin!I145(LUm}TQ!7PN56rslZ;^8EvM4;X8Z45{K zk?{S5wzoFHWL(aeHx2@Mr&5N}PmFxJ)BS8}^T&hG4EmFPOH+75gn-tNNHFPQ8@Xt4 zLeZdXD+s_21QKoJWf)n17di;yIcQ5DLzRET1~(}JUW^a_<+!a$6t}Hi|R(->lKqtGHBY)#xg9B)wgu>+_P*==9FPWtT>$cL**W z8lB&li1&m>H&_@jtTUjcV(_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ld?1G<{2Xnw>@KmbMaYh}hT;kO zMCy!(B7QO?ocI(Qink79;{&Mk-T?lwHE(ke7{uYCaN=Voso}Gu)lF*zt)^Jg$qnJ8 zPxqEPI7P<&+bnt2&W+Mvj_-sDJ$n2+4K);j*B|bg*E7afqe0I!>*xNi&|pCYd3|DX z1sb~kD%BCgxh$ARe;w$w#<6{$YA~ezmkO_gyxy=M&EV0R$NIc3GTfvTX+5E}kM((d zdPdP%pVwK2yskn_mfZN!;hEMn*5`GMVO;64|18JwG4N@PWSrMYhAyQ~{*w&*ugK!t zXizLzpVwuEye_kS*5~p6Lg~9zhrG@+trzxOeqxSKsvMN_IZ6~IG#5|rI%}eLykW0;|$rJQkSvjHbKgLvd?bv@5mT( z9+E5-j-Q1IaR?1vKV4yQ7_MSL1#|shmZRUV^cn7<&b5+j|0D2dYv*$TpIi8M&AIZq z_yBaT()9UUlbQ=6O0Ik^egHD$BHQQRiSD{WeL8RPvyCQxS8WZLe_ze{!}-bfd0tofc{IJ!Qct1c-0V#}Sp`oz}t`FE5>3oI4(lRIF$jQ65J sG>#wtUbO5A^}h+-92aHRtk36DNyNY0{L|;2We8R)`=9DWv~z9!FJ)DA#sB~S literal 0 HcmV?d00001 diff --git a/bin/armv7l/voice_getengine b/bin/armv7l/voice_getengine new file mode 100755 index 0000000000000000000000000000000000000000..c101a5f01ab68bd8d440911b0cc1cf433ed8a4fd GIT binary patch literal 8748 zcmc&)dvsG(y5A@1BYk1TiUm4&(iSO{rlAz5^>Ir%9NMG>bYLtqIw4I@n@rOrCMooR zwumkrFDwcz+65?GS7r?=YISr*?tpaN@y_x(GAmxx#W;GW1-n{oCoM~*U0#RW-*<8j z90KC}cX#>ad+cw2`*HT(XYcROvARm+IF6}F&+-^aT{kmU40`xSjOlbNzL@dMfV>~E zEXwySp2L`mGT0H~6eNIBSrxKF6pB~!^^^x$#VwEtR32&>AeWO5brGmM<&sTQ$ANO} zBPc!ts9ws~;ddMCw;_*^jywY8t8J`+tU`dEpyu5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_w`FqWe-j0^EVkTNLD}}^UyXed@WZlx*m9>J$FS*&`)gjCiV3VzeB-F&6QGpi zzI#}kY6H6@_kGmqhW3s@?wB^!23ARq`#Hyga`JD(G*qBS9t-2+xV;Ln?eV+ki3MuU z2U`}(5l#SXIqvHP$PI&M7h8@pwjBSyCcIGjDVJlN&-V1s_y!<1@HujSigwzw3*~qw V*@b>t?A$2|>k@KjZ35V~@qg%)OU(cP literal 0 HcmV?d00001 diff --git a/bin/x86_64/voice_getengine b/bin/x86_64/voice_getengine new file mode 100755 index 0000000000000000000000000000000000000000..a4e2f60d900629d645cda127cbd4751ec4b5b8d0 GIT binary patch literal 11984 zcmc&)eRPvmn!o*m+EP-rb*kbLkV3&BGzc6ND-E>xR)gCS3MiJ4CU2VzA&L1Y#TnPS zX_R+jkTYj=**P+Y8Pvn>x^tM_)x$8W2EmruaduJM8D`v3#E(f$M@O>1=YG_e zK$Nrp?Cp8;+~;?nulwAO_x2|Dw>wvqmXt76%Gk|}xUsJZq*XQ?oh2(Et!y!?#OD-t zHJbpwf@7k+RS>j_l98qrt(15fXgSqOB~U=8NLW!7AyM*ItlWLAXi=0gD+frAV%;d) zH(o1nMb}Y4C_YJ*9)(4E15$55>M2?nzv>_Ljh-p8Uxl;{ZB!H`St_0H#=KPDHjT6A zQKx{JqDt=@(4#mnw$w_&c>#aVq6PB;-njvPFg`GMVDX~4ix$|TA=`W&Kgm(?GX&z_D(wAt}ohNlS+l}UK4RFQ>j z)Z=N!a}^$$YDQD;Qap34VSQNvNjzAh=v9UGpRl5dc7hNNFb zbzL#9rXLliYL66d`|@LmLbZYD(!;vg5w=P~%b6f?F`P9C*yJXFN~t|ItJ-me-qDDy^fQ27b( z*Olx@LH=Ks^6Gseq#652;7UBvH?i^v}WZpBkr#$-Ira?!pByHtLS=R$s8DB}0sBJz5XesvVVFNJ+8Y!#MQ ziuet{&h$cI@Ta)_YPO#?JyTf=T&CWHqKfxQAD+4MZO!yHX=Z({P&nof1zny{Fs2X0 z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jVhBwZtEucZBwJ}Bv9l0GHrvy!TA@0)4m)q?kw&8zps`_Q7Dt*>A<{_UPE z5)w4(!kEVYXl>rrY|0aT`D1%*C6`ru$sI5&9lfG&+`b%#FGGn9b*o z`k0M>9Y`AZf*PLiW2sHtTy*PZ#trrBktls%X^ZFqH#uT9d=;uk!sj&O+eq6tJ@`=G zTs|*2h$BR1!`G3d=8s7;;Q(rVp_olon2o+V7vbP+6mf4A^0Kb7^na%hL6z2oT94xu z38;NSc~I*|@k>#mwW;(AfA?lpf|9CzM#0ljG3(zX4JkT92^P^`37qyS<$t5Bj8hq~ z+RxO!q2lmCm$m?^@Yei%MVZuZpVuRry!?s{e@Sf`x^gV{J#qH z)$fWFU8G*T(xK8<{#O;~tM{>@>b<1o3*)D`Pa&%OtKVxWdVj$SN##%3+f$%l_&ZXk z5|p&i|H1b #include #include +#include #include "stt.h" #include "stt_client.h" @@ -505,6 +506,61 @@ int stt_get_engine(stt_h stt, char** engine_id) return ret; } +int __stt_set_buxtonkey(const char* engine_id) +{ + /* Set vconfkey */ + struct buxton_client * bux_cli; + struct buxton_layer * bux_layer; + struct buxton_value * bux_val; + + int ret = buxton_open(&bux_cli, NULL, NULL); + if (0 != ret) { + SLOG(LOG_ERROR, stt_tag(), "[DBUS-BUXTON2] Fail to open buxton client"); + return STT_ERROR_OPERATION_FAILED; + } + SLOG(LOG_DEBUG, stt_tag(), "[DBUS-BUXTON2] buxton_open: %d", ret); + bux_layer = buxton_create_layer("user"); + if (NULL == bux_layer) { + SLOG(LOG_ERROR, stt_tag(), "[DBUS-BUXTON2] buxton_create_layer FAIL"); + buxton_close(bux_cli); + bux_cli = NULL; + return STT_ERROR_OPERATION_FAILED; + } + bux_val = buxton_value_create_string(engine_id); + if (NULL == bux_val) { + SLOG(LOG_ERROR, stt_tag(), "[DBUS-BUXTON2] buxton_value_create_string FAIL"); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + bux_layer = NULL; + bux_cli = NULL; + return STT_ERROR_OPERATION_FAILED; + } + + ret = buxton_set_value_sync(bux_cli, bux_layer, STT_ENGINE_DB_CUSTOM, bux_val); + if (0 != ret) { + SLOG(LOG_ERROR, stt_tag(), "[DBUS-BUXTON2] Fail to set value sync"); + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + return STT_ERROR_OPERATION_FAILED; + } + SLOG(LOG_DEBUG, stt_tag(), "[DBUS-BUXTON2] buxton_set_value_sync: %d, %s", ret, STT_ENGINE_DB_CUSTOM); + + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + + return STT_ERROR_NONE; +} + int stt_set_engine(stt_h stt, const char* engine_id) { stt_client_s* client = NULL; @@ -540,6 +596,13 @@ int stt_set_engine(stt_h stt, const char* engine_id) client->current_engine_id = strdup(engine_id); + /* Set vconfkey */ + int ret = __stt_set_buxtonkey(engine_id); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] set buxtonkey Failed!!!"); + return ret; + } + SLOG(LOG_DEBUG, TAG_STTC, "====="); SLOG(LOG_DEBUG, TAG_STTC, " "); @@ -704,7 +767,7 @@ static Eina_Bool __stt_connect_daemon(void *data) /* Send hello */ int ret = -1; - ret = stt_dbus_request_hello(); + ret = stt_dbus_request_hello(client->uid); if (0 != ret) { if (STT_ERROR_INVALID_STATE == ret) { diff --git a/client/stt_dbus.c b/client/stt_dbus.c index e64a8cb..e5e7e3b 100644 --- a/client/stt_dbus.c +++ b/client/stt_dbus.c @@ -18,14 +18,22 @@ #include "stt_client.h" +#include +#include + static int g_waiting_time = 3000; static int g_waiting_short_time = 500; +static char* g_server_service_name = NULL; +static char* g_server_service_object = NULL; +static char* g_server_service_interface = NULL; + static Ecore_Fd_Handler* g_fd_handler = NULL; static DBusConnection* g_conn_sender = NULL; static DBusConnection* g_conn_listener = NULL; +void __stt_dbus_service_free(); extern int __stt_cb_error(int uid, int reason, char* err_msg); @@ -35,6 +43,318 @@ extern int __stt_cb_set_state(int uid, int state); extern int __stt_cb_set_volume(int uid, float volume); +char* __stt_get_service_name(char* engine_id) +{ + char* service_name = NULL; + const char* engine_default = NULL; + + struct buxton_client * bux_cli; + struct buxton_layer * bux_layer; + struct buxton_value * bux_val; + + int ret = buxton_open(&bux_cli, NULL, NULL); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_STTC, "[DBUS-BUXTON2] Fail to open buxton client, ret(%d)", ret); + return NULL; + } + SLOG(LOG_DEBUG, TAG_STTC, "[DBUS-BUXTON2] buxton_open: %d", ret); + bux_layer = buxton_create_layer("user"); + if (NULL == bux_layer) { + SLOG(LOG_ERROR, TAG_STTC, "[DBUS-BUXTON2] buxton_create_layer FAIL"); + buxton_close(bux_cli); + bux_cli = NULL; + return NULL; + } + + bux_val = buxton_value_create_string("stt-engine-default"); + if (NULL == bux_val) { + SLOG(LOG_ERROR, TAG_STTC, "[DBUS-BUXTON2] buxton_value_create_string FAIL"); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + bux_layer = NULL; + bux_cli = NULL; + return NULL; + } + + ret = buxton_get_value_sync(bux_cli, bux_layer, STT_ENGINE_DB_DEFAULT, &bux_val); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_STTC, "[DBUS-BUXTON2] Fail to get value sync, ret(%d)", ret); + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + return NULL; + } + ret = buxton_value_get_string(bux_val, &engine_default); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_STTC, "[DBUS-BUXTON2] Fail to get value string, ret(%d)", ret); + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + return NULL; + } + SLOG(LOG_DEBUG, TAG_STTC, "[DBUS-BUXTON2] buxton_value_get_string: engine_default: %s", engine_default); + + + if (NULL == engine_id || NULL == engine_default || 0 == strncmp(engine_id, engine_default, strlen(engine_id))) { + service_name = (char*)calloc(strlen(STT_SERVER_SERVICE_NAME) + 1, sizeof(char)); + if (NULL == service_name) { + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Memory allocation Failed!!"); + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + return NULL; + } + snprintf(service_name, strlen(STT_SERVER_SERVICE_NAME) + 1, "%s", STT_SERVER_SERVICE_NAME); + } else { + service_name = (char*)calloc(strlen(STT_SERVER_SERVICE_NAME) + strlen(engine_id) - 8, sizeof(char)); + if (NULL == service_name) { + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Memory allocation Failed!!"); + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + return NULL; + } + snprintf(service_name, strlen(STT_SERVER_SERVICE_NAME) + strlen(engine_id) - 8, "%s%s%s", STT_SERVER_SERVICE_NAME, ".", (engine_id + 10)); + } + + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + + SLOG(LOG_DEBUG, TAG_STTC, "[get_service_name] FINISH!! service name: %s", service_name); + + return service_name; +} + +char* __stt_get_service_object(char* engine_id) +{ + char* service_object = NULL; + const char* engine_default = NULL; + + struct buxton_client * bux_cli; + struct buxton_layer * bux_layer; + struct buxton_value * bux_val; + + int ret = buxton_open(&bux_cli, NULL, NULL); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_STTC, "[DBUS-BUXTON2] Fail to open buxton client, ret(%d)", ret); + return NULL; + } + bux_layer = buxton_create_layer("user"); + if (NULL == bux_layer) { + SLOG(LOG_DEBUG, TAG_STTC, "[DBUS-BUXTON2] buxton_create_layer FAIL"); + buxton_close(bux_cli); + bux_cli = NULL; + return NULL; + } + + bux_val = buxton_value_create_string("stt-engine-default"); + if (NULL == bux_val) { + SLOG(LOG_ERROR, TAG_STTC, "[DBUS-BUXTON2] buxton_value_create_string FAIL"); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + bux_layer = NULL; + bux_cli = NULL; + return NULL; + } + + ret = buxton_get_value_sync(bux_cli, bux_layer, STT_ENGINE_DB_DEFAULT, &bux_val); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_STTC, "[DBUS-BUXTON2] Fail to get value sync, ret(%d)", ret); + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + return NULL; + } + ret = buxton_value_get_string(bux_val, &engine_default); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_STTC, "[DBUS-BUXTON2] Fail to get string, ret(%d)", ret); + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + return NULL; + } + SLOG(LOG_DEBUG, TAG_STTC, "[DBUS-BUXTON2] buxton_value_get_string: engine_default: %s", engine_default); + + if (NULL == engine_id || NULL == engine_default || 0 == strncmp(engine_id, engine_default, strlen(engine_id))) { + service_object = (char*)calloc(strlen(STT_SERVER_SERVICE_OBJECT_PATH) + 1, sizeof(char)); + if (NULL == service_object) { + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Memory allocation Failed!!"); + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + return NULL; + } + snprintf(service_object, strlen(STT_SERVER_SERVICE_OBJECT_PATH) + 1, "%s", STT_SERVER_SERVICE_OBJECT_PATH); + } else { + service_object = (char*)calloc(strlen(STT_SERVER_SERVICE_OBJECT_PATH) + strlen(engine_id) - 8, sizeof(char)); + if (NULL == service_object) { + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Memory allocation Failed!!"); + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + return NULL; + } + snprintf(service_object, strlen(STT_SERVER_SERVICE_OBJECT_PATH) + strlen(engine_id) - 8, "%s%s%s", STT_SERVER_SERVICE_OBJECT_PATH, "/", (engine_id + 10)); + } + + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + + SLOG(LOG_DEBUG, TAG_STTC, "[get_service_object] FINISH!! service object: %s", service_object); + + return service_object; +} + +char* __stt_get_service_interface(char* engine_id) +{ + char* service_interface = NULL; + const char* engine_default = NULL; + + struct buxton_client * bux_cli; + struct buxton_layer * bux_layer; + struct buxton_value * bux_val; + + int ret = buxton_open(&bux_cli, NULL, NULL); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_STTC, "[DBUS-BUXTON2] Fail to open buxton client, ret(%d)", ret); + return NULL; + } + bux_layer = buxton_create_layer("user"); + if (NULL == bux_layer) { + SLOG(LOG_ERROR, TAG_STTC, "[DBUS-BUXTON2] buxton_create_layer FAIL"); + buxton_close(bux_cli); + bux_cli = NULL; + return NULL; + } + + bux_val = buxton_value_create_string("stt-engine-default"); + if (NULL == bux_val) { + SLOG(LOG_ERROR, TAG_STTC, "[DBUS-BUXTON2] buxton_value_create_string FAIL"); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + bux_layer = NULL; + bux_cli = NULL; + return NULL; + } + + ret = buxton_get_value_sync(bux_cli, bux_layer, STT_ENGINE_DB_DEFAULT, &bux_val); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_STTC, "[DBUS-BUXTON2] Fail to get value sync, ret(%d)", ret); + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + return NULL; + } + ret = buxton_value_get_string(bux_val, &engine_default); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_STTC, "[DBUS-BUXTON2] Fail to get string, ret(%d)", ret); + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + return NULL; + } + SLOG(LOG_DEBUG, TAG_STTC, "[DBUS-BUXTON2] buxton_value_get_string: engine_default: %s", engine_default); + + if (NULL == engine_id || NULL == engine_default || 0 == strncmp(engine_id, engine_default, strlen(engine_id))) { + service_interface = (char*)calloc(strlen(STT_SERVER_SERVICE_INTERFACE) + 1, sizeof(char)); + if (NULL == service_interface) { + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Memory allocation Failed!!"); + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + return NULL; + } + snprintf(service_interface, strlen(STT_SERVER_SERVICE_INTERFACE) + 1, "%s", STT_SERVER_SERVICE_INTERFACE); + } else { + service_interface = (char*)calloc(strlen(STT_SERVER_SERVICE_INTERFACE) + strlen(engine_id) - 8, sizeof(char)); + if (NULL == service_interface) { + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Memory allocation Failed!!"); + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + return NULL; + } + snprintf(service_interface, strlen(STT_SERVER_SERVICE_INTERFACE) + strlen(engine_id) - 8, "%s%s%s", STT_SERVER_SERVICE_INTERFACE, ".", (engine_id + 10)); + } + + char* ret_char = strchr(service_interface, '-'); + while(NULL != ret_char) { + ret_char[0] = '_'; + ret_char = strchr(service_interface, '-'); + } + + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + ret = buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + + SLOG(LOG_DEBUG, TAG_STTC, "[get_service_interface] FINISH!! service interface: %s", service_interface); + + return service_interface; +} + + static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handler) { if (NULL == g_conn_listener) return ECORE_CALLBACK_RENEW; @@ -399,6 +719,8 @@ int stt_dbus_close_connection() g_conn_sender = NULL; g_conn_listener = NULL; + __stt_dbus_service_free(); + return 0; } @@ -423,26 +745,107 @@ int stt_dbus_reconnect() return 0; } -int stt_dbus_request_hello() +void __stt_dbus_service_free() { - DBusMessage* msg; + if (NULL != g_server_service_name) { + free(g_server_service_name); + g_server_service_name = NULL; + } + if (NULL != g_server_service_object) { + free(g_server_service_object); + g_server_service_object = NULL; + } + if (NULL != g_server_service_interface) { + free(g_server_service_interface); + g_server_service_interface = NULL; + } +} - msg = dbus_message_new_method_call( - STT_SERVER_SERVICE_NAME, - STT_SERVER_SERVICE_OBJECT_PATH, - STT_SERVER_SERVICE_INTERFACE, - STT_METHOD_HELLO); +int stt_dbus_request_hello(int uid) +{ + stt_client_s* client = stt_client_get_by_uid(uid); + + /* Check whether there is any dbus whose name has owner or not */ + dbus_bool_t is_exist = FALSE; + DBusError err; + dbus_error_init(&err); + + DBusMessage* msg = NULL; + DBusMessage* result_msg = NULL; + int result = 0; + + if (g_conn_sender) { + if(NULL != client) { + __stt_dbus_service_free(); + + if (NULL == client->current_engine_id) { + /* Default engine */ + g_server_service_name = strdup(STT_SERVER_SERVICE_NAME); + if (NULL == g_server_service_name) { + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to allocate memory"); + return STT_ERROR_OUT_OF_MEMORY; + } + g_server_service_object = strdup(STT_SERVER_SERVICE_OBJECT_PATH); + if (NULL == g_server_service_name) { + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to allocate memory"); + return STT_ERROR_OUT_OF_MEMORY; + } + g_server_service_interface = strdup(STT_SERVER_SERVICE_INTERFACE); + if (NULL == g_server_service_name) { + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to allocate memory"); + return STT_ERROR_OUT_OF_MEMORY; + } + SLOG(LOG_DEBUG, TAG_STTC, "[DBUS] service name: %s, object path: %s, interface: %s", g_server_service_name, g_server_service_object, g_server_service_interface); + + msg = dbus_message_new_method_call( + STT_SERVER_SERVICE_NAME, + STT_SERVER_SERVICE_OBJECT_PATH, + STT_SERVER_SERVICE_INTERFACE, + STT_METHOD_HELLO); + } else { + /* Get service name, object, interface */ + SLOG(LOG_DEBUG, TAG_STTC, "[DBUS] current_engine_id: %s", client->current_engine_id); + + g_server_service_name = __stt_get_service_name(client->current_engine_id); + g_server_service_object = __stt_get_service_object(client->current_engine_id); + g_server_service_interface = __stt_get_service_interface(client->current_engine_id); + + if (NULL == g_server_service_name || NULL == g_server_service_object || NULL == g_server_service_interface) { + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] dbus service info invalid"); + return STT_ERROR_OPERATION_FAILED; + } + + SLOG(LOG_DEBUG, TAG_STTC, "[DBUS] service name: %s, object path: %s, interface: %s", g_server_service_name, g_server_service_object, g_server_service_interface); + + /* Custom engine */ + is_exist = dbus_bus_name_has_owner(g_conn_sender, g_server_service_name, &err); + SLOG(LOG_DEBUG, TAG_STTC, "[DBUS] is there dbus name has owner??: %s (g_server_service_name: %s)", (is_exist == TRUE) ? "True" : "False", g_server_service_name); + + if (TRUE == is_exist) { + SLOG(LOG_DEBUG, TAG_STTC, "[DBUS] dbus: is_exist: True"); + msg = dbus_message_new_method_call( + g_server_service_name, + g_server_service_object, + g_server_service_interface, + STT_METHOD_HELLO); + } else { + SLOG(LOG_DEBUG, TAG_STTC, "[DBUS] dbus: is_exist: False"); + msg = dbus_message_new_method_call( + STT_SERVER_CUSTOM_SERVICE_NAME, + STT_SERVER_CUSTOM_SERVICE_OBJECT_PATH, + STT_SERVER_CUSTOM_SERVICE_INTERFACE, + STT_METHOD_HELLO); + } + } + } + } if (NULL == msg) { SLOG(LOG_ERROR, TAG_STTC, ">>>> Request stt hello : Fail to make message"); return STT_ERROR_OPERATION_FAILED; } - DBusError err; - dbus_error_init(&err); - DBusMessage* result_msg = NULL; - int result = 0; if (g_conn_sender) { result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_short_time, &err); @@ -483,9 +886,9 @@ int stt_dbus_request_initialize(int uid, bool* silence_supported, bool* credenti DBusMessage* msg; msg = dbus_message_new_method_call( - STT_SERVER_SERVICE_NAME, - STT_SERVER_SERVICE_OBJECT_PATH, - STT_SERVER_SERVICE_INTERFACE, + g_server_service_name, + g_server_service_object, + g_server_service_interface, STT_METHOD_INITIALIZE); if (NULL == msg) { @@ -553,10 +956,12 @@ int stt_dbus_request_finalize(int uid) { DBusMessage* msg; + SLOG(LOG_DEBUG, TAG_STTC, "[dbus_info] service name: %s, service object: %s, service interface: %s", g_server_service_name, g_server_service_object, g_server_service_interface); + msg = dbus_message_new_method_call( - STT_SERVER_SERVICE_NAME, - STT_SERVER_SERVICE_OBJECT_PATH, - STT_SERVER_SERVICE_INTERFACE, + g_server_service_name, + g_server_service_object, + g_server_service_interface, STT_METHOD_FINALIZE); if (NULL == msg) { @@ -613,11 +1018,12 @@ int stt_dbus_request_set_current_engine(int uid, const char* engine_id, bool* si DBusMessage* msg; msg = dbus_message_new_method_call( - STT_SERVER_SERVICE_NAME, - STT_SERVER_SERVICE_OBJECT_PATH, - STT_SERVER_SERVICE_INTERFACE, + g_server_service_name, + g_server_service_object, + g_server_service_interface, STT_METHOD_SET_CURRENT_ENGINE); + if (NULL == msg) { SLOG(LOG_ERROR, TAG_STTC, ">>>> stt set engine : Fail to make message"); return STT_ERROR_OPERATION_FAILED; @@ -683,9 +1089,9 @@ int stt_dbus_request_check_app_agreed(int uid, const char* appid, bool* value) DBusMessage* msg; msg = dbus_message_new_method_call( - STT_SERVER_SERVICE_NAME, - STT_SERVER_SERVICE_OBJECT_PATH, - STT_SERVER_SERVICE_INTERFACE, + g_server_service_name, + g_server_service_object, + g_server_service_interface, STT_METHOD_CHECK_APP_AGREED); if (NULL == msg) { @@ -752,9 +1158,9 @@ int stt_dbus_request_get_support_langs(int uid, stt_h stt, stt_supported_languag DBusMessage* msg; msg = dbus_message_new_method_call( - STT_SERVER_SERVICE_NAME, - STT_SERVER_SERVICE_OBJECT_PATH, - STT_SERVER_SERVICE_INTERFACE, + g_server_service_name, + g_server_service_object, + g_server_service_interface, STT_METHOD_GET_SUPPORT_LANGS); if (NULL == msg) { @@ -837,9 +1243,9 @@ int stt_dbus_request_get_default_lang(int uid, char** language) DBusMessage* msg; msg = dbus_message_new_method_call( - STT_SERVER_SERVICE_NAME, - STT_SERVER_SERVICE_OBJECT_PATH, - STT_SERVER_SERVICE_INTERFACE, + g_server_service_name, + g_server_service_object, + g_server_service_interface, STT_METHOD_GET_CURRENT_LANG); if (NULL == msg) { @@ -905,9 +1311,9 @@ int stt_dbus_request_set_private_data(int uid, const char* key, const char* data DBusMessage* msg; msg = dbus_message_new_method_call( - STT_SERVER_SERVICE_NAME, - STT_SERVER_SERVICE_OBJECT_PATH, - STT_SERVER_SERVICE_INTERFACE, + g_server_service_name, + g_server_service_object, + g_server_service_interface, STT_METHOD_SET_PRIVATE_DATA); if (NULL == msg) { @@ -975,9 +1381,9 @@ int stt_dbus_request_get_private_data(int uid, const char* key, char** data) DBusMessage* msg; msg = dbus_message_new_method_call( - STT_SERVER_SERVICE_NAME, - STT_SERVER_SERVICE_OBJECT_PATH, - STT_SERVER_SERVICE_INTERFACE, + g_server_service_name, + g_server_service_object, + g_server_service_interface, STT_METHOD_GET_PRIVATE_DATA); if (NULL == msg) { @@ -1051,10 +1457,10 @@ int stt_dbus_request_is_recognition_type_supported(int uid, const char* type, bo DBusMessage* msg; msg = dbus_message_new_method_call( - STT_SERVER_SERVICE_NAME, - STT_SERVER_SERVICE_OBJECT_PATH, - STT_SERVER_SERVICE_INTERFACE, - STT_METHOD_IS_TYPE_SUPPORTED); + g_server_service_name, + g_server_service_object, + g_server_service_interface, + STT_METHOD_IS_TYPE_SUPPORTED); if (NULL == msg) { SLOG(LOG_ERROR, TAG_STTC, ">>>> stt is partial result supported : Fail to make message"); @@ -1120,10 +1526,10 @@ int stt_dbus_request_set_start_sound(int uid, const char* file) DBusMessage* msg; msg = dbus_message_new_method_call( - STT_SERVER_SERVICE_NAME, - STT_SERVER_SERVICE_OBJECT_PATH, - STT_SERVER_SERVICE_INTERFACE, - STT_METHOD_SET_START_SOUND); + g_server_service_name, + g_server_service_object, + g_server_service_interface, + STT_METHOD_SET_START_SOUND); if (NULL == msg) { SLOG(LOG_ERROR, TAG_STTC, ">>>> stt set start sound : Fail to make message"); @@ -1181,10 +1587,10 @@ int stt_dbus_request_unset_start_sound(int uid) DBusMessage* msg; msg = dbus_message_new_method_call( - STT_SERVER_SERVICE_NAME, - STT_SERVER_SERVICE_OBJECT_PATH, - STT_SERVER_SERVICE_INTERFACE, - STT_METHOD_UNSET_START_SOUND); + g_server_service_name, + g_server_service_object, + g_server_service_interface, + STT_METHOD_UNSET_START_SOUND); if (NULL == msg) { SLOG(LOG_ERROR, TAG_STTC, ">>>> stt unset start sound : Fail to make message"); @@ -1246,10 +1652,10 @@ int stt_dbus_request_set_stop_sound(int uid, const char* file) DBusMessage* msg; msg = dbus_message_new_method_call( - STT_SERVER_SERVICE_NAME, - STT_SERVER_SERVICE_OBJECT_PATH, - STT_SERVER_SERVICE_INTERFACE, - STT_METHOD_SET_STOP_SOUND); + g_server_service_name, + g_server_service_object, + g_server_service_interface, + STT_METHOD_SET_STOP_SOUND); if (NULL == msg) { SLOG(LOG_ERROR, TAG_STTC, ">>>> stt set stop sound : Fail to make message"); @@ -1307,10 +1713,10 @@ int stt_dbus_request_unset_stop_sound(int uid) DBusMessage* msg; msg = dbus_message_new_method_call( - STT_SERVER_SERVICE_NAME, - STT_SERVER_SERVICE_OBJECT_PATH, - STT_SERVER_SERVICE_INTERFACE, - STT_METHOD_UNSET_STOP_SOUND); + g_server_service_name, + g_server_service_object, + g_server_service_interface, + STT_METHOD_UNSET_STOP_SOUND); if (NULL == msg) { SLOG(LOG_ERROR, TAG_STTC, ">>>> stt unset stop sound : Fail to make message"); @@ -1373,9 +1779,9 @@ int stt_dbus_request_start(int uid, const char* lang, const char* type, int sile /* create a signal & check for errors */ msg = dbus_message_new_method_call( - STT_SERVER_SERVICE_NAME, - STT_SERVER_SERVICE_OBJECT_PATH, - STT_SERVER_SERVICE_INTERFACE, + g_server_service_name, + g_server_service_object, + g_server_service_interface, STT_METHOD_START); if (NULL == msg) { @@ -1478,9 +1884,9 @@ int stt_dbus_request_stop(int uid) /* create a signal & check for errors */ msg = dbus_message_new_method_call( - STT_SERVER_SERVICE_NAME, - STT_SERVER_SERVICE_OBJECT_PATH, - STT_SERVER_SERVICE_INTERFACE, + g_server_service_name, + g_server_service_object, + g_server_service_interface, STT_METHOD_STOP); if (NULL == msg) { @@ -1558,10 +1964,10 @@ int stt_dbus_request_cancel(int uid) /* create a signal & check for errors */ msg = dbus_message_new_method_call( - STT_SERVER_SERVICE_NAME, - STT_SERVER_SERVICE_OBJECT_PATH, /* object name of the signal */ - STT_SERVER_SERVICE_INTERFACE, /* interface name of the signal */ - STT_METHOD_CANCEL); /* name of the signal */ + g_server_service_name, + g_server_service_object, + g_server_service_interface, + STT_METHOD_CANCEL); if (NULL == msg) { SLOG(LOG_ERROR, TAG_STTC, ">>>> stt cancel : Fail to make message"); diff --git a/client/stt_dbus.h b/client/stt_dbus.h index 5330b99..4564d41 100644 --- a/client/stt_dbus.h +++ b/client/stt_dbus.h @@ -27,7 +27,7 @@ int stt_dbus_open_connection(); int stt_dbus_close_connection(); -int stt_dbus_request_hello(); +int stt_dbus_request_hello(int uid); int stt_dbus_request_initialize(int uid, bool* silence_supported, bool* credential_needed); diff --git a/common/stt_config_mgr.c b/common/stt_config_mgr.c index f5ba157..b8162e8 100644 --- a/common/stt_config_mgr.c +++ b/common/stt_config_mgr.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "stt_config_mgr.h" #include "stt_defs.h" @@ -1060,6 +1061,62 @@ int stt_config_mgr_get_engine(char** engine) return STT_CONFIG_ERROR_NONE; } +int __stt_config_set_buxtonkey(const char* engine) +{ + /* Set vconfkey */ + struct buxton_client * bux_cli; + struct buxton_layer * bux_layer; + struct buxton_value * bux_val; + + int ret = buxton_open(&bux_cli, NULL, NULL); + if (0 != ret) { + SLOG(LOG_ERROR, stt_tag(), "[DBUS-BUXTON2] Fail to open buxton client, ret(%d)", ret); + return STT_CONFIG_ERROR_OPERATION_FAILED; + } + bux_layer = buxton_create_layer("user"); + if (NULL == bux_layer) { + SLOG(LOG_ERROR, stt_tag(), "[DBUS-BUXTON2] buxton_create_layer FAIL"); + buxton_close(bux_cli); + bux_cli = NULL; + return STT_CONFIG_ERROR_OPERATION_FAILED; + } + bux_val = buxton_value_create_string(engine); + if (NULL == bux_val) { + SLOG(LOG_ERROR, stt_tag(), "[DBUS-BUXTON2] buxton_value_create_string FAIL"); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + bux_layer = NULL; + bux_cli = NULL; + return STT_CONFIG_ERROR_OPERATION_FAILED; + } else { + SLOG(LOG_DEBUG, stt_tag(), "[DBUS-BUXTON2] layer: %s", buxton_layer_get_name(bux_layer)); + } + + ret = buxton_set_value_sync(bux_cli, bux_layer, STT_ENGINE_DB_DEFAULT, bux_val); + if (0 != ret) { + SLOG(LOG_ERROR, stt_tag(), "[DBUS-BUXTON2] Fail to set value sync, ret(%d)", ret); + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + return STT_CONFIG_ERROR_OPERATION_FAILED; + } + SLOG(LOG_DEBUG, stt_tag(), "[DBUS-BUXTON2] buxton_set_value_sync: %s", STT_ENGINE_DB_DEFAULT); + + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + + return STT_CONFIG_ERROR_NONE; +} + int stt_config_mgr_set_engine(const char* engine) { if (0 >= g_slist_length(g_config_client_list)) { @@ -1082,6 +1139,12 @@ int stt_config_mgr_set_engine(const char* engine) SLOG(LOG_DEBUG, stt_tag(), "New engine id : %s", engine); + int ret = __stt_config_set_buxtonkey(engine); + if (0 != ret) { + SLOG(LOG_ERROR, stt_tag(), "[ERROR] set buxtonkey Failed!!!"); + return ret; + } + GSList *iter = NULL; stt_engine_info_s *engine_info = NULL; bool is_valid_engine = false; diff --git a/common/stt_defs.h b/common/stt_defs.h index 1761eee..08126c4 100644 --- a/common/stt_defs.h +++ b/common/stt_defs.h @@ -33,6 +33,16 @@ extern "C" { #define STT_SERVER_SERVICE_OBJECT_PATH "/org/tizen/voice/sttserver" #define STT_SERVER_SERVICE_INTERFACE "org.tizen.voice.sttserver" +#define STT_SERVER_CUSTOM_SERVICE_NAME "org.tizen.voice.sttservercustom" +#define STT_SERVER_CUSTOM_SERVICE_OBJECT_PATH "/org/tizen/voice/sttservercustom" +#define STT_SERVER_CUSTOM_SERVICE_INTERFACE "org.tizen.voice.sttservercustom" + +/****************************************************************************************** +* Definitions for Vconf Keys +*******************************************************************************************/ + +#define STT_ENGINE_DB_DEFAULT "db/voice/stt/engine/default" +#define STT_ENGINE_DB_CUSTOM "db/voice/stt/engine/custom" /****************************************************************************************** * Message Definition for Client diff --git a/include/stt.h b/include/stt.h index 3049dd9..853d961 100755 --- a/include/stt.h +++ b/include/stt.h @@ -417,6 +417,7 @@ int stt_get_engine(stt_h stt, char** engine_id); * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder + * @privilege %http://tizen.org/privilege/appmanager.launch * * @param[in] stt The STT handle * @param[in] engine_id Engine id diff --git a/org.tizen.voice.sttserver.service b/org.tizen.voice.sttserver.service index a5d7f48..dc7e2d4 100644 --- a/org.tizen.voice.sttserver.service +++ b/org.tizen.voice.sttserver.service @@ -1,4 +1,4 @@ [D-BUS Service] Name=org.tizen.voice.sttserver -Exec=/bin/sh -c "launch_app org.tizen.stt-engine-default" - +#Exec=/bin/sh -c "launch_app org.tizen.stt-engine-default" +Exec=/bin/sh -c "voice_getengine get user db/voice/stt/engine/default | awk '{print$5}' | xargs -t -i launch_app {}" diff --git a/org.tizen.voice.sttservercustom.service b/org.tizen.voice.sttservercustom.service new file mode 100644 index 0000000..87509eb --- /dev/null +++ b/org.tizen.voice.sttservercustom.service @@ -0,0 +1,4 @@ +[D-BUS Service] +Name=org.tizen.voice.sttservercustom +Exec=/bin/sh -c "voice_getengine get user db/voice/stt/engine/custom | awk '{print$5}' | xargs -t -i launch_app {}" + diff --git a/packaging/stt.spec b/packaging/stt.spec index 97125bf..8ce6024 100644 --- a/packaging/stt.spec +++ b/packaging/stt.spec @@ -8,9 +8,11 @@ Source0: %{name}-%{version}.tar.gz Source1001: %{name}.manifest Source1002: %{name}-devel.manifest Requires(post): /sbin/ldconfig +Requires(post): /usr/bin/buxton2ctl Requires(postun): /sbin/ldconfig BuildRequires: pkgconfig(aul) BuildRequires: pkgconfig(capi-appfw-app-manager) +BuildRequires: pkgconfig(buxton2) BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(capi-media-audio-io) BuildRequires: pkgconfig(capi-media-wav-player) @@ -84,10 +86,10 @@ export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE" export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE" %if "%{PRODUCT_TYPE}" == "TV" export CFLAGS="$CFLAGS -DTV_PRODUCT" -cmake . -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%{_libdir} -DINCLUDEDIR=%{_includedir} \ +cmake . -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%{_libdir} -DBINDIR=%{_bindir} -DINCLUDEDIR=%{_includedir} \ -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE -DTZ_SYS_BIN=%TZ_SYS_BIN -D_TV_PRODUCT=TRUE %else -cmake . -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%{_libdir} -DINCLUDEDIR=%{_includedir} \ +cmake . -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%{_libdir} -DBINDIR=%{_bindir} -DINCLUDEDIR=%{_includedir} \ -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE -DTZ_SYS_BIN=%TZ_SYS_BIN %endif @@ -111,6 +113,11 @@ mkdir -p %{_libdir}/voice/ mkdir -p %{TZ_SYS_RO_SHARE}/voice/test +# buxton2ctl create-string # +#buxton2ctl create-string "user" "db/voice/stt/engine/default" "org.tizen.stt-engine-default" "http://tizen.org/privilege/internal/buxton" "http://tizen.org/privilege/internal/buxton" +buxton2ctl create-string "user" "db/voice/stt/engine/default" "org.tizen.stt-engine-default" "http://tizen.org/privilege/internal/default/public" "http://tizen.org/privilege/internal/default/platform" +buxton2ctl create-string "user" "db/voice/stt/engine/custom" "org.tizen.stt-engine-default" "http://tizen.org/privilege/internal/default/public" "http://tizen.org/privilege/recorder" +#buxton2ctl create-string "user" "db/voice/stt/engine/custom" "org.tizen.stt-engine-default" "http://tizen.org/privilege/internal/buxton" "http://tizen.org/privilege/internal/buxton" %postun -p /sbin/ldconfig @@ -123,8 +130,11 @@ mkdir -p %{TZ_SYS_RO_SHARE}/voice/test %{TZ_SYS_RO_SHARE}/upgrade/scripts/500.stt_upgrade_24to30.sh %{TZ_SYS_RO_SHARE}/voice/stt/1.0/stt-config.xml %{TZ_SYS_RO_SHARE}/dbus-1/services/org.tizen.voice.sttserver.service +%{TZ_SYS_RO_SHARE}/dbus-1/services/org.tizen.voice.sttservercustom.service %{TZ_SYS_RO_SHARE}/voice/test/stt-test %{TZ_SYS_RO_SHARE}/license/%{name} +#%{TZ_SYS_BIN}/* +%{_bindir}/voice_getengine %{TZ_SYS_RO_ETC}/package-manager/parserlib/metadata/libstt-engine-parser.so* %files devel diff --git a/server/sttd_dbus.c b/server/sttd_dbus.c index b30a35a..b4d7d10 100644 --- a/server/sttd_dbus.c +++ b/server/sttd_dbus.c @@ -20,6 +20,9 @@ #include "sttd_client_data.h" #include "sttd_dbus_server.h" #include "stt_defs.h" +#include +#include +#include static DBusConnection* g_conn_sender = NULL; static DBusConnection* g_conn_listener = NULL; @@ -30,6 +33,12 @@ static int g_waiting_time = 3000; static int g_internal_result_id = 0; +static char* g_server_service_name = NULL; +static char* g_server_service_object = NULL; +static char* g_server_service_interface = NULL; + +void __sttd_dbus_service_free(); + int sttdc_send_hello(int uid) { int pid = sttd_client_get_pid(uid); @@ -345,6 +354,8 @@ int sttdc_send_error_signal(int uid, int reason, const char *err_msg) static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handler) { + SLOG(LOG_DEBUG, TAG_STTD, "[Dbus] listener_event_callback is called!!!"); + if (NULL == g_conn_listener) return ECORE_CALLBACK_RENEW; dbus_connection_read_write_dispatch(g_conn_listener, 50); @@ -362,58 +373,61 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle return ECORE_CALLBACK_RENEW; } + SLOG(LOG_DEBUG, TAG_STTD, "[Dbus info] service name: %s, service object: %s, service interface: %s", (NULL == g_server_service_name) ? "NULL" : g_server_service_name, + (NULL == g_server_service_object) ? "NULL" : g_server_service_object, (NULL == g_server_service_interface) ? "NULL" : g_server_service_interface); + /* client event */ - if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_HELLO)) + if (dbus_message_is_method_call(msg, g_server_service_interface, STT_METHOD_HELLO)) sttd_dbus_server_hello(g_conn_listener, msg); - else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_INITIALIZE)) + else if (dbus_message_is_method_call(msg, g_server_service_interface, STT_METHOD_INITIALIZE)) sttd_dbus_server_initialize(g_conn_listener, msg); - else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_FINALIZE)) + else if (dbus_message_is_method_call(msg, g_server_service_interface, STT_METHOD_FINALIZE)) sttd_dbus_server_finalize(g_conn_listener, msg); - else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_SET_CURRENT_ENGINE)) + else if (dbus_message_is_method_call(msg, g_server_service_interface, STT_METHOD_SET_CURRENT_ENGINE)) sttd_dbus_server_set_current_engine(g_conn_listener, msg); - else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_CHECK_APP_AGREED)) + else if (dbus_message_is_method_call(msg, g_server_service_interface, STT_METHOD_CHECK_APP_AGREED)) sttd_dbus_server_check_app_agreed(g_conn_listener, msg); - else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_GET_SUPPORT_LANGS)) + else if (dbus_message_is_method_call(msg, g_server_service_interface, STT_METHOD_GET_SUPPORT_LANGS)) sttd_dbus_server_get_support_lang(g_conn_listener, msg); - else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_GET_CURRENT_LANG)) + else if (dbus_message_is_method_call(msg, g_server_service_interface, STT_METHOD_GET_CURRENT_LANG)) sttd_dbus_server_get_default_lang(g_conn_listener, msg); - else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_SET_PRIVATE_DATA)) + else if (dbus_message_is_method_call(msg, g_server_service_interface, STT_METHOD_SET_PRIVATE_DATA)) sttd_dbus_server_set_private_data(g_conn_listener, msg); - else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_GET_PRIVATE_DATA)) + else if (dbus_message_is_method_call(msg, g_server_service_interface, STT_METHOD_GET_PRIVATE_DATA)) sttd_dbus_server_get_private_data(g_conn_listener, msg); - else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_IS_TYPE_SUPPORTED)) + else if (dbus_message_is_method_call(msg, g_server_service_interface, STT_METHOD_IS_TYPE_SUPPORTED)) sttd_dbus_server_is_recognition_type_supported(g_conn_listener, msg); - else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_SET_START_SOUND)) + else if (dbus_message_is_method_call(msg, g_server_service_interface, STT_METHOD_SET_START_SOUND)) sttd_dbus_server_set_start_sound(g_conn_listener, msg); - else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_UNSET_START_SOUND)) + else if (dbus_message_is_method_call(msg, g_server_service_interface, STT_METHOD_UNSET_START_SOUND)) sttd_dbus_server_unset_start_sound(g_conn_listener, msg); - else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_SET_STOP_SOUND)) + else if (dbus_message_is_method_call(msg, g_server_service_interface, STT_METHOD_SET_STOP_SOUND)) sttd_dbus_server_set_stop_sound(g_conn_listener, msg); - else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_UNSET_STOP_SOUND)) + else if (dbus_message_is_method_call(msg, g_server_service_interface, STT_METHOD_UNSET_STOP_SOUND)) sttd_dbus_server_unset_stop_sound(g_conn_listener, msg); - else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_START)) + else if (dbus_message_is_method_call(msg, g_server_service_interface, STT_METHOD_START)) sttd_dbus_server_start(g_conn_listener, msg); - else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_STOP)) + else if (dbus_message_is_method_call(msg, g_server_service_interface, STT_METHOD_STOP)) sttd_dbus_server_stop(g_conn_listener, msg); - else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_CANCEL)) + else if (dbus_message_is_method_call(msg, g_server_service_interface, STT_METHOD_CANCEL)) sttd_dbus_server_cancel(g_conn_listener, msg); @@ -423,6 +437,138 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle return ECORE_CALLBACK_RENEW; } +void __sttd_dbus_service_free() +{ + if (NULL != g_server_service_name) { + free(g_server_service_name); + g_server_service_name = NULL; + } + + if (NULL != g_server_service_object) { + free(g_server_service_object); + g_server_service_object = NULL; + } + + if (NULL != g_server_service_interface) { + free(g_server_service_interface); + g_server_service_interface = NULL; + } +} + +int __sttd_get_buxtonkey() +{ + /* request our name on the bus and check for errors */ + int pid = getpid(); + char engine_appid[2048] = {0, }; + const char* engine_default = NULL; + + struct buxton_client * bux_cli; + struct buxton_layer * bux_layer; + struct buxton_value * bux_val; + + int ret = buxton_open(&bux_cli, NULL, NULL); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_STTD, "[DBUS-BUXTON2] Fail to open buxton client, ret(%d)", ret); + return STTD_ERROR_OPERATION_FAILED; + } + bux_layer = buxton_create_layer("user"); + if (NULL == bux_layer) { + SLOG(LOG_ERROR, TAG_STTD, "[DBUS-BUXTON2] buxton_create_layer FAIL"); + buxton_close(bux_cli); + bux_cli = NULL; + return STTD_ERROR_OPERATION_FAILED; + } + bux_val = buxton_value_create_string("stt-engine-default"); + if (NULL == bux_val) { + SLOG(LOG_ERROR, TAG_STTD, "[DBUS-BUXTON2] buxton_value_create_string FAIL"); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + bux_layer = NULL; + bux_cli = NULL; + return STTD_ERROR_OPERATION_FAILED; + } else { + SLOG(LOG_DEBUG, TAG_STTD, "[DBUS-BUXTON2] layer: %s", buxton_layer_get_name(bux_layer)); + } + ret = buxton_get_value_sync(bux_cli, bux_layer, STT_ENGINE_DB_DEFAULT, &bux_val); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_STTD, "[DBUS-BUXTON2] Fail to get value sync, ret(%d)", ret); + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + return STTD_ERROR_OPERATION_FAILED; + } + ret = buxton_value_get_string(bux_val, &engine_default); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_STTD, "[DBUS-BUXTON2] Fail to get value string, ret(%d)", ret); + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + return STTD_ERROR_OPERATION_FAILED; + } + SLOG(LOG_DEBUG, TAG_STTD, "[DBUS-BUXTON2] buxton_value_get_string: engine_default: %s", engine_default); + + ret = aul_app_get_appid_bypid(pid, engine_appid, sizeof(engine_appid)); + + __sttd_dbus_service_free(); + + if (NULL == engine_appid || NULL == engine_default || 0 == strncmp(engine_appid, engine_default, strlen(engine_appid))) { + g_server_service_name = (char*)calloc(strlen(STT_SERVER_SERVICE_NAME) + 1, sizeof(char)); + snprintf(g_server_service_name, strlen(STT_SERVER_SERVICE_NAME) + 1, "%s", STT_SERVER_SERVICE_NAME); + g_server_service_object = (char*)calloc(strlen(STT_SERVER_SERVICE_OBJECT_PATH) + 1, sizeof(char)); + snprintf(g_server_service_object, strlen(STT_SERVER_SERVICE_OBJECT_PATH) + 1, "%s", STT_SERVER_SERVICE_OBJECT_PATH); + g_server_service_interface = (char*)calloc(strlen(STT_SERVER_SERVICE_INTERFACE) + 1, sizeof(char)); + snprintf(g_server_service_interface, strlen(STT_SERVER_SERVICE_INTERFACE) + 1, "%s", STT_SERVER_SERVICE_INTERFACE); + } else { + g_server_service_name = (char*)calloc(strlen(STT_SERVER_SERVICE_NAME) + strlen(engine_appid) - 8, sizeof(char)); + snprintf(g_server_service_name, strlen(STT_SERVER_SERVICE_NAME) + strlen(engine_appid) - 8, "%s%s%s", STT_SERVER_SERVICE_NAME, ".", (engine_appid + 10)); + g_server_service_object = (char*)calloc(strlen(STT_SERVER_SERVICE_OBJECT_PATH) + strlen(engine_appid) - 8, sizeof(char)); + snprintf(g_server_service_object, strlen(STT_SERVER_SERVICE_OBJECT_PATH) + strlen(engine_appid) - 8, "%s%s%s", STT_SERVER_SERVICE_OBJECT_PATH, "/", (engine_appid + 10)); + g_server_service_interface = (char*)calloc(strlen(STT_SERVER_SERVICE_INTERFACE) + strlen(engine_appid) - 8, sizeof(char)); + snprintf(g_server_service_interface, strlen(STT_SERVER_SERVICE_INTERFACE) + strlen(engine_appid) - 8, "%s%s%s", STT_SERVER_SERVICE_INTERFACE, ".", (engine_appid + 10)); + } + + if (NULL == g_server_service_name || NULL == g_server_service_object || NULL == g_server_service_interface) { + SLOG(LOG_ERROR, TAG_STTD, "[ERROR] dbus info invalid"); + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + return STTD_ERROR_OPERATION_FAILED; + } + + char* ret_char = strchr(g_server_service_interface, '-'); + while(NULL != ret_char) { + ret_char[0] = '_'; + ret_char = strchr(g_server_service_interface, '-'); + } + + SLOG(LOG_DEBUG, TAG_STTD, "[get_service_interface] service interface: %s", g_server_service_interface); + + buxton_value_free(bux_val); + buxton_free_layer(bux_layer); + buxton_close(bux_cli); + + bux_cli = NULL; + bux_layer = NULL; + bux_val = NULL; + + SLOG(LOG_DEBUG, TAG_STTD, "[get_service_name] FINISH!! service name: %s", g_server_service_name); + + return STTD_ERROR_NONE; + +} + int sttd_dbus_open_connection() { DBusError err; @@ -455,8 +601,14 @@ int sttd_dbus_open_connection() return STTD_ERROR_OPERATION_FAILED; } - /* request our name on the bus and check for errors */ - ret = dbus_bus_request_name(g_conn_listener, STT_SERVER_SERVICE_NAME, DBUS_NAME_FLAG_REPLACE_EXISTING, &err); + /* Get buxton key */ + ret = __sttd_get_buxtonkey(); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to get buxton key"); + return ret; + } + + ret = dbus_bus_request_name(g_conn_listener, g_server_service_name, DBUS_NAME_FLAG_REPLACE_EXISTING, &err); if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) { SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to be primary owner"); @@ -471,7 +623,7 @@ int sttd_dbus_open_connection() /* add a rule for getting signal */ char rule[128]; - snprintf(rule, 128, "type='signal',interface='%s'", STT_SERVER_SERVICE_INTERFACE); + snprintf(rule, 128, "type='signal',interface='%s'", g_server_service_interface); /* add a rule for which messages we want to see */ dbus_bus_add_match(g_conn_listener, rule, &err); /* see signals from the given interface */ @@ -505,7 +657,7 @@ int sttd_dbus_close_connection() g_dbus_fd_handler = NULL; } - dbus_bus_release_name(g_conn_listener, STT_SERVER_SERVICE_NAME, &err); + dbus_bus_release_name(g_conn_listener, g_server_service_name, &err); if (dbus_error_is_set(&err)) { SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] dbus_bus_release_name() : %s", err.message); @@ -521,6 +673,8 @@ int sttd_dbus_close_connection() g_conn_listener = NULL; g_conn_sender = NULL; + __sttd_dbus_service_free(); + SLOG(LOG_DEBUG, TAG_STTD, "[Server] Close dbus connection"); return 0; -- 2.7.4