Initialize Tizen 2.3
[framework/system/oma-dm-agent.git] / include / common / dm-status / oma_dm_status_db_handler.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_HANDLER_H_
19 #define OMA_DM_STATUS_DB_HANDLER_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  * external API (1. about db handler mgr)
28  * ==================================
29  */
30
31 /**
32  * @par Description: API to alloc the db handler manager
33  *
34  *
35  * @par Purpose:
36  * @par Typical use case:
37  * @par Method of function operation:
38  * @par Important notes:
39  *
40  * @return                              DM_OK   on success
41  *                                              DM_ERR_UNKNOWN or Other DM_ERROR
42  *
43  * @par Errors:
44  *
45  * @pre None.
46  * @post
47  * @see
48  * @remarks None.
49  *
50  * @par Sample Code:
51  * @code
52  * @endcode
53  */
54 DM_ERROR Alloc_DB_Handler_Mgr();
55
56 /**
57  * @par Description: API to free the db handler manager
58  *
59  *
60  * @par Purpose:
61  * @par Typical use case:
62  * @par Method of function operation:
63  * @par Important notes:
64  *
65  * @return                              DM_OK   on success
66  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
67  *
68  * @par Errors:
69  *
70  * @pre None.
71  * @post
72  * @see
73  * @remarks None.
74  *
75  * @par Sample Code:
76  * @code
77  * @endcode
78  */
79 DM_ERROR Free_DB_Handler_Mgr();
80
81 /**
82  * @par Description: API to free engine structure
83  *
84  *
85  * @par Purpose:
86  * @par Typical use case:
87  * @par Method of function operation:
88  * @par Important notes:
89  * @param[in]   free structure count
90  * @param[in]   engine_status structure
91  *
92  * @return
93  *
94  *
95  * @par Errors:
96  *
97  * @pre None.
98  * @post
99  * @see
100  * @remarks None.
101  *
102  * @par Sample Code:
103  * @code
104  * @endcode
105  */
106 void Free_Memory_Engine_Status(engine_status ** status, int count);
107
108 /*
109  * ==================================
110  * external API (2. about agent db )
111  * ==================================
112  */
113 /*
114  * =============================================================================================================================
115  * Database Open & Close & Create table
116  * =============================================================================================================================
117  *
118  */
119 /**
120  * @par Description: API to dm_service db open
121  *
122  *
123  * @par Purpose:
124  * @par Typical use case:
125  * @par Method of function operation:
126  * @par Important notes:
127  *
128  * @return                              DM_OK   on success
129  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
130  *
131  *
132  * @par Errors:
133  *
134  * @pre None.
135  * @post
136  * @see
137  * @remarks None.
138  *
139  * @par Sample Code:
140  * @code
141  * @endcode
142  */
143 DM_ERROR DB_Open();
144
145 /**
146  * @par Description: API to dm_service db close
147  *
148  *
149  * @par Purpose:
150  * @par Typical use case:
151  * @par Method of function operation:
152  * @par Important notes:
153  *
154  * @return
155  *
156  *
157  *
158  * @par Errors:
159  *
160  * @pre None.
161  * @post
162  * @see
163  * @remarks None.
164  *
165  * @par Sample Code:
166  * @code
167  * @endcode
168  */
169 void DB_Close();
170
171 /**
172  * @par Description: API to create dm_service db
173  *
174  *
175  * @par Purpose:
176  * @par Typical use case:
177  * @par Method of function operation:
178  * @par Important notes:
179  *
180  * @return                              DM_OK   on success
181  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
182  *
183  *
184  * @par Errors:
185  *
186  * @pre None.
187  * @post
188  * @see
189  * @remarks None.
190  *
191  * @par Sample Code:
192  * @code
193  * @endcode
194  */
195 DM_ERROR DB_Create_Table();
196
197 /**
198  * @par Description: API to delete dm_service db
199  *
200  *
201  * @par Purpose:
202  * @par Typical use case:
203  * @par Method of function operation:
204  * @par Important notes:
205  *
206  * @return                              DM_OK   on success
207  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
208  *
209  *
210  * @par Errors:
211  *
212  * @pre None.
213  * @post
214  * @see
215  * @remarks None.
216  *
217  * @par Sample Code:
218  * @code
219  * @endcode
220  */
221 DM_ERROR DB_Delete_Table();
222
223 /**
224  * @par Description: API to reset dm_service db
225  *
226  *
227  * @par Purpose:
228  * @par Typical use case:
229  * @par Method of function operation:
230  * @par Important notes:
231  *
232  * @return                              DM_OK   on success
233  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
234  *
235  *
236  * @par Errors:
237  *
238  * @pre None.
239  * @post
240  * @see
241  * @remarks None.
242  *
243  * @par Sample Code:
244  * @code
245  * @endcode
246  */
247 DM_ERROR DB_Reset_Table();
248
249 /*
250  * =============================================================================================================================
251  * Control Transaction
252  * =============================================================================================================================
253  */
254 /**
255  * @par Description: API to begin transaction dm_service db
256  *
257  *
258  * @par Purpose:
259  * @par Typical use case:
260  * @par Method of function operation:
261  * @par Important notes:
262  *
263  * @return                              DM_OK   on success
264  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
265  *
266  *
267  * @par Errors:
268  *
269  * @pre None.
270  * @post
271  * @see
272  * @remarks None.
273  *
274  * @par Sample Code:
275  * @code
276  * @endcode
277  */
278 DM_ERROR DB_Begin_Transaction();
279
280 /**
281  * @par Description: API to end transaction dm_service db
282  *
283  *
284  * @par Purpose:
285  * @par Typical use case:
286  * @par Method of function operation:
287  * @par Important notes:
288  * @param[in]   DB_TRANSACTION ( commit, rollback)
289  *
290  * @return                              DM_OK   on success
291  *                                                      DM_ERR_UNKNOWN on error
292  *
293  *
294  * @par Errors:
295  *
296  * @pre None.
297  * @post
298  * @see
299  * @remarks None.
300  *
301  * @par Sample Code:
302  * @code
303  * @endcode
304  */
305 DM_ERROR DB_End_Transaction(DB_TRANSACTION transaction);
306
307 /*
308  * =============================================================================================================================
309  * engine_status table
310  * =============================================================================================================================
311  */
312 /**
313  * @par Description: API to init engine status
314  *
315  *
316  * @par Purpose:
317  * @par Typical use case:
318  * @par Method of function operation:
319  * @par Important notes:
320  *
321  * @return                              DM_OK   on success
322  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
323  *
324  *
325  * @par Errors:
326  *
327  * @pre None.
328  * @post
329  * @see
330  * @remarks None.
331  *
332  * @par Sample Code:
333  * @code
334  * @endcode
335  */
336 DM_ERROR Init_Engine_Status();
337
338 /**
339  * @par Description: API to add engine status row in db
340  *
341  *
342  * @par Purpose:
343  * @par Typical use case:
344  * @par Method of function operation:
345  * @par Important notes:
346  * @param[in]   engine_status structure
347  *
348  * @return                              DM_OK   on success
349  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
350  *
351  *
352  * @par Errors:
353  *
354  * @pre None.
355  * @post
356  * @see
357  * @remarks None.
358  *
359  * @par Sample Code:
360  * @code
361  * @endcode
362  */
363 DM_ERROR Add_Engine_Status(engine_status * status);
364
365 /**
366  * @par Description: API to delete engine status in db
367  *
368  *
369  * @par Purpose:
370  * @par Typical use case:
371  * @par Method of function operation:
372  * @par Important notes:
373  * @param[in]   engine_status id
374  *
375  * @return                              DM_OK   on success
376  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
377  *
378  *
379  * @par Errors:
380  *
381  * @pre None.
382  * @post
383  * @see
384  * @remarks None.
385  *
386  * @par Sample Code:
387  * @code
388  * @endcode
389  */
390 DM_ERROR Delete_Engine_Status(int engine_id);
391
392 /**
393  * @par Description: API to update engine status in db
394  *
395  *
396  * @par Purpose:
397  * @par Typical use case:
398  * @par Method of function operation:
399  * @par Important notes:
400  * @param[in]   engine_status structure
401  *
402  * @return                              DM_OK   on success
403  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
404  *
405  *
406  * @par Errors:
407  *
408  * @pre None.
409  * @post
410  * @see
411  * @remarks None.
412  *
413  * @par Sample Code:
414  * @code
415  * @endcode
416  */
417 DM_ERROR Update_Engine_Status(engine_status * status);
418
419 /**
420  * @par Description: API to update engine status column in db
421  *
422  *
423  * @par Purpose:
424  * @par Typical use case:
425  * @par Method of function operation:
426  * @par Important notes:
427  * @param[in]   engine_status id
428  * @param[in]   engine_status key
429  * @param[in]   engine_status value
430  *
431  * @return                              DM_OK   on success
432  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
433  *
434  *
435  * @par Errors:
436  *
437  * @pre None.
438  * @post
439  * @see
440  * @remarks None.
441  *
442  * @par Sample Code:
443  * @code
444  * @endcode
445  */
446 DM_ERROR Update_Engine_Status_Column(int engine_id, ENGINE_STATUS_VALUE engine_status_value, void *value);
447
448 /**
449  * @par Description: API to get engine status structure in db
450  *
451  *
452  * @par Purpose:
453  * @par Typical use case:
454  * @par Method of function operation:
455  * @par Important notes:
456  * @param[in]   engine_status id
457  * @param[out]  engine_status structure
458  *
459  * @return                              DM_OK   on success
460  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
461  *
462  *
463  * @par Errors:
464  *
465  * @pre None.
466  * @post
467  * @see
468  * @remarks None.
469  *
470  * @par Sample Code:
471  * @code
472  * @endcode
473  */
474 DM_ERROR Get_Engine_Status(int engine_id, engine_status ** status);
475
476 /**
477  * @par Description: API to get engine status structure in db
478  *
479  *
480  * @par Purpose:
481  * @par Typical use case:
482  * @par Method of function operation:
483  * @par Important notes:
484  * @param[out]  engine_status structure list
485  * @param[out]  engine_status structure count
486  *
487  * @return                              DM_OK   on success
488  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
489  *
490  *
491  * @par Errors:
492  *
493  * @pre None.
494  * @post
495  * @see
496  * @remarks None.
497  *
498  * @par Sample Code:
499  * @code
500  * @endcode
501  */
502 DM_ERROR Get_AII_Engine_Status(engine_status ** status_list, int *count);
503
504 /**
505  * @par Description: API to check exist engine status structure in db
506  *
507  *
508  * @par Purpose:
509  * @par Typical use case:
510  * @par Method of function operation:
511  * @par Important notes:
512  * @param[in]   engine_status id
513  *
514  * @return                              DM_OK   on success
515  *                                                      DM_ERR_UNKNOWN or Other DM_ERROR
516  *
517  *
518  * @par Errors:
519  *
520  * @pre None.
521  * @post
522  * @see
523  * @remarks None.
524  *
525  * @par Sample Code:
526  * @code
527  * @endcode
528  */
529 int IsExist_Engine_id(int engine_id);
530
531 #endif                          /* OMA_DM_STATUS_DB_HANDLER_H_ */