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.
21 #include "plugin/data_converter_resource.h"
26 #endif /* __cplusplus */
30 * @brief Support to use service converter module
33 /** @addtogroup data_adapter
38 * @brief Allocate internal object for content type
42 int content_type = FW_CONTACT;
43 char *obj = (char *)sync_agent_alloc_obj(content_type);
46 * @param[in] content_type service type - service data connector pluIn's ID described in F/W config file
47 * @return operation result
48 * @retval internal_structure_pointer success
51 void *sync_agent_alloc_obj(int content_type);
54 * @brief Free internal object for content type
59 sync_agent_da_return_e da_err = SYNC_AGENT_DA_SUCCESS;
61 char *obj = (char *)sync_agent_alloc_obj(content_type);
63 da_err = sync_agent_free_obj(1, (void *)obj);
64 if (da_err != SYNC_AGENT_DA_SUCCESS) {
69 * @param[in] content_type service type - service data connector pluIn's ID described in F/W config file
70 * @param[in] in_object internal object pointer
71 * @return operation result
72 * @retval SYNC_AGENT_DA_SUCCESS success
73 * @retval SYNC_AGENT_DA_ERRORS fail
75 sync_agent_da_return_e sync_agent_free_obj(int content_type, void *in_object);
78 * @brief Set value for internal object
82 char *object = (char*)sync_agent_alloc_obj(FW_CONTACT);
83 char *account_name = "test_account";
84 char *result = sync_agent_set_value_to_obj(FW_CONTACT, (void*)object, VCARD_CONTENT_EXTENSION, "X-ACCOUNT-N", (void*)account_name);
90 * @param[in] content_type service type - service data connector pluIn's ID described in F/W config file
91 * @param[in] in_object internal object pointer
93 * @param[in] extension_key extension key
94 * @param[in] set_value value
95 * @return operation result
96 * @retval new_object_pointer success
99 void *sync_agent_set_value_to_obj(int content_type, void *in_object, int key, char *extension_key, void *set_value);
102 * @brief Allocate internal object for content type
106 char *account_full_name = sync_agent_get_value_to_obj(FW_CONTACT, object, VCARD_CONTENT_EXTENSION, "X-ACCOUNT");
107 if (account_full_name == NULL) {
112 * @param[in] content_type service type - service data connector pluIn's ID described in F/W config file
113 * @param[in] in_object internal object pointer
115 * @param[in] extension_key extension key
116 * @return operation result
117 * @retval value_pointer success
120 void *sync_agent_get_value_to_obj(int content_type, void *in_object, int key, char *extension_key);
123 * @brief Get meta infomation of internal object
127 sync_agent_plugin_object_info_s *datastore_info = sync_agent_get_obj_info(FW_CONTACT);
128 if (datastore_info != NULL) {
133 * @param[in] content_type service type - service data connector pluIn's ID described in F/W config file
134 * @return operation result
135 * @retval value_pointer success
138 sync_agent_plugin_object_info_s *sync_agent_get_obj_info(int content_type);
141 * @brief Free infomation of internal object
145 sync_agent_plugin_object_info_s *datastore_info = sync_agent_get_obj_info(FW_CONTACT);
147 sync_agent_da_return_e result = sync_agent_free_obj_info(FW_CONTACT, datastore_info);
148 if( result != SYNC_AGENT_DA_SUCCESS) {
153 * @param[in] content_type service type - service data connector pluIn's ID described in F/W config file
154 * @param[in] obj_info object info
155 * @return operation result
156 * @retval SYNC_AGENT_DA_SUCCESS success
157 * @retval SYNC_AGENT_DA_ERRORS fail
159 sync_agent_da_return_e sync_agent_free_obj_info(int content_type, sync_agent_plugin_object_info_s * obj_info);
167 #endif /* __cplusplus */
168 #endif /* CONVERTER_H_ */