1 /* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef POWER_SHELL_COMMAND_H 17 #define POWER_SHELL_COMMAND_H 18 19 #include <functional> 20 #include <map> 21 #include "shell_command.h" 22 23 #include "power_mgr_client.h" 24 25 namespace OHOS { 26 namespace PowerMgr { 27 class PowerShellCommand : public OHOS::AAFwk::ShellCommand { 28 public: 29 PowerShellCommand(int argc, char *argv[]); ~PowerShellCommand()30 ~PowerShellCommand() override {}; 31 32 private: 33 ErrCode CreateCommandMap() override; 34 ErrCode CreateMessageMap() override; 35 ErrCode init() override; 36 ErrCode RunAsHelpCommand(); 37 ErrCode RunAsDumpCommand(); 38 ErrCode RunAsSetModeCommand(); 39 ErrCode RunAsWakeupCommand(); 40 ErrCode RunAsSuspendCommand(); 41 ErrCode RunAsQueryLockCommand(); 42 #ifdef HAS_DISPLAY_MANAGER_PART 43 ErrCode RunAsDisplayCommand(); 44 bool DisplayOptargEmpty(); 45 ErrCode RunAsDisplayCommandHelp(); 46 ErrCode RunAsDisplayCommandOverride(); 47 ErrCode RunAsDisplayCommandRestore(); 48 ErrCode RunAsDisplayCommandBoost(); 49 ErrCode RunAsDisplayCommandCancelBoost(); 50 ErrCode RunAsDisplayCommandSetValue(); 51 ErrCode RunAsDisplayCommandDiscount(); 52 ErrCode RunAsDisplayCommandDelay(); 53 std::map<char, std::function<int32_t()>> commandDisplay_; 54 #endif 55 ErrCode RunAsTimeOutCommand(); 56 }; 57 } // namespace PowerMgr 58 } // namespace OHOS 59 #endif // POWER_SHELL_COMMAND_H 60