int uid;
bool connected;
rpc_port_proxy_tts_h rpc_h;
+ int mode;
} tts_tidl_info_s;
static GList* g_tidl_infos = NULL;
return NULL;
}
- if (0 != rpc_port_proxy_tts_connect(handle)) {
- rpc_port_proxy_tts_destroy(handle);
- SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to connect the service");
- return NULL;
- }
-
return handle;
}
return TTS_ERROR_OUT_OF_MEMORY;
}
- info->rpc_h = __open_rpc_port(uid, tts_client_get_mode(client));
+ tts_mode_e mode = tts_client_get_mode(client);
+ info->rpc_h = __open_rpc_port(uid, mode);
if (NULL == info->rpc_h) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to open proxy");
free(info);
return TTS_ERROR_OPERATION_FAILED;
}
+ info->mode = mode;
info->uid = uid;
g_tidl_infos = g_list_append(g_tidl_infos, info);
SLOG(LOG_ERROR, TAG_TTSC, "[INFO] uid(%d) rpc_h(%p)", uid, info->rpc_h);
- SLOG(LOG_DEBUG, TAG_TTSC, "@@@");
return TTS_ERROR_NONE;
}
return TTS_ERROR_INVALID_PARAMETER;
}
+ if (info->mode != client->mode) {
+ SLOG(LOG_INFO, TAG_TTSC, "[TIDL] tts mode is changed from (%d) to (%d)", info->mode, client->mode);
+ if (NULL != info->rpc_h && 0 != rpc_port_proxy_tts_destroy(info->rpc_h)) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to destroy old rpc_port");
+ return TTS_ERROR_OPERATION_FAILED;
+ }
+
+ info->rpc_h = __open_rpc_port(uid, client->mode);
+ if (NULL == info->rpc_h) {
+ SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to open proxy");
+ return TTS_ERROR_OPERATION_FAILED;
+ }
+ info->mode = client->mode;
+ }
+
if (!info->connected) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Not Connected");
+ rpc_port_proxy_tts_connect(info->rpc_h);
return TTS_ERROR_OPERATION_FAILED;
}
/*
-* Copyright (c) 2011-2016 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
#include <dlog.h>
#include <Ecore.h>
#include <vconf.h>
+#include <app_manager.h>
#include "ttse.h"
#include "ttse_internal.h"
return FALSE;
}
+static ttsd_mode_e __get_mode_from_appid()
+{
+ int pid = getpid();
+ char* appid = NULL;
+ app_manager_get_app_id(pid, &appid);
+
+ if (NULL == appid) {
+ return TTSD_MODE_DEFAULT;
+ }
+
+ SLOG(LOG_WARN, tts_tag(), "[WARNING] appid (%s)", appid);
+ char* token = strtok(appid, "-");
+ char* last = NULL;
+ while (NULL != token) {
+ last = token;
+ token = strtok(NULL, "-");
+ }
+
+ ttsd_mode_e mode = TTSD_MODE_DEFAULT;
+ if (!strncmp("noti", last, strlen(last))) {
+ mode = TTSD_MODE_NOTIFICATION;
+ } else if (!strncmp("sr", last, strlen(last))) {
+ mode = TTSD_MODE_SCREEN_READER;
+ } else if (!strncmp("interrupt", last, strlen(last))) {
+ mode = TTSD_MODE_INTERRUPT;
+ } else {
+ SLOG(LOG_INFO, tts_tag(), "[INFO] mode (%s)", last);
+ }
+
+ free(appid);
+
+ return mode;
+}
+
int ttse_main(int argc, char** argv, ttse_request_callback_s *callback)
{
bundle *b = NULL;
ttsd_mode_e mode = TTSD_MODE_DEFAULT;
int ret = TTSE_ERROR_NONE;
+
b = bundle_import_from_argv(argc, argv);
if (NULL != b) {
char *val = NULL;
SLOG(LOG_ERROR, tts_tag(), "[ERROR] NULL data");
}
} else {
- SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to get data from bundle");
+ SLOG(LOG_INFO, tts_tag(), "[INFO] Get mode value from app ID");
+ mode = __get_mode_from_appid();
}
+
bundle_free(b);
val = NULL;
} else {