class ManualWakeLease

Defined at line 36 of file ../../sdk/lib/driver/power/cpp/wake-lease.h

This is probably not the implementation you're looking for, consider using

`WakeLeaseProvider`. `ManualWakeLease` may be appropriate if

`WakeLeaseProvider` does not fit your needs.

ManualWakeLease can be used to prevent the system from suspending. After a

call to `Start()` returns, the system will keep running until after `End()`

is called or the instance is dropped. Users can use the same instance to

perform multiple atomic operations, for example by calling `Start()` after

`End()`.

If doing multiple atomic operations, a single `ManualWakeLease` can have

performance advantages over using a WakeLease directly because the

`ManualWakeLease` monitors system state over its lifetime, allowing it to

avoid certain operations vs a series of shorter-lived `WakeLease` instances.

Public Methods

void ManualWakeLease (async_dispatcher_t * dispatcher, std::string_view name, fidl::ClientEnd<fuchsia_power_system::ActivityGovernor> sag, inspect::Node * parent_node, bool log, uint32_t long_duration_threshold_ms)

This is probably not the implementation you're looking for, consider using

`WakeLeaseProvider`. `ManualWakeLease` may be appropriate if

`WakeLeaseProvider` does not fit your needs.

ManualWakeLease can be used to prevent the system from suspending. After a

call to `Start()` returns the system will keep running until after `End()`

is called or the instance is dropped. Users can use the same instance to

perform multiple atomic operations, for example by calling `Start()` after

`End()`.

If doing multiple atomic operations, a single `ManualWakeLease` can have

performance advantages over using a WakeLease directly because the

`ManualWakeLease` monitors system state over its lifetime, allowing it to

avoid certain operations vs a series of shorter-lived `WakeLease` instances.

Defined at line 30 of file ../../sdk/lib/driver/power/cpp/wake-lease.cc

void SetSuspended (bool suspended)

Defined at line 90 of file ../../sdk/lib/driver/power/cpp/wake-lease.h

bool IsSuspended ()

Defined at line 91 of file ../../sdk/lib/driver/power/cpp/wake-lease.h

bool Start (bool ignore_system_state)

Start an atomic operation. If `ActivityGovernor` protocol connection is

valid the system is guaranteed to stay running until `End()` is called or

this instance is dropped.

Returns `true` if one of the following is true:

* It was not necessary to take a SAG wake lease at this time because the

system is resumed

* A SAG wake lease was acquired

* A SAG wake lease was previously acquired

Returns `false` if it was necessary to acquire a SAG wake lease, but

an error occurred during acquisition. In this case, the `ManualWakeLease`

instance should be replaced with a new one.

Defined at line 95 of file ../../sdk/lib/driver/power/cpp/wake-lease.cc

zx::result<zx::eventpair> End ()

Indicate that the operation is complete. The system may suspend after this

call is made. Calling `End()` makes sense in the case the caller wants to

use this instance to start a new atomic operation in the future. Returns

the wake lease currently currently held, if any.

Defined at line 117 of file ../../sdk/lib/driver/power/cpp/wake-lease.cc

void DepositWakeLease (zx::eventpair wake_lease)

Stores the SAG wake lease in the instance. The wake lease will be retained

until `End` or `TakeWakeLease` is called.

Defined at line 138 of file ../../sdk/lib/driver/power/cpp/wake-lease.cc

zx::result<zx::eventpair> TakeWakeLease ()

Consider whether End() is more appropriate for the use case.

Returns ZX_ERR_BAD_HANDLE if we don't currently have a wake lease.

IMPORTANT: This does not implicitly call `End()`, meaning that at the next

system transition to suspend, this class will take a SAG wake lease and

cause the suspend to abort.

Defined at line 157 of file ../../sdk/lib/driver/power/cpp/wake-lease.cc

zx::result<zx::eventpair> GetWakeLeaseCopy ()

Get a duplicate of the stored SAG wake lease. Returns ZX_ERR_BAD_HANDLE if

we don't currently have a wake lease.

Defined at line 167 of file ../../sdk/lib/driver/power/cpp/wake-lease.cc

void AfterResume (AfterResumeCompleter::Sync & completer)

fuchsia.power.system/SuspendBlocker implementation. This is used to avoid

creatingwake leases in cases where the system is resumed and `HandleInterrupt`

is called.

Defined at line 178 of file ../../sdk/lib/driver/power/cpp/wake-lease.cc

void BeforeSuspend (BeforeSuspendCompleter::Sync & completer)

Defined at line 183 of file ../../sdk/lib/driver/power/cpp/wake-lease.cc

void handle_unknown_method (fidl::UnknownMethodMetadata<fuchsia_power_system::SuspendBlocker> metadata, fidl::UnknownMethodCompleter::Sync & completer)

Defined at line 198 of file ../../sdk/lib/driver/power/cpp/wake-lease.cc