Tizen 2.0 Release
[framework/system/oma-dm-agent.git] / include / common / dm-status / oma_dm_status_db.h
1 /*
2  * oma-dm-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 #ifndef OMA_DM_STATUS_DB_H_
19 #define OMA_DM_STATUS_DB_H_
20
21 /*dm-agent*/
22 #include "common/dm_error.h"
23 #include "common/dm-status/oma_dm_status_db_common.h"
24
25 /*
26  * =============================================================================================================================
27  * Database Open & Close & Create table
28  * =============================================================================================================================
29  *
30  */
31
32 /**
33  * @par Description: API to dm open agent db handler
34  *
35  *
36  * @par Purpose:
37  * @par Typical use case:
38  * @par Method of function operation:
39  * @par Important notes:
40  * @param[out]  db handler
41  *
42  * @return                              DM_OK   on success
43  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
44  *
45  *
46  * @par Errors:
47  *
48  * @pre None.
49  * @post
50  * @see
51  * @remarks None.
52  *
53  * @par Sample Code:
54  * @code
55  * @endcode
56  */
57 DM_ERROR dm_open_agent(DB_HANDLER ** db_handler);
58
59 /**
60  * @par Description: API to dm close agent db handler
61  *
62  *
63  * @par Purpose:
64  * @par Typical use case:
65  * @par Method of function operation:
66  * @par Important notes:
67  * @param[in]   db handler
68  *
69  * @return                              DM_OK   on success
70  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
71  *
72  *
73  * @par Errors:
74  *
75  * @pre None.
76  * @post
77  * @see
78  * @remarks None.
79  *
80  * @par Sample Code:
81  * @code
82  * @endcode
83  */
84 DM_ERROR dm_close_agent(DB_HANDLER * db_handler);
85
86 /**
87  * @par Description: API to create dm service db table
88  *
89  *
90  * @par Purpose:
91  * @par Typical use case:
92  * @par Method of function operation:
93  * @par Important notes:
94  * @param[in]   db handler
95  *
96  * @return                              DM_OK   on success
97  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
98  *
99  *
100  * @par Errors:
101  *
102  * @pre None.
103  * @post
104  * @see
105  * @remarks None.
106  *
107  * @par Sample Code:
108  * @code
109  * @endcode
110  */
111 DM_ERROR dm_create_table(DB_HANDLER * db_handler);
112
113 /**
114  * @par Description: API to delete dm service db table
115  *
116  *
117  * @par Purpose:
118  * @par Typical use case:
119  * @par Method of function operation:
120  * @par Important notes:
121  * @param[in]   db handler
122  *
123  * @return                              DM_OK   on success
124  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
125  *
126  *
127  * @par Errors:
128  *
129  * @pre None.
130  * @post
131  * @see
132  * @remarks None.
133  *
134  * @par Sample Code:
135  * @code
136  * @endcode
137  */
138 DM_ERROR dm_delete_table(DB_HANDLER * db_handler);
139
140 /**
141  * @par Description: API to reset dm service db table
142  *
143  *
144  * @par Purpose:
145  * @par Typical use case:
146  * @par Method of function operation:
147  * @par Important notes:
148  * @param[in]   db handler
149  *
150  * @return                              DM_OK   on success
151  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
152  *
153  *
154  * @par Errors:
155  *
156  * @pre None.
157  * @post
158  * @see
159  * @remarks None.
160  *
161  * @par Sample Code:
162  * @code
163  * @endcode
164  */
165 DM_ERROR dm_reset_table(DB_HANDLER * db_handler);
166
167 /*
168  * =============================================================================================================================
169  * Control Transaction
170  * =============================================================================================================================
171  */
172
173 /**
174  * @par Description: API to begin transaction dm service db table
175  *
176  *
177  * @par Purpose:
178  * @par Typical use case:
179  * @par Method of function operation:
180  * @par Important notes:
181  * @param[in]   db handler
182  *
183  * @return                              DM_OK   on success
184  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
185  *
186  *
187  * @par Errors:
188  *
189  * @pre None.
190  * @post
191  * @see
192  * @remarks None.
193  *
194  * @par Sample Code:
195  * @code
196  * @endcode
197  */
198 DM_ERROR dm_begin_transaction(DB_HANDLER * db_handler);
199
200 /**
201  * @par Description: API to end transaction dm service db table
202  *
203  *
204  * @par Purpose:
205  * @par Typical use case:
206  * @par Method of function operation:
207  * @par Important notes:
208  * @param[in]   db handler
209  * @param[in]   DB_TRANSACTION (commit, rollback)
210  *
211  * @return                              DM_OK   on success
212  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
213  *
214  *
215  * @par Errors:
216  *
217  * @pre None.
218  * @post
219  * @see
220  * @remarks None.
221  *
222  * @par Sample Code:
223  * @code
224  * @endcode
225  */
226 DM_ERROR dm_end_transaction(DB_HANDLER * db_handler, DB_TRANSACTION transaction);
227
228 /*
229  * =============================================================================================================================
230  * engine_status table
231  * =============================================================================================================================
232  */
233
234 /**
235  * @par Description: API to init dm service db table
236  *
237  *
238  * @par Purpose:
239  * @par Typical use case:
240  * @par Method of function operation:
241  * @par Important notes:
242  * @param[in]   db handler
243  *
244  * @return                              DM_OK   on success
245  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
246  *
247  *
248  * @par Errors:
249  *
250  * @pre None.
251  * @post
252  * @see
253  * @remarks None.
254  *
255  * @par Sample Code:
256  * @code
257  * @endcode
258  */
259 DM_ERROR dm_init_engine_status(DB_HANDLER * db_handler);
260
261 /**
262  * @par Description: API to add engine status structure in dm service db table
263  *
264  *
265  * @par Purpose:
266  * @par Typical use case:
267  * @par Method of function operation:
268  * @par Important notes:
269  * @param[in]   db handler
270  * @param[in]   engine status structure
271  *
272  * @return                              DM_OK   on success
273  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
274  *
275  *
276  * @par Errors:
277  *
278  * @pre None.
279  * @post
280  * @see
281  * @remarks None.
282  *
283  * @par Sample Code:
284  * @code
285  * @endcode
286  */
287 DM_ERROR dm_add_engine_status(DB_HANDLER * db_handler, engine_status * status);
288
289 /**
290  * @par Description: API to delete engine status structure in dm service db table
291  *
292  *
293  * @par Purpose:
294  * @par Typical use case:
295  * @par Method of function operation:
296  * @par Important notes:
297  * @param[in]   db handler
298  * @param[in]   engine status id
299  *
300  * @return                              DM_OK   on success
301  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
302  *
303  *
304  * @par Errors:
305  *
306  * @pre None.
307  * @post
308  * @see
309  * @remarks None.
310  *
311  * @par Sample Code:
312  * @code
313  * @endcode
314  */
315 DM_ERROR dm_delete_engine_status(DB_HANDLER * db_handler, int engine_id);
316
317 /**
318  * @par Description: API to update engine status structure in dm service db table
319  *
320  *
321  * @par Purpose:
322  * @par Typical use case:
323  * @par Method of function operation:
324  * @par Important notes:
325  * @param[in]   db handler
326  * @param[in]   engine status structure
327  *
328  * @return                              DM_OK   on success
329  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
330  *
331  *
332  * @par Errors:
333  *
334  * @pre None.
335  * @post
336  * @see
337  * @remarks None.
338  *
339  * @par Sample Code:
340  * @code
341  * @endcode
342  */
343 DM_ERROR dm_update_engine_status(DB_HANDLER * db_handler, engine_status * status);
344
345 /**
346  * @par Description: API to update engine status column in dm service db table
347  *
348  *
349  * @par Purpose:
350  * @par Typical use case:
351  * @par Method of function operation:
352  * @par Important notes:
353  * @param[in]   db handler
354  * @param[in]   engine status key
355  * @param[in]   engine status value
356  *
357  * @return                              DM_OK   on success
358  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
359  *
360  *
361  * @par Errors:
362  *
363  * @pre None.
364  * @post
365  * @see
366  * @remarks None.
367  *
368  * @par Sample Code:
369  * @code
370  * @endcode
371  */
372 DM_ERROR dm_update_engine_status_column(DB_HANDLER * db_handler, int engine_id, ENGINE_STATUS_VALUE engine_status_value, void *value);
373
374 /**
375  * @par Description: API to get engine status structure in dm service db table
376  *
377  *
378  * @par Purpose:
379  * @par Typical use case:
380  * @par Method of function operation:
381  * @par Important notes:
382  * @param[in]   db handler
383  * @param[in]   engine status id
384  * @param[out]  engine status structure
385  *
386  * @return                              DM_OK   on success
387  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
388  *
389  *
390  * @par Errors:
391  *
392  * @pre None.
393  * @post
394  * @see
395  * @remarks None.
396  *
397  * @par Sample Code:
398  * @code
399  * @endcode
400  */
401 DM_ERROR dm_get_engine_status(DB_HANDLER * db_handler, int engine_id, engine_status ** status);
402
403 /**
404  * @par Description: API to get all engine status structure in dm service db table
405  *
406  *
407  * @par Purpose:
408  * @par Typical use case:
409  * @par Method of function operation:
410  * @par Important notes:
411  * @param[in]   db handler
412  * @param[out]  engine status structures
413  * @param[out]  engine status count
414  *
415  * @return                              DM_OK   on success
416  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
417  *
418  *
419  * @par Errors:
420  *
421  * @pre None.
422  * @post
423  * @see
424  * @remarks None.
425  *
426  * @par Sample Code:
427  * @code
428  * @endcode
429  */
430 DM_ERROR dm_get_aII_engine_status(DB_HANDLER * db_handler, engine_status ** status_list, int *count);
431
432 /**
433  * @par Description: API to check exist  engine status in dm service db table
434  *
435  *
436  * @par Purpose:
437  * @par Typical use case:
438  * @par Method of function operation:
439  * @par Important notes:
440  * @param[in]   db handler
441  * @param[in]   engine status id
442  *
443  * @return                              DM_OK   on success
444  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
445  *
446  *
447  * @par Errors:
448  *
449  * @pre None.
450  * @post
451  * @see
452  * @remarks None.
453  *
454  * @par Sample Code:
455  * @code
456  * @endcode
457  */
458 int dm_isExist_engine_id(DB_HANDLER * db_handler, int engine_id);
459
460 #endif                          /* OMA_DM_STATUS_DB_H_ */