resource-monitor: Update function description according to Native API rules 12/280012/2 submit/tizen/20220822.094833
authorChanwoo Choi <cw00.choi@samsung.com>
Fri, 19 Aug 2022 06:30:37 +0000 (15:30 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Mon, 22 Aug 2022 08:45:57 +0000 (17:45 +0900)
Add the error enumeration for only resource monitor module
and update function descriptions according to Native API rules.
- RESOURCE_MONITOR_ERROR_NONE
- RESOURCE_MONITOR_ERROR_NOT_SUPPORTED
- RESOURCE_MONITOR_ERROR_INVALID_PARAMETER
- RESOURCE_MONITOR_ERROR_NO_DATA
- RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY

Lastly, change the prototype of resource_monitor_is_resource_attr_supported()
as following because if capi function requires the parameters,
must handle the invalid parameter error case by returning
the INVALID_PARAMETER error.

[De
-bool resource_monitor_is_resource_attr_supported(int id, int resource_id, u_int64_t attr_id);
+int resource_monitor_is_resource_attr_supported(int id, int resource_id, u_int64_t attr_id, bool *supported);

Change-Id: I0485f6a485d4ce6dcb70f9013b3a7dc9db0fbd3f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
include/resource-monitor.h
src/resource-monitor.c
tools/system-resource-monitor/system-resource-monitor.c

index dc0ff2828472445e0ae7825d28aaa78573849d00..e255a09822e97bb9128d629bc4c009619c024002 100644 (file)
  * limitations under the License.
  */
 
-#ifndef __resource_SYSTEM_RESOURCE_MONITOR_H__
-#define __resource_SYSTEM_RESOURCE_MONITOR_H__
+#ifndef __TIZEN_SYSTEM_MONITOR_RESOURCE_MONITOR_H__
+#define __TIZEN_SYSTEM_MONITOR_RESOURCE_MONITOR_H__
+
+#include <tizen.h>
 
 #include <sys/types.h>
 #include <pass/resource-monitor.h>
@@ -35,7 +37,19 @@ extern "C" {
  */
 
 /**
- * @brief Define the supported resource type for monitoring
+ * @brief Define the error value.
+ * @since_tizen 7.0
+ */
+enum {
+       RESOURCE_MONITOR_ERROR_NONE                     = TIZEN_ERROR_NONE,
+       RESOURCE_MONITOR_ERROR_NOT_SUPPORTED            = TIZEN_ERROR_NOT_SUPPORTED,
+       RESOURCE_MONITOR_ERROR_INVALID_PARAMETER        = TIZEN_ERROR_INVALID_PARAMETER,
+       RESOURCE_MONITOR_ERROR_NO_DATA                  = TIZEN_ERROR_NO_DATA,
+       RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY            = TIZEN_ERROR_OUT_OF_MEMORY,
+};
+
+/**
+ * @brief Define the supported resource type for monitoring.
  * @since_tizen 7.0
  */
 enum {
@@ -51,7 +65,7 @@ enum {
 };
 
 /**
- * @brief Define the supported attributes and controls for CPU resource type
+ * @brief Define the supported attributes and controls for CPU resource type.
  * @since_tizen 7.0
  */
 enum {
@@ -69,7 +83,7 @@ enum {
 };
 
 /**
- * @brief Define the supported attributes and controls for Memory bus resource type
+ * @brief Define the supported attributes and controls for Memory bus resource type.
  * @since_tizen 7.0
  */
 enum {
@@ -87,7 +101,7 @@ enum {
 };
 
 /**
- * @brief Define the supported attributes and controls for GPU resource type
+ * @brief Define the supported attributes and controls for GPU resource type.
  * @since_tizen 7.0
  */
 enum {
@@ -105,7 +119,7 @@ enum {
 };
 
 /**
- * @brief Define the supported attributes for Memory resource type
+ * @brief Define the supported attributes for Memory resource type.
  * @since_tizen 7.0
  */
 enum {
@@ -121,7 +135,7 @@ enum {
 };
 
 /**
- * @brief Define the supported attributes for Battery resource type
+ * @brief Define the supported attributes for Battery resource type.
  * @since_tizen 7.0
  */
 enum {
@@ -135,7 +149,7 @@ enum {
 };
 
 /**
- * @brief Define the supported attributes and controls for Display resource type
+ * @brief Define the supported attributes and controls for Display resource type.
  * @since_tizen 7.0
  */
 enum {
@@ -148,7 +162,7 @@ enum {
 };
 
 /**
- * @brief Define the supported attributes for System resource type
+ * @brief Define the supported attributes for System resource type.
  * @since_tizen 7.0
  */
 enum {
@@ -164,7 +178,7 @@ enum {
 
 
 /**
- * @brief Define the supported attributes for Disk resource type
+ * @brief Define the supported attributes for Disk resource type.
  * @since_tizen 7.0
  */
 enum {
@@ -189,130 +203,368 @@ enum {
  */
 
 /**
- * @brief Initialize the resource monitor
+ * @brief  Initializes the resource monitor.
  * @since_tizen 7.0
+ * @remarks The @c return value should be released using resourc_monitor_exit().
  * @return @c positive integer as resource monitor id on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
  */
 int resource_monitor_init(void);
 
 /**
- * @brief Exit the resource monitor
- * @param[in] Id of resource monitor which be returnted by resource_monitor_init
+ * @brief Exits the resource monitor.
+ * @since_tizen 7.0
+ * @param[in] id             Id of resource monitor which be returnted by resource_monitor_init()
  * @return @c 0 on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER            Invalid Parameter
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
  */
 int resource_monitor_exit(int id);
 
 /**
- * @brief Get the count of supported resources according to resource type
- * @param[in] Resource monitor id
- * @param[in] Resource type
- * @param[out] Resource count retrived from resource monitor
+ * @brief Gets the count of supported resources according to resource type.
+ * @since_tizen 7.0
+ * @param[in] id             Resource monitor id
+ * @param[in] resource_type  Resource type
+ * @param[out] resource_count  Resource count retrived from resource monitor
  * @return @c 0 on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER            Invalid Parameter
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
  */
 int resource_monitor_get_resource_count(int id, int resource_type, int *resource_count);
 
 /**
- * @brief Create resource for given resource_type
- * @param[in] Resource monitor id which be returnted by resource_monitor_init
- * @param[in] Resource type
+ * @brief Creates resource for given resource_type.
+ * @since_tizen 7.0
+ * @remarks The @c return value should be released using resourc_delete_resource().
+ * @param[in] id             Resource monitor id which be returnted by resource_monitor_init()
+ * @param[in] resource_type  Resource type
  * @return @c positive integer as resource id on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER            Invalid Parameter
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
  */
 int resource_monitor_create_resource(int id, int resource_type);
 
 /**
- * @brief Delete resource of given resource id
- * @param[in] Resource monitor id which be returnted by resource_monitor_init
- * @param[in] Resource id
+ * @brief Deletes resource of given resource id.
+ * @since_tizen 7.0
+ * @param[in] id             Resource monitor id which be returnted by resource_monitor_init()
+ * @param[in] resource_id    Resource id
  * @return @c 0 on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER            Invalid Parameter
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
  */
 int resource_monitor_delete_resource(int id, int resource_id);
 
 /**
- * @brief Set the resource control with value which is diffierential according to resource control id
- * @param[in] Resource monitor id
- * @param[in] Resource id
- * @param[in] Resource control id
- * @param[in] Value for resource control id
+ * @brief Sets the resource control with value which is diffierential according to resource control id.
+ * @since_tizen 7.0
+ * @param[in] id             Resource monitor id
+ * @param[in] resource_id    Resource id
+ * @param[in] ctrl_id        Resource control id
+ * @param[in] value          Value for resource control id
  * @return @c 0 on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER            Invalid Parameter
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
  */
 int resource_monitor_set_resource_ctrl(int id, int resource_id, u_int64_t ctrl_id, int value);
 
 /**
- * @brief Set the interested attributes for monitoring
- * @param[in] Resource monitor id
- * @param[in] Resource id
- * @param[in] Attribute mask including the various attributes
+ * @brief Sets the interested attributes for monitoring.
+ * @since_tizen 7.0
+ * @remarks Should be released using resource_monitor_unset_resource_attr().
+ * @param[in] id             Resource monitor id
+ * @param[in] resource_id    Resource id
+ * @param[in] attr_mask      Attribute mask including the various attributes
  * @return @c 0 on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER            Invalid Parameter
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
  */
 int resource_monitor_set_resource_attr(int id, int resource_id, u_int64_t attr_mask);
 
 /**
- * @brief Unset the interested attributes for monitoring
- * @param[in] Resource monitor id
- * @param[in] Resource id
- * @param[in] Attribute mask including the various attributes
+ * @brief Unsets the interested attributes for monitoring.
+ * @since_tizen 7.0
+ * @param[in] id             Resource monitor id
+ * @param[in] resource_id    Resource id
+ * @param[in] attr_mask      Attribute mask including the various attributes
  * @return @c 0 on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER            Invalid Parameter
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
  */
 int resource_monitor_unset_resource_attr(int id, int resource_id, u_int64_t attr_mask);
 
 /**
- * @brief Check whether a resouce attribute is supported or not
- * @param[in] Resource monitor id
- * @param[in] Resource id
- * @param[in] Resource attribute id
+ * @brief Checks whether a resouce attribute is supported or not.
+ * @since_tizen 7.0
+ * @param[in] id             Resource monitor id
+ * @param[in] resource_id    Resource id
+ * @param[in] attr_id        Resource attribute id
+ * @param[out] supported     Resource attributes is either supported or not (@c true  == supporeted, @c false = not supported)
  * @return @c 0 on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER            Invalid Parameter
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
  */
-bool resource_monitor_is_resource_attr_supported(int id, int resource_id, u_int64_t attr_id);
+int resource_monitor_is_resource_attr_supported(int id, int resource_id, u_int64_t attr_id, bool *supported);
 
 /**
- * @brief Update value of the interested attributes for all created resource
- * @param[in] Resource monitor id
+ * @brief Updates the value of interested attributes for all created resource.
+ * @since_tizen 7.0
+ * @param[in] id             Resource monitor id
  * @return @c 0 on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER            Invalid Parameter
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
  */
 int resource_monitor_update(int id);
 
 /**
- * @brief Update value of the interested attributes for a resource
- * @param[in] Resource monitor id
- * @param[in] Resource id
+ * @brief Updates the value of interested attributes for a resource.
+ * @since_tizen 7.0
+ * @param[in] id             Resource monitor id
+ * @param[in] resource_id    Resource id
  * @return @c 0 on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER            Invalid Parameter
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
  */
 int resource_monitor_update_resource(int id, int resource_id);
 
 /**
- * @brief Get [int/int64/uint/uint64/double/string] value of resource attribute
- * @details resource_monitor_get_value_string returns the value stored on allocated memory.
- *          After using the value, must need to free the allocated memory of value.
- * @param[in] Resource monitor id
- * @param[in] Resource id
- * @param[in] Resource attribute id
- * @param[out] Value retrieved from resource attribute
- * @return @ 0 on success, otherwise a negative error value
- */
-int resource_monitor_get_value_int(int id, int resource_id, u_int64_t attr, int32_t *value);
-int resource_monitor_get_value_int64(int id, int resource_id, u_int64_t attr, int64_t *value);
-int resource_monitor_get_value_uint(int id, int resource_id, u_int64_t attr, u_int32_t *value);
-int resource_monitor_get_value_uint64(int id, int resource_id, u_int64_t attr, u_int64_t *value);
-int resource_monitor_get_value_double(int id, int resource_id, u_int64_t attr, double *value);
-int resource_monitor_get_value_string(int id, int resource_id, u_int64_t attr, char **value);
-
-/**
- * @brief Get [int/int64/uint/uint64/double/string] array of resource attribute
- * @details All get_array return the value stored on allocated memory.
- *          After using the value, must need to free the allocated memory of value.
- * @param[in] Resource monitor id
- * @param[in] Resource id
- * @param[in] Resource attribute id
- * @param[out] Array retrieved from resource attribute
- * @param[out] Length of array
- * @return @ 0 on success, otherwise a negative error value
- */
-int resource_monitor_get_array_int(int id, int res_id, u_int64_t attr, int32_t **array, int *length);
-int resource_monitor_get_array_int64(int id, int res_id, u_int64_t attr, int64_t **array, int *length);
-int resource_monitor_get_array_uint(int id, int res_id, u_int64_t attr, u_int32_t **array, int *length);
-int resource_monitor_get_array_uint64(int id, int res_id, u_int64_t attr, u_int64_t **array, int *length);
-int resource_monitor_get_array_double(int id, int res_id, u_int64_t attr, double **array, int *length);
-int resource_monitor_get_array_string(int id, int res_id, u_int64_t attr, char ***array, int *length);
+ * @brief Gets the int value of resource attribute.
+ * @since_tizen 7.0
+ * @param[in] id             Resource monitor id
+ * @param[in] resource_id    Resource id
+ * @param[in] attr_id        Resource attribute id
+ * @param[out] value         Value retrieved from resource attribute
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER            Invalid Parameter
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
+ */
+int resource_monitor_get_value_int(int id, int resource_id, u_int64_t attr_id, int32_t *value);
+
+/**
+ * @brief Gets the int64 value of resource attribute.
+ * @since_tizen 7.0
+ * @param[in] id             Resource monitor id
+ * @param[in] resource_id    Resource id
+ * @param[in] attr_id        Resource attribute id
+ * @param[out] value         Value retrieved from resource attribute
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER            Invalid Parameter
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
+ */
+int resource_monitor_get_value_int64(int id, int resource_id, u_int64_t attr_id, int64_t *value);
+
+/**
+ * @brief Gets the uint value of resource attribute.
+ * @since_tizen 7.0
+ * @param[in] id             Resource monitor id
+ * @param[in] resource_id    Resource id
+ * @param[in] attr_id        Resource attribute id
+ * @param[out] value         Value retrieved from resource attribute
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER            Invalid Parameter
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
+ */
+int resource_monitor_get_value_uint(int id, int resource_id, u_int64_t attr_id, u_int32_t *value);
+
+/**
+ * @brief Gets the uint64 value of resource attribute.
+ * @since_tizen 7.0
+ * @param[in] id             Resource monitor id
+ * @param[in] resource_id    Resource id
+ * @param[in] attr_id        Resource attribute id
+ * @param[out] value         Value retrieved from resource attribute
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER            Invalid Parameter
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
+ */
+int resource_monitor_get_value_uint64(int id, int resource_id, u_int64_t attr_id, u_int64_t *value);
+
+/**
+ * @brief Gets the double value of resource attribute.
+ * @since_tizen 7.0
+ * @param[in] id             Resource monitor id
+ * @param[in] resource_id    Resource id
+ * @param[in] attr_id        Resource attribute id
+ * @param[out] value         Value retrieved from resource attribute
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER            Invalid Parameter
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
+ */
+int resource_monitor_get_value_double(int id, int resource_id, u_int64_t attr_id, double *value);
+
+/**
+ * @brief Gets the string value of resource attribute.
+ * @since_tizen 7.0
+ * @remarks The @a value should be released using free().
+ * @param[in] id             Resource monitor id
+ * @param[in] resource_id    Resource id
+ * @param[in] attr_id        Resource attribute id
+ * @param[out] value         Value retrieved from resource attribute
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER            Invalid Parameter
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
+ */
+int resource_monitor_get_value_string(int id, int resource_id, u_int64_t attr_id, char **value);
+
+/**
+ * @brief Gets the int array of resource attribute.
+ * @since_tizen 7.0
+ * @remarks The @a array should be released using free().
+ * @param[in] id             Resource monitor id
+ * @param[in] resource_id    Resource id
+ * @param[in] attr_id        Resource attribute id
+ * @param[out] array         Array retrieved from resource attribute
+ * @param[out] length        Length of array
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER            Invalid Parameter
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
+ */
+int resource_monitor_get_array_int(int id, int resource_id, u_int64_t attr_id, int32_t **array, int *length);
+
+/**
+ * @brief Gets the int64 array of resource attribute.
+ * @since_tizen 7.0
+ * @remarks The @a array should be released using free().
+ * @param[in] id             Resource monitor id
+ * @param[in] resource_id    Resource id
+ * @param[in] attr_id        Resource attribute id
+ * @param[out] array         Array retrieved from resource attribute
+ * @param[out] length        Length of array
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER            Invalid Parameter
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
+ */
+int resource_monitor_get_array_int64(int id, int resource_id, u_int64_t attr_id, int64_t **array, int *length);
+
+/**
+ * @brief Gets the uint array of resource attribute.
+ * @since_tizen 7.0
+ * @remarks The @a array should be released using free().
+ * @param[in] id             Resource monitor id
+ * @param[in] resource_id    Resource id
+ * @param[in] attr_id        Resource attribute id
+ * @param[out] array         Array retrieved from resource attribute
+ * @param[out] length        Length of array
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER            Invalid Parameter
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
+ */
+int resource_monitor_get_array_uint(int id, int resource_id, u_int64_t attr_id, u_int32_t **array, int *length);
+
+/**
+ * @brief Gets the uint64 array of resource attribute.
+ * @since_tizen 7.0
+ * @remarks The @a array should be released using free().
+ * @param[in] id             Resource monitor id
+ * @param[in] resource_id    Resource id
+ * @param[in] attr_id        Resource attribute id
+ * @param[out] array         Array retrieved from resource attribute
+ * @param[out] length        Length of array
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER            Invalid Parameter
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
+ */
+int resource_monitor_get_array_uint64(int id, int resource_id, u_int64_t attr_id, u_int64_t **array, int *length);
+
+/**
+ * @brief Gets the double array of resource attribute.
+ * @since_tizen 7.0
+ * @remarks The @a array should be released using free().
+ * @param[in] id             Resource monitor id
+ * @param[in] resource_id    Resource id
+ * @param[in] attr_id        Resource attribute id
+ * @param[out] array         Array retrieved from resource attribute
+ * @param[out] length        Length of array
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER            Invalid Parameter
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
+ */
+int resource_monitor_get_array_double(int id, int resource_id, u_int64_t attr_id, double **array, int *length);
+
+/**
+ * @brief Gets the string array of resource attribute.
+ * @since_tizen 7.0
+ * @remarks The @a array should be released using free().
+ * @param[in] id             Resource monitor id
+ * @param[in] resource_id    Resource id
+ * @param[in] attr_id        Resource attribute id
+ * @param[out] array         Array retrieved from resource attribute
+ * @param[out] length        Length of array
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #RESOURCE_MONITOR_ERROR_NONE                         Successful
+ * @retval #RESOURCE_MONITOR_ERROR_NOT_SUPPORTED                Not Supported
+ * @retval #RESOURCE_MONITOR_ERROR_INVALID_PARAMETER            Invalid Parameter
+ * @retval #RESOURCE_MONITOR_ERROR_NO_DATA                      Empty Data
+ * @retval #RESOURCE_MONITOR_ERROR_OUT_OF_MEMORY                Out of Memory
+ */
+int resource_monitor_get_array_string(int id, int resource_id, u_int64_t attr_id, char ***array, int *length);
 
 /**
  * @}
@@ -322,4 +574,4 @@ int resource_monitor_get_array_string(int id, int res_id, u_int64_t attr, char *
 }
 #endif
 
-#endif /* __resource_SYSTEM_RESOURCE_MONITOR_H__ */
+#endif /* __TIZEN_SYSTEM_MONITOR_RESOURCE_MONITOR_H__ */
index 043e3e526a4bf1f333492f144153784a0dfd1f60..73b20b01ca3f7d2fd50df7642b975c7208106792 100644 (file)
@@ -62,9 +62,9 @@ int resource_monitor_unset_resource_attr(int id, int resource_id, u_int64_t attr
        return pass_resource_monitor_unset_resource_attr(id, resource_id, attr_mask);
 }
 
-bool resource_monitor_is_resource_attr_supported(int id, int resource_id, u_int64_t attr_id)
+int resource_monitor_is_resource_attr_supported(int id, int resource_id, u_int64_t attr_id, bool *supported)
 {
-       return pass_resource_monitor_is_resource_attr_supported(id, resource_id, attr_id);
+       return pass_resource_monitor_is_resource_attr_supported(id, resource_id, attr_id, supported);
 }
 
 int resource_monitor_update(int id)
@@ -77,62 +77,62 @@ int resource_monitor_update_resource(int id, int resource_id)
        return resource_monitor_update_resource(id, resource_id);
 }
 
-int resource_monitor_get_value_int(int id, int resource_id, u_int64_t attr, int32_t *value)
+int resource_monitor_get_value_int(int id, int resource_id, u_int64_t attr_id, int32_t *value)
 {
-       return pass_resource_monitor_get_value_int(id, resource_id, attr, value);
+       return pass_resource_monitor_get_value_int(id, resource_id, attr_id, value);
 }
 
-int resource_monitor_get_value_int64(int id, int resource_id, u_int64_t attr, int64_t *value)
+int resource_monitor_get_value_int64(int id, int resource_id, u_int64_t attr_id, int64_t *value)
 {
-       return pass_resource_monitor_get_value_int64(id, resource_id, attr, value);
+       return pass_resource_monitor_get_value_int64(id, resource_id, attr_id, value);
 }
 
-int resource_monitor_get_value_uint(int id, int resource_id, u_int64_t attr, u_int32_t *value)
+int resource_monitor_get_value_uint(int id, int resource_id, u_int64_t attr_id, u_int32_t *value)
 {
-       return pass_resource_monitor_get_value_uint(id, resource_id, attr, value);
+       return pass_resource_monitor_get_value_uint(id, resource_id, attr_id, value);
 }
 
-int resource_monitor_get_value_uint64(int id, int resource_id, u_int64_t attr, u_int64_t *value)
+int resource_monitor_get_value_uint64(int id, int resource_id, u_int64_t attr_id, u_int64_t *value)
 {
-       return pass_resource_monitor_get_value_uint64(id, resource_id, attr, value);
+       return pass_resource_monitor_get_value_uint64(id, resource_id, attr_id, value);
 }
 
-int resource_monitor_get_value_double(int id, int resource_id, u_int64_t attr, double *value)
+int resource_monitor_get_value_double(int id, int resource_id, u_int64_t attr_id, double *value)
 {
-       return pass_resource_monitor_get_value_double(id, resource_id, attr, value);
+       return pass_resource_monitor_get_value_double(id, resource_id, attr_id, value);
 }
 
-int resource_monitor_get_value_string(int id, int resource_id, u_int64_t attr, char **value)
+int resource_monitor_get_value_string(int id, int resource_id, u_int64_t attr_id, char **value)
 {
-       return pass_resource_monitor_get_value_string(id, resource_id, attr, value);
+       return pass_resource_monitor_get_value_string(id, resource_id, attr_id, value);
 }
 
-int resource_monitor_get_array_int(int id, int res_id, u_int64_t attr, int32_t **array, int *length)
+int resource_monitor_get_array_int(int id, int resource_id, u_int64_t attr_id, int32_t **array, int *length)
 {
-       return pass_resource_monitor_get_array_int(id, res_id, attr, array, length);
+       return pass_resource_monitor_get_array_int(id, resource_id, attr_id, array, length);
 }
 
-int resource_monitor_get_array_int64(int id, int res_id, u_int64_t attr, int64_t **array, int *length)
+int resource_monitor_get_array_int64(int id, int resource_id, u_int64_t attr_id, int64_t **array, int *length)
 {
-       return pass_resource_monitor_get_array_int64(id, res_id, attr, array, length);
+       return pass_resource_monitor_get_array_int64(id, resource_id, attr_id, array, length);
 }
 
-int resource_monitor_get_array_uint(int id, int res_id, u_int64_t attr, u_int32_t **array, int *length)
+int resource_monitor_get_array_uint(int id, int resource_id, u_int64_t attr_id, u_int32_t **array, int *length)
 {
-       return pass_resource_monitor_get_array_uint(id, res_id, attr, array, length);
+       return pass_resource_monitor_get_array_uint(id, resource_id, attr_id, array, length);
 }
 
-int resource_monitor_get_array_uint64(int id, int res_id, u_int64_t attr, u_int64_t **array, int *length)
+int resource_monitor_get_array_uint64(int id, int resource_id, u_int64_t attr_id, u_int64_t **array, int *length)
 {
-       return pass_resource_monitor_get_array_uint64(id, res_id, attr, array, length);
+       return pass_resource_monitor_get_array_uint64(id, resource_id, attr_id, array, length);
 }
 
-int resource_monitor_get_array_double(int id, int res_id, u_int64_t attr, double **array, int *length)
+int resource_monitor_get_array_double(int id, int resource_id, u_int64_t attr_id, double **array, int *length)
 {
-       return pass_resource_monitor_get_array_double(id, res_id, attr, array, length);
+       return pass_resource_monitor_get_array_double(id, resource_id, attr_id, array, length);
 }
 
-int resource_monitor_get_array_string(int id, int res_id, u_int64_t attr, char ***array, int *length)
+int resource_monitor_get_array_string(int id, int resource_id, u_int64_t attr_id, char ***array, int *length)
 {
-       return pass_resource_monitor_get_array_string(id, res_id, attr, array, length);
+       return pass_resource_monitor_get_array_string(id, resource_id, attr_id, array, length);
 }
index bed0b967584e4d7d837256c7b845608e38dad506..7a3f6539729a64df702aff324b87e78bd8df5773 100644 (file)
@@ -219,7 +219,8 @@ struct __resource_type {
 
 static inline void create_resource_and_set_attrs(struct resource_data *res, int ctrl_val)
 {
-       int i;
+       int i, ret;
+       bool supported;
 
        if (!res)
                return;
@@ -231,8 +232,13 @@ static inline void create_resource_and_set_attrs(struct resource_data *res, int
                                res->mon_id, res->res_id, res->ctrl_id, ctrl_val);
 
        for (i = 0; i < res->num_attrs; i++) {
-               if (resource_monitor_is_resource_attr_supported(
-                               res->mon_id, res->res_id, res->attrs[i].id))
+               ret = resource_monitor_is_resource_attr_supported(
+                               res->mon_id, res->res_id, res->attrs[i].id,
+                               &supported);
+               if (ret < 0)
+                       continue;
+
+               if (supported)
                        res->mask |= res->attrs[i].id;
        }
 
@@ -298,9 +304,17 @@ static inline void get_resource_attr_value(struct resource_data *res, int i)
        bool supported;
        int ret = 0;
 
-       supported = resource_monitor_is_resource_attr_supported(
+       ret = resource_monitor_is_resource_attr_supported(
                                                res->mon_id, res->res_id,
-                                               res->attrs[i].id);
+                                               res->attrs[i].id,
+                                               &supported);
+
+       if (ret < 0) {
+               printf("%40s | %-5s | %s", "Not Implemented",
+                               res->attrs[i].unit, res->attrs[i].desc);
+               return;
+       }
+
        if (!supported) {
                printf("%40s | %-5s | %s", "Not Supported",
                                res->attrs[i].unit, res->attrs[i].desc);