Store current service state from engine library
[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 current_state);
26 int tts_core_notify_utt_started(tts_client_s* client, int utt_id);
27 int tts_core_notify_utt_completeted(tts_client_s* client, int utt_id);
28 int tts_core_notify_error_async(tts_client_s* client, tts_error_e reason, int utt_id, const char* err_msg);
29 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);
30 int tts_core_notify_engine_changed(tts_client_s* client, const char* engine_id, const char* language, int voice_type, bool need_credential);
31 int tts_core_notify_screen_reader_changed(tts_client_s* client, bool value);
32 int tts_core_notify_service_state_changed(tts_client_s* client, tts_service_state_e before_state, tts_service_state_e current_state);
33
34 bool tts_core_is_valid_text(const char* text);
35 bool tts_core_check_screen_reader(tts_client_s* client);
36 bool tts_core_check_credential(tts_client_s* client);
37
38 const char* tts_core_covert_error_code(tts_error_e err);
39
40 // called by tts.c
41 int tts_core_initialize();
42 int tts_core_deinitialize();
43
44 int tts_core_prepare(tts_client_s* client);
45 int tts_core_prepare_sync(tts_client_s* client);
46 int tts_core_unprepare(tts_client_s* client);
47 int tts_core_reprepare();
48
49 int tts_core_foreach_supported_voices(tts_client_s* client, const char* engine_id, tts_supported_voice_cb callback, void* user_data);
50
51 // called by tts_ipc
52 int tts_core_add_text(tts_client_s* client, const char* text, const char* language, int voice_type, int speed, int* utt_id);
53 int tts_core_play(tts_client_s* client);
54 int tts_core_stop(tts_client_s* client);
55 int tts_core_pause(tts_client_s* client);
56 int tts_core_repeat(tts_client_s* client, char** text_repeat, int* utt_id);
57
58 int tts_core_add_pcm(tts_client_s* client, int event, const void* data, unsigned int data_size, int audio_type, int rate);
59 int tts_core_play_pcm(tts_client_s* client);
60 int tts_core_stop_pcm(tts_client_s* client);
61
62 int tts_core_set_private_data(tts_client_s* client, const char* key, const char* data);
63 int tts_core_get_private_data(tts_client_s* client, const char* key, char** data);
64
65 int tts_core_get_service_state(tts_client_s* client, tts_service_state_e* service_state);
66
67 int tts_core_receive_hello(unsigned int uid, int ret, tts_service_state_e service_state, int credential_needed);
68 int tts_core_handle_service_reset();
69
70 #ifdef __cplusplus
71 }
72 #endif
73
74 #endif /* __TTS_CORE_H_ */