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 ACCOUNT_SERVICE_H_
19 #define ACCOUNT_SERVICE_H_
25 #endif /* __cplusplus */
29 * @brief Support to use framework Account module
32 /** @addtogroup account
37 * @brief Enumerations of account type
40 SYNC_AGENT_ACC_TYPE_LOCAL = 0,
41 /**< local account type */
42 SYNC_AGENT_ACC_TYPE_EAS, /**< eas account type */
43 SYNC_AGENT_ACC_TYPE_GOOGLE, /**< google account type */
44 SYNC_AGENT_ACC_TYPE_NONE /**< no account type */
45 } sync_agent_service_account_type_e;
48 * @brief Structure of Service Account instance
51 char *email; /**< e-mail address */
52 sync_agent_service_account_type_e type; /**< type of service account */
53 } sync_agent_service_account_info_s;
56 * @brief Mapping service's all account to F/W account
60 sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS;
62 account_err = sync_agent_construct_account_tbl_from_service();
63 if (account_err != SYNC_AGENT_ACC_SUCCESS) {
68 * @remarks Services which are provided as a DataConnector plug-in.
69 * @return SYNC_AGENT_ACC_SUCCESS on success, otherwise a error value.
70 * @retval SYNC_AGENT_ACC_SUCCESS Successful
71 * @retval SYNC_AGENT_ACC_FAIL Parsing the initialization config file failed
72 * @retval SYNC_AGENT_ACC_CHANGED Service account repository changed
73 * @post Mapped service's all existed account id with F/W account id
76 sync_agent_acc_error_e sync_agent_construct_account_tbl_from_service(void);
79 * @brief Create sync_agent_service_account_info_s structure
83 sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS;
84 sync_agent_service_account_info_s *account_info = NULL;
86 account_err = sync_agent_create_service_account_info(&account_info);
87 if (account_err != SYNC_AGENT_ACC_SUCCESS) {
92 * @param[out] account_info instance of service account info
93 * @return SYNC_AGENT_ACC_SUCCESS on success, otherwise a error value.
94 * @retval SYNC_AGENT_ACC_SUCCESS Successful
95 * @retval SYNC_AGENT_ACC_FAIL When memory allocation is failed
97 sync_agent_acc_error_e sync_agent_create_service_account_info(sync_agent_service_account_info_s ** account_info);
100 * @brief Get Account Information
104 sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS;
105 sync_agent_service_account_info_s *account_info = NULL;
107 account_err = sync_agent_get_service_account(fw_account_id, 1, &account_info);
108 if (account_err != SYNC_AGENT_ACC_SUCCESS) {
113 * @remarks Account Information type is defined in account plugIn.
114 * @param[in] fw_account_id account id
115 * @param[in] service_type service type
116 * @param[out] account_info instance of service account info
117 * @return SYNC_AGENT_ACC_SUCCESS on success, otherwise an error value.
118 * @retval SYNC_AGENT_ACC_SUCCESS Successful
119 * @retval SYNC_AGENT_ACC_FAIL Parsing the initialization config file failed
120 * @retval SYNC_AGENT_ACC_CHANGED Service account repository changed
121 * @pre account plugIn loaded
123 sync_agent_acc_error_e sync_agent_get_service_account(int fw_account_id, int service_type, sync_agent_service_account_info_s ** account_info);
126 * @brief Free sync_agent_service_account_info_s structure
130 sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS;
131 sync_agent_service_account_info_s *account_info = NULL;
133 account_err = sync_agent_get_service_account(fw_account_id, 1, &account_info);
135 sync_agent_free_service_account_info(account_info);
137 * @param[in] account_info instance of service account info
139 void sync_agent_free_service_account_info(sync_agent_service_account_info_s * account_info);
147 #endif /* __cplusplus */
148 #endif /* ACCOUNT_SERVICE_H_ */