4 * Copyright (c) 2010 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #ifndef __TIZEN_SOCIAL_CONTACTS_SERVICE_H__
20 #define __TIZEN_SOCIAL_CONTACTS_SERVICE_H__
23 #define API __attribute__ ((visibility("default")))
32 * @file contacts_service.h
36 * @ingroup CAPI_SOCIAL_CONTACTS_SVC_MODULE
37 * @defgroup CAPI_SOCIAL_CONTACTS_SVC_COMMON_MODULE Common
39 * @brief The contacts common API provides the set of definitions and interfaces to initialize and deinitialize.
41 * @section CAPI_SOCIAL_CONTACTS_SVC_COMMON_MODULE_HEADER Required Header
42 * \#include <contacts.h>
49 * @brief Connects to the contacts service.
53 * @remarks Connection opening is necessary to access the contacts server such as fetching, inserting, or updating records.\n
54 * The execution of contacts_connect() and contacts_disconnect() could slow down your application. So it is not recommended to call them frequently.
56 * @return @c 0 on success,
57 * otherwise a negative error value
59 * @retval #CONTACTS_ERROR_NONE Successful
60 * @retval #CONTACTS_ERROR_DB Database operation failure
61 * @retval #CONTACTS_ERROR_IPC_NOT_AVALIABLE IPC server is not available
62 * @retval #CONTACTS_ERROR_IPC IPC error
63 * @retval #CONTACTS_ERROR_SYSTEM System error
64 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
66 * @see contacts_disconnect()
68 int contacts_connect(void);
71 * @brief Disconnects from the contacts service.
75 * @remarks If there is no opened connection, this function returns #CONTACTS_ERROR_DB.
77 * @return @c 0 on success,
78 * otherwise a negative error value
80 * @retval #CONTACTS_ERROR_NONE Successful
81 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
82 * @retval #CONTACTS_ERROR_DB Database operation failure
83 * @retval #CONTACTS_ERROR_IPC IPC error
85 * @see contacts_connect()
87 int contacts_disconnect(void);
90 * @brief Connects to the contacts service with a connection on another thread.
94 * @remarks Opening connection is necessary to access the contact server and to perform operations such as fetching, inserting, or updating records.\n
95 * On multiple thread environment with contacts_connect(), request can be failed in one thread, while another request is working by the connection in the other thread.
96 * To prevent request fail, contacts_connect_on_thread() is recommended. Then new connection is set for the thread.
98 * @return @c 0 on success,
99 * otherwise a negative error value
101 * @retval #CONTACTS_ERROR_NONE Successful
102 * @retval #CONTACTS_ERROR_OUT_OF_MEMORY Out of memory
103 * @retval #CONTACTS_ERROR_DB Database operation failure
104 * @retval #CONTACTS_ERROR_IPC_NOT_AVALIABLE IPC server is not available
105 * @retval #CONTACTS_ERROR_IPC IPC error
106 * @retval #CONTACTS_ERROR_SYSTEM System error
107 * @retval #CONTACTS_ERROR_INTERNAL Internal error
108 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
110 * @see contacts_disconnect_on_thread()
112 int contacts_connect_on_thread(void);
115 * @brief Disconnects from the contacts service.
119 * @return @c 0 on success,
120 * otherwise a negative error value
122 * @retval #CONTACTS_ERROR_NONE Successful
123 * @retval #CONTACTS_ERROR_INVALID_PARAMETER Invalid parameter
124 * @retval #CONTACTS_ERROR_DB Database operation failure
125 * @retval #CONTACTS_ERROR_IPC IPC error
127 * @see contacts_connect_on_thread()
129 int contacts_disconnect_on_thread(void);
133 * @brief Definition for contacts_connect_with_flags(). If it is called the API with this flag, then retry to call contacts_connect() for several times.
137 * @see contacts_connect_with_flags()
139 #define CONTACTS_CONNECT_FLAG_RETRY 0x00000001
142 * @brief Definition for default flag of contacts_connect_with_flags().
146 * @see contacts_connect_with_flags()
148 #define CONTACTS_CONNECT_FLAG_NONE 0
151 * @brief Connects to the contacts service.
155 * @param[in] flags connection flag
157 * @remarks Connection opening is necessary to access the contacts server such as fetching, inserting, or updating records.\n
158 * Before contacts-service daemon is ready, if you call contacts_connect(), it will fail.
159 * To prevent it, if you call this API with @ref CONTACTS_CONNECT_FLAG_RETRY flags, it will retry several time.\n
160 * To close the connection, contacts_disconnect() should be called.
162 * @return @c 0 on success,
163 * otherwise a negative error value
165 * @retval #CONTACTS_ERROR_NONE Successful
166 * @retval #CONTACTS_ERROR_DB Database operation failure
167 * @retval #CONTACTS_ERROR_IPC_NOT_AVALIABLE IPC server is not available
168 * @retval #CONTACTS_ERROR_IPC IPC error
169 * @retval #CONTACTS_ERROR_SYSTEM System error
170 * @retval #CONTACTS_ERROR_PERMISSION_DENIED Permission denied. This application does not have the privilege to call this method.
172 * @see contacts_disconnect()
174 int contacts_connect_with_flags(unsigned int flags);
177 int contacts_connect2(void);
178 int contacts_disconnect2(void);
190 #endif //__TIZEN_SOCIAL_CONTACTS_SERVICE_H__