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 OMA_DM_STATUS_DB_H_
19 #define OMA_DM_STATUS_DB_H_
22 #include "common/dm_error.h"
23 #include "common/dm-status/oma_dm_status_db_common.h"
26 * =============================================================================================================================
27 * Database Open & Close & Create table
28 * =============================================================================================================================
33 * @par Description: API to dm open agent db handler
37 * @par Typical use case:
38 * @par Method of function operation:
39 * @par Important notes:
40 * @param[out] db handler
42 * @return DM_OK on success
43 * DM_ERR_UNKNOWN or Other DM_ERROR
57 DM_ERROR dm_open_agent(DB_HANDLER ** db_handler);
60 * @par Description: API to dm close agent db handler
64 * @par Typical use case:
65 * @par Method of function operation:
66 * @par Important notes:
67 * @param[in] db handler
69 * @return DM_OK on success
70 * DM_ERR_UNKNOWN or Other DM_ERROR
84 DM_ERROR dm_close_agent(DB_HANDLER * db_handler);
87 * @par Description: API to create dm service db table
91 * @par Typical use case:
92 * @par Method of function operation:
93 * @par Important notes:
94 * @param[in] db handler
96 * @return DM_OK on success
97 * DM_ERR_UNKNOWN or Other DM_ERROR
111 DM_ERROR dm_create_table(DB_HANDLER * db_handler);
114 * @par Description: API to delete dm service db table
118 * @par Typical use case:
119 * @par Method of function operation:
120 * @par Important notes:
121 * @param[in] db handler
123 * @return DM_OK on success
124 * DM_ERR_UNKNOWN or Other DM_ERROR
138 DM_ERROR dm_delete_table(DB_HANDLER * db_handler);
141 * @par Description: API to reset dm service db table
145 * @par Typical use case:
146 * @par Method of function operation:
147 * @par Important notes:
148 * @param[in] db handler
150 * @return DM_OK on success
151 * DM_ERR_UNKNOWN or Other DM_ERROR
165 DM_ERROR dm_reset_table(DB_HANDLER * db_handler);
168 * =============================================================================================================================
169 * Control Transaction
170 * =============================================================================================================================
174 * @par Description: API to begin transaction dm service db table
178 * @par Typical use case:
179 * @par Method of function operation:
180 * @par Important notes:
181 * @param[in] db handler
183 * @return DM_OK on success
184 * DM_ERR_UNKNOWN or Other DM_ERROR
198 DM_ERROR dm_begin_transaction(DB_HANDLER * db_handler);
201 * @par Description: API to end transaction dm service db table
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)
211 * @return DM_OK on success
212 * DM_ERR_UNKNOWN or Other DM_ERROR
226 DM_ERROR dm_end_transaction(DB_HANDLER * db_handler, DB_TRANSACTION transaction);
229 * =============================================================================================================================
230 * engine_status table
231 * =============================================================================================================================
235 * @par Description: API to init dm service db table
239 * @par Typical use case:
240 * @par Method of function operation:
241 * @par Important notes:
242 * @param[in] db handler
244 * @return DM_OK on success
245 * DM_ERR_UNKNOWN or Other DM_ERROR
259 DM_ERROR dm_init_engine_status(DB_HANDLER * db_handler);
262 * @par Description: API to add engine status structure in dm service db table
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
272 * @return DM_OK on success
273 * DM_ERR_UNKNOWN or Other DM_ERROR
287 DM_ERROR dm_add_engine_status(DB_HANDLER * db_handler, engine_status * status);
290 * @par Description: API to delete engine status structure in dm service db table
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
300 * @return DM_OK on success
301 * DM_ERR_UNKNOWN or Other DM_ERROR
315 DM_ERROR dm_delete_engine_status(DB_HANDLER * db_handler, int engine_id);
318 * @par Description: API to update engine status structure in dm service db table
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
328 * @return DM_OK on success
329 * DM_ERR_UNKNOWN or Other DM_ERROR
343 DM_ERROR dm_update_engine_status(DB_HANDLER * db_handler, engine_status * status);
346 * @par Description: API to update engine status column in dm service db table
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
357 * @return DM_OK on success
358 * DM_ERR_UNKNOWN or Other DM_ERROR
372 DM_ERROR dm_update_engine_status_column(DB_HANDLER * db_handler, int engine_id, ENGINE_STATUS_VALUE engine_status_value, void *value);
375 * @par Description: API to get engine status structure in dm service db table
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
386 * @return DM_OK on success
387 * DM_ERR_UNKNOWN or Other DM_ERROR
401 DM_ERROR dm_get_engine_status(DB_HANDLER * db_handler, int engine_id, engine_status ** status);
404 * @par Description: API to get all engine status structure in dm service db table
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
415 * @return DM_OK on success
416 * DM_ERR_UNKNOWN or Other DM_ERROR
430 DM_ERROR dm_get_aII_engine_status(DB_HANDLER * db_handler, engine_status ** status_list, int *count);
433 * @par Description: API to check exist engine status in dm service db table
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
443 * @return DM_OK on success
444 * DM_ERR_UNKNOWN or Other DM_ERROR
458 int dm_isExist_engine_id(DB_HANDLER * db_handler, int engine_id);
460 #endif /* OMA_DM_STATUS_DB_H_ */