diff options
Diffstat (limited to 'include/common/dm-status/oma_dm_status_db_handler.h')
-rwxr-xr-x | include/common/dm-status/oma_dm_status_db_handler.h | 531 |
1 files changed, 531 insertions, 0 deletions
diff --git a/include/common/dm-status/oma_dm_status_db_handler.h b/include/common/dm-status/oma_dm_status_db_handler.h new file mode 100755 index 0000000..d5ded22 --- /dev/null +++ b/include/common/dm-status/oma_dm_status_db_handler.h @@ -0,0 +1,531 @@ +/* + * oma-dm-agent + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OMA_DM_STATUS_DB_HANDLER_H_ +#define OMA_DM_STATUS_DB_HANDLER_H_ + +/*dm-agent*/ +#include "common/dm_error.h" +#include "common/dm-status/oma_dm_status_db_common.h" + +/* + * ================================== + * external API (1. about db handler mgr) + * ================================== + */ + +/** + * @par Description: API to alloc the db handler manager + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * + * @return DM_OK on success + * DM_ERR_UNKNOWN or Other DM_ERROR + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +DM_ERROR Alloc_DB_Handler_Mgr(); + +/** + * @par Description: API to free the db handler manager + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * + * @return DM_OK on success + * DM_ERR_UNKNOWN or Other DM_ERROR + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +DM_ERROR Free_DB_Handler_Mgr(); + +/** + * @par Description: API to free engine structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] free structure count + * @param[in] engine_status structure + * + * @return + * + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void Free_Memory_Engine_Status(engine_status ** status, int count); + +/* + * ================================== + * external API (2. about agent db ) + * ================================== + */ +/* + * ============================================================================================================================= + * Database Open & Close & Create table + * ============================================================================================================================= + * + */ +/** + * @par Description: API to dm_service db open + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * + * @return DM_OK on success + * DM_ERR_UNKNOWN or Other DM_ERROR + * + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +DM_ERROR DB_Open(); + +/** + * @par Description: API to dm_service db close + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * + * @return + * + * + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void DB_Close(); + +/** + * @par Description: API to create dm_service db + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * + * @return DM_OK on success + * DM_ERR_UNKNOWN or Other DM_ERROR + * + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +DM_ERROR DB_Create_Table(); + +/** + * @par Description: API to delete dm_service db + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * + * @return DM_OK on success + * DM_ERR_UNKNOWN or Other DM_ERROR + * + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +DM_ERROR DB_Delete_Table(); + +/** + * @par Description: API to reset dm_service db + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * + * @return DM_OK on success + * DM_ERR_UNKNOWN or Other DM_ERROR + * + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +DM_ERROR DB_Reset_Table(); + +/* + * ============================================================================================================================= + * Control Transaction + * ============================================================================================================================= + */ +/** + * @par Description: API to begin transaction dm_service db + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * + * @return DM_OK on success + * DM_ERR_UNKNOWN or Other DM_ERROR + * + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +DM_ERROR DB_Begin_Transaction(); + +/** + * @par Description: API to end transaction dm_service db + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] DB_TRANSACTION ( commit, rollback) + * + * @return DM_OK on success + * DM_ERR_UNKNOWN on error + * + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +DM_ERROR DB_End_Transaction(DB_TRANSACTION transaction); + +/* + * ============================================================================================================================= + * engine_status table + * ============================================================================================================================= + */ +/** + * @par Description: API to init engine status + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * + * @return DM_OK on success + * DM_ERR_UNKNOWN or Other DM_ERROR + * + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +DM_ERROR Init_Engine_Status(); + +/** + * @par Description: API to add engine status row in db + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] engine_status structure + * + * @return DM_OK on success + * DM_ERR_UNKNOWN or Other DM_ERROR + * + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +DM_ERROR Add_Engine_Status(engine_status * status); + +/** + * @par Description: API to delete engine status in db + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] engine_status id + * + * @return DM_OK on success + * DM_ERR_UNKNOWN or Other DM_ERROR + * + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +DM_ERROR Delete_Engine_Status(int engine_id); + +/** + * @par Description: API to update engine status in db + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] engine_status structure + * + * @return DM_OK on success + * DM_ERR_UNKNOWN or Other DM_ERROR + * + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +DM_ERROR Update_Engine_Status(engine_status * status); + +/** + * @par Description: API to update engine status column in db + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] engine_status id + * @param[in] engine_status key + * @param[in] engine_status value + * + * @return DM_OK on success + * DM_ERR_UNKNOWN or Other DM_ERROR + * + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +DM_ERROR Update_Engine_Status_Column(int engine_id, ENGINE_STATUS_VALUE engine_status_value, void *value); + +/** + * @par Description: API to get engine status structure in db + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] engine_status id + * @param[out] engine_status structure + * + * @return DM_OK on success + * DM_ERR_UNKNOWN or Other DM_ERROR + * + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +DM_ERROR Get_Engine_Status(int engine_id, engine_status ** status); + +/** + * @par Description: API to get engine status structure in db + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[out] engine_status structure list + * @param[out] engine_status structure count + * + * @return DM_OK on success + * DM_ERR_UNKNOWN or Other DM_ERROR + * + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +DM_ERROR Get_AII_Engine_Status(engine_status ** status_list, int *count); + +/** + * @par Description: API to check exist engine status structure in db + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] engine_status id + * + * @return DM_OK on success + * DM_ERR_UNKNOWN or Other DM_ERROR + * + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +int IsExist_Engine_id(int engine_id); + +#endif /* OMA_DM_STATUS_DB_HANDLER_H_ */ |