Unify error handling function
[platform/core/uifw/tts.git] / client / tts_core.h
1 /*
2 *  Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
3 *  Licensed under the Apache License, Version 2.0 (the "License");
4 *  you may not use this file except in compliance with the License.
5 *  You may obtain a copy of the License at
6 *  http://www.apache.org/licenses/LICENSE-2.0
7 *  Unless required by applicable law or agreed to in writing, software
8 *  distributed under the License is distributed on an "AS IS" BASIS,
9 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 *  See the License for the specific language governing permissions and
11 *  limitations under the License.
12 */
13
14
15 #ifndef __TTS_CORE_H_
16 #define __TTS_CORE_H_
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21
22 #include "tts_client.h"
23
24 // common function
25 int tts_core_notify_state_changed(tts_client_s* client, tts_state_e before_state, tts_state_e current_state);
26 int tts_core_notify_state_changed_async(tts_client_s* client, tts_state_e before_state, tts_state_e current_state);
27 int tts_core_notify_utt_started(tts_client_s* client, int utt_id);
28 int tts_core_notify_utt_completeted(tts_client_s* client, int utt_id);
29 int tts_core_notify_error_async(tts_client_s* client, tts_error_e reason, int utt_id, char* err_msg);
30 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);
31 int tts_core_notify_engine_changed(tts_client_s* client, const char* engine_id, const char* language, int voice_type, bool need_credential);
32
33 int tts_core_set_current_state(tts_client_s* client, tts_state_e state);
34 bool tts_core_is_valid_text(const char* text);
35
36 // called by tts.c
37 int tts_core_initialize();
38 int tts_core_deinitialize();
39 const char* tts_core_get_engine_name();
40
41 int tts_core_prepare(tts_client_s* client);
42 int tts_core_prepare_sync(tts_client_s* client);
43 int tts_core_unprepare(tts_client_s* client, bool is_screen_reader_on);
44 int tts_core_reprepare();
45
46 int tts_core_foreach_supported_voices(tts_client_s* client, const char* engine_id, tts_supported_voice_cb callback, void* user_data);
47
48 // called by tts_ipc
49 int tts_core_receive_hello(int uid, int ret, int credential_needed);
50 int tts_core_handle_service_reset();
51
52 #ifdef __cplusplus
53 }
54 #endif
55
56 #endif /* __TTS_CORE_H_ */