3.0 Native API reference english examination
[platform/core/pim/calendar-service.git] / include / calendar_service.h
1 /*
2  * Calendar Service
3  *
4  * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef __TIZEN_SOCIAL_CALENDAR_SERVICE_H__
21 #define __TIZEN_SOCIAL_CALENDAR_SERVICE_H__
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /**
28  * @file calendar_service.h
29  */
30
31 /**
32  * @ingroup CAPI_SOCIAL_CALENDAR_SVC_MODULE
33  * @defgroup CAPI_SOCIAL_CALENDAR_SVC_COMMON_MODULE Common
34  * @brief The calendar common API provides the set of definitions and interfaces to initialize and deinitialize.
35  * @section CAPI_SOCIAL_CALENDAR_SVC_COMMON_MODULE_HEADER Required Header
36  * \#include <calendar.h>
37  * <BR>
38  * @{
39  */
40
41 /**
42  * @brief Connects to the calendar service.
43  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
44  * @remarks Opening the connection is necessary to access the calendar database and perform operations such as fetching, inserting, or updating records.\n
45  *          The execution of calendar_connect() and calendar_disconnect() could slow down your application, so you are recommended not to call them frequently.
46  * @return @c 0 on success,
47  *         otherwise a negative error value
48  * @retval #CALENDAR_ERROR_NONE Successful
49  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
50  * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
51  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
52  * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
53  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method
54  * @retval #CALENDAR_ERROR_IPC Unknown IPC error
55  * @retval #CALENDAR_ERROR_SYSTEM Error from another modules
56  * @see  calendar_disconnect()
57  */
58 int calendar_connect(void);
59
60
61 /**
62  * @brief Disconnects from the calendar service.
63  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
64  * @remarks If there is no opened connection, this function returns #CALENDAR_ERROR_DB_FAILED.
65  * @return @c 0 on success,
66  *         otherwise a negative error value
67  * @retval #CALENDAR_ERROR_NONE Successful
68  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
69  * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
70  * @retval #CALENDAR_ERROR_IPC Unknown IPC error
71  * @see calendar_connect()
72  */
73 int calendar_disconnect(void);
74
75
76 /**
77  * @brief Connects to the calendar service on a thread.
78  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
79  * @remarks Opening a connection is necessary to access the calendar database and perform operations such as fetching, inserting, or updating records.\n
80  *          On a thread environment with calendar_connect(), request in one thread could fail, while another request connection is working in the other thread.
81  *          To prevent request failure, calendar_connect_on_thread() is recommended.
82  * @return @c 0 on success,
83  *         otherwise a negative error value
84  * @retval #CALENDAR_ERROR_NONE Successful
85  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
86  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method
87  * @see  calendar_disconnect_on_thread()
88  */
89 int calendar_connect_on_thread(void);
90
91
92 /**
93  * @brief Disconnects from the calendar service on a thread.
94  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
95  * @remarks If there is no opened connection, this function returns #CALENDAR_ERROR_DB_FAILED.
96  * @return @c 0 on success,
97  *         otherwise a negative error value
98  * @retval #CALENDAR_ERROR_NONE Successful
99  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
100  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
101  * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
102  * @see calendar_connect_on_thread()
103  */
104 int calendar_disconnect_on_thread(void);
105
106
107 /**
108  * @brief Connects to the calendar service.
109  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 3.0 @endif
110  * @remarks Opening a connection is necessary to access the calendar database and perform operations such as fetching, inserting, or updating records.\n
111  *          Before the calendar-service daemon is ready, if you call calendar_connect(), it could fail.
112  *          It is recommended to call this API with #CALENDAR_CONNECT_FLAG_RETRY flags in such a situation.
113  * @param[in] flags calendar_connect_flag
114  * @return @c 0 on success,
115  *         otherwise a negative error value
116  * @retval #CALENDAR_ERROR_NONE Successful
117  * @retval #CALENDAR_ERROR_DB_FAILED Database operation failure
118  * @retval #CALENDAR_ERROR_OUT_OF_MEMORY Out of memory
119  * @retval #CALENDAR_ERROR_INVALID_PARAMETER Invalid parameter
120  * @retval #CALENDAR_ERROR_NOT_PERMITTED Operation not permitted
121  * @retval #CALENDAR_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
122  * @retval #CALENDAR_ERROR_IPC Unknown IPC error
123  * @retval #CALENDAR_ERROR_SYSTEM Error from another modules
124  * @see  calendar_disconnect(), CALENDAR_CONNECT_FLAG_RETRY
125  */
126 int calendar_connect_with_flags(unsigned int flags);
127
128
129 /**
130  * @}
131  */
132
133 #ifdef __cplusplus
134 }
135 #endif
136
137 #endif /* __TIZEN_SOCIAL_CALENDAR_SERVICE_H__ */
138