<br />

Added: HEAD

## **PROTOCOLS**

## ElementControl

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=199)*

Provides element-scoped access to an element previously added via
Topology.AddElement.

<br />

### AddDependency

Add a new dependency to an existing element.
If any open leases would incorporate this dependency, the required
element and any transitively required elements must complete all
necessary transitions (via ElementRunner.SetLevel calls) before this
method will return.

#### Request

| Name | Type |
|---|---|
| `payload` | `LevelDependency` |

#### Response

| Name | Type |
|---|---|
| `payload` | `ElementControl_AddDependency_Result` |

### OpenStatusChannel

Register a new Status channel on which Power Broker will send
read-only updates of the element's current power level. This method
is intended to allow element owners to give read-only access to the
element's current power level to clients by opening and transferring
this channel.

#### Request

| Name | Type |
|---|---|
| `status_channel` | `server_end:Status` |

### RegisterDependencyToken

Register a token which will permit the bearer to add either a
dependency upon this element.

#### Request

| Name | Type |
|---|---|
| `token` | `DependencyToken` |

#### Response

| Name | Type |
|---|---|
| `payload` | `ElementControl_RegisterDependencyToken_Result` |

### RemoveDependency

Remove an existing dependency from this element.

The dependency to remove is described by a `LevelDependency`, which is
interpreted as it is for AddDependency: the dependency of this element
at `dependent_level` upon the element that `requires_token` was
registered for, at the first valid level in `requires_level_by_preference`.
Passing the `LevelDependency` that was used to add a dependency, either
to AddDependency or in `ElementSchema.dependencies`, removes it. Other
dependencies of this element are not affected, including those upon the
same element on other levels. `remove_with_required_element` is ignored.

The dependency is removed immediately. Open leases stop requiring it,
and the required element may be lowered right away if nothing else
requires it to remain at its current level. Elements that were only
required transitively through the removed dependency are lowered in
order, as when a lease is dropped: each of them stays at its current
level until the element that requires it has been lowered. This method
does not wait for these transitions.

Returns `INVALID` if `dependent_level`, `requires_token` or
`requires_level_by_preference` is missing or not valid,
`NOT_AUTHORIZED` if `requires_token` is not a currently registered
dependency token (for example, if the token was unregistered or the
required element was removed), and `NOT_FOUND` if this element does not
have the dependency.

#### Request

| Name | Type |
|---|---|
| `payload` | `LevelDependency` |

#### Response

| Name | Type |
|---|---|
| `payload` | `ElementControl_RemoveDependency_Result` |

### UnregisterDependencyToken

Unregister a token previously registered via RegisterDependencyToken.

#### Request

| Name | Type |
|---|---|
| `token` | `DependencyToken` |

#### Response

| Name | Type |
|---|---|
| `payload` | `ElementControl_UnregisterDependencyToken_Result` |

## ElementInfoProvider

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=413)*

Provides an interface to retrieve information about PowerElements managed by a component.

<br />

### GetElementPowerLevelNames

Returns mappings of PowerLevels to plaintext names for each element managed
by a component. Returns an error if no mappings can be returned.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `payload` | `ElementInfoProvider_GetElementPowerLevelNames_Result` |

### GetStatusEndpoints

Returns available Status client endpoints and stable identifiers for each
element managed by a component. Returns an error if no endpoints can be
returned (i.e. no elements were able to implement the Status channel).

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `payload` | `ElementInfoProvider_GetStatusEndpoints_Result` |

## ElementRunner

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=261)*

The runner or operator of an element.
This should be implemented by all element owners.
The client end is passed to Power Broker via ElementSchema.element_runner.
Power Broker calls SetLevel initially, and then whenever the required level
of the element changes.

<br />

### SetLevel

Sets the level of the power element.

The server blocks while making the level transition. It returns
once the transition to the new required level is complete.
If the element cannot transition to the new required level and
it cannot retry, the channel will be closed.

#### Request

| Name | Type |
|---|---|
| `level` | `PowerLevel` |

#### Response

| Name | Type |
|---|---|
| `payload` | `ElementRunner_SetLevel_Result` |

## LeaseControl

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=352)*

Provides lease-scoped access to actions that can be taken on a lease
previously acquired via Lessor.Lease. Closing this control channel drops
the lease.
TODO(https://fxbug.dev/339474151): Switch from a protocol to an eventpair.

<br />

### WatchStatus

Get the current status of the lease.
If last_status is UNKNOWN, the call will return immediately
with the current status. Otherwise, the call will block
until the current status differs from last_status.
Added: HEAD

#### Request

| Name | Type |
|---|---|
| `last_status` | `LeaseStatus` |

#### Response

| Name | Type |
|---|---|
| `payload` | `LeaseControl_WatchStatus_Result` |

## Lessor

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=299)*

DEPRECATED. Use `Topology.Lease` instead.
Provides element-scoped access to request leases to raise the levels of an
element previously added via Topology.AddElement.

<br />

### Lease

Request made to indicate the client wants the element raised to the given
level. When the call returns, this **does** **not** mean the
corresponding element is at the requested level, only that the requested
level is valid and request is being worked on.

Fulfilling the request will raise the level of all the level's direct
and transitive power dependencies to their required levels. When
`LeaseControl.WatchStatus` reports `LeaseStatus::SATISFIED` this means
given element is at the level specified by the lease.

Requesting an invalid level returns `LeaseError::INVALID_LEVEL`.

#### Request

| Name | Type |
|---|---|
| `level` | `PowerLevel` |

#### Response

| Name | Type |
|---|---|
| `payload` | `Lessor_Lease_Result` |

## Status

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=371)*

Provides read-only access to the current PowerLevel of an element and the
ability to watch changes to an element's power level. A new channel to
this protocol can be obtained by calling OpenStatus on the element's
ElementControl channel (and passed to other clients who need access
to the element's current power level).

<br />

### WatchPowerLevel

Returns the current power level for this element. The first call on
this channel will return immediately. Subsequent calls will block until
the current power level has changed.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `payload` | `Status_WatchPowerLevel_Result` |

## Topology

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=74)*

This is the primary initial protocol used by Power Element Owners to
communicate with Power Broker. Power Element Owners should add the
elements they own to the Power Topology through AddElement. All further
interactions with Power Broker are done through channels opened by the
AddElement call, which are scoped to the added element.

<br />

### AddElement

Called by a Power Element owner to register a new Power Element and
open control channels for that element.

#### Request

| Name | Type |
|---|---|
| `payload` | `ElementSchema` |

#### Response

| Name | Type |
|---|---|
| `payload` | `Topology_AddElement_Result` |

### Lease

Called by a client to directly open a lease on the given dependencies
without the need for creating and managing a new element.

#### Request

| Name | Type |
|---|---|
| `payload` | `LeaseSchema` |

#### Response

| Name | Type |
|---|---|
| `payload` | `Topology_Lease_Result` |

## **STRUCTS**

### ElementControl_AddDependency_Response

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=225)*

\<EMPTY\>

### ElementControl_RegisterDependencyToken_Response

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=213)*

\<EMPTY\>

### ElementControl_RemoveDependency_Response

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=252)*

\<EMPTY\>

### ElementControl_UnregisterDependencyToken_Response

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=218)*

\<EMPTY\>

### ElementInfoProvider_GetElementPowerLevelNames_Response [resource](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#value-vs-resource)

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=416)*

| Field | Type | Description | Default |
|---|---|---|---|
| `level_names` | `vector<ElementPowerLevelNames>` |   | No default |

### ElementInfoProvider_GetStatusEndpoints_Response [resource](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#value-vs-resource)

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=423)*

| Field | Type | Description | Default |
|---|---|---|---|
| `endpoints` | `vector<ElementStatusEndpoint>` |   | No default |

### ElementRunner_SetLevel_Response

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=270)*

\<EMPTY\>

### LeaseControl_WatchStatus_Response

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=361)*

| Field | Type | Description | Default |
|---|---|---|---|
| `status` | `LeaseStatus` |   | No default |

### Lessor_Lease_Response [resource](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#value-vs-resource)

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=314)*

| Field | Type | Description | Default |
|---|---|---|---|
| `lease_control` | `client_end:LeaseControl` | Channel for actions to be taken on the lease. When this channel is closed, the lease will be dropped. | No default |

### Status_WatchPowerLevel_Response [resource](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#value-vs-resource)

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=375)*

| Field | Type | Description | Default |
|---|---|---|---|
| `current_level` | `PowerLevel` |   | No default |

### Topology_AddElement_Response

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=77)*

\<EMPTY\>

### Topology_Lease_Response

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=81)*

\<EMPTY\>

## **ENUMS**

### AddElementError [flexible](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#strict-vs-flexible)

Type: `uint32`

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=192)*

| Name | Value | Description |
|---|---|---|
| ### INVALID | `1` |   |
| ### NOT_AUTHORIZED | `2` |   |

### BinaryPowerLevel [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#strict-vs-flexible)

Type: `uint8`

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=20)*

BinaryPowerLevel is a well-known set of PowerLevels with only two
states: OFF and ON.

<br />

| Name | Value | Description |
|---|---|---|
| ### OFF | `0` |   |
| ### ON | `1` |   |

### ElementInfoProviderError [flexible](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#strict-vs-flexible)

Type: `uint32`

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=428)*

| Name | Value | Description |
|---|---|---|
| ### UNKNOWN | `0` |   |
| ### FAILED | `1` |   |

### LeaseError [flexible](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#strict-vs-flexible)

Type: `uint32`

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=321)*

| Name | Value | Description |
|---|---|---|
| ### INTERNAL | `1` |   |
| ### NOT_AUTHORIZED | `2` |   |
| ### INVALID_LEVEL | `3` |   |
| ### INVALID_ARGUMENT | `4` |   |

### LeaseStatus [flexible](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#strict-vs-flexible)

Type: `uint32`

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=328)*

| Name | Value | Description |
|---|---|---|
| ### UNKNOWN | `0` |   |
| ### PENDING | `1` | The lease has been received by Power Broker, and the upward power transition has begun, but has not yet completed. That is, one or more dependencies of the leased `PowerLevel` are not yet at their required levels. |
| ### SATISFIED | `2` | All dependencies required by the leased `PowerLevel` are at their required `PowerLevel`s, and the leased `PowerElement` has transitioned to the requested level. |
| ### POWERING_DOWN | `3` | The lease has been dropped by the client and acknowledged by Power Broker, and the downward power transition has begun, but has not yet completed. |
| ### VACATED | `4` | The lease has been removed, and all resulting power transitions have been completed. |

### ModifyDependencyError [flexible](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#strict-vs-flexible)

Type: `uint32`

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=273)*

| Name | Value | Description |
|---|---|---|
| ### ALREADY_EXISTS | `1` |   |
| ### INVALID | `2` |   |
| ### NOT_AUTHORIZED | `3` |   |
| ### NOT_FOUND | `4` |   |

### RegisterDependencyTokenError [flexible](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#strict-vs-flexible)

Type: `uint32`

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=280)*

| Name | Value | Description |
|---|---|---|
| ### ALREADY_IN_USE | `1` |   |
| ### INTERNAL | `2` |   |

### StatusError [flexible](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#strict-vs-flexible)

Type: `uint32`

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=380)*

| Name | Value | Description |
|---|---|---|
| ### UNKNOWN | `1` |   |

### UnregisterDependencyTokenError [flexible](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#strict-vs-flexible)

Type: `uint32`

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=285)*

| Name | Value | Description |
|---|---|---|
| ### NOT_AUTHORIZED | `1` |   |
| ### NOT_FOUND | `2` |   |

## **TABLES**

### ElementPowerLevelNames

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=406)*

Mapping of a vector of [fuchsia.power.broker](https://fuchsia.dev/reference/fuchsia.power.broker/)/[PowerLevelName](https://fuchsia.dev/reference/fuchsia.power.broker/#PowerLevelName) to a Power Element via
its plaintext name. Names are expected to be unique between elements and persistent
across reboots of the same build, but consistency is not guaranteed between different builds.

<br />

| Ordinal | Field | Type | Description |
|---|---|---|---|
| ### 1 | `identifier` | `string:64` |   |
| ### 2 | `levels` | `vector<PowerLevelName>:256` |   |

### ElementSchema [resource](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#value-vs-resource)

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=85)*

Passed to Topology.AddElement.

<br />

| Ordinal | Field | Type | Description |
|---|---|---|---|
| ### 1 | `element_name` | `string:64` | Human-readable name for logging and debug purposes. |
| ### 2 | `initial_current_level` | `PowerLevel` | The initial current power level of the element. To be used with `initial_lease_token`, see note below. |
| ### 3 | `valid_levels` | `vector<PowerLevel>:256` | All power levels that are valid for this element. Any level not specified here will be treated as invalid. Levels must be listed in ascending order from low to high. Note, levels are enums and their integer values do not have an inherent meaning. For example, *theoretically* a binary (off, on) could be represented with (0, 1), (1, 0), (17, 19) or any combination of two two numbers. (But please use BinaryPowerLevel above!) |
| ### 4 | `dependencies` | `vector<LevelDependency>:128` | List of dependencies for this element's power levels. Note: dependencies UPON this element's levels cannot be added here. |
| ### 8 | `lessor_channel` | `server_end:Lessor` | REMOVED: 7: level_control_channels, use `element_runner` instead (see below). DEPRECATED. Use `Topology.Lease` instead. Optional. If passed, Leases for this element can be requested via this channel. |
| ### 9 | `element_control` | `server_end:ElementControl` | Caller-provided ElementControl channel to be passed to Power Broker. When this channel is dropped, the element will be removed from the topology. All channels associated with this element will be closed and all tokens registered to this element will be unregistered. |
| ### 10 | `element_runner` | `client_end:ElementRunner` | The client-end that Power Broker should use to set the power level of this element. The server_end of this should be retained and the ElementRunner protocol implemented by the element's runner. |
| ### 11 | `initial_lease_token` | `LeaseToken` | If `initial_lease_token` is set, a lease will be immediately taken at `initial_current_level` and all SetLevel calls prior to reaching `initial_current_level` will be suppressed. The first SetLevel call will be for `initial_current_level`. The client should pass here the half of an eventpair to be held by Power Broker. The other half of the pair should be retained by the client. Note: this lease will likely not be SATISFIED when returned, as that would require the ElementRunner server to already have received and responded to a SetLevel request from Power Broker. Clients can listen for `LEASE_SIGNAL_SATISFIED` to know when the lease has been `SATISFIED`. |

### ElementStatusEndpoint [resource](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#value-vs-resource)

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=390)*

Status client endpoint and a plaintext name for a specific Power Element. Names are
expected to be unique between elements and persistent across reboots of the same build,
but consistency is not guaranteed between different builds.

<br />

| Ordinal | Field | Type | Description |
|---|---|---|---|
| ### 1 | `identifier` | `string:64` |   |
| ### 2 | `status` | `client_end:Status` |   |

### LeaseDependency [resource](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#value-vs-resource)

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=153)*

| Ordinal | Field | Type | Description |
|---|---|---|---|
| ### 1 | `requires_token` | `DependencyToken` | Must supply a token registered via the RegisterDependencyToken call of the required element's ElementControl protocol. |
| ### 2 | `requires_level` | `PowerLevel` | Level of the element required. Most clients will want to use this, but for forward compatibility, requires_level_by_preference may be used instead. |
| ### 3 | `requires_level_by_preference` | `vector<PowerLevel>:256` | Advanced Options (Optional) For forward compatibility, the list of levels in decreasing preferential order that power broker should attempt to make required for this dependency to be satisfied. The first level in list that is a valid level will become the required level. If this is set, `requires_level` will be ignored. Platform clients can use this list to keep backwards compatibility with dependencies by providing multiple levels that the dependency may have implemented in older API levels. |

### LeaseSchema [resource](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#value-vs-resource)

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=134)*

Passed to Topology.Lease.

<br />

| Ordinal | Field | Type | Description |
|---|---|---|---|
| ### 1 | `lease_token` | `LeaseToken` | The half of an eventpair to be held by the Power Broker. The other half of the pair should be retained by the client. See `LeaseToken` below for more usage details. |
| ### 2 | `lease_name` | `string:64` | Human-readable name for logging and debug purposes. |
| ### 3 | `dependencies` | `vector<LeaseDependency>:128` | List of dependencies for this lease. Must not be empty or absent; a lease with no dependencies is rejected with `LeaseError::INVALID_ARGUMENT`. |
| ### 4 | `should_return_pending_lease` | `bool` | (Optional) By default, `Topology.Lease` will wait until the lease is `SATISFIED` before returning. If `should_return_pending_lease` is true, it will instead return as soon as the lease has been granted by Power Broker but it may still be `PENDING`. Clients can listen for `LEASE_SIGNAL_SATISFIED` to know when the lease has been `SATISFIED`. |

### LevelDependency [resource](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#value-vs-resource)

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=46)*

Describes a dependency from one power element's level on another power
element's level.
For example if element `PowerElement_A` has a level `PowerLevel_A3` which
depends on an element `PowerElement_B` being at `PowerLevel_B2` then we would
fill out the struct to convey the meaning:

- `dependent_level` = `PowerLevel_A3`
- `requires_token` = `PowerElement_B`
- `requires_level_by_preference` = `[PowerLevel_B2]` (Note the values above are only *symbolic* , eg. `dependent_level` requires an integer value, not a string.)

The dependent Element's identity is not specified in this struct and must
be specified as a separate argument in a request or be inferred, perhaps
because a channel is scoped to the dependent element.

<br />

| Ordinal | Field | Type | Description |
|---|---|---|---|
| ### 1 | `dependent_level` | `PowerLevel` | The power element level that this `LevelDependency` struct declaration supports. This is level that has a dependency on `requires_level_by_preference`. |
| ### 2 | `requires_token` | `DependencyToken` | Must supply a token registered via the RegisterDependencyToken call of the required element's ElementControl protocol. |
| ### 3 | `requires_level_by_preference` | `vector<PowerLevel>:256` | A list of levels in decreasing preferential order that power broker should attempt to make required for this dependency to be satisfied. The first level in list that is a valid level will become the required level. Platform clients can use this list to keep backwards compatibility with dependencies by providing multiple levels that the dependency may have implemented in older API levels. |
| ### 4 | `remove_with_required_element` | `bool` | If true, this dependency will be automatically removed if/when the required element is removed. |

### PowerLevelName

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=398)*

Mapping of a plaintext name to a PowerLevel. Names are expected to be unique between
elements and persistent across reboots of the same build, but consistency is not
guaranteed between different builds.

<br />

| Ordinal | Field | Type | Description |
|---|---|---|---|
| ### 1 | `level` | `PowerLevel` |   |
| ### 2 | `name` | `string:16` |   |

## **UNIONS**

### ElementControl_AddDependency_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#strict-vs-flexible)

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=225)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `ElementControl_AddDependency_Response` |   |
| ### 2 | `err` | `ModifyDependencyError` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### ElementControl_RegisterDependencyToken_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#strict-vs-flexible)

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=213)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `ElementControl_RegisterDependencyToken_Response` |   |
| ### 2 | `err` | `RegisterDependencyTokenError` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### ElementControl_RemoveDependency_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#strict-vs-flexible)

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=252)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `ElementControl_RemoveDependency_Response` |   |
| ### 2 | `err` | `ModifyDependencyError` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### ElementControl_UnregisterDependencyToken_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#strict-vs-flexible)

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=218)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `ElementControl_UnregisterDependencyToken_Response` |   |
| ### 2 | `err` | `UnregisterDependencyTokenError` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### ElementInfoProvider_GetElementPowerLevelNames_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#strict-vs-flexible) [resource](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#value-vs-resource)

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=416)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `ElementInfoProvider_GetElementPowerLevelNames_Response` |   |
| ### 2 | `err` | `ElementInfoProviderError` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### ElementInfoProvider_GetStatusEndpoints_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#strict-vs-flexible) [resource](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#value-vs-resource)

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=423)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `ElementInfoProvider_GetStatusEndpoints_Response` |   |
| ### 2 | `err` | `ElementInfoProviderError` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### ElementRunner_SetLevel_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#strict-vs-flexible)

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=270)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `ElementRunner_SetLevel_Response` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### LeaseControl_WatchStatus_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#strict-vs-flexible)

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=361)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `LeaseControl_WatchStatus_Response` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### Lessor_Lease_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#strict-vs-flexible) [resource](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#value-vs-resource)

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=314)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `Lessor_Lease_Response` |   |
| ### 2 | `err` | `LeaseError` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### Status_WatchPowerLevel_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#strict-vs-flexible) [resource](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#value-vs-resource)

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=375)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `Status_WatchPowerLevel_Response` |   |
| ### 2 | `err` | `StatusError` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### Topology_AddElement_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#strict-vs-flexible)

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=77)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `Topology_AddElement_Response` |   |
| ### 2 | `err` | `AddElementError` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### Topology_Lease_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#strict-vs-flexible)

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=81)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `Topology_Lease_Response` |   |
| ### 2 | `err` | `LeaseError` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

## **BITS**

### Permissions [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language.md.txt#strict-vs-flexible)

Type: `uint32`

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=291)*

Element Permissions

<br />

| Name | Value | Description |
|---|---|---|
| ### MODIFY_DEPENDENT | 1 |   |
| ### MODIFY_DEPENDENCY | 4 |   |

## **CONSTANTS**

| Name | Value | Type | Description |
|---|---|---|---|
| [LEASE_SIGNAL_SATISFIED](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=185) | `16777216` | `uint32` | Signal sent by Power Broker on the LeaseToken when the lease is satisfied. |
| [LEASE_TOKEN_RIGHTS](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=180) | A token that represents an open lease. The client's handle should be dropped to indicate the lease should be closed. This handle may be duplicated if the lease will be shared; the lease will remain open until the last handle is dropped. |
| [MAX_DEPENDENCIES_IN_ADD_ELEMENT](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=188) | `128` | `uint16` |   |
| [MAX_ELEMENT_NAME_LEN](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=25) | `64` | `uint8` |   |
| [MAX_LEVEL_NAME_LEN](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=385) | `16` | `uint16` | PowerLevel name lengths are limited to reduce Inspect space usage |
| [MAX_TOKENS_IN_ADD_ELEMENT](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=189) | `128` | `uint16` |   |
| [MAX_VALID_POWER_LEVELS](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=190) | `256` | `uint16` |   |

## **ALIASES**

| Name | Value | Description |
|---|---|---|
| [DependencyToken](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=30) | `zx/Handle` | A token that represents the right to add a dependency upon another element. Should first be registered with Power Broker via ElementControl.RegisterDependencyToken of the required element. |
| [LeaseToken](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=182) | `zx/Handle` |   |
| [PowerLevel](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=16) | `uint8` | Used to describe the power level of an element. Could extend this further to support additional types of power levels, such as ACPI. |

## **SERVICES**

### ElementInfoProviderService

*Defined in [fuchsia.power.broker/broker.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=433)*

| Name | Type | Transport |
|---|---|---|
| [status_provider](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.broker/broker.fidl;l=434) | `fuchsia.power.broker/ElementInfoProvider` | Channel |

<br />