From a90df333abb23dfc167fd1a39785609cdf443e2d Mon Sep 17 00:00:00 2001 From: lokilee73 Date: Wed, 17 Feb 2021 18:03:30 +0900 Subject: [PATCH] Change function name and location ex) 1. function name is_display_state_supported -> is_feature_display_state_supported is_display_supported -> is_feature_display_supported 2. location common.c -> display.c Change-Id: I0fc050b244858e4d3b3ffcc02b6455af51cdecfa Signed-off-by: lokilee73 --- include/display-internal.h | 18 ++++++++++++++ src/callback.c | 4 +-- src/common.c | 42 ------------------------------- src/common.h | 2 -- src/display.c | 62 +++++++++++++++++++++++++++++++++++++++------- src/power.c | 2 +- 6 files changed, 74 insertions(+), 56 deletions(-) diff --git a/include/display-internal.h b/include/display-internal.h index 2ad3811..b8574bc 100644 --- a/include/display-internal.h +++ b/include/display-internal.h @@ -118,6 +118,24 @@ int device_display_set_brightness_state(int display_index, display_state_e state * @see device_display_change_state_by_reason() */ int device_display_change_state_by_reason(display_state_e type, const char *reason, int timeout, dbus_pending_cb cb); + +/** + * @platform + * @brief Check display feature(http://tizen.org/feature/display) + * @since_tizen 6.5 + * @return @c 1 if it is supported, + * otherwise 0 + */ +int is_feature_display_supported(void); + +/** + * @platform + * @brief Check display state feature(http://tizen.org/feature/display.state) + * @since_tizen 6.5 + * @return @c 1 if it is supported, + * otherwise 0 + */ +int is_feature_display_state_supported(void); #ifdef __cplusplus } #endif diff --git a/src/callback.c b/src/callback.c index d2adebb..e8006d0 100644 --- a/src/callback.c +++ b/src/callback.c @@ -292,7 +292,7 @@ int device_add_callback(device_callback_e type, device_changed_cb cb, void *data GList *elem, *elem_next; int ret, n; - if (!is_display_supported() && type == DEVICE_CALLBACK_DISPLAY_STATE) + if (!is_feature_display_supported() && type == DEVICE_CALLBACK_DISPLAY_STATE) return DEVICE_ERROR_NOT_SUPPORTED; if (type < 0 || type >= DEVICE_CALLBACK_MAX) @@ -334,7 +334,7 @@ int device_remove_callback(device_callback_e type, device_changed_cb cb) GList *elem, *elem_next; int ret, n; - if (!is_display_supported() && type == DEVICE_CALLBACK_DISPLAY_STATE) + if (!is_feature_display_supported() && type == DEVICE_CALLBACK_DISPLAY_STATE) return DEVICE_ERROR_NOT_SUPPORTED; if (type < 0 || type >= DEVICE_CALLBACK_MAX) diff --git a/src/common.c b/src/common.c index a35a612..8545e10 100644 --- a/src/common.c +++ b/src/common.c @@ -24,8 +24,6 @@ #define MODEL_NAME "http://tizen.org/system/model_name" #define MODEL_EMULATOR "Emulator" -#define DISPLAY_FEATURE "http://tizen.org/feature/display" -#define DISPLAY_STATE_FEATURE "http://tizen.org/feature/display.state" tizen_profile_t _get_tizen_profile() { @@ -128,43 +126,3 @@ bool is_emulator(void) return emul; } //LCOV_EXCL_STOP - -int is_display_supported(void) -{ - int ret; - bool display_avail; - - ret = system_info_get_platform_bool(DISPLAY_FEATURE, &display_avail); - if (ret < 0) { -//LCOV_EXCL_START System Error - _E("Failed to get value of display feature"); - return false; -//LCOV_EXCL_STOP - } else if (ret == 0 && !display_avail) { -//LCOV_EXCL_START System Error - _D("Display feature is not supported"); - return false; -//LCOV_EXCL_STOP - } else - return true; -} - -int is_display_state_supported(void) -{ - int ret; - bool display_state_avail; - - ret = system_info_get_platform_bool(DISPLAY_STATE_FEATURE, &display_state_avail); - if (ret < 0) { -//LCOV_EXCL_START System Error - _E("Failed to get value of display state feature"); - return false; -//LCOV_EXCL_STOP - } else if (ret == 0 && !display_state_avail) { -//LCOV_EXCL_START System Error - _D("Display state feature is not supported"); - return false; -//LCOV_EXCL_STOP - } else - return true; -} diff --git a/src/common.h b/src/common.h index 5008b7f..90fc373 100644 --- a/src/common.h +++ b/src/common.h @@ -69,6 +69,4 @@ int check_async_call_rate(long *num_calls); #define TIZEN_FEATURE_TRACKER (_get_tizen_profile() == TIZEN_PROFILE_TV) bool is_emulator(void); -int is_display_state_supported(void); -int is_display_supported(void); #endif /* __COMMON_H__ */ diff --git a/src/display.c b/src/display.c index ca776b6..2305f45 100644 --- a/src/display.c +++ b/src/display.c @@ -19,11 +19,15 @@ #include #include #include +#include #include "display.h" #include "display-internal.h" #include "common.h" +#define DISPLAY_FEATURE "http://tizen.org/feature/display" +#define DISPLAY_STATE_FEATURE "http://tizen.org/feature/display.state" + #define METHOD_GET_DISPLAY_COUNT "GetDisplayCount" #define METHOD_GET_MAX_BRIGHTNESS "GetMaxBrightness" #define METHOD_GET_BRIGHTNESS "GetBrightness" @@ -64,7 +68,7 @@ int device_display_get_numbers(int *device_number) { int ret; - ret = is_display_supported(); + ret = is_feature_display_supported(); if (!ret) return DEVICE_ERROR_NOT_SUPPORTED; @@ -91,7 +95,7 @@ int device_display_get_max_brightness(int display_index, int *max_brightness) { int ret; - ret = is_display_supported(); + ret = is_feature_display_supported(); if (!ret) return DEVICE_ERROR_NOT_SUPPORTED; @@ -127,7 +131,7 @@ int device_display_get_brightness(int display_index, int *brightness) { int ret; - ret = is_display_supported(); + ret = is_feature_display_supported(); if (!ret) return DEVICE_ERROR_NOT_SUPPORTED; @@ -157,7 +161,7 @@ int device_display_set_brightness(int display_index, int brightness) { int ret, max; - ret = is_display_supported(); + ret = is_feature_display_supported(); if (!ret) return DEVICE_ERROR_NOT_SUPPORTED; @@ -189,7 +193,7 @@ int device_display_get_state(display_state_e *state) { int ret, val; - ret = is_display_supported(); + ret = is_feature_display_supported(); if (!ret) return DEVICE_ERROR_NOT_SUPPORTED; @@ -249,7 +253,7 @@ int device_display_change_state(display_state_e state) static int privilege = -1; static long num_calls = 0; - ret = is_display_state_supported(); + ret = is_feature_display_state_supported(); if (!ret) return DEVICE_ERROR_NOT_SUPPORTED; @@ -295,7 +299,7 @@ int device_display_get_max_brightness_state(int display_index, display_state_e s { int ret; - ret = is_display_supported(); + ret = is_feature_display_supported(); if (!ret) return DEVICE_ERROR_NOT_SUPPORTED; @@ -340,7 +344,7 @@ int device_display_get_brightness_state(int display_index, display_state_e state { int ret; - ret = is_display_supported(); + ret = is_feature_display_supported(); if (!ret) return DEVICE_ERROR_NOT_SUPPORTED; @@ -376,7 +380,7 @@ int device_display_set_brightness_state(int display_index, display_state_e state { int ret, max; - ret = is_display_supported(); + ret = is_feature_display_supported(); if (!ret) return DEVICE_ERROR_NOT_SUPPORTED; @@ -431,3 +435,43 @@ int device_display_change_state_by_reason(display_state_e type, const char *reas return errno_to_device_error(ret); } //LCOV_EXCL_STOP + +int is_feature_display_supported(void) +{ + int ret; + bool display_avail; + + ret = system_info_get_platform_bool(DISPLAY_FEATURE, &display_avail); + if (ret < 0) { +//LCOV_EXCL_START System Error + _E("Failed to get value of display feature"); + return false; +//LCOV_EXCL_STOP + } else if (ret == 0 && !display_avail) { +//LCOV_EXCL_START System Error + _D("Display feature is not supported"); + return false; +//LCOV_EXCL_STOP + } else + return true; +} + +int is_feature_display_state_supported(void) +{ + int ret; + bool display_state_avail; + + ret = system_info_get_platform_bool(DISPLAY_STATE_FEATURE, &display_state_avail); + if (ret < 0) { +//LCOV_EXCL_START System Error + _E("Failed to get value of display state feature"); + return false; +//LCOV_EXCL_STOP + } else if (ret == 0 && !display_state_avail) { +//LCOV_EXCL_START System Error + _D("Display state feature is not supported"); + return false; +//LCOV_EXCL_STOP + } else + return true; +} diff --git a/src/power.c b/src/power.c index 5999d12..d47041b 100644 --- a/src/power.c +++ b/src/power.c @@ -508,7 +508,7 @@ int device_power_wakeup(bool dim) { int ret; - ret = is_display_state_supported(); + ret = is_feature_display_state_supported(); if (!ret) return DEVICE_ERROR_NOT_SUPPORTED; -- 2.7.4