Add multi-user support
[platform/core/uifw/tts.git] / server / ttsd_main.h
1 /*
2 *  Copyright (c) 2012, 2013 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 __TTSD_MAIN_H_
16 #define __TTSD_MAIN_H_
17
18 #include <stdio.h>
19 #include <stdbool.h>
20 #include <stdlib.h>
21 #include <unistd.h>
22 #include <string.h>
23 #include <glib.h>
24 #include <dlog.h>
25 #include <errno.h>
26
27 /* For multi-user support */
28 #include <tzplatform_config.h>
29
30 #include "ttsp.h"
31 #include "tts_defs.h"
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 /* TTS Daemon Define */ 
38 #define BASE_DIRECTORY_DEFAULT                  "/usr/lib/voice/tts/1.0"
39 #define ENGINE_DIRECTORY_DEFAULT                "/usr/lib/voice/tts/1.0/engine"
40 #define ENGINE_DIRECTORY_DEFAULT_SETTING        "/usr/lib/voice/tts/1.0/setting"
41
42 #define CONFIG_DIRECTORY                tzplatform_mkpath(TZ_USER_HOME, ".voice")
43
44 #define ENGINE_DIRECTORY_DOWNLOAD               tzplatform_mkpath(TZ_USER_HOME, ".voice/tts/1.0/engine")
45 #define ENGINE_DIRECTORY_DOWNLOAD_SETTING       tzplatform_mkpath(TZ_USER_HOME, ".voice/tts/1.0/setting")
46
47 #define CONFIG_DEFAULT                          BASE_DIRECTORY_DEFAULT"/ttsd.conf"
48 #define DEFAULT_CONFIG_FILE_NAME                tzplatform_mkpath(TZ_USER_HOME, ".voice/ttsd_default.conf")
49
50 /* for debug message */
51 #define DATA_DEBUG
52
53 typedef enum {
54         TTSD_ERROR_NONE                 = 0,                    /**< Successful */
55         TTSD_ERROR_OUT_OF_MEMORY        = -ENOMEM,              /**< Out of Memory */
56         TTSD_ERROR_IO_ERROR             = -EIO,                 /**< I/O error */
57         TTSD_ERROR_INVALID_PARAMETER    = -EINVAL,              /**< Invalid parameter */
58         TTSD_ERROR_OUT_OF_NETWORK       = -ENETDOWN,            /**< Out of network */
59         TTSD_ERROR_INVALID_STATE        = -0x0100000 | 0x21,    /**< Invalid state */
60         TTSD_ERROR_INVALID_VOICE        = -0x0100000 | 0x22,    /**< Invalid voice */
61         TTSD_ERROR_ENGINE_NOT_FOUND     = -0x0100000 | 0x23,    /**< No available engine  */
62         TTSD_ERROR_TIMED_OUT            = -0x0100000 | 0x24,    /**< No answer from the daemon */
63         TTSD_ERROR_OPERATION_FAILED     = -0x0100000 | 0x25,    /**< Operation failed  */
64         TTSD_ERROR_AUDIO_POLICY_BLOCKED = -0x0100000 | 0x26     /**< Audio policy blocked */
65 }ttsd_error_e;
66
67 typedef enum {
68         TTSD_MODE_DEFAULT = 0,          /**< Default mode for normal application */
69         TTSD_MODE_NOTIFICATION,         /**< Notification mode */
70         TTSD_MODE_SCREEN_READER         /**< Screen reader mode */
71 }ttsd_mode_e;
72
73 typedef enum {
74         TTSD_INTERRUPTED_PAUSED = 0,    /**< Current state change 'Pause' */
75         TTSD_INTERRUPTED_STOPPED        /**< Current state change 'Ready' */
76 }ttsd_interrupted_code_e;
77
78
79 typedef struct {
80         char* engine_id;
81         char* engine_name;
82         char* ug_name;
83 }engine_s;
84
85 typedef struct {
86         char* language;
87         ttsp_voice_type_e type;
88 }voice_s;
89
90 typedef struct {
91         char* key;
92         char* value;
93 }engine_setting_s;
94
95 /* get daemon mode : default, notification or screen reader */
96 ttsd_mode_e ttsd_get_mode();
97
98 /* Get log tag : default, notification, screen reader */
99 char* get_tag();
100
101 #ifdef __cplusplus
102 }
103 #endif
104
105 #endif  /* __TTSD_MAIN_H_ */