cd4e00c3a7005f88ff2304f3520e178a394af9ce
[framework/messaging/email-service.git] / email-api / include / email-api-init.h
1 /*\r
2 *  email-service\r
3 *\r
4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
5 *\r
6 * Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>\r
7 *\r
8 * Licensed under the Apache License, Version 2.0 (the "License");\r
9 * you may not use this file except in compliance with the License.\r
10 * You may obtain a copy of the License at\r
11 *\r
12 * http://www.apache.org/licenses/LICENSE-2.0\r
13 *\r
14 * Unless required by applicable law or agreed to in writing, software\r
15 * distributed under the License is distributed on an "AS IS" BASIS,\r
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
17 * See the License for the specific language governing permissions and\r
18 * limitations under the License.\r
19 *\r
20 */\r
21 \r
22 \r
23 #ifndef __EMAIL_API_INTI_H__\r
24 #define __EMAIL_API_INTI_H__\r
25 \r
26 #include "email-types.h"\r
27 \r
28 /**\r
29 * @defgroup EMAIL_SERVICE Email Service\r
30 * @{\r
31 */\r
32 \r
33 \r
34 /**\r
35 * @ingroup EMAIL_SERVICE\r
36 * @defgroup EMAIL_API_INIT Email Initialization API\r
37 * @{\r
38 */\r
39 \r
40 /**\r
41  *\r
42  * This file contains the data structures and interfaces needed for application,\r
43  * to interact with email-service.\r
44  * @file                email-api-init.h\r
45  * @author      Kyuho Jo <kyuho.jo@samsung.com>\r
46  * @author      Sunghyun Kwon <sh0701.kwon@samsung.com>\r
47  * @version     0.1\r
48  * @brief               This file contains the data structures and interfaces of Email FW Initialization provided by\r
49  *                      email-service .\r
50  *@{\r
51  *@code\r
52  *\r
53  *      #include "emf_mapi_init.h"\r
54  *\r
55  *      bool\r
56  *      other_app_invoke_uniform_api_sample(int* error_code)\r
57  *      {\r
58  *               int err = EMF_ERROR_NONE;\r
59  *\r
60  *              // Open connections to email-service and DB\r
61  *              // The connections will be maintain throughout application's execution\r
62  *              if(EMF_ERROR_NONE == email_service_begin())\r
63  *              {\r
64  *                      If(EMF_ERROR_NONE != email_open_db())\r
65  *                      {\r
66  *                              return false;\r
67  *                      }\r
68  *\r
69  *                      // Execute email_init_storage() if and only if there is no db file.\r
70  *                      // This fuction will create db file and tables for email service\r
71  *                      If(EMF_ERROR_NONE !=email_init_storage())\r
72  *                      {\r
73  *                              return false;\r
74  *                      }\r
75  *              }\r
76  *\r
77  *              ......\r
78  *\r
79  *              // Work with calling MAPI functions\r
80  *\r
81  *              ......\r
82  *\r
83  *              // Close the connections to email-service and DB after all email job is finished. (ex. close an email application)\r
84  *              // DO NOT have to call these funtions until the connections is not needed any more.\r
85  *              err =email_close_db();\r
86  *              err =email_service_end();\r
87  *       }\r
88  *\r
89  * @endcode\r
90  * @}\r
91  */\r
92 \r
93 \r
94 \r
95 #ifdef __cplusplus\r
96 extern "C" {\r
97 #endif /* __cplusplus */\r
98 \r
99 /**\r
100 \r
101  * @open\r
102  * @fn email_init_storage(void)\r
103  * @brief       Create all table for email. Exposed to External Application- core team.Creates all Email DB tables [ EXTERNAL]\r
104  *\r
105  * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure\r
106  * @exception none\r
107  * @see none\r
108  * @remarks N/A\r
109  */\r
110 EXPORT_API int email_init_storage(void);\r
111 \r
112 /**\r
113 \r
114  * @open\r
115  * @fn email_open_db(void)\r
116  * @brief This function Open the email DB and register busy handler\r
117  *\r
118  * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
119  * @exception none\r
120  * @see         none\r
121  * @remarks N/A\r
122  */\r
123 EXPORT_API int email_open_db(void);\r
124 \r
125 \r
126 /**\r
127 \r
128  * @open\r
129  * @fn email_close_db(void)\r
130  * @brief       This function closes the connection of  the email DB\r
131  *\r
132  * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
133  * @exception none\r
134  * @see none\r
135  * @remarks N/A\r
136  */\r
137 EXPORT_API int email_close_db(void);\r
138 \r
139 /**\r
140 \r
141  * @open\r
142  * @fn email_service_begin(void)\r
143  * @brief       Does the IPC Proxy Initialization by the Application which used the Email FW API's\r
144  *\r
145  * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
146  * @exception none\r
147  * @see         none\r
148  * @remarks N/A\r
149  */\r
150 EXPORT_API int email_service_begin(void);\r
151 \r
152 /**\r
153 \r
154  * @open\r
155  * @fn email_service_end(void)\r
156  * @brief       This function does the IPC Proxy Finaization by the Application which used the Email FW API's\r
157  *\r
158  * @return This function returns EMF_ERROR_NONE on success or error code (refer to EMF_ERROR_XXX) on failure.\r
159  * @exception   none\r
160  * @see         none\r
161  * @remarks N/A\r
162  */\r
163 EXPORT_API int email_service_end(void);\r
164 \r
165 #ifdef __cplusplus\r
166 }\r
167 #endif /* __cplusplus */\r
168 \r
169 /**\r
170 * @} @}\r
171 */\r
172 \r
173 \r
174 #endif  /* __EMAIL_API_INTI_H__ */\r