return ret;
}
+int ttsd_engine_check_app_agreed(const char* appid, bool* is_agreed)
+{
+ if (false == g_agent_init) {
+ SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] Not Initialized");
+ return TTSD_ERROR_OPERATION_FAILED;
+ }
+
+ if (false == g_engine_info->is_loaded) {
+ SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] No loaded engine");
+ return TTSD_ERROR_ENGINE_NOT_FOUND;
+ }
+
+ if (NULL == appid || NULL == is_agreed) {
+ SLOG(LOG_WARN, tts_tag(), "[Engine Agent WARNING] Invalid parameter, appid is NULL");
+ return TTSD_ERROR_NONE;
+ }
+
+
+ if (NULL == g_engine_info->callbacks->check_app_agreed) {
+ SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] Not supported feature");
+ return TTSD_ERROR_NOT_SUPPORTED_FEATURE;
+ }
+
+ int ret = 0;
+ bool tmp = true; // default value is true until now
+ ret = g_engine_info->callbacks->check_app_agreed(appid, &tmp);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, tts_tag(), "[Engine Agent ERROR] Fail to check app agreed(%d)", ret);
+ return TTSD_ERROR_OPERATION_FAILED;
+ }
+
+ *is_agreed = tmp;
+
+ return ret;
+}
+
void __free_voice_list(GList* voice_list)
{
GList *iter = NULL;
* limitations under the License.
*/
+#include <app_manager.h>
#include <aul.h>
#include <Ecore.h>
return TTSD_ERROR_NONE;
}
-bool __get_client_cb(int pid, int uid, app_state_e state, void* user_data)
+bool __get_client_cb(int pid, int uid, app_tts_state_e state, void* user_data)
{
/* clear client data */
ttsd_data_clear_data(uid);
return;
}
-bool __terminate_client(int pid, int uid, app_state_e state, void* user_data)
+bool __terminate_client(int pid, int uid, app_tts_state_e state, void* user_data)
{
SLOG(LOG_INFO, tts_tag(), "@@@ Start to terminate client [%d]", uid);
ttsd_server_finalize(uid);
}
if (0 != ttsd_engine_agent_is_credential_needed(uid, credential_needed)) {
- SLOG(LOG_ERROR, tts_tag(), "Server ERROR] Fail to get credential necessity");
+ SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to get credential necessity");
return TTSD_ERROR_OPERATION_FAILED;
}
+
+ char* appid = NULL;
+ if (0 != app_manager_get_app_id(pid, &appid)) {
+ SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to get app id, pid(%d)", pid);
+ }
+ bool is_agreed = false;
+ if (0 != ttsd_engine_check_app_agreed(appid, &is_agreed)) {
+ SLOG(LOG_ERROR, tts_tag(), "Server ERROR] Fail to check app agreed");
+ if (!appid)
+ free(appid);
+ return TTSD_ERROR_OPERATION_FAILED;
+ }
+ if (!appid)
+ free(appid);
+
+ if (false == is_agreed) {
+ SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] App is not agreed");
+ return TTSD_ERROR_PERMISSION_DENIED;
+ }
+
if (0 != ttsd_data_new_client(pid, uid)) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to add client info");
return TTSD_ERROR_OPERATION_FAILED;
return;
}
-bool __get_client_for_clean_up(int pid, int uid, app_state_e state, void* user_data)
+bool __get_client_for_clean_up(int pid, int uid, app_tts_state_e state, void* user_data)
{
bool exist = false;
int i = 0;
{
SLOG(LOG_INFO, tts_tag(), "[Server] Server finalize");
- app_state_e state;
+ app_tts_state_e state;
if (0 > ttsd_data_get_client_state(uid, &state)) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] ttsd_server_finalize : uid is not valid");
}
int ttsd_server_add_queue(int uid, const char* text, const char* lang, int voice_type, int speed, int utt_id, const char* credential)
{
- app_state_e state;
+ app_tts_state_e state;
if (0 > ttsd_data_get_client_state(uid, &state)) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] ttsd_server_add_queue : uid is not valid");
return TTSD_ERROR_INVALID_PARAMETER;
int ttsd_server_play(int uid, const char* credential)
{
- app_state_e state;
+ app_tts_state_e state;
if (0 > ttsd_data_get_client_state(uid, &state)) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] uid(%d) is NOT valid ", uid);
return TTSD_ERROR_INVALID_PARAMETER;
int ttsd_server_stop(int uid)
{
- app_state_e state;
+ app_tts_state_e state;
if (0 > ttsd_data_get_client_state(uid, &state)) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] uid is not valid");
return TTSD_ERROR_INVALID_PARAMETER;
int ttsd_server_pause(int uid, int* utt_id)
{
- app_state_e state;
+ app_tts_state_e state;
if (0 > ttsd_data_get_client_state(uid, &state)) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] ttsd_server_pause : uid is not valid");
return TTSD_ERROR_INVALID_PARAMETER;
int ttsd_server_get_support_voices(int uid, GList** voice_list)
{
- app_state_e state;
+ app_tts_state_e state;
if (0 > ttsd_data_get_client_state(uid, &state)) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] uid is not valid");
return TTSD_ERROR_INVALID_PARAMETER;
int ttsd_server_get_current_voice(int uid, char** language, int* voice_type)
{
- app_state_e state;
+ app_tts_state_e state;
if (0 > ttsd_data_get_client_state(uid, &state)) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] ttsd_server_get_current_voice : uid is not valid");
return TTSD_ERROR_INVALID_PARAMETER;
int ttsd_server_set_private_data(int uid, const char* key, const char* data)
{
- app_state_e state;
+ app_tts_state_e state;
if (0 > ttsd_data_get_client_state(uid, &state)) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] uid(%d) is NOT valid", uid);
return TTSD_ERROR_INVALID_PARAMETER;
int ttsd_server_get_private_data(int uid, const char* key, char** data)
{
- app_state_e state;
+ app_tts_state_e state;
if (0 > ttsd_data_get_client_state(uid, &state)) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] uid(%d) is NOT valid", uid);
return TTSD_ERROR_INVALID_PARAMETER;
int ttsd_server_play_pcm(int uid)
{
- app_state_e state;
+ app_tts_state_e state;
if (0 > ttsd_data_get_client_state(uid, &state)) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] uid(%d) is NOT valid ", uid);
return TTSD_ERROR_INVALID_PARAMETER;
int ttsd_server_stop_pcm(int uid)
{
- app_state_e state;
+ app_tts_state_e state;
if (0 > ttsd_data_get_client_state(uid, &state)) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] uid is not valid");
return TTSD_ERROR_INVALID_PARAMETER;