blob: 1d5a0f06a9786b3b2cf78b10644806797ffc9bd4 [file] [log] [blame]
#!/usr/bin/env fuchsia-vendored-python
# Copyright 2023 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.
"""Contains Abstract Base Classes for all affordances capable devices."""
import abc
from collections.abc import Callable
from honeydew.interfaces.device_classes import fuchsia_device
class RebootCapableDevice(abc.ABC):
"""Abstract base class to be implemented by a device which supports the
reboot operation."""
@abc.abstractmethod
def reboot(self) -> None:
"""Soft reboot the device."""
@abc.abstractmethod
def on_device_boot(self) -> None:
"""Take actions after the device is rebooted."""
@abc.abstractmethod
def register_for_on_device_boot(self, fn: Callable[[], None]) -> None:
"""Register a function that will be called in on_device_boot."""
@abc.abstractmethod
def wait_for_offline(
self, timeout: float = fuchsia_device.TIMEOUTS["OFFLINE"]
) -> None:
"""Wait for Fuchsia device to go offline.
Args:
timeout: How long in sec to wait for device to go offline.
"""
@abc.abstractmethod
def wait_for_online(
self, timeout: float = fuchsia_device.TIMEOUTS["ONLINE"]
) -> None:
"""Wait for Fuchsia device to go online.
Args:
timeout: How long in sec to wait for device to go offline.
"""