X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=server%2Fsttd_client_data.c;h=a47427aa0aa6498a90d799a42fca8691ede49378;hb=a395cbdea4fb4218b945c1afa416f81558504346;hp=1ae94caedcdaeee2d46133e434beca9f6dec682c;hpb=df41c2a70ce9e02d7fe74351b5888fd36f41c367;p=platform%2Fcore%2Fuifw%2Fstt.git diff --git a/server/sttd_client_data.c b/server/sttd_client_data.c index 1ae94ca..a47427a 100644 --- a/server/sttd_client_data.c +++ b/server/sttd_client_data.c @@ -12,6 +12,8 @@ */ +#include + #include "sttd_main.h" #include "stt_defs.h" #include "sttd_client_data.h" @@ -19,7 +21,7 @@ /* Client list */ static GSList *g_client_list = NULL; -static unsigned int g_cur_recog_uid = 0; +static atomic_uint g_cur_recog_uid = 0; int client_show_list() { @@ -479,3 +481,54 @@ bool stt_client_get_app_agreed(unsigned int uid) hnd = tmp->data; return hnd->app_agreed; } + +int sttd_client_get_audio_id(unsigned int uid, char** audio_id) +{ + if (NULL == audio_id) { + SLOG(LOG_ERROR, TAG_STTD, "[Client Data ERROR] audio_id is NULL"); + return STTD_ERROR_INVALID_PARAMETER; + } + + GSList *tmp = NULL; + client_info_s* hnd = NULL; + + tmp = __client_get_item(uid); + if (NULL == tmp) { + return STTD_ERROR_INVALID_PARAMETER; + } + + hnd = tmp->data; + if (NULL != hnd->audio_id) { + *audio_id = strdup(hnd->audio_id); + } else { + *audio_id = NULL; + } + + return 0; +} + +int sttd_client_set_audio_id(unsigned int uid, const char* audio_id) +{ + GSList *tmp = NULL; + client_info_s* hnd = NULL; + + tmp = __client_get_item(uid); + if (NULL == tmp) { + SECURE_SLOG(LOG_ERROR, TAG_STTD, "[Client Data ERROR] uid(%u) is NOT valid", uid); + return STTD_ERROR_INVALID_PARAMETER; + } + + hnd = tmp->data; + if (NULL != hnd->audio_id) { + free(hnd->audio_id); + } + + if (NULL != audio_id) { + hnd->audio_id = strdup(audio_id); + SLOG(LOG_DEBUG, TAG_STTD, "[Client Data] Audio ID : %s", hnd->audio_id); + } else { + hnd->audio_id = NULL; + } + + return 0; +} \ No newline at end of file