From: Jiyoung Yun Date: Mon, 13 Apr 2015 02:30:47 +0000 (+0900) Subject: capi-system-device: Remove deviced dependency X-Git-Tag: submit/tizen/20150413.081634^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c96f417c851c4aed5bf742ceb0eafc6dd548c6f5;p=platform%2Fcore%2Fapi%2Fdevice.git capi-system-device: Remove deviced dependency The capi-system-device can invoke dbus method without deviced dependency. Some function of device header file is deprecated. Change-Id: If0da743246ea30e87bfddf1604d04790c7f61d7a Signed-off-by: Jiyoung Yun --- diff --git a/CMakeLists.txt b/CMakeLists.txt index acefee1..974e587 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(INC_DIR include) INCLUDE_DIRECTORIES(${INC_DIR}) -SET(dependents "deviced dlog vconf dbus-1 dbus-glib-1 capi-base-common capi-system-info") +SET(dependents "dlog vconf dbus-1 dbus-glib-1 capi-base-common capi-system-info") SET(pc_dependents "capi-base-common") INCLUDE(FindPkgConfig) diff --git a/packaging/capi-system-device.spec b/packaging/capi-system-device.spec index 895b1ef..52e176e 100644 --- a/packaging/capi-system-device.spec +++ b/packaging/capi-system-device.spec @@ -7,7 +7,6 @@ License: Apache-2.0 Source0: %{name}-%{version}.tar.gz Source1: capi-system-device.manifest BuildRequires: cmake -BuildRequires: pkgconfig(deviced) BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(dlog) diff --git a/src/device.c b/src/device.c index 4fdb11e..a58f2d1 100644 --- a/src/device.c +++ b/src/device.c @@ -18,8 +18,6 @@ #include #include #include -#include -#include #include #include "device.h" @@ -36,127 +34,34 @@ int device_get_display_numbers(int* device_number) { - if(device_number == NULL) - return DEVICE_ERROR_INVALID_PARAMETER; - - *device_number = display_get_count(); - CHECK_ERR(*device_number); - - return DEVICE_ERROR_NONE; + return device_display_get_numbers(device_number); } int device_get_brightness(int disp_idx, int* value) { - int val, max_id, ret; - - if(value == NULL) - return DEVICE_ERROR_INVALID_PARAMETER; - - ret = device_get_display_numbers(&max_id); - if (ret != DEVICE_ERROR_NONE) - return ret; - - if(disp_idx < 0 || disp_idx >= max_id) - return DEVICE_ERROR_INVALID_PARAMETER; - - val = display_get_brightness(); - CHECK_ERR(val); - - *value = val; - return DEVICE_ERROR_NONE; + return device_display_get_brightness(disp_idx, value); } int device_set_brightness(int disp_idx, int new_value) { - int max_value, val, max_id, ret; - - if(new_value < 0) - return DEVICE_ERROR_INVALID_PARAMETER; - - ret = device_get_display_numbers(&max_id); - if (ret != DEVICE_ERROR_NONE) - return ret; - - if(disp_idx < 0 || disp_idx >= max_id) - return DEVICE_ERROR_INVALID_PARAMETER; - - ret = device_get_max_brightness(disp_idx, &max_value); - if (ret != DEVICE_ERROR_NONE) - return ret; - - if(new_value > max_value) - return DEVICE_ERROR_INVALID_PARAMETER; - - val = display_set_brightness(new_value); - CHECK_ERR(val); - - return DEVICE_ERROR_NONE; + _E("Deprecated api."); + return DEVICE_ERROR_NOT_SUPPORTED; } int device_get_max_brightness(int disp_idx, int* max_value) { - int val, max_id, ret; - - if(max_value == NULL) - return DEVICE_ERROR_INVALID_PARAMETER; - - ret = device_get_display_numbers(&max_id); - _E("max id : %d", max_id); - if (ret != DEVICE_ERROR_NONE) - return ret; - - if(disp_idx < 0 || disp_idx >= max_id) - return DEVICE_ERROR_INVALID_PARAMETER; - - val = display_get_max_brightness(); - CHECK_ERR(val); - - *max_value = val; - return DEVICE_ERROR_NONE; + return device_display_get_max_brightness(disp_idx, max_value); } int device_set_brightness_from_settings(int disp_idx) { - int max_id, val, ret; - - ret = device_get_display_numbers(&max_id); - if (ret != DEVICE_ERROR_NONE) - return ret; - - if(disp_idx < 0 || disp_idx >= max_id) - return DEVICE_ERROR_INVALID_PARAMETER; - - val = display_release_brightness(); - CHECK_ERR(val); - - return DEVICE_ERROR_NONE; + _E("Deprecated api."); + return DEVICE_ERROR_NOT_SUPPORTED; } int device_set_brightness_to_settings(int disp_idx, int new_value) { - int max_value, val, max_id, ret; - - if(new_value < 0) - return DEVICE_ERROR_INVALID_PARAMETER; - - ret = device_get_display_numbers(&max_id); - if (ret != DEVICE_ERROR_NONE) - return ret; - - if(disp_idx < 0 || disp_idx >= max_id) - return DEVICE_ERROR_INVALID_PARAMETER; - - ret = device_get_max_brightness(disp_idx, &max_value); - if (ret != DEVICE_ERROR_NONE) - return ret; - - if(new_value > max_value) - return DEVICE_ERROR_INVALID_PARAMETER; - - val = display_set_brightness_with_setting(new_value); - CHECK_ERR(val); - - return DEVICE_ERROR_NONE; + return device_display_set_brightness(disp_idx, new_value); } int device_battery_get_detail(int *percent) @@ -167,13 +72,20 @@ int device_battery_get_detail(int *percent) int device_battery_is_full(bool* full) { + device_battery_level_e status; + int ret; + if (full == NULL) return DEVICE_ERROR_INVALID_PARAMETER; - int f = battery_is_full(); - CHECK_ERR(f); + ret = device_battery_get_level_status(&status); + CHECK_ERR(ret); + + if (status == DEVICE_BATTERY_LEVEL_FULL) + *full = true; + else + *full = false; - *full = (f == 1) ? true : false; return DEVICE_ERROR_NONE; }