1cb69b360Sopenharmony_ci/* 2cb69b360Sopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd. 3cb69b360Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4cb69b360Sopenharmony_ci * you may not use this file except in compliance with the License. 5cb69b360Sopenharmony_ci * You may obtain a copy of the License at 6cb69b360Sopenharmony_ci * 7cb69b360Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8cb69b360Sopenharmony_ci * 9cb69b360Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10cb69b360Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11cb69b360Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12cb69b360Sopenharmony_ci * See the License for the specific language governing permissions and 13cb69b360Sopenharmony_ci * limitations under the License. 14cb69b360Sopenharmony_ci */ 15cb69b360Sopenharmony_ci 16cb69b360Sopenharmony_ci#ifndef POWERMGR_POWER_MANAGE_H 17cb69b360Sopenharmony_ci#define POWERMGR_POWER_MANAGE_H 18cb69b360Sopenharmony_ci 19cb69b360Sopenharmony_ci#include <ohos_types.h> 20cb69b360Sopenharmony_ci 21cb69b360Sopenharmony_ci#ifdef __cplusplus 22cb69b360Sopenharmony_ciextern "C" { 23cb69b360Sopenharmony_ci#endif // __cplusplus 24cb69b360Sopenharmony_ci 25cb69b360Sopenharmony_citypedef enum { 26cb69b360Sopenharmony_ci SUSPEND_DEVICE_REASON_MIN = 0, 27cb69b360Sopenharmony_ci SUSPEND_DEVICE_REASON_APPLICATION = SUSPEND_DEVICE_REASON_MIN, 28cb69b360Sopenharmony_ci SUSPEND_DEVICE_REASON_DEVICE_ADMIN = 1, 29cb69b360Sopenharmony_ci SUSPEND_DEVICE_REASON_TIMEOUT = 2, 30cb69b360Sopenharmony_ci SUSPEND_DEVICE_REASON_LID_SWITCH = 3, 31cb69b360Sopenharmony_ci SUSPEND_DEVICE_REASON_POWER_BUTTON = 4, 32cb69b360Sopenharmony_ci SUSPEND_DEVICE_REASON_HDMI = 5, 33cb69b360Sopenharmony_ci SUSPEND_DEVICE_REASON_SLEEP_BUTTON = 6, 34cb69b360Sopenharmony_ci SUSPEND_DEVICE_REASON_ACCESSIBILITY = 7, 35cb69b360Sopenharmony_ci SUSPEND_DEVICE_REASON_FORCE_SUSPEND = 8, 36cb69b360Sopenharmony_ci SUSPEND_DEVICE_REASON_MAX = SUSPEND_DEVICE_REASON_FORCE_SUSPEND, 37cb69b360Sopenharmony_ci} SuspendDeviceType; 38cb69b360Sopenharmony_ci 39cb69b360Sopenharmony_citypedef enum { 40cb69b360Sopenharmony_ci WAKEUP_DEVICE_UNKNOWN = 0, 41cb69b360Sopenharmony_ci WAKEUP_DEVICE_POWER_BUTTON = 1, 42cb69b360Sopenharmony_ci WAKEUP_DEVICE_APPLICATION = 2, 43cb69b360Sopenharmony_ci WAKEUP_DEVICE_PLUGGED_IN = 3, 44cb69b360Sopenharmony_ci WAKEUP_DEVICE_GESTURE = 4, 45cb69b360Sopenharmony_ci WAKEUP_DEVICE_CAMERA_LAUNCH = 5, 46cb69b360Sopenharmony_ci WAKEUP_DEVICE_WAKE_KEY = 6, 47cb69b360Sopenharmony_ci WAKEUP_DEVICE_WAKE_MOTION = 7, 48cb69b360Sopenharmony_ci WAKEUP_DEVICE_HDMI = 8, 49cb69b360Sopenharmony_ci WAKEUP_DEVICE_LID = 9, 50cb69b360Sopenharmony_ci} WakeupDeviceType; 51cb69b360Sopenharmony_ci 52cb69b360Sopenharmony_ci/** 53cb69b360Sopenharmony_ci * Suspend device. 54cb69b360Sopenharmony_ci * 55cb69b360Sopenharmony_ci * @param reason The reason why will you suspend the device. 56cb69b360Sopenharmony_ci * @param suspendImmed The flag indicating whether the system will suspend immediately. 57cb69b360Sopenharmony_ci */ 58cb69b360Sopenharmony_civoid SuspendDevice(SuspendDeviceType reason, BOOL suspendImmed); 59cb69b360Sopenharmony_ci 60cb69b360Sopenharmony_ci/** 61cb69b360Sopenharmony_ci * Wake up the device. 62cb69b360Sopenharmony_ci * 63cb69b360Sopenharmony_ci * @param reason The reason for waking up the device. 64cb69b360Sopenharmony_ci * @param details Details of the wakeup reason. 65cb69b360Sopenharmony_ci */ 66cb69b360Sopenharmony_civoid WakeupDevice(WakeupDeviceType reason, const char* details); 67cb69b360Sopenharmony_ci 68cb69b360Sopenharmony_ci#ifdef __cplusplus 69cb69b360Sopenharmony_ci} 70cb69b360Sopenharmony_ci#endif // __cplusplus 71cb69b360Sopenharmony_ci#endif // POWERMGR_POWER_MANAGE_H 72