| // Copyright 2020 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| library fuchsia.device.manager; |
| |
| using zx; |
| |
| // This enum should be same as the one in |
| // sdk/fidl/fuchsia-hardware-power-statecontrol/admin.fidl. |
| // At the moment, we cannot import that library because the |
| // fuchsia-device-manager library uses zx_build. |
| enum SystemPowerState : uint8 { |
| SYSTEM_POWER_STATE_FULLY_ON = 1; |
| SYSTEM_POWER_STATE_REBOOT = 2; |
| SYSTEM_POWER_STATE_REBOOT_BOOTLOADER = 3; |
| SYSTEM_POWER_STATE_REBOOT_RECOVERY = 4; |
| SYSTEM_POWER_STATE_POWEROFF = 5; |
| SYSTEM_POWER_STATE_MEXEC = 6; |
| SYSTEM_POWER_STATE_SUSPEND_RAM = 7; |
| }; |
| const uint32 MAX_SYSTEM_POWER_STATES = 7; |
| |
| /// Provides protocol for managing driver manager and all the devices during a |
| /// system state transition. |
| [Discoverable] |
| protocol SystemStateTransition { |
| /// Sets and updates the termination SystemPowerState of driver_manager. |
| /// On Success, the system power state is cached. The next time |
| /// driver_manager's stop event is triggered, driver_manager suspends |
| /// the system to "state". |
| /// Returns ZX_ERR_INVALID_ARGS if the system power state is not a shutdown/reboot |
| /// state(SYSTEM_POWER_STATE_POWEROFF, SYSTEM_POWER_STATE_REBOOT, |
| /// SYSTEM_POWER_STATE_REBOOT_BOOTLOADER, |
| /// SYSTEM_POWER_STATE_REBOOT_RECOVERY, SYSTEM_POWER_STATE_MEXEC) |
| /// Returns ZX_ERR_BAD_STATE if driver_manager is unable to save the state. |
| /// Each time the api is called the termination state is updated and cached. |
| SetTerminationSystemState(SystemPowerState state) -> () error zx.status; |
| }; |