[sample] update lib and header files
authorJeonghoon Park <jh1979.park@samsung.com>
Fri, 17 May 2019 06:45:25 +0000 (15:45 +0900)
committer박정훈/Tizen Platform Lab(SR)/Staff Engineer/삼성전자 <jh1979.park@samsung.com>
Fri, 17 May 2019 08:46:31 +0000 (17:46 +0900)
inc/iot-device-manage-type.h
inc/iot-device-manage.h
lib/libiot-device-manage.so.0

index d6951ff..fbbe58b 100644 (file)
@@ -26,10 +26,14 @@ extern "C" {
 * @since_tizen 5.0
 */
 typedef enum {
-       IDM_CMD_TYPE_UNKNOWN = 0,    /**< Unknown command */
-       IDM_CMD_TYPE_POWER = 1,      /**< Command regarding power */
-       IDM_CMD_TYPE_DIAGNOSIS = 4,  /**< Command regarding diagnosis */
-       IDM_CMD_TYPE_INFO = 5,       /**< Command regarding information */
+       IDM_CMD_REBOOT = 1,      /**< Command for rebooting device */
+       IDM_CMD_GET_LOG_ARCHIVE, /**< Command for getting log archive file for diagnosis */
+       IDM_CMD_GET_TASKINFO,    /**< Command for getting task information */
+       // IDM_CMD_GET_SYSINFO,     /**< TBD : Command for getting system information */
+       // IDM_CMD_LCDOFF,          /**< TBD : Command for turning LCD off */
+       // IDM_CMD_HIBERNATE,       /**< TBD : Command for hibernating device */
+       // IDM_CMD_HALT,            /**< TBD : Command for halting device */
+       // IDM_CMD_GET_ERR_CODE,    /**< TBD : Command for getting error codes for diagnosis */
 } idm_cmd_type_e;
 
 /**
@@ -44,35 +48,6 @@ typedef enum {
 } idm_cmd_status_e;
 
 /**
-* @brief Enumeration for command regarding power
-* @since_tizen 5.0
-*/
-typedef enum { /* TBD */
-       IDM_CMD_POWER_REBOOT = 100,  /**< Command for power rebooting */
-       IDM_CMD_POWER_LCDOFF,        /**< Command for turning LCD off */               /* TBD */
-       IDM_CMD_POWER_HIBERNATE,     /**< Command for hibernating on peak season */    /* TBD : Control electric power on the peak season */
-       IDM_CMD_POWER_HALT,          /**< Command for halting on peak season */        /* TBD : Control electric power on the peak season */
-} idm_cmd_power_e;
-
-/**
-* @brief Enumeration for command regarding diagnosis
-* @since_tizen 5.0
-*/
-typedef enum { /* TBD */
-       IDM_CMD_DIAGNOSIS_GET_LOG_ARCHIVE = 400,  /**< Command for getting logs for diagnosis */
-       IDM_CMD_DIAGNOSIS_GET_ERR_CODE,   /**< Command for getting error codes for diagnosis */    /* TBD : Collect error codes from sensors & motors */
-} idm_cmd_diagnosis_e;
-
-/**
-* @brief Enumeration for command regarding information
-* @since_tizen 5.0
-*/
-typedef enum { /* TBD */
-       IDM_CMD_INFO_GET_SYSINFO = 500,  /**< Command for getting system information */
-       IDM_CMD_INFO_GET_TASKINFO,       /**< Command for getting task information */    /* TBD : Add lots of things to a gateway so it needs to monitor resources. */
-} idm_cmd_info_e;
-
-/**
 * @brief Enumeration for command result
 * @since_tizen 5.0
 */
index 6982276..8434122 100644 (file)
@@ -49,7 +49,7 @@ int idm_command_free(idm_command_h command);
  * @since_tizen 5.0
  * @remarks This is not thread safe.
  *          This works asynchronously.
- *          To use this API, the command must be perset by using idm_command_set_power_cmd(), idm_command_set_diagnosis_cmd(), idm_command_set_info_cmd().
+ *          To use this API, the command must be preset by using idm_command_set_power_cmd(), idm_command_set_diagnosis_cmd(), idm_command_set_info_cmd().
  * @param[in] command The idm_command handle
  * @param[in] result_cb The callback function to get result
  * @param[in] user_data The user data to be passed to the callback function
@@ -65,7 +65,6 @@ int idm_command_run(idm_command_h command, idm_result_cb result_cb, void *user_d
  * @brief Stops the command.
  * @since_tizen 5.0
  * @remarks This is not thread safe.
- *          If the command is not running, it returns a negative error value.
  * @param[in] command The idm_command handle
  * @return 0 on success, otherwise a negative error value
  * @see idm_command_run()
@@ -116,32 +115,40 @@ int idm_command_get_type(idm_command_h command, idm_cmd_type_e *type);
 
 /**
  * @platfrom
- * @brief Sets the command regarding power
+ * @brief Sets the command for getting information
  * @since_tizen 5.0
  * @privlevel platform
- * @privilege http://tizen.org/privilege/reboot
- * @remarks This is not thread safe.
+ * @privilege %http://tizen.org/privilege/reboot
+ * @privilege %http://tizen.org/privilege/systemmonitor
+ * @remarks Required privilege depends on @p cmd \n
+ *          #IDM_CMD_REBOOT requires privilege http://tizen.org/privilege/reboot \n
+ *          #IDM_CMD_GET_TASKINFO requires privilege http://tizen.org/privilege/systemmonitor \n
+ *          This is not thread safe.
  * @param[in] command The idm_command handle
- * @param[in] cmd The command regarding power
- * @param[in] reason The reason for setting @cmd
+ * @param[in] cmd The command for getting information
+ * @param[in] detail The details for setting @p cmd
+ *
  * @return 0 on success, otherwise a negative error value
- * @see idm_cmd_power_e
+ * @see idm_cmd_info_e
  *
  * @par Example
  * @code
- * #include <libidm.h>
+ * #include <iot-device-manage.h>
+ * #include <iot-device-manage-type.h>
  *
- * static void __reboot_result_callback(idm_command_h command, idm_result_e result, idm_reason_e reason, const char *detail, void *data)
+ * static void __result_cb(idm_command_h command, idm_result_e result, idm_reason_e reason, const char *detail, void *data)
  * {
- *     app_data *ad = data;
- *             _D("result : %d, reason : %d, detail : %s", result, reason, detail ? detail : "None");
+ *             unsigned long id;
+ *             idm_command_get_id(command, &id);
+ *
+ *             _D("[%d] result : %d, reason : %d, detail : %s", id, result, reason, detail ? detail : "None");
  *
  *             if (result != IDM_RESULT_RUNNING) {
  *                     idm_command_free(command);
  *             }
  * }
  *
- * static void __reboot(void)
+ * static void __get_taskinfo(const char *request, unsigned long id)
  * {
  *             idm_command_h command = NULL;
  *             int ret = -1;
@@ -152,14 +159,16 @@ int idm_command_get_type(idm_command_h command, idm_cmd_type_e *type);
  *                     return;
  *             }
  *
- *             ret = idm_command_set_power_cmd(command, IDM_CMD_POWER_REBOOT, NULL);
+ *             idm_command_set_id(command, id);
+ *
+ *             ret = idm_command_set_cmd_detail(command, IDM_CMD_GET_TASKINFO, request);
  *             if (ret != 0) {
- *                     _E("failed to idm_command_set_power_cmd");
+ *                     _E("failed to idm_command_set_cmd_detail");
  *                     idm_command_free(command);
  *                     return;
  *             }
  *
- *             ret = idm_command_run(command, __reboot_result_callback, ad);
+ *             ret = idm_command_run(command, __result_cb, NULL);
  *             if (ret != 0) {
  *                     _E("failed to idm_command_run");
  *                     idm_command_free(command);
@@ -168,79 +177,7 @@ int idm_command_get_type(idm_command_h command, idm_cmd_type_e *type);
  * }
  * @endcode
  */
-int idm_command_set_power_cmd(idm_command_h command, idm_cmd_power_e cmd, const char* reason);
-
-/**
- * @brief Sets the command regarding diagnosis
- * @since_tizen 5.0
- * @remarks This is not thread safe.
- * @param[in] command The idm_command handle
- * @param[in] cmd The command regarding diagnosis
- * @param[in] detail The details for setting @cmd
- * @return 0 on success, otherwise a negative error value
- * @see idm_cmd_diagnosis_e
- */
-int idm_command_set_diagnosis_cmd(idm_command_h command, idm_cmd_diagnosis_e cmd, const char* detail);
-
-/**
- * @platfrom
- * @brief Sets the command for getting information
- * @since_tizen 5.0
- * @privlevel platform
- * @privilege http://tizen.org/privilege/systemmonitor
- * @remarks This is not thread safe.
- * @param[in] command The idm_command handle
- * @param[in] cmd The command for getting information
- * @param[in] detail The details for setting @cmd
- * @return 0 on success, otherwise a negative error value
- * @see idm_cmd_info_e
- *
- * @par Example
- * @code
- * #include <libidm.h>
- *
- * static void __result_cb(idm_command_h command, idm_result_e result, idm_reason_e reason, const char *detail, void *data)
- * {
- *             unsigned long id;
- *             idm_command_get_id(command, &id);
- *
- *             _D("[%d] result : %d, reason : %d, detail : %s", id, result, reason, detail ? detail : "None");
- *
- *             if (result != IDM_RESULT_RUNNING) {
- *                     idm_command_free(command);
- *             }
- * }
- *
- * static void __get_taskinfo(char *request, unsigned long id)
- * {
- *             idm_command_h command = NULL;
- *             int ret = -1;
- *
- *             idm_command_new(&command);
- *             if (ret != 0) {
- *                     _E("failed to idm_command_new");
- *                     return;
- *             }
- *
- *             idm_command_set_id(command, id);
- *
- *             ret = idm_command_set_info_cmd(command, IDM_CMD_INFO_GET_TASKINFO, request);
- *             if (ret != 0) {
- *                     _E("failed to idm_command_set_info_cmd");
- *                     idm_command_free(command);
- *                     return;
- *             }
- *
- *             ret = idm_command_run(command, __result_cb, NULL);
- *             if (ret != 0) {
- *                     _E("failed to idm_command_run");
- *                     idm_command_free(command);
- *                     return;
- *             }
- * }
- * @endcode
- */
-int idm_command_set_info_cmd(idm_command_h command, idm_cmd_info_e cmd, const char* detail);
+int idm_command_set_cmd_detail(idm_command_h command, idm_cmd_type_e cmd, const char* detail);
 
 #ifdef __cplusplus
 }
index 2afb32d..fad2338 100644 (file)
Binary files a/lib/libiot-device-manage.so.0 and b/lib/libiot-device-manage.so.0 differ