diff options
Diffstat (limited to 'include/service-adapter/sa_command.h')
-rwxr-xr-x | include/service-adapter/sa_command.h | 866 |
1 files changed, 866 insertions, 0 deletions
diff --git a/include/service-adapter/sa_command.h b/include/service-adapter/sa_command.h new file mode 100755 index 0000000..7ded49f --- /dev/null +++ b/include/service-adapter/sa_command.h @@ -0,0 +1,866 @@ +/* + * oma-ds-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. + */ + +/** + * @SA_Commandl.h + * @version 0.1 + * @brief This file is the header file of interface of Command structure + */ + +#ifndef SA_COMMAND_H_ +#define SA_COMMAND_H_ + +#include "service-adapter/sa_define.h" +#include "common/common_define.h" + +/** + * @par Description: API to create alert command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] enum type, sync type + * @param[in] location_s structure(about source info) + * @param[in] location_s structure(about target info) + * @param[in] string type, last anchor + * @param[in] string type, next anchor + * @param[in] Cred structure + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_alert_command(session_s * session, alert_type_e sync_type, location_s * source, location_s * target, char *last_anchor, char *next_anchor, cred_s * cred, command_s ** command); + +/** + * @par Description: API to create get command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] location_s structure(about target info) + * @param[in] string type, content type + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_get_command(session_s * session, location_s * target, const char *content_type, command_s ** command); + +/** + * @par Description: API to create put command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] location_s structure(about source info) + * @param[in] string type, content type + * @param[in] DevInf structure + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_put_command(session_s * session, location_s * source, const char *content_type, devinf_s * devinf, command_s ** command); + +/** + * @par Description: API to create results command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] location_s structure(about source info) + * @param[in] string type, content type + * @param[in] DevInf structure + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_results_command(session_s * session, location_s * source, const char *content_type, devinf_s * devinf, command_s ** command); + +/** + * @par Description: API to create sync start command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] location_s structure(about source info) + * @param[in] location_s structure(about target info) + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_sync_start_command(session_s * session, location_s * source, location_s * target, command_s ** command); + +/** + * @par Description: API to create sync end command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_sync_end_command(command_s ** command); + +/** + * @par Description: API to create add command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] enum type, change type + * @param[in] string type, luid of item + * @param[in] string type, content type + * @param[in] string type, data(vobject) + * @param[in] unsigned int type, size of data + * @param[in] int type, moreData(LargeObj) + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_add_command(session_s * session, change_type_e type, char *luid, const char *content_type, char *data, unsigned int size, int more_data, command_s ** command); + +/** + * @par Description: API to create replace command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] enum type, change type + * @param[in] string type, luid of item + * @param[in] string type, content type + * @param[in] string type, data(vobject) + * @param[in] unsigned int type, size of data + * @param[in] int type, more_data(LargeObj) + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_replace_command(session_s * session, change_type_e type, char *luid, const char *content_type, const char *data, unsigned int size, int more_data, command_s ** command); + +/** + * @par Description: API to create delete command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] enum type, change type + * @param[in] string type, luid of item + * @param[in] string type, content type + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_delete_command(session_s * session, change_type_e type, char *luid, const char *content_type, command_s ** command); + +/** + * @par Description: API to create map command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] location_s structure(about source info) + * @param[in] location_s structure(about target info) + * @param[out] command_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED, ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_map_command(session_s * session, location_s * source, location_s * target, command_s ** command); + +/** + * @par Description: API to free list of command structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] list of command structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_commands(GList * commands); + +/** + * @par Description: API to free command structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] command structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_command(command_s * command); + +/** + * @par Description: API to increase reference count of command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] command_s structure + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e increase_command_ref_count(command_s * command); + +/** + * @par Description: API to decrease reference count of command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] command_s structure + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e decrease_command_ref_count(command_s * command); + +/** + * @par Description: API to set msgRef in results command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] Commnad structure + * @param[in] unsigned int type, msg reference + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_results_command_msg_ref(command_s * command, unsigned int msg_ref); + +/** + * @par Description: API to set cmdRef in results command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] Commnad structure + * @param[in] unsigned int, cmd reference + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_results_command_cmd_ref(command_s * command, unsigned int cmd_ref); + +/** + * @par Description: API to set targetRef in results command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] command_s structure + * @param[in] location_s structure(target info) + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_results_command_target_ref(command_s * command, location_s * location); + +/** + * @par Description: API to set number_of_changes in sync start command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] command_s structure + * @param[in] unsigned int type, number of changes + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_sync_start_command_number_of_changes(command_s * command, unsigned int number_of_changes); + +/** + * @par Description: API to set Mem structure in sync start command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] command_s structure + * @param[in] mem_s structure + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_sync_start_command_mem(command_s * command, mem_s * mem); + +/** + * @par Description: API to set item in map command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] command_s structure + * @param[in] item_s structure + * @param[out] + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NOT_DEFINED on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e set_map_command_item(command_s * mapCommand, item_s * temp); + +/** + * @par Description: API to create status command with locatiion structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] data (status code) + * @param[in] command_s structure + * @param[in] location_s structure(about source info) + * @param[in] location_s structure(about target info) + * @param[in] command type + * @param[out] status_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_new_status_location(session_s * session, oma_status_type_e data, command_s * command, location_s * source_ref, location_s * target_ref, command_type_e type, status_s ** status); + +/** + * @par Description: API to create create status command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] session_s structure + * @param[in] enum type, data (status code) + * @param[in] command_s structure + * @param[in] enum type, command type + * @param[out] status_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_new_status(session_s * session, oma_status_type_e data, command_s * command, command_type_e type, status_s ** status); + +/** + * @par Description: API to create status command + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] enum type, data (status code) + * @param[in] unsigned int type, cmd ID + * @param[in] unsigned int type, cmd reference + * @param[in] unsigned int type, msg reference + * @param[in] location_s structure(about source info) + * @param[in] location_s structure(about target info) + * @param[in] enum type, command type + * @param[out] status_s structure + * + * @return ERROR_INTERNAL_OK on success + * ERROR_INTERNAL_NO_MEMORY on error + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +sa_error_type_e create_status(oma_status_type_e data, unsigned int cmd_id, unsigned int cmd_ref, unsigned int msg_ref, location_s * source_ref, location_s * target_ref, command_type_e type, status_s ** status); + +/** + * @par Description: API to free list of Status structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] list of Status structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_statuses(GList * status); + +/** + * @par Description: API to free Status structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] Status structure + * @param[out] + * + * @return + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +void free_status(status_s * status); + +/** + * @par Description: API to get status code from Status structure + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] Status structure + * @param[out] + * + * @return OMA_StatusType type + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +oma_status_type_e get_status_code(status_s * status); + +/** + * @par Description: API to convert to command type from char* + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] char* (Alert, Sync, Put, SyncHdr, Add, Replace, Map, Delete, Results, Get) + * @param[out] + * + * @return command_type_e type + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +command_type_e convert_command_type(char *type); + +/** + * @par Description: API to convert to change type from command type + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] enum type, command_type_e + * @param[out] + * + * @return change_type_e type + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +change_type_e convert_change_type_command_type(command_type_e type); + +/** + * @par Description: API to convert to command type from change type + * + * + * @par Purpose: + * @par Typical use case: + * @par Method of function operation: + * @par Important notes: + * @param[in] enum type, change_type_e + * @param[out] + * + * @return command_type_e type + * + * @par Errors: + * + * @pre None. + * @post + * @see + * @remarks None. + * + * @par Sample Code: + * @code + * @endcode + */ +command_type_e convert_command_type_change_type(change_type_e type); + +/* unused function + * keep for in case + */ +/* +ChangeType convertToChangeType(unsigned int type); +char *convertFromCommandType(CommandType type); +*/ + +#endif /* SA_COMMAND_H_ */ |