[ACR-1653][tts][Add] Add new APIs and an error type for checking screen reader option 98/263098/6 accepted/tizen/unified/20210907.015400 submit/tizen/20210906.145543
authorsooyeon <sooyeon.kim@samsung.com>
Thu, 26 Aug 2021 15:27:03 +0000 (00:27 +0900)
committersooyeon <sooyeon.kim@samsung.com>
Tue, 31 Aug 2021 16:18:39 +0000 (01:18 +0900)
- Add a new callback to notify screen reader changed

Change-Id: I758de9786a5b0186437dccda772a10628b536694
Signed-off-by: sooyeon <sooyeon.kim@samsung.com>
client/tts.c
client/tts_client.c
client/tts_client.h
client/tts_core.c
client/tts_core.h
common/tts_config_mgr.c
common/tts_config_mgr.h
include/tts.h
server/ttsd_config.c

index 32ce98313dbe33dbba09b62fcdaf954e00f79b03..8b4fdc68fcce3c6646bc9f9c8f96aec16e8d6fb8 100644 (file)
@@ -186,6 +186,23 @@ static void __tts_config_engine_changed_cb(const char* engine_id, const char* se
        tts_core_notify_engine_changed(client, engine_id, language, voice_type, need_credential);
        return;
 }
+
+static void __tts_config_screen_reader_changed_cb(bool value, void* user_data)
+{
+       tts_h tts = (tts_h)user_data;
+
+       tts_client_s* client = tts_client_get(tts);
+       if (NULL == client) {
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] A handle is not valid. tts(%p)", tts);
+               return;
+       }
+
+       SLOG(LOG_DEBUG, TAG_TTSC, "Screen reader is changed. current status (%d)", value);
+
+       /* call callback function */
+       tts_core_notify_screen_reader_changed(client, value);
+}
+
 //LCOV_EXCL_STOP
 
 int tts_create(tts_h* tts)
@@ -261,6 +278,14 @@ int tts_create(tts_h* tts)
                return __tts_convert_config_error_code(ret);
        }
 
+       ret = tts_config_mgr_set_screen_reader_callback(uid, __tts_config_screen_reader_changed_cb, new_tts);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to set config changed : %d", ret);
+               tts_config_mgr_finalize(uid);
+               tts_client_destroy(new_tts);
+               return __tts_convert_config_error_code(ret);
+       }
+
        if (is_first_client) {
                // These function would be called only when first client is created.
                if (0 != tts_core_initialize()) {
@@ -820,6 +845,34 @@ int tts_get_error_message(tts_h tts, char** err_msg)
        return TTS_ERROR_NONE;
 }
 
+int tts_check_screen_reader_on(tts_h tts, bool* is_on)
+{
+       if (0 != __tts_get_feature_enabled()) {
+               return TTS_ERROR_NOT_SUPPORTED;
+       }
+
+       if (NULL == is_on) {
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Input parameter is null");
+               return TTS_ERROR_INVALID_PARAMETER;
+       }
+
+       tts_client_s* client = tts_client_get(tts);
+       if (NULL == client) {
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] A handle is not valid. tts(%p)", tts);
+               return TTS_ERROR_INVALID_PARAMETER;
+       }
+
+       if (false == tts_core_check_screen_reader(client)) {
+               SLOG(LOG_WARN, TAG_TTSC, "[WARNING] Screen reader option is not available");
+               *is_on = false;
+       } else {
+               SLOG(LOG_INFO, TAG_TTSC, "[INFO] Screen reader option is available");
+               *is_on = true;
+       }
+
+       return TTS_ERROR_NONE;
+}
+
 int tts_add_text(tts_h tts, const char* text, const char* language, int voice_type, int speed, int* utt_id)
 {
        if (0 != __tts_get_feature_enabled()) {
@@ -862,7 +915,7 @@ int tts_add_text(tts_h tts, const char* text, const char* language, int voice_ty
 
        if (false == tts_core_check_screen_reader(client)) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Screen reader option is not available");
-               return TTS_ERROR_INVALID_STATE;
+               return TTS_ERROR_SCREEN_READER_OFF;
        }
 
        if (true == client->credential_needed && NULL == client->credential) {
@@ -924,7 +977,7 @@ int tts_play_async(tts_h tts)
 
        if (false == tts_core_check_screen_reader(client)) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Screen reader option is not available");
-               return TTS_ERROR_INVALID_STATE;
+               return TTS_ERROR_SCREEN_READER_OFF;
        }
 
        if (true == client->credential_needed && NULL == client->credential) {
@@ -962,7 +1015,7 @@ int tts_play(tts_h tts)
 
        if (false == tts_core_check_screen_reader(client)) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Screen reader option is not available");
-               return TTS_ERROR_INVALID_STATE;
+               return TTS_ERROR_SCREEN_READER_OFF;
        }
 
        if (true == client->credential_needed && NULL == client->credential) {
@@ -1024,7 +1077,7 @@ int tts_stop_aync(tts_h tts)
 
        if (false == tts_core_check_screen_reader(client)) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Screen reader option is not available");
-               return TTS_ERROR_INVALID_STATE;
+               return TTS_ERROR_SCREEN_READER_OFF;
        }
 
        ecore_main_loop_thread_safe_call_async(__tts_stop_async, (void*)tts);
@@ -1056,7 +1109,7 @@ int tts_stop(tts_h tts)
 
        if (false == tts_core_check_screen_reader(client)) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Screen reader option is not available");
-               return TTS_ERROR_INVALID_STATE;
+               return TTS_ERROR_SCREEN_READER_OFF;
        }
 
        int ret = tts_core_stop(client);
@@ -1113,7 +1166,7 @@ int tts_pause_async(tts_h tts)
 
        if (false == tts_core_check_screen_reader(client)) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Screen reader option is not available");
-               return TTS_ERROR_INVALID_STATE;
+               return TTS_ERROR_SCREEN_READER_OFF;
        }
 
        ecore_main_loop_thread_safe_call_async(__tts_pause_async, (void*)tts);
@@ -1144,7 +1197,7 @@ int tts_pause(tts_h tts)
 
        if (false == tts_core_check_screen_reader(client)) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Screen reader option is not available");
-               return TTS_ERROR_INVALID_STATE;
+               return TTS_ERROR_SCREEN_READER_OFF;
        }
 
        int ret = tts_core_pause(client);
@@ -1559,6 +1612,62 @@ int tts_unset_engine_changed_cb(tts_h tts)
        return 0;
 }
 
+int tts_set_screen_reader_changed_cb(tts_h tts, tts_screen_reader_changed_cb callback, void* user_data)
+{
+       if (0 != __tts_get_feature_enabled()) {
+               return TTS_ERROR_NOT_SUPPORTED;
+       }
+
+       tts_client_s* client = tts_client_get(tts);
+       if (NULL == client) {
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] A handle is not valid. tts(%p)", tts);
+               return TTS_ERROR_INVALID_PARAMETER;
+       }
+
+       if (NULL == callback) {
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set screen reader changed cb : Input parameter is null");
+               return TTS_ERROR_INVALID_PARAMETER;
+       }
+
+       tts_state_e current_state = tts_client_get_current_state(client);
+       if (TTS_STATE_CREATED != current_state) {
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Set screen reader changed cb : Current state is not 'Created'.");
+               return TTS_ERROR_INVALID_STATE;
+       }
+
+       tts_client_set_screen_reader_changed_cb(client, callback, user_data);
+
+       SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Set screen reader changed cb");
+
+       return 0;
+}
+
+int tts_unset_screen_reader_changed_cb(tts_h tts)
+{
+       if (0 != __tts_get_feature_enabled()) {
+               return TTS_ERROR_NOT_SUPPORTED;
+       }
+
+       tts_client_s* client = tts_client_get(tts);
+       if (NULL == client) {
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] A handle is not valid. tts(%p)", tts);
+               return TTS_ERROR_INVALID_PARAMETER;
+       }
+
+       tts_state_e current_state = tts_client_get_current_state(client);
+       if (TTS_STATE_CREATED != current_state) {
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Unset screen reader changed cb : Current state is not 'Created'.");
+               return TTS_ERROR_INVALID_STATE;
+       }
+
+       tts_client_set_screen_reader_changed_cb(client, NULL, NULL);
+
+       SLOG(LOG_DEBUG, TAG_TTSC, "[SUCCESS] Unset screen reader changed cb");
+
+       return 0;
+}
+
+
 //LCOV_EXCL_START
 int tts_add_pcm(tts_h tts, int event, const void* data, unsigned int data_size, int audio_type, int rate)
 {
@@ -1582,7 +1691,7 @@ int tts_add_pcm(tts_h tts, int event, const void* data, unsigned int data_size,
 
        if (false == tts_core_check_screen_reader(client)) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Screen reader option is not available");
-               return TTS_ERROR_INVALID_STATE;
+               return TTS_ERROR_SCREEN_READER_OFF;
        }
 
        int ret = tts_core_add_pcm(client, event, data, data_size, audio_type, rate);
@@ -1617,7 +1726,7 @@ int tts_play_pcm(tts_h tts)
 
        if (false == tts_core_check_screen_reader(client)) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Screen reader option is not available");
-               return TTS_ERROR_INVALID_STATE;
+               return TTS_ERROR_SCREEN_READER_OFF;
        }
 
        int ret = tts_core_play_pcm(client);
@@ -1652,7 +1761,7 @@ int tts_stop_pcm(tts_h tts)
 
        if (false == tts_core_check_screen_reader(client)) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Screen reader option is not available");
-               return TTS_ERROR_INVALID_STATE;
+               return TTS_ERROR_SCREEN_READER_OFF;
        }
 
        int ret = tts_core_stop_pcm(client);
@@ -1693,7 +1802,7 @@ int tts_repeat(tts_h tts, char** text_repeat, int* utt_id)
 
        if (false == tts_core_check_screen_reader(client)) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Screen reader option is not available");
-               return TTS_ERROR_INVALID_STATE;
+               return TTS_ERROR_SCREEN_READER_OFF;
        }
 
        if (true == client->credential_needed && NULL == client->credential) {
index 841ee52f03cedd69debd8ebc0d2cd1f1f7048276..111f790504adf7607835408cbe545467b39d5605 100644 (file)
@@ -82,6 +82,12 @@ static inline void __set_engine_changed_cb(tts_client_s* client, tts_engine_chan
        client->engine_changed_user_data = user_data;
 }
 
+static inline void __set_screen_reader_changed_cb(tts_client_s* client, tts_screen_reader_changed_cb callback, void* user_data)
+{
+       client->screen_reader_changed_cb = callback;
+       client->screen_reader_changed_user_data = user_data;
+}
+
 static inline void __set_supported_voice_cb(tts_client_s* client, tts_supported_voice_cb callback, void* user_data)
 {
        client->supported_voice_cb = callback;
@@ -570,6 +576,14 @@ void tts_client_set_engine_changed_cb(tts_client_s* client, tts_engine_changed_c
        __set_engine_changed_cb(client, callback, user_data);
 }
 
+void tts_client_set_screen_reader_changed_cb(tts_client_s* client, tts_screen_reader_changed_cb callback, void* user_data)
+{
+       if (false == tts_client_is_valid_client(client)) {
+               return;
+       }
+       __set_screen_reader_changed_cb(client, callback, user_data);
+}
+
 void tts_client_set_supported_voice_cb(tts_client_s* client, tts_supported_voice_cb callback, void* user_data)
 {
        if (false == tts_client_is_valid_client(client)) {
@@ -674,6 +688,22 @@ void* tts_client_get_engine_changed_user_data(tts_client_s* client)
        return client->engine_changed_user_data;
 }
 
+tts_screen_reader_changed_cb tts_client_get_screen_reader_changed_cb(tts_client_s* client)
+{
+       if (false == tts_client_is_valid_client(client)) {
+               return NULL;
+       }
+       return client->screen_reader_changed_cb;
+}
+
+void* tts_client_get_screen_reader_changed_user_data(tts_client_s* client)
+{
+       if (false == tts_client_is_valid_client(client)) {
+               return NULL;
+       }
+       return client->screen_reader_changed_user_data;
+}
+
 tts_supported_voice_cb tts_client_get_supported_voice_cb(tts_client_s* client)
 {
        if (false == tts_client_is_valid_client(client)) {
index 729fe5cb85c9a1cf27f567f8fa3bff0a33b79a80..e406f015b4927118fab70aebe64268fc1e34574b 100644 (file)
@@ -48,6 +48,8 @@ typedef struct {
        void*                           default_voice_changed_user_data;
        tts_engine_changed_cb           engine_changed_cb;
        void*                           engine_changed_user_data;
+       tts_screen_reader_changed_cb    screen_reader_changed_cb;
+       void*                           screen_reader_changed_user_data;
        tts_supported_voice_cb          supported_voice_cb;
        void*                           supported_voice_user_data;
 
@@ -131,6 +133,7 @@ void tts_client_set_utterance_completed_cb(tts_client_s* client, tts_utterance_c
 void tts_client_set_error_cb(tts_client_s* client, tts_error_cb callback, void* user_data);
 void tts_client_set_default_voice_changed_cb(tts_client_s* client, tts_default_voice_changed_cb callback, void* user_data);
 void tts_client_set_engine_changed_cb(tts_client_s* client, tts_engine_changed_cb callback, void* user_data);
+void tts_client_set_screen_reader_changed_cb(tts_client_s* client, tts_screen_reader_changed_cb callback, void* user_data);
 void tts_client_set_supported_voice_cb(tts_client_s* client, tts_supported_voice_cb callback, void* user_data);
 
 tts_state_changed_cb tts_client_get_state_changed_cb(tts_client_s* client);
@@ -151,6 +154,9 @@ void* tts_client_get_default_voice_changed_user_data(tts_client_s* client);
 tts_engine_changed_cb tts_client_get_engine_changed_cb(tts_client_s* client);
 void* tts_client_get_engine_changed_user_data(tts_client_s* client);
 
+tts_screen_reader_changed_cb tts_client_get_screen_reader_changed_cb(tts_client_s* client);
+void* tts_client_get_screen_reader_changed_user_data(tts_client_s* client);
+
 tts_supported_voice_cb tts_client_get_supported_voice_cb(tts_client_s* client);
 void* tts_client_get_supported_voice_user_data(tts_client_s* client);
 
index 13345b2e7a5f2c66862f847911e40720f044deb6..e2b07179ff59c12b4b69e069ee6d13a0a99792c6 100644 (file)
@@ -415,7 +415,7 @@ static int __send_hello_msg(tts_client_s* client)
 
        if (false == tts_core_check_screen_reader(client)) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Screen reader option is not available");
-               return TTS_ERROR_INVALID_STATE;
+               return TTS_ERROR_SCREEN_READER_OFF;
        }
 
        int uid = tts_client_get_uid(client);
@@ -887,6 +887,30 @@ int tts_core_notify_engine_changed(tts_client_s* client, const char* engine_id,
        return TTS_ERROR_NONE;
 }
 
+int tts_core_notify_screen_reader_changed(tts_client_s* client, bool value)
+{
+       if (false == tts_client_is_valid_client(client)) {
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Handle is not valid.");
+               return TTS_ERROR_INVALID_PARAMETER;
+       }
+
+       SLOG(LOG_DEBUG, TAG_TTSC, "Screen reader is changed. Current status(%d)", value);
+
+       tts_screen_reader_changed_cb callback = tts_client_get_screen_reader_changed_cb(client);
+       void* data = tts_client_get_screen_reader_changed_user_data(client);
+
+       if (NULL != callback) {
+               SLOG(LOG_DEBUG, TAG_TTSC, "Notify screen reader changed");
+               tts_client_use_callback(client);
+               callback(tts_client_get_handle(client), value, data);
+               tts_client_not_use_callback(client);
+       } else {
+               SLOG(LOG_WARN, TAG_TTSC, "No registered callback(screen_reader_changed)");
+       }
+
+       return TTS_ERROR_NONE;
+}
+
 bool tts_core_is_valid_text(const char* text)
 {
        if (NULL == text) {
@@ -1023,7 +1047,7 @@ int tts_core_prepare(tts_client_s* client)
 
        if (false == tts_core_check_screen_reader(client)) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Screen reader option is not available");
-               return TTS_ERROR_INVALID_STATE;
+               return TTS_ERROR_SCREEN_READER_OFF;
        }
 
        SLOG(LOG_INFO, TAG_TTSC, "[INFO] Start core_prepare. tts_h(%p), tts_client(%p)", tts_client_get_handle(client), client);
@@ -1053,7 +1077,7 @@ int tts_core_prepare_sync(tts_client_s* client)
        while (TTS_CONNECTION_RETRY_COUNT > cnt) {
                if (false == tts_core_check_screen_reader(client)) {
                        SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Screen reader option is not available");
-                       return TTS_ERROR_INVALID_STATE;
+                       return TTS_ERROR_SCREEN_READER_OFF;
                }
 
                if (EINA_FALSE == __prepare_sync_cb(client)) {
index ecf75f3d4cb3c7e71f7399db665ad61390e9dbe2..a2553aa4846621be303c10a4858b4e85caf9ab04 100644 (file)
@@ -29,6 +29,7 @@ int tts_core_notify_utt_completeted(tts_client_s* client, int utt_id);
 int tts_core_notify_error_async(tts_client_s* client, tts_error_e reason, int utt_id, const char* err_msg);
 int tts_core_notify_default_voice_changed(tts_client_s* client, const char* before_lang, int before_voice_type, const char* language, int voice_type);
 int tts_core_notify_engine_changed(tts_client_s* client, const char* engine_id, const char* language, int voice_type, bool need_credential);
+int tts_core_notify_screen_reader_changed(tts_client_s* client, bool value);
 
 bool tts_core_is_valid_text(const char* text);
 bool tts_core_check_screen_reader(tts_client_s* client);
index 375bc707318bb56c58a2de96639367ca2524bfaa..3963e92515e5c4828a01ddccb432d636e4a92392 100644 (file)
@@ -35,6 +35,7 @@ typedef struct {
        tts_config_pitch_changed_cb             pitch_cb;
        tts_config_bg_volume_ratio_changed_cb bg_volume_ratio_cb;
        void*   user_data;
+       void*   screen_user_data;
 } tts_config_client_s;
 
 static GSList* g_engine_list = NULL;
@@ -729,7 +730,7 @@ void __tts_config_screen_reader_changed_cb(keynode_t *key, void *data)
 
                if (NULL != temp_client) {
                        if (NULL != temp_client->screen_cb) {
-                               temp_client->screen_cb((bool)screen_reader);
+                               temp_client->screen_cb((bool)screen_reader, temp_client->screen_user_data);
                        }
                }
 
@@ -1079,6 +1080,7 @@ int tts_config_mgr_initialize(int uid)
                temp_client->screen_cb = NULL;
                temp_client->bg_volume_ratio_cb = NULL;
                temp_client->user_data = NULL;
+               temp_client->screen_user_data = NULL;
 
                g_config_client_list = g_slist_append(g_config_client_list, temp_client);
 
@@ -1098,6 +1100,7 @@ int tts_config_mgr_initialize(int uid)
                temp_client->screen_cb = NULL;
                temp_client->bg_volume_ratio_cb = NULL;
                temp_client->user_data = NULL;
+               temp_client->screen_user_data = NULL;
 
                g_config_client_list = g_slist_append(g_config_client_list, temp_client);
        }
@@ -1329,7 +1332,7 @@ int tts_config_mgr_unset_callback(int uid)
        return 0;
 }
 
-int tts_config_set_screen_reader_callback(int uid, tts_config_screen_reader_changed_cb callback)
+int tts_config_mgr_set_screen_reader_callback(int uid, tts_config_screen_reader_changed_cb callback, void* user_data)
 {
        if (NULL == callback) {
                SLOG(LOG_ERROR, TAG_TTSCONFIG, "Input parameter is NULL");
@@ -1348,6 +1351,7 @@ int tts_config_set_screen_reader_callback(int uid, tts_config_screen_reader_chan
                if (NULL != temp_client) {
                        if (uid == temp_client->uid) {
                                temp_client->screen_cb = callback;
+                               temp_client->screen_user_data = user_data;
                        }
                }
 
@@ -1356,7 +1360,7 @@ int tts_config_set_screen_reader_callback(int uid, tts_config_screen_reader_chan
        return 0;
 }
 
-int tts_config_unset_screen_reader_callback(int uid)
+int tts_config_mgr_unset_screen_reader_callback(int uid)
 {
        GSList *iter = NULL;
        tts_config_client_s* temp_client = NULL;
@@ -1370,6 +1374,7 @@ int tts_config_unset_screen_reader_callback(int uid)
                if (NULL != temp_client) {
                        if (uid == temp_client->uid) {
                                temp_client->screen_cb = NULL;
+                               temp_client->screen_user_data = NULL;
                        }
                }
 
index 8aee904cca8288df51439146881938c185edb028..2c6324242035f93601a83ae4fa24565714b567db 100644 (file)
@@ -50,11 +50,11 @@ typedef bool (*tts_config_supported_engine_cb)(const char* engine_id, const char
 
 typedef bool (*tts_config_supported_voice_cb)(const char* engine_id, const char* language, int type, void* user_data);
 
-typedef void (*tts_config_engine_changed_cb)(const char* engine_id, const char* setting, 
+typedef void (*tts_config_engine_changed_cb)(const char* engine_id, const char* setting,
                                             const char* language, int voice_type, bool auto_voice, bool need_credential, void* user_data);
 
-typedef void (*tts_config_voice_changed_cb)(const char* before_language, int before_voice_type, 
-                                           const char* current_language, int current_voice_type, 
+typedef void (*tts_config_voice_changed_cb)(const char* before_language, int before_voice_type,
+                                           const char* current_language, int current_voice_type,
                                            bool auto_voice, void* user_data);
 
 typedef void (*tts_config_speech_rate_changed_cb)(int value, void* user_data);
@@ -63,7 +63,7 @@ typedef void (*tts_config_pitch_changed_cb)(int value, void* user_data);
 
 typedef void (*tts_config_bg_volume_ratio_changed_cb)(double value, void* user_data);
 
-typedef void (*tts_config_screen_reader_changed_cb)(bool value);
+typedef void (*tts_config_screen_reader_changed_cb)(bool value, void* user_data);
 
 
 int tts_config_mgr_initialize(int uid);
@@ -71,10 +71,10 @@ int tts_config_mgr_initialize(int uid);
 int tts_config_mgr_finalize(int uid);
 
 
-int tts_config_mgr_set_callback(int uid, 
-                               tts_config_engine_changed_cb engine_cb, 
-                               tts_config_voice_changed_cb voice_cb, 
-                               tts_config_speech_rate_changed_cb speech_cb, 
+int tts_config_mgr_set_callback(int uid,
+                               tts_config_engine_changed_cb engine_cb,
+                               tts_config_voice_changed_cb voice_cb,
+                               tts_config_speech_rate_changed_cb speech_cb,
                                tts_config_pitch_changed_cb pitch_cb,
                                tts_config_bg_volume_ratio_changed_cb bg_volume_ratio_cb,
                                void* user_data);
@@ -82,9 +82,9 @@ int tts_config_mgr_set_callback(int uid,
 int tts_config_mgr_unset_callback(int uid);
 
 /* Only for screen reader option */
-int tts_config_set_screen_reader_callback(int uid, tts_config_screen_reader_changed_cb callback);
+int tts_config_mgr_set_screen_reader_callback(int uid, tts_config_screen_reader_changed_cb callback, void* user_data);
 
-int tts_config_unset_screen_reader_callback(int uid);
+int tts_config_mgr_unset_screen_reader_callback(int uid);
 
 
 int tts_config_mgr_get_engine_list(tts_config_supported_engine_cb callback, void* user_data);
index 15922d628cede613705cba7a5b72923c117f6d86..3a8bb00d2434c7ada12fa2ef9d109d0531c6f658 100644 (file)
@@ -57,7 +57,8 @@ typedef enum {
        TTS_ERROR_OPERATION_FAILED = TIZEN_ERROR_TTS | 0x04, /**< Operation failed */
        TTS_ERROR_AUDIO_POLICY_BLOCKED = TIZEN_ERROR_TTS | 0x05, /**< Audio policy blocked */
        TTS_ERROR_NOT_SUPPORTED_FEATURE = TIZEN_ERROR_TTS | 0x06, /**< Not supported feature of current engine @if MOBILE (Since 3.0) @elseif WEARABLE (Since 2.3.2) @endif */
-       TTS_ERROR_SERVICE_RESET = TIZEN_ERROR_TTS | 0x07 /**< Service reset @if MOBILE (Since 3.0) @elseif WEARABLE (Since 2.3.2) @endif */
+       TTS_ERROR_SERVICE_RESET = TIZEN_ERROR_TTS | 0x07, /**< Service reset @if MOBILE (Since 3.0) @elseif WEARABLE (Since 2.3.2) @endif */
+       TTS_ERROR_SCREEN_READER_OFF = TIZEN_ERROR_TTS | 0x08 /**< Screen reader is off (Since 6.5) */
 } tts_error_e;
 
 
@@ -231,6 +232,16 @@ typedef void (*tts_default_voice_changed_cb)(tts_h tts, const char* previous_lan
 typedef void (*tts_engine_changed_cb)(tts_h tts, const char* engine_id, const char* language, int voice_type, bool need_credential, void* user_data);
 
 
+/**
+ * @brief Called when the option of screen reader is changed.
+ * @since_tizen 6.5
+ * @param[in] tts The TTS handle
+ * @param[in] is_on The status of screen reader. If @a is_on is @c true, screen reader is turned on. If not, it is turned off.
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see tts_set_screen_reader_changed_cb()
+*/
+typedef void (*tts_screen_reader_changed_cb)(tts_h tts, bool is_on, void* user_data);
+
 /**
  * @brief Creates a handle for TTS.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
@@ -239,11 +250,11 @@ typedef void (*tts_engine_changed_cb)(tts_h tts, const char* engine_id, const ch
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
- * @retval #TTS_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TTS_ERROR_OUT_OF_MEMORY Out of memory
  * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @post If this function is called, the TTS state will be #TTS_STATE_CREATED.
  * @see tts_destroy()
 */
@@ -257,9 +268,9 @@ int tts_create(tts_h* tts);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @see tts_create()
 */
 int tts_destroy(tts_h tts);
@@ -273,10 +284,10 @@ int tts_destroy(tts_h tts);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @pre The state should be #TTS_STATE_CREATED.
  * @see tts_get_mode()
 */
@@ -291,9 +302,9 @@ int tts_set_mode(tts_h tts, tts_mode_e mode);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @pre The state should be #TTS_STATE_CREATED.
  * @see tts_set_mode()
 */
@@ -313,9 +324,9 @@ int tts_get_mode(tts_h tts, tts_mode_e* mode);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Success
- * @retval #TTS_ERROR_INVALID_STATE Invalid state
- * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
+ * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TTS_ERROR_INVALID_STATE Invalid state
  * @pre The state should be #TTS_STATE_CREATED or #TTS_STATE_READY.
  * @see tts_play()
 */
@@ -329,9 +340,10 @@ int tts_set_credential(tts_h tts, const char* credential);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
+ * @retval #TTS_ERROR_SCREEN_READER_OFF Screen reader is turned off
  * @pre The state should be #TTS_STATE_CREATED.
  * @post If this function is successful, the TTS state will be #TTS_STATE_READY.
  *       If this function is failed, the error callback is called. (e.g. #TTS_ERROR_ENGINE_NOT_FOUND)
@@ -347,9 +359,9 @@ int tts_prepare(tts_h tts);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @pre The state should be #TTS_STATE_READY.
  * @post If this function is called, the TTS state will be #TTS_STATE_CREATED.
  * @see tts_prepare()
@@ -366,10 +378,10 @@ int tts_unprepare(tts_h tts);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @post This function invokes tts_supported_voice_cb() repeatedly for getting voices.
  * @see tts_get_default_voice()
 */
@@ -386,10 +398,10 @@ int tts_foreach_supported_voices(tts_h tts, tts_supported_voice_cb callback, voi
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @see tts_foreach_supported_voices()
 */
 int tts_get_default_voice(tts_h tts, char** language, int* voice_type);
@@ -409,11 +421,11 @@ int tts_get_default_voice(tts_h tts, char** language, int* voice_type);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
  * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @pre The state should be #TTS_STATE_READY.
  * @see tts_get_private_data()
 */
@@ -433,11 +445,11 @@ int tts_set_private_data(tts_h tts, const char* key, const char* data);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
- * @retval #TTS_ERROR_INVALID_STATE Invalid state
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TTS_ERROR_INVALID_STATE Invalid state
  * @retval #TTS_ERROR_ENGINE_NOT_FOUND Engine not found
  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @pre The state should be #TTS_STATE_READY.
  * @see tts_set_private_data()
 */
@@ -452,10 +464,10 @@ int tts_get_private_data(tts_h tts, const char* key, char** data);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @pre The state should be #TTS_STATE_READY.
  * @see tts_add_text()
 */
@@ -470,8 +482,8 @@ int tts_get_max_text_size(tts_h tts, unsigned int* size);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
- * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
+ * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @see tts_play()
  * @see tts_stop()
  * @see tts_pause()
@@ -489,10 +501,10 @@ int tts_get_state(tts_h tts, tts_state_e* state);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @pre The state should be #TTS_STATE_CREATED.
  * @see tts_add_text()
 */
@@ -509,8 +521,8 @@ int tts_get_speed_range(tts_h tts, int* min, int* normal, int* max);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
- * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
+ * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
  * @see tts_set_error_cb()
  * @see tts_unset_error_cb()
@@ -518,6 +530,26 @@ int tts_get_speed_range(tts_h tts, int* min, int* normal, int* max);
 int tts_get_error_message(tts_h tts, char** err_msg);
 
 
+/**
+ * @brief Checks whether screen reader is turned on or not.
+ * @since_tizen 6.5
+ * @remarks If TTS mode is #TTS_MODE_SCREEN_READER, you should call this function to check whether screen reader is turned on or not, before calling 'tts_prepare()'.
+ *          If TTS mode is #TTS_MODE_SCREEN_READER and @a is_on is @c false, all other functions will return #TIZEN_ERROR_SCREEN_READER_OFF.
+ *          The @a is_on must be released using free() when it is no longer required.
+ * @param[in] tts The TTS handle
+ * @param[out] is_on The current status of screen reader
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
+ * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
+ * @see tts_set_screen_reader_changed_cb()
+ * @see tts_unset_screen_reader_changed_cb()
+*/
+int tts_check_screen_reader_on(tts_h tts, bool* is_on);
+
+
 /**
  * @brief Adds a text to the queue.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
@@ -531,12 +563,13 @@ int tts_get_error_message(tts_h tts, char** err_msg);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
+ * @retval #TTS_ERROR_PERMISSION_DENIED Permission denied
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
  * @retval #TTS_ERROR_INVALID_VOICE Invalid voice about language, voice type
  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
- * @retval #TTS_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #TTS_ERROR_SCREEN_READER_OFF Screen reader is turned off
  * @pre The state should be #TTS_STATE_READY, #TTS_STATE_PLAYING or #TTS_STATE_PAUSED.
  * @see tts_get_max_text_size()
  * @see tts_set_credential()
@@ -551,12 +584,13 @@ int tts_add_text(tts_h tts, const char* text, const char* language, int voice_ty
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
+ * @retval #TTS_ERROR_PERMISSION_DENIED Permission denied
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_OUT_OF_NETWORK Out of network
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
- * @retval #TTS_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #TTS_ERROR_SCREEN_READER_OFF Screen reader is turned off
  * @pre The current state should be #TTS_STATE_READY or #TTS_STATE_PAUSED.
  * @post If this function succeeds, the TTS state will be #TTS_STATE_PLAYING.
  * @see tts_add_text()
@@ -577,10 +611,11 @@ int tts_play(tts_h tts);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
+ * @retval #TTS_ERROR_SCREEN_READER_OFF Screen reader is turned off
  * @pre The TTS state should be #TTS_STATE_READY or #TTS_STATE_PLAYING or #TTS_STATE_PAUSED.
  * @post If this function succeeds, the TTS state will be #TTS_STATE_READY.
  *       This function will remove all text via tts_add_text() and synthesized sound data.
@@ -597,10 +632,11 @@ int tts_stop(tts_h tts);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
+ * @retval #TTS_ERROR_SCREEN_READER_OFF Screen reader is turned off
  * @pre The TTS state should be #TTS_STATE_PLAYING.
  * @post If this function succeeds, the TTS state will be #TTS_STATE_PAUSED.
  * @see tts_play()
@@ -623,10 +659,11 @@ int tts_pause(tts_h tts);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_OPERATION_FAILED Operation failure
+ * @retval #TTS_ERROR_SCREEN_READER_OFF Screen reader is turned off
  * @pre The state should be #TTS_STATE_READY.
  * @post If this function succeeds, the TTS state will be #TTS_STATE_PLAYING.
  * @see tts_add_text()
@@ -643,9 +680,9 @@ int tts_repeat(tts_h tts, char** text_repeat, int* utt_id);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @pre The state should be #TTS_STATE_CREATED.
  * @see tts_state_changed_cb()
  * @see tts_unset_state_changed_cb()
@@ -660,9 +697,9 @@ int tts_set_state_changed_cb(tts_h tts, tts_state_changed_cb callback, void* use
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @pre The state should be #TTS_STATE_CREATED.
  * @see tts_set_state_changed_cb()
 */
@@ -678,9 +715,9 @@ int tts_unset_state_changed_cb(tts_h tts);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @pre The state should be #TTS_STATE_CREATED.
  * @see tts_utterance_started_cb()
  * @see tts_unset_utterance_started_cb()
@@ -695,9 +732,9 @@ int tts_set_utterance_started_cb(tts_h tts, tts_utterance_started_cb callback, v
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @pre The state should be #TTS_STATE_CREATED.
  * @see tts_set_utterance_started_cb()
 */
@@ -713,9 +750,9 @@ int tts_unset_utterance_started_cb(tts_h tts);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @pre The state should be #TTS_STATE_CREATED.
  * @see tts_utterance_completed_cb()
  * @see tts_unset_utterance_completed_cb()
@@ -730,9 +767,9 @@ int tts_set_utterance_completed_cb(tts_h tts, tts_utterance_completed_cb callbac
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @pre The state should be #TTS_STATE_CREATED.
  * @see tts_set_utterance_completed_cb()
 */
@@ -748,9 +785,9 @@ int tts_unset_utterance_completed_cb(tts_h tts);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @pre The state should be #TTS_STATE_CREATED.
  * @see tts_error_cb()
  * @see tts_unset_error_cb()
@@ -765,9 +802,9 @@ int tts_set_error_cb(tts_h tts, tts_error_cb callback, void* user_data);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @pre The state should be #TTS_STATE_CREATED.
  * @see tts_set_error_cb()
 */
@@ -783,9 +820,9 @@ int tts_unset_error_cb(tts_h tts);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @pre The state should be #TTS_STATE_CREATED.
  * @see tts_default_voice_changed_cb()
  * @see tts_unset_default_voice_changed_cb()
@@ -800,9 +837,9 @@ int tts_set_default_voice_changed_cb(tts_h tts, tts_default_voice_changed_cb cal
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @pre The state should be #TTS_STATE_CREATED.
  * @see tts_set_default_voice_changed_cb()
 */
@@ -818,9 +855,9 @@ int tts_unset_default_voice_changed_cb(tts_h tts);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @pre The state should be #TTS_STATE_CREATED.
  * @see tts_engine_changed_cb()
  * @see tts_unset_engine_changed_cb()
@@ -835,15 +872,50 @@ int tts_set_engine_changed_cb(tts_h tts, tts_engine_changed_cb callback, void* u
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #TTS_ERROR_INVALID_STATE Invalid state
- * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
  * @pre The state should be #TTS_STATE_CREATED.
  * @see tts_set_engine_changed_cb()
 */
 int tts_unset_engine_changed_cb(tts_h tts);
 
 
+/**
+ * @brief Registers a callback function to detect the option of screen reader is changed or not.
+ * @since_tizen 6.5
+ * @remarks If TTS mode is #TTS_MODE_SCREEN_READER, you should set the callback to check the option of screen reader is changed or not.
+ * @param[in] tts The TTS handle
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
+ * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TTS_ERROR_INVALID_STATE Invalid state
+ * @pre The state should be #TTS_STATE_CREATED.
+ * @see tts_screen_reader_changed_cb()
+ * @see tts_unset_screen_reader_changed_cb()
+*/
+int tts_set_screen_reader_changed_cb(tts_h tts, tts_screen_reader_changed_cb callback, void* user_data);
+
+
+/**
+ * @brief Unregisters the callback function to detect the option of screen reader is changed or not.
+ * @since_tizen 6.5
+ * @param[in] tts The TTS handle
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #TTS_ERROR_NONE Successful
+ * @retval #TTS_ERROR_NOT_SUPPORTED TTS NOT supported
+ * @retval #TTS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TTS_ERROR_INVALID_STATE Invalid state
+ * @pre The state should be #TTS_STATE_CREATED.
+ * @see tts_set_screen_reader_changed_cb()
+*/
+int tts_unset_screen_reader_changed_cb(tts_h tts);
+
 #ifdef __cplusplus
 }
 #endif
index 341ae968bf380890b5b1c9f85484d60540ba4038..57915712e2df8c88e0d882d4a887587a3683e206 100644 (file)
@@ -75,7 +75,7 @@ void __ttsd_config_pitch_changed_cb(int value, void* user_data)
        }
 }
 
-void __ttsd_config_screen_reader_changed_cb(bool value)
+void __ttsd_config_screen_reader_changed_cb(bool value, void* user_data)
 {
        if (NULL != g_sr_callback) {
                g_sr_callback(value);
@@ -119,7 +119,7 @@ int ttsd_config_initialize(ttsd_config_changed_cb config_cb)
 
 int ttsd_config_finalize()
 {
-       tts_config_unset_screen_reader_callback(getpid());
+       tts_config_mgr_unset_screen_reader_callback(getpid());
 
        tts_config_mgr_finalize(getpid());
 
@@ -135,7 +135,7 @@ int ttsd_config_set_screen_reader_callback(ttsd_config_screen_reader_changed_cb
 
        g_sr_callback = sr_cb;
 
-       int ret = tts_config_set_screen_reader_callback(getpid(), __ttsd_config_screen_reader_changed_cb) ;
+       int ret = tts_config_mgr_set_screen_reader_callback(getpid(), __ttsd_config_screen_reader_changed_cb, NULL) ;
        if (0 != ret) {
                SLOG(LOG_ERROR, tts_tag(), "[Config] Fail to set screen reader callback");
                return -1;