3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * Licensed under the Apache License, Version 2.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #ifndef INTERFACE_LAST_ANCHOR_H_
19 #define INTERFACE_LAST_ANCHOR_H_
25 #endif /* __cplusplus */
28 * @file interface_last_anchor.h
32 /** @addtogroup data_adapter
37 * @brief Structure of framework last anchor instance
41 /**< F/W account id */
43 /**< service data connector plug-in id described in F/W config file */
44 char *last_anchor_server;
45 /**< last anchor that server has */
46 char *last_anchor_client;
47 /**< last anchor that client has */
49 /**< name of accessor */
50 } sync_agent_da_last_anchor_s;
53 * @brief Enumerations of option used to fetch framework last anchor instance
56 SYNC_AGENT_DA_GET_LAST_ANCHOR_LIST_OPTION_ITEM_TYPE_ID,
57 /**< get last anchor by item type id */
58 } sync_agent_da_get_last_anchor_list_option_e;
61 * @brief Structure of query used to fetch list of framework last anchor
64 sync_agent_da_get_last_anchor_list_option_e option; /**< sync_agent_da_get_last_anchor_list_option_e type of option */
66 /**< F/W account id - SYNC_AGENT_DA_GET_LAST_ANCHOR_LIST_OPTION_ITEM_TYPE_ID */
68 /**< F/W item type id - SYNC_AGENT_DA_GET_LAST_ANCHOR_LIST_OPTION_ITEM_TYPE_ID */
69 } sync_agent_da_get_last_anchor_list_query_s;
72 * @brief Create initialized framework last anchor instance
76 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
77 sync_agent_da_last_anchor_s *anchor;
79 ret = sync_agent_create_last_anchor(&anchor);
80 if (ret != SYNC_AGENT_DA_SUCCESS) {
85 * @param[out] sync_agent_last_anchor sync_agent_da_last_anchor_s type of last anchor instance newly initialied
86 * @return operation result
87 * @retval SYNC_AGENT_DA_SUCCESS success
88 * @retval error_value fail
89 * @return operation result
90 * @retval SYNC_AGENT_DA_SUCCESS success
91 * @retval error_value fail
93 sync_agent_da_return_e sync_agent_create_last_anchor(sync_agent_da_last_anchor_s ** sync_agent_last_anchor);
96 * @brief Add framework last anchor instance into frameowrk db
100 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
101 sync_agent_da_last_anchor_s *anchor;
103 ret = sync_agent_create_last_anchor(&anchor);
104 if (ret != SYNC_AGENT_DA_SUCCESS) {
110 ret = sync_agent_add_last_anchor(anchor);
111 if (ret != SYNC_AGENT_DA_SUCCESS) {
116 * @param[in] sync_agent_last_anchor sync_agent_da_last_anchor_s type of last anchor instance to add into framework
117 * @return operation result
118 * @retval SYNC_AGENT_DA_SUCCESS success
119 * @retval error_value fail
121 sync_agent_da_return_e sync_agent_add_last_anchor(sync_agent_da_last_anchor_s * sync_agent_last_anchor);
124 * @brief Update framework last anchor on framework db
128 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
129 sync_agent_da_get_last_anchor_list_query_s query;
130 GList *anchor_list = NULL;
132 query.option = SYNC_AGENT_DA_GET_LAST_ANCHOR_LIST_OPTION_ITEM_TYPE_ID;
133 query.account_id = account_id;
134 query.item_type_id = FW_CONTACT;
136 ret = sync_agent_get_last_anchor_list(&query, &anchor_list);
137 if (ret != SYNC_AGENT_DA_SUCCESS) {
143 ret = sync_agent_update_last_anchor((sync_agent_da_last_anchor_s *)(anchor_list->data));
144 if (ret != SYNC_AGENT_DA_SUCCESS) {
149 * @param[in] sync_agent_last_anchor sync_agent_da_last_anchor_s type of last anchor instance to update into framework
150 * @return operation result
151 * @retval SYNC_AGENT_DA_SUCCESS success
152 * @retval error_value fail
154 sync_agent_da_return_e sync_agent_update_last_anchor(sync_agent_da_last_anchor_s * sync_agent_last_anchor);
157 * @brief Fetch framework last anchor from framework db
161 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
162 sync_agent_da_get_last_anchor_list_query_s query;
163 GList *anchor_list = NULL;
165 query.option = SYNC_AGENT_DA_GET_LAST_ANCHOR_LIST_OPTION_ITEM_TYPE_ID;
166 query.account_id = account_id;
167 query.item_type_id = FW_CONTACT;
169 ret = sync_agent_get_last_anchor_list(&query, &anchor_list);
170 if (ret != SYNC_AGENT_DA_SUCCESS) {
175 * @param[in] query sync_agent_da_get_last_anchor_list_query_s type of query to apply to fetch operation
176 * @param[out] list GList type of list which will be filled with last anchor instances fetched
177 * @return operation result
178 * @retval SYNC_AGENT_DA_SUCCESS success
179 * @retval error_value fail
181 sync_agent_da_return_e sync_agent_get_last_anchor_list(sync_agent_da_get_last_anchor_list_query_s * query, GList ** list);
184 * @brief Free framework last anchor fetched from framework db
188 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
189 sync_agent_da_last_anchor_s *anchor;
191 ret = sync_agent_create_last_anchor(&anchor);
192 if (ret != SYNC_AGENT_DA_SUCCESS) {
198 ret = sync_agent_free_last_anchor(anchor);
199 if (ret != SYNC_AGENT_DA_SUCCESS) {
204 * @param[in] sync_agent_last_anchor sync_agent_da_last_anchor_s type of last anchor item to free
205 * @return operation result
206 * @retval SYNC_AGENT_DA_SUCCESS success
207 * @retval error_value fail
209 sync_agent_da_return_e sync_agent_free_last_anchor(sync_agent_da_last_anchor_s * sync_agent_last_anchor);
217 #endif /* __cplusplus */
218 #endif /* INTERFACE_LAST_ANCHOR_H_ */