Tizen 2.0 Release
[pkgs/o/oma-ds-service.git] / include / common / common_util.h
1 /*
2  * oma-ds-agent
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
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
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  */
17
18 /**
19  *   @Common_Util.h
20  *   @version                                                                   0.1
21  *   @brief                                                                             This file is the header file of interface for utility function
22  */
23
24 #ifndef COMMON_UTIL_H_
25 #define COMMON_UTIL_H_
26
27 #include <stdbool.h>
28
29 /**
30  * @par Description: API to create sync_agent_da_config_s structure
31  *
32  *
33  * @par Purpose:
34  * @par Typical use case:
35  * @par Method of function operation:
36  * @par Important notes:
37  * @param[in]           int type, account id
38  * @param[in]           string type, key
39  * @param[in]           string type, value(char *)
40  * @param[in]           string type, type of value(string, int)
41  * @param[in]           string type, name of access(SE, SA...)
42  * @param[out]          sync_agent_da_config_s
43  *
44  * @return                              true on success
45  *                                                      false on error
46  *
47  * @par Errors:
48  *
49  * @pre None.
50  * @post
51  * @see
52  * @remarks None.
53  *
54  * @par Sample Code:
55  * @code
56  * @endcode
57  */
58 bool create_config_str(int account_id, char *key, char *value, char *type, char *access_name, sync_agent_da_config_s ** config);
59
60 /**
61  * @par Description: API to set value into config_tbl(key, value)
62  *
63  *
64  * @par Purpose:
65  * @par Typical use case:
66  * @par Method of function operation:
67  * @par Important notes:
68  * @param[in]           int type, account id
69  * @param[in]           string type, key
70  * @param[in]           string type, value(char *)
71  * @param[in]           string type, type of value(string, int)
72  * @param[in]           string type, name of access(SE, SA...)
73  * @param[out]
74  *
75  * @return                              true on success
76  *                                                      false on error
77  *
78  * @par Errors:
79  *
80  * @pre None.
81  * @post
82  * @see
83  * @remarks None.
84  *
85  * @par Sample Code:
86  * @code
87  * @endcode
88  */
89 bool set_config_str(int account_id, char *key, char *value, char *type, char *access_name);
90
91 /**
92  * @par Description: API to set value into config_tbl(key, value)
93  *
94  *
95  * @par Purpose:
96  * @par Typical use case:
97  * @par Method of function operation:
98  * @par Important notes:
99  * @param[in]           int type, account id
100  * @param[in]           string type, key
101  * @param[in]           int type, value(int)
102  * @param[in]           string type, type of value(string, int)
103  * @param[in]           string type, name of access(SE, SA...)
104  * @param[out]
105  *
106  * @return                              true on success
107  *                                                      false on error
108  *
109  * @par Errors:
110  *
111  * @pre None.
112  * @post
113  * @see
114  * @remarks None.
115  *
116  * @par Sample Code:
117  * @code
118  * @endcode
119  */
120 bool set_config_int(int account_id, char *key, int value, char *type, char *access_name);
121
122 /**
123  * @par Description: API to get value from config_tbl(key, value)
124  *
125  *
126  * @par Purpose:
127  * @par Typical use case:
128  * @par Method of function operation:
129  * @par Important notes:
130  * @param[in]           int type, account id
131  * @param[in]           string type, key
132  * @param[out]          string type, value
133  *
134  * @return                              true on success
135  *                                                      false on error
136  *
137  * @par Errors:
138  *
139  * @pre None.
140  * @post
141  * @see
142  * @remarks None.
143  *
144  * @par Sample Code:
145  * @code
146  * @endcode
147  */
148 bool get_config(int account_id, char *key, char **value);
149
150 /**
151  * @par Description: API to get account ID from profileDirName(Sync1...)
152  *
153  *
154  * @par Purpose:
155  * @par Typical use case:
156  * @par Method of function operation:
157  * @par Important notes:
158  * @param[in]           string type, profileDirName(Sync1, Sync2...)
159  * @param[in]           boolean type, already open agent db or not
160  * @param[out]
161  *
162  * @return                              account ID      (more than 1)    on success
163  *                                                      -1 on error
164  *
165  * @par Errors:
166  *
167  * @pre None.
168  * @post
169  * @see
170  * @remarks None.
171  *
172  * @par Sample Code:
173  * @code
174  * @endcode
175  */
176 int get_account_id(char *profile, bool open);
177
178 /**
179  *  @brief                              convert sync type(UI-> Engine)
180  *  @param[in]          sync type(Full, Update both, Update to server, Update to phone, Refresh from server, Refresh from phone)
181  *  @return                     char *
182  *  @retval                             value of sync type                              Success
183  *                                                      NULL                                                            Error
184  */
185 /*int convert_synctype_value(char *syncType_str);*/
186 /*char *convert_synctype_str(char *syncType_value);*/
187 #endif                          /* COMMON_UTIL_H_ */