}
int pid = ttsd_data_get_pid(uid);
- char appid[128] = {0, };
- if (0 != aul_app_get_appid_bypid(pid, appid, sizeof(appid))) {
+ char appid[1024] = {0, };
+ if (0 != aul_app_get_appid_bypid(pid, appid, sizeof(appid) - 1)) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to get app id");
}
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 (true == *credential_needed) {
+ 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);
- 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 (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)) {
return true;
#if 0
- char appid[128] = {0, };
- if (0 != aul_app_get_appid_bypid(pid, appid, sizeof(appid))) {
+ char appid[1024] = {0, };
+ if (0 != aul_app_get_appid_bypid(pid, appid, sizeof(appid) - 1)) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to get app id");
}
}
}
+ /* check the current playback focus */
+ if (TTSD_MODE_INTERRUPT != ttsd_get_mode()) {
+ bool is_current_interrupt = false;
+ if (0 != ttsd_player_check_current_playback_focus(&is_current_interrupt)) {
+ SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to check the current playback focus");
+ } else {
+ if (true == is_current_interrupt) {
+ SLOG(LOG_WARN, tts_tag(), "[Server WARNING] Current playback focus is set on Interrupt mode. Cannot play default, screen reader, and noti modes.");
+ return TTSD_ERROR_AUDIO_POLICY_BLOCKED;
+ }
+ }
+ }
+
int current_uid = ttsd_data_get_current_playing();
SLOG(LOG_INFO, tts_tag(), "[Server] playing uid (%d)", current_uid);
return TTSD_ERROR_OPERATION_FAILED;
}
+ if (APP_STATE_PAUSED == state) {
+ SLOG(LOG_DEBUG, tts_tag(), "[Server] uid(%d) is 'Pause' state : resume player", uid);
+
+ /* Resume player */
+ if (0 != ttsd_player_resume(uid)) {
+ SLOG(LOG_WARN, tts_tag(), "[Server WARNING] Fail to ttsd_player_resume()");
+ }
+ } else {
+ if (0 != ttsd_player_play_pcm(uid)) {
+ SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to play pcm sound : uid(%d)", uid);
+
+ // Change ready state
+ ttsd_server_stop_pcm(uid);
+
+ int tmp_pid;
+ tmp_pid = ttsd_data_get_pid(uid);
+ ttsdc_send_set_state_message(tmp_pid, uid, APP_STATE_READY);
+ }
+ }
+
return TTSD_ERROR_NONE;
}
SLOG(LOG_INFO, tts_tag(), "[Server] server stop, state(%d)", state);
- if (APP_STATE_PLAYING == state || APP_STATE_PAUSED == state) {
- if (0 != ttsd_player_clear(uid))
- SLOG(LOG_WARN, tts_tag(), "[Server] Fail to ttsd_player_stop()");
-
+ if (APP_STATE_PLAYING == state || APP_STATE_PAUSED == state || APP_STATE_READY == state) {
ttsd_data_set_client_state(uid, APP_STATE_READY);
}
/* Reset all data */
ttsd_data_clear_data(uid);
+ ttsd_player_stop(uid);
+
+
return TTSD_ERROR_NONE;
}
temp_sound_data = NULL;
}
- if (0 != ttsd_player_play(uid)) {
+/* if (0 != ttsd_player_play(uid)) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to play sound : uid(%d)", uid);
- /* Change ready state */
+ // Change ready state
ttsd_server_stop(uid);
int tmp_pid;
tmp_pid = ttsd_data_get_pid(uid);
ttsdc_send_set_state_message(tmp_pid, uid, APP_STATE_READY);
}
+*/
} else {
SLOG(LOG_DEBUG, tts_tag(), "[SERVER] Event : TTSE_RESULT_EVENT_ERROR");
}