From 4b65ed91091192f3a83d8d8cead147aeeed52ce9 Mon Sep 17 00:00:00 2001 From: Hyotaek Shim Date: Tue, 5 Jan 2021 12:59:45 +0900 Subject: [PATCH] Remove internal header files Change-Id: I840dac267e916fa103e11d135b910d8e7aee6b0b Signed-off-by: Hyotaek Shim --- include/hal-battery-internal.h | 91 ------------------- include/hal-battery.h | 15 +++ include/hal-display-internal.h | 126 -------------------------- include/hal-led-internal.h | 72 --------------- include/hal-touchscreen-internal.h | 10 -- src/battery.c | 107 +++++++++++----------- src/display.c | 1 - src/led.c | 1 - src/{touchscreen-internal.c => touchscreen.c} | 1 - 9 files changed, 68 insertions(+), 356 deletions(-) delete mode 100644 include/hal-battery-internal.h delete mode 100644 include/hal-display-internal.h delete mode 100644 include/hal-led-internal.h delete mode 100644 include/hal-touchscreen-internal.h rename src/{touchscreen-internal.c => touchscreen.c} (97%) diff --git a/include/hal-battery-internal.h b/include/hal-battery-internal.h deleted file mode 100644 index 19b8768..0000000 --- a/include/hal-battery-internal.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef __TIZEN_SYSTEM_BATTERY_INTERNAL_H__ -#define __TIZEN_SYSTEM_BATTERY_INTERNAL_H__ - - -#include -#include "device-error.h" - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * @addtogroup CAPI_SYSTEM_DEVICE_BATTERY_MODULE - * @{ - */ -#define BATTERY_INFO_MAX 32 - -struct device_battery_info { - char status[BATTERY_INFO_MAX]; - char health[BATTERY_INFO_MAX]; - char power_source[BATTERY_INFO_MAX]; - int online; - int present; - int capacity; - int current_now; - int current_average; - int voltage_now; - int voltage_average; - int temperature; -}; - -/** - * @brief Gets the battery status.. - * @since_tizen 6.0 - * @param[out] info battery status information.\n - * The current_average is INT_MAX if battery hw does not provide current average.\n - * The voltage_average is INT_MAX if battery hw does not provide voltage average. - * @return @c 0 on success, - * otherwise a negative error value - * @retval #DEVICE_ERROR_NONE Successful - * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed - * @retval #DEVICE_ERROR_NOT_SUPPORTED Not supported device - */ -int device_battery_get_info(struct device_battery_info *info); - -/** - * @brief Gets the battery status.. - * @since_tizen 6.0 - * @param[out] info battery status information.\n - * The current_average is INT_MAX if battery hw does not provide current average.\n - * The voltage_average is INT_MAX if battery hw does not provide voltage average. - * @return @c 0 on success, - * otherwise a negative error value - * @retval #DEVICE_ERROR_NONE Successful - * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed - * @retval #DEVICE_ERROR_NOT_SUPPORTED Not supported device - */ -int device_battery_get_info_direct(struct device_battery_info *info); - -/** - * @} - */ - - -#ifdef __cplusplus -} -#endif - - -#endif // __TIZEN_SYSTEM_BATTERY_H__ diff --git a/include/hal-battery.h b/include/hal-battery.h index f28f8ee..e706f4f 100644 --- a/include/hal-battery.h +++ b/include/hal-battery.h @@ -27,6 +27,7 @@ extern "C" { #endif +#define BATTERY_INFO_MAX 32 /** * @addtogroup CAPI_SYSTEM_DEVICE_BATTERY_MODULE @@ -98,6 +99,20 @@ typedef enum { } device_battery_status_e; +struct device_battery_info { + char status[BATTERY_INFO_MAX]; + char health[BATTERY_INFO_MAX]; + char power_source[BATTERY_INFO_MAX]; + int online; + int present; + int capacity; + int current_now; + int current_average; + int voltage_now; + int voltage_average; + int temperature; +}; + /** * @brief Gets the battery charge percentage. * @details It returns an integer value from @c 0 to @c 100 that indicates remaining battery charge diff --git a/include/hal-display-internal.h b/include/hal-display-internal.h deleted file mode 100644 index e9bf055..0000000 --- a/include/hal-display-internal.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef __TIZEN_SYSTEM_DISPLAY_INTERNAL_H__ -#define __TIZEN_SYSTEM_DISPLAY_INTERNAL_H__ - - -#include -#include - -#include "device-error.h" -#include "hal-display-enum.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Gets the display brightness value. - * @since_tizen @if MOBILE 5.0 @elseif WEARABLE 5.0 @endif - * @privlevel public - * @privilege %http://tizen.org/privilege/display - * @param[in] display_index The index of the display \n - * It can be greater than or equal to @c 0 and less than the number of displays returned by device_display_get_numbers(). \n - * The index zero is always assigned to the main display - * @param[out] brightness The current brightness value of the display - * @param[in] state The enum value of the display state \n - * @return @c 0 on success, - * otherwise a negative error value - * @retval #DEVICE_ERROR_NONE Successful - * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DEVICE_ERROR_PERMISSION_DENIED Permission denied - * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed - * @see device_display_get_numbers() - * @see device_display_set_brightness_state() - * @see device_display_get_max_brightness_state() - */ -int device_display_get_brightness_state(int display_index, display_state_e state, int *brightness); - - -/** - * @brief Gets the maximum brightness value that can be set. - * @since_tizen @if MOBILE 5.0 @elseif WEARABLE 5.0 @endif - * @privlevel public - * @privilege %http://tizen.org/privilege/display - * @param[in] display_index The index of the display \n - * It can be greater than or equal to @c 0 and less than the number of displays returned by device_display_get_numbers(). \n - * The index zero is always assigned to the main display - * @param[out] max_brightness The maximum brightness value of the display - * @param[in] state The enum value of the display state \n - * @return @c 0 on success, - * otherwise a negative error value - * @retval #DEVICE_ERROR_NONE Successful - * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DEVICE_ERROR_PERMISSION_DENIED Permission denied - * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed - * @see device_display_get_numbers() - * @see device_display_get_brightness_state() - * @see device_display_set_brightness_state() - */ -int device_display_get_max_brightness_state(int display_index, display_state_e state, int *brightness); - - -/** - * @brief Sets the display brightness value. - * @since_tizen @if MOBILE 5.0 @elseif WEARABLE 5.0 @endif - * @privlevel public - * @privilege %http://tizen.org/privilege/display - * @param[in] display_index The index of the display \n - * It can be greater than or equal to @c 0 and less than the number of displays returned by device_display_get_numbers(). \n - * The index zero is always assigned to the main display - * @param[in] brightness The new brightness value to set \n - * The maximum value can be represented by device_display_get_max_brightness_state() - * @param[in] state The enum value of the display state \n - * @return @c 0 on success, - * otherwise a negative error value - * @retval #DEVICE_ERROR_NONE Successful - * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DEVICE_ERROR_PERMISSION_DENIED Permission denied - * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed - * @see device_display_get_numbers() - * @see device_display_get_max_brightness() - * @see device_display_set_brightness_state() - */ -int device_display_set_brightness_state(int display_index, display_state_e state, int brightness); - -/** - * @brief Change display state by a specific reason - * @since_tizen @if MOBILE 5.0 @elseif WEARABLE 5.0 @endif - * @privlevel public - * @privilege %http://tizen.org/privilege/display - * @param[in] type The type is display state to change\n - * DISPLAY_STATE_NORMAL : change to normal\n - * DISPLAY_STATE_SCREEN_OFF: change to off\n - * @param[in] reason Reason that causes display chage state\n - * @param[in] timeout Timeout to change state\n - * @param[in] cb Callback function for handling result of dbus method call\n - * @return @c 0 on success, - * otherwise a negative error value - * @retval #DEVICE_ERROR_NONE Successful - * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DEVICE_ERROR_PERMISSION_DENIED Permission denied - * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed - * @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); -#ifdef __cplusplus -} -#endif - - -#endif // __TIZEN_SYSTEM_DISPLAY_INTERNAL_H__ diff --git a/include/hal-led-internal.h b/include/hal-led-internal.h deleted file mode 100644 index 7a13455..0000000 --- a/include/hal-led-internal.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef __TIZEN_SYSTEM_LED_INTERNAL_H__ -#define __TIZEN_SYSTEM_LED_INTERNAL_H__ - - -#include "device-error.h" - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * @brief Gets the total number of LEDs in the device. - * @since_tizen @if MOBILE 5.0 @elseif WEARABLE 5.0 @endif - * @privlevel public - * @privilege %http://tizen.org/privilege/led - * @remarks This API is related to the following feature: %http://tizen.org/feature/led - * @param[out] Number of LEDs - * @return @c 0 on success, - * otherwise a negative error value - * @retval #DEVICE_ERROR_NONE Successful - * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DEVICE_ERROR_PERMISSION_DENIED Permission denied - * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed - * @retval #DEVICE_ERROR_NOT_SUPPORTED Not supported device - */ -int device_multi_led_get_number(int *num_of_leds); - -/** - * @brief Plays multiple LEDs at the same time. - * @since_tizen @if MOBILE 5.0 @elseif WEARABLE 5.0 @endif - * @privlevel public - * @privilege %http://tizen.org/privilege/led - * @remarks This API is related to the following feature: %http://tizen.org/feature/led - * @remarks The array size must be the same as the number of LEDs, which is obtained by device_multi_led_get_number(). - * @param[in] color[] The Color value for each LED\n - * The first byte means opaque, and the other 3 bytes mean RGB values - * @return @c 0 on success, - * otherwise a negative error value - * @retval #DEVICE_ERROR_NONE Successful - * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DEVICE_ERROR_PERMISSION_DENIED Permission denied - * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed - * @retval #DEVICE_ERROR_NOT_SUPPORTED Not supported device - */ -int device_multi_led_control(unsigned int color[]); - - -#ifdef __cplusplus -} -#endif - - -#endif // __TIZEN_SYSTEM_LED_INTERNAL_H__ diff --git a/include/hal-touchscreen-internal.h b/include/hal-touchscreen-internal.h deleted file mode 100644 index 900b41d..0000000 --- a/include/hal-touchscreen-internal.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __TIZEN_SYSTEM_TOUCHSCREEN_INTERNAL_H__ -#define __TIZEN_SYSTEM_TOUCHSCREEN_INTERNAL_H__ - -#include -#include - -int device_touchscreen_enable(dbus_pending_cb cb); -int device_touchscreen_disable(dbus_pending_cb cb); - -#endif diff --git a/src/battery.c b/src/battery.c index 9a2eb08..794da65 100644 --- a/src/battery.c +++ b/src/battery.c @@ -25,7 +25,6 @@ #include #include "hal-battery.h" -#include "hal-battery-internal.h" #include "common.h" #include @@ -147,6 +146,57 @@ int device_battery_get_level_status(device_battery_level_e *status) return DEVICE_ERROR_NONE; } +static int load_battery_plugin() +{ + if (plugin_battery_get_info) + return 0; + + if (!handle) { + handle = dlopen(BATTERY_PLUGIN, RTLD_NOW); + if (!handle) { +//LCOV_EXCL_START System Error + _E("Failed to open '%s' : %s", BATTERY_PLUGIN, dlerror()); + return -1; +//LCOV_EXCL_STOP + } + } + + plugin_battery_get_info = (int (*)(void *))dlsym(handle, GET_INFO_FUNC); + if (!plugin_battery_get_info) { +//LCOV_EXCL_START System Error + _E("Failed to get symbol '%s' : %s", GET_INFO_FUNC, dlerror()); + return -1; +//LCOV_EXCL_STOP + } + + return 0; +} + +int device_battery_get_info_direct(struct device_battery_info *info) +{ + int ret; + + if (!info) + return DEVICE_ERROR_INVALID_PARAMETER; + + ret = is_battery_supported(); + if (!ret) + return DEVICE_ERROR_NOT_SUPPORTED; + + if (load_battery_plugin() < 0) + return DEVICE_ERROR_OPERATION_FAILED; + + ret = plugin_battery_get_info(info); + if (ret < 0) { +//LCOV_EXCL_START System Error + _E("Failed to get battery info: %d", ret); + return DEVICE_ERROR_OPERATION_FAILED; +//LCOV_EXCL_STOP + } + + return DEVICE_ERROR_NONE; +} + int device_battery_get_info(struct device_battery_info *info) { int ret; @@ -184,10 +234,10 @@ int device_battery_get_info(struct device_battery_info *info) &voltage_average, &temperature); if (ret < 0) { -//LCOV_EXCL_START System Error + //LCOV_EXCL_START System Error ret = errno_to_device_error(ret); goto out; -//LCOV_EXCL_STOP + //LCOV_EXCL_STOP } snprintf(info->status, sizeof(info->status), "%s", status); @@ -213,57 +263,6 @@ out: return ret; } -static int load_battery_plugin() -{ - if (plugin_battery_get_info) - return 0; - - if (!handle) { - handle = dlopen(BATTERY_PLUGIN, RTLD_NOW); - if (!handle) { -//LCOV_EXCL_START System Error - _E("Failed to open '%s' : %s", BATTERY_PLUGIN, dlerror()); - return -1; -//LCOV_EXCL_STOP - } - } - - plugin_battery_get_info = (int (*)(void *))dlsym(handle, GET_INFO_FUNC); - if (!plugin_battery_get_info) { -//LCOV_EXCL_START System Error - _E("Failed to get symbol '%s' : %s", GET_INFO_FUNC, dlerror()); - return -1; -//LCOV_EXCL_STOP - } - - return 0; -} - -int device_battery_get_info_direct(struct device_battery_info *info) -{ - int ret; - - if (!info) - return DEVICE_ERROR_INVALID_PARAMETER; - - ret = is_battery_supported(); - if (!ret) - return DEVICE_ERROR_NOT_SUPPORTED; - - if (load_battery_plugin() < 0) - return DEVICE_ERROR_OPERATION_FAILED; - - ret = plugin_battery_get_info(info); - if (ret < 0) { -//LCOV_EXCL_START System Error - _E("Failed to get battery info: %d", ret); - return DEVICE_ERROR_OPERATION_FAILED; -//LCOV_EXCL_STOP - } - - return DEVICE_ERROR_NONE; -} - int device_battery_get_health(device_battery_health_e *health) { struct device_battery_info info; diff --git a/src/display.c b/src/display.c index 05284b3..941641c 100644 --- a/src/display.c +++ b/src/display.c @@ -21,7 +21,6 @@ #include #include "hal-display.h" -#include "hal-display-internal.h" #include "common.h" #define METHOD_GET_DISPLAY_COUNT "GetDisplayCount" diff --git a/src/led.c b/src/led.c index ef417d6..c3ddb4a 100644 --- a/src/led.c +++ b/src/led.c @@ -22,7 +22,6 @@ #include #include "hal-led.h" -#include "hal-led-internal.h" #include "common.h" #define METHOD_GET_MAX_BRIGHTNESS "GetMaxBrightness" diff --git a/src/touchscreen-internal.c b/src/touchscreen.c similarity index 97% rename from src/touchscreen-internal.c rename to src/touchscreen.c index c1c2469..1dc0eaa 100644 --- a/src/touchscreen-internal.c +++ b/src/touchscreen.c @@ -17,7 +17,6 @@ #include #include "common.h" -#include "hal-touchscreen-internal.h" #define METHOD_TOUCHSCREEN_ENABLE "Enable" #define METHOD_TOUCHSCREEN_DISABLE "Disable" -- 2.7.4