From: Nam KwanWoo Date: Fri, 12 Apr 2013 08:59:03 +0000 (+0900) Subject: add new key SYSTEM_INFO_KEY_AUTO_ROTATION_SUPPORTED X-Git-Tag: 2.1b_release~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b62fa008ca8feff2a180f3b5a53fdc3facc48e4d;p=platform%2Fcore%2Fapi%2Fsystem-info.git add new key SYSTEM_INFO_KEY_AUTO_ROTATION_SUPPORTED Change-Id: If44257651bb8d708fd0b89bdfc669ce41dcdbeaa --- diff --git a/include/system_info.h b/include/system_info.h index 09a2311..cbb2743 100644 --- a/include/system_info.h +++ b/include/system_info.h @@ -102,6 +102,7 @@ typedef enum { SYSTEM_INFO_KEY_TETHERING_SUPPORTED, /**< Indicates whether the device supports tethering */ SYSTEM_INFO_KEY_SPEECH_SYNTHESIS_SUPPORTED, /**< Indicates whether the device supports tts */ SYSTEM_INFO_KEY_GRAPHICS_HWACCEL_SUPPORTED, /**< Indicates whether the device supports graphics hardware acceleration */ + SYSTEM_INFO_KEY_FEATURE_AUTO_ROTATION_SUPPORTED, /**< Indicates whether the device supports native auto rotation feature */ } system_info_key_e; /** diff --git a/include/system_info_private.h b/include/system_info_private.h index 274a6e1..61e897e 100644 --- a/include/system_info_private.h +++ b/include/system_info_private.h @@ -119,6 +119,7 @@ int system_info_get_cbs_supported(system_info_key_e key, system_info_data_type_e int system_info_get_tethering_supported(system_info_key_e key, system_info_data_type_e data_type, void **value); int system_info_get_nfc_reserved_push_supported(system_info_key_e key, system_info_data_type_e data_type, void **value); int system_info_get_graphics_hwaccel_supported(system_info_key_e key, system_info_data_type_e data_type, void **value); +int system_info_get_feature_auto_rotation_supported(system_info_key_e key, system_info_data_type_e data_type, void **value); int system_info_get_value_from_xml(char *xml_file_path, char *model, char *id_field, char **value); #ifdef __cplusplus diff --git a/packaging/capi-system-info.spec b/packaging/capi-system-info.spec index 1fdee56..0ac7c66 100644 --- a/packaging/capi-system-info.spec +++ b/packaging/capi-system-info.spec @@ -1,7 +1,7 @@ #sbs-git:slp/api/system-info capi-system-info 0.1.0 63d15bafa590ee9de869c8a8ade712e06828e5c3 Name: capi-system-info Summary: A System Information library in SLP C API -Version: 0.1.12 +Version: 0.1.13 Release: 0 Group: System/Libraries License: Apache License, Version 2.0 and IEFT RFC Collection diff --git a/src/system_info.c b/src/system_info.c index b6a88d1..084ea96 100644 --- a/src/system_info.c +++ b/src/system_info.c @@ -452,6 +452,13 @@ system_info_s system_info_table[] = { }, { + /**< Indicates whether the device supports auto rotation feature */ + SYSTEM_INFO_KEY_FEATURE_AUTO_ROTATION_SUPPORTED, + SYSTEM_INFO_DATA_TYPE_BOOL, + system_info_get_feature_auto_rotation_supported +}, + +{ SYSTEM_INFO_MAX, -1, NULL } diff --git a/src/system_info_platform.c b/src/system_info_platform.c index 656ef4c..67eed39 100644 --- a/src/system_info_platform.c +++ b/src/system_info_platform.c @@ -50,6 +50,7 @@ #define MESSAGE_INFO_FILE_PATH "/etc/config/sysinfo-message.xml" #define GRAPHICS_INFO_FILE_PATH "/etc/config/graphics/sysinfo-graphics.xml" +#define SCREEN_INFO_FILE_PATH "/etc/config/screen/sysinfo-screen.xml" int system_info_get_value_from_xml(char *xml_file_path, char *model, char *id_field, char **value) { @@ -769,3 +770,32 @@ int system_info_get_graphics_hwaccel_supported(system_info_key_e key, system_inf return SYSTEM_INFO_ERROR_NONE; } + +int system_info_get_feature_auto_rotation_supported(system_info_key_e key, system_info_data_type_e data_type, void **value) + +{ + bool *supported; + char *string = NULL; + char *model = "default"; + + supported = (bool *)value; + + if (access(SCREEN_INFO_FILE_PATH, R_OK)) { + *supported = false; + return SYSTEM_INFO_ERROR_NONE; + } + + if (system_info_get_value_from_xml(SCREEN_INFO_FILE_PATH, model, "auto-rotation-support", &string)) { + LOGE("cannot get auto-rotation-support info from %s!!!", SCREEN_INFO_FILE_PATH); + return SYSTEM_INFO_ERROR_IO_ERROR; + } + + if (!strcmp(string, "true") || !strcmp(string, "TRUE")) + *supported = true; + else + *supported = false; + + free(string); + + return SYSTEM_INFO_ERROR_NONE; +}