+++ /dev/null
-/*
- * 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 <stdbool.h>
-#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__
extern "C" {
#endif
+#define BATTERY_INFO_MAX 32
/**
* @addtogroup CAPI_SYSTEM_DEVICE_BATTERY_MODULE
} 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
+++ /dev/null
-/*
- * 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 <gio/gio.h>
-#include <libsyscommon/dbus-system.h>
-
-#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__
+++ /dev/null
-/*
- * 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__
+++ /dev/null
-#ifndef __TIZEN_SYSTEM_TOUCHSCREEN_INTERNAL_H__
-#define __TIZEN_SYSTEM_TOUCHSCREEN_INTERNAL_H__
-
-#include <gio/gio.h>
-#include <libsyscommon/dbus-system.h>
-
-int device_touchscreen_enable(dbus_pending_cb cb);
-int device_touchscreen_disable(dbus_pending_cb cb);
-
-#endif
#include <libsyscommon/dbus-system.h>
#include "hal-battery.h"
-#include "hal-battery-internal.h"
#include "common.h"
#include <system_info.h>
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;
&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);
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;
#include <libsyscommon/dbus-system.h>
#include "hal-display.h"
-#include "hal-display-internal.h"
#include "common.h"
#define METHOD_GET_DISPLAY_COUNT "GetDisplayCount"
#include <libsyscommon/dbus-system.h>
#include "hal-led.h"
-#include "hal-led-internal.h"
#include "common.h"
#define METHOD_GET_MAX_BRIGHTNESS "GetMaxBrightness"
#include <libsyscommon/dbus-system.h>
#include "common.h"
-#include "hal-touchscreen-internal.h"
#define METHOD_TOUCHSCREEN_ENABLE "Enable"
#define METHOD_TOUCHSCREEN_DISABLE "Disable"