Define a macro checking feature support
[platform/core/api/runtime-info.git] / include / runtime_info_private.h
index 17f6c28..c5f86f1 100644 (file)
@@ -18,6 +18,7 @@
 #ifndef __TIZEN_SYSTEM_RUNTIME_INFO_PRIVATE_H__
 #define __TIZEN_SYSTEM_RUNTIME_INFO_PRIVATE_H__
 
+#include <system_info.h>
 #include <vconf.h>
 
 #ifdef __cplusplus
@@ -40,6 +41,15 @@ extern "C"
 
 #define RUNTIME_INFO_INTERNAL_KEY_WIFI_STATUS  1
 
+#define RETURN_ERROR_IF_NOT_SUPPORTED(feature) \
+{      \
+       bool _supported;        \
+       if (system_info_get_platform_bool(feature, &_supported) != SYSTEM_INFO_ERROR_NONE) \
+               return RUNTIME_INFO_ERROR_IO_ERROR;     \
+       if (!_supported)        \
+               return RUNTIME_INFO_ERROR_NOT_SUPPORTED;        \
+}
+
 typedef enum {
        RUNTIME_INFO_DATA_TYPE_STRING,
        RUNTIME_INFO_DATA_TYPE_INT,