2 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __IOT_DEVICE_MANAGE_TYPE_H__
18 #define __IOT_DEVICE_MANAGE_TYPE_H__
20 #include <tizen_error.h>
27 * @brief Enumeration for command type
31 IDM_CMD_REBOOT = 1, /**< Command for rebooting device */
32 IDM_CMD_GET_LOG_ARCHIVE, /**< Command for getting log archive file for diagnosis */
33 IDM_CMD_GET_TASKINFO, /**< Command for getting task information */
34 IDM_CMD_GET_SYSINFO, /**< Command for getting system information */
35 // IDM_CMD_LCDOFF, /**< TBD : Command for turning LCD off */
36 // IDM_CMD_HIBERNATE, /**< TBD : Command for hibernating device */
37 // IDM_CMD_HALT, /**< TBD : Command for halting device */
38 // IDM_CMD_GET_ERR_CODE, /**< TBD : Command for getting error codes for diagnosis */
42 * @brief Enumeration for command status
46 IDM_CMD_CREATED = 0, /**< Command is created */
47 IDM_CMD_INITIALIZED, /**< Command is initialized */
48 IDM_CMD_RUNNING, /**< Command is running */
49 IDM_CMD_DONE, /**< Command is done */
53 * @brief Enumeration for command result
57 IDM_RESULT_RUNNING, /**< Command is still running */
58 IDM_RESULT_SUCCESS, /**< Command succeded */
59 IDM_RESULT_FAILED, /**< Command failed */
63 * @brief Enumeration for error reason
67 IDM_REASON_NONE = TIZEN_ERROR_NONE, /**< No error */
68 IDM_REASON_UNKNOWN = TIZEN_ERROR_UNKNOWN, /**< Unknown error */
69 IDM_REASON_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
70 IDM_REASON_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
71 IDM_REASON_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< Input/output error */
72 IDM_REASON_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
73 IDM_REASON_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
74 IDM_REASON_STOPPED = TIZEN_ERROR_CANCELED, /**< Stopped */
75 IDM_REASON_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
79 * @brief Enumeration for error code
83 IDM_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
84 IDM_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
85 IDM_ERROR_NOT_PERMITTED = TIZEN_ERROR_NOT_PERMITTED, /**< Operation not permitted */
86 IDM_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
87 IDM_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
88 IDM_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid function parameter */
89 IDM_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA, /**< No data available */
90 IDM_ERROR_ALREADY_IN_PROGRESS = TIZEN_ERROR_ALREADY_IN_PROGRESS, /**< Operation already in */
91 IDM_ERROR_CANCELED = TIZEN_ERROR_CANCELED, /**< Operation Canceled */
92 IDM_ERROR_UNKNOWN = TIZEN_ERROR_UNKNOWN, /**< Unknown error */
93 IDM_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
97 * @brief Structure for command
100 typedef struct __idm_command_h *idm_command_h;
103 * @brief Type definition of result callback function
105 * @remarks Format of @p detail for receiving result detail depends on the type of @p command \n
106 * #IDM_CMD_GET_TASKINFO refers to 'schema/taskResult.json' as JSON schema definition and 'schema/taskResultExample.json' as example\n
107 * #IDM_CMD_GET_LOG_ARCHIVE refers to 'schema/logArchiveResult.json' as JSON schema definition and 'schema/logArchiveResultExample.json' as example\n
108 * @param command Command handle
109 * @param result Enum value for result
110 * @param reason Enum value for reason
111 * @param detail Detail about result
112 * @param data User data
113 * @pre The callback must be registered using idm_command_run()
114 * @see idm_command_run()
115 * @see idm_command_get_type()
117 typedef void (*idm_result_cb) (idm_command_h command, idm_result_e result, idm_reason_e reason, const char *detail, void *data); /* TBD */
122 #endif /* __IOT_DEVICE_MANAGE_TYPE_H__ */