# fuchsia.power.clientlevel

<br />

Added: 7

## **PROTOCOLS**

## Connector

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

Allows a client to connect a [Watcher](https://fuchsia.dev/reference/fidl/fuchsia.power.clientlevel#Watcher) to the power level of a given
[ClientType](https://fuchsia.dev/reference/fidl/fuchsia.power.clientlevel#ClientType).

<br />

### Connect

Connects a [Watcher](https://fuchsia.dev/reference/fidl/fuchsia.power.clientlevel#Watcher) to the power level of the specified
[ClientType](https://fuchsia.dev/reference/fidl/fuchsia.power.clientlevel#ClientType).

A client may call this method and begin using the [Watcher](https://fuchsia.dev/reference/fidl/fuchsia.power.clientlevel#Watcher) client
endpoint immediately.

If a power configuration does not exist for the provided `client_type`,
then the request will fail. On failure, both the `watcher` server
endpoint as well as the current `Connector` connection will be
terminated.

- `client_type` specifies to which [ClientType](https://fuchsia.dev/reference/fidl/fuchsia.power.clientlevel#ClientType) power level that
  `watcher` should be connected. The value is valid iff a power
  configuration exists for the provided `client_type`.

- `watcher` is the server endpoint of a [Watcher](https://fuchsia.dev/reference/fidl/fuchsia.power.clientlevel#Watcher) channel that will be
  connected to the [ClientType](https://fuchsia.dev/reference/fidl/fuchsia.power.clientlevel#ClientType) power level.

#### Request

| Name | Type |
|---|---|
| `client_type` | `https://fuchsia.dev/reference/fidl/fuchsia.power.clientlevel#ClientType` |
| `watcher` | `server_end:https://fuchsia.dev/reference/fidl/fuchsia.power.clientlevel#Watcher` |

## Watcher

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

Allows a client to watch for changes to the power level of a given
[ClientType](https://fuchsia.dev/reference/fidl/fuchsia.power.clientlevel#ClientType).

This protocol cannot be connected to the service directly. Instead, the
server endpoint of a `Watcher` channel must first be connected to the power
level of the desired [ClientType](https://fuchsia.dev/reference/fidl/fuchsia.power.clientlevel#ClientType) using the [Connector.Connect](https://fuchsia.dev/reference/fidl/fuchsia.power.clientlevel#Connector.Connect) method.
The client endpoint of a `Watcher` channel is only useful after it has been
connected in this way.

<br />

### Watch

Watches for changes to the power level of the connected [ClientType](https://fuchsia.dev/reference/fidl/fuchsia.power.clientlevel#ClientType).

The power level for a given [ClientType](https://fuchsia.dev/reference/fidl/fuchsia.power.clientlevel#ClientType) is determined according to
the power configuration for that [ClientType](https://fuchsia.dev/reference/fidl/fuchsia.power.clientlevel#ClientType). See the
[README.md](https://fuchsia.dev/src/power/power-manager/system_power_mode_config/README)
for more details.

On a given connection, the first call will return immediately with the
current power level for the connected [ClientType](https://fuchsia.dev/reference/fidl/fuchsia.power.clientlevel#ClientType). Subsequent `Watch`
requests will only return a new `level` if the power level of the
connected [ClientType](https://fuchsia.dev/reference/fidl/fuchsia.power.clientlevel#ClientType) has changed. This follows the [hanging
get](https://fuchsia.dev/fuchsia-src/concepts/api/fidl#hanging-get)
pattern.

- `level` is an unsigned integer representing the power level of the connected [ClientType](https://fuchsia.dev/reference/fidl/fuchsia.power.clientlevel#ClientType).

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `level` | `uint64` |

## **ENUMS**

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

Type: `uint32`

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

A value that represents the type of client using the protocol.

`ClientType` is used as a parameter for:

1. [Connector.Connect](https://fuchsia.dev/reference/fidl/fuchsia.power.clientlevel#Connector.Connect) to connect a [Watcher](https://fuchsia.dev/reference/fidl/fuchsia.power.clientlevel#Watcher) to the power level of the specified client type
2. [fuchsia.power.systemmode](https://fuchsia.dev/reference/fuchsia.power.systemmode/)/[ClientConfigurator.Get](https://fuchsia.dev/reference/fuchsia.power.systemmode/#ClientConfigurator.Get) and [fuchsia.power.systemmode](https://fuchsia.dev/reference/fuchsia.power.systemmode/)/[ClientConfigurator.Set](https://fuchsia.dev/reference/fuchsia.power.systemmode/#ClientConfigurator.Set) to update the power configuration of the specified client type

<br />

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