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