2 * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __TIZEN_SYSTEM_POWER_INTERNAL_H__
18 #define __TIZEN_SYSTEM_POWER_INTERNAL_H__
28 #include "device-error.h"
32 * @brief Power off the device.
33 * @details It operates synchronously.
36 * @privilege %http://tizen.org/privilege/reboot
37 * @return @c 0 on success,
38 * otherwise a negative error value
39 * @retval #DEVICE_ERROR_NONE Successful
40 * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
41 * @retval #DEVICE_ERROR_PERMISSION_DENIED Permission denied
42 * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
44 int device_power_poweroff(void);
47 POWER_STATE_MIN_INDEX = 4,
48 POWER_STATE_NORMAL_INDEX = POWER_STATE_MIN_INDEX,
49 POWER_STATE_SLEEP_INDEX,
50 POWER_STATE_POWEROFF_INDEX,
51 POWER_STATE_REBOOT_INDEX,
52 POWER_STATE_MAX_INDEX,
55 #define POWER_STATE_NORMAL (1ULL << POWER_STATE_NORMAL_INDEX)
56 #define POWER_STATE_SLEEP (1ULL << POWER_STATE_SLEEP_INDEX)
57 #define POWER_STATE_POWEROFF (1ULL << POWER_STATE_POWEROFF_INDEX)
58 #define POWER_STATE_REBOOT (1ULL << POWER_STATE_REBOOT_INDEX)
59 #define POWER_STATE_ALL ((1ULL << POWER_STATE_MAX_INDEX) - (1ULL << POWER_STATE_MIN_INDEX))
61 #define SIGNAME_CHANGE_STATE_TO_NORMAL "ChangeStateToNormal"
62 #define SIGNAME_CHANGE_STATE_TO_SLEEP "ChangeStateToSleep"
63 #define SIGNAME_CHANGE_STATE_TO_POWEROFF "ChangeStateToPowerOff"
64 #define SIGNAME_CHANGE_STATE_TO_REBOOT "ChangeStateToReboot"
66 struct device_change_state_info {
72 typedef int (*change_state_callback) (const struct device_change_state_info *info, void *user_data);
74 int device_power_add_change_state_wait_callback(uint64_t state_bits, change_state_callback cb, void *user_data);
75 void device_power_remove_change_state_wait_callback(uint64_t state_bits);