<br />

Added: HEAD

## **PROTOCOLS**

## Source

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

### GetSpec

Returns static hardware characteristics that do not change during operation.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#Source_GetSpec_Result` |

### GetStatus

Returns dynamic status of the source immediately.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#Source_GetStatus_Result` |

### SetRole

Set the role of this specific node.

Errors:

- `INVALID_ARGS`: If the provided role is invalid.
- `NOT_SUPPORTED`: If the requested role is not supported by the hardware.
- `INTERNAL`: If an unexpected error occurred.

#### Request

| Name | Type |
|---|---|
| `role` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#Role` |

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#Source_SetRole_Result` |

### Watch

Change notification for power source state using a "hanging-get" pattern.

The first call to this method returns the current hardware state immediately.
Subsequent calls block until a change occurs that matches the provided masks.

At most one `Watch` call may be outstanding at a time per connection.
Completing a call acknowledges that the client has received the previous update.

### Power Management and Suspend

To prevent lost wakeups, the server (driver) must ensure that the `Watch` call
remains active (and hardware interrupts armed) while the system is suspended.

- **Interest Triggers** : If a change in the `interest` mask occurs while the system is suspended, the server MUST NOT complete the `Watch` call until the system wakes for another reason (e.g., a `wake_on` event or external trigger). This ensures the CPU remains asleep for non-critical updates.
- **Wake-On Triggers** : If a change in the `wake_on` mask occurs, the server MUST wake the system and complete the call immediately with a `wake_lease`.

As a result of this queuing behavior, if multiple changes occur while the
system is suspended, they may be merged into a single returned `status` table,
and intermediate state transitions may be lost.

- `interest`: The client wants to be notified if any of the fields present in this table change. If any field in `interest` changes, the method returns.
- `wake_on`: Similar to `interest`, but if a change occurs in these fields, the server will attempt to keep the system awake using the provided `lease` (or by returning a `wake_lease`) until the client acknowledges the update.
- `lease`: A power lease token used to coordinate handoff between the server and client, ensuring the system does not suspend before the client can process a critical power event.

Returns:

- `status`: The updated status table containing the fields that changed.
- `wake_lease`: An optional lease token provided if the change triggered a `wake_on` condition and the server is maintaining system state.

Errors:

- `ALREADY_BOUND`: If the source is already being watched.

#### Request

| Name | Type |
|---|---|
| `interest` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#Status` |
| `wake_on` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#Status` |
| `lease` | `https://fuchsia.dev/reference/fuchsia.power.system//https://fuchsia.dev/reference/fuchsia.power.system#LeaseToken` |

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#Source_Watch_Result` |

## **STRUCTS**

### Source_GetSpec_Response

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

| Field | Type | Description | Default |
|---|---|---|---|
| `spec` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#Spec` |   | No default |

### Source_GetStatus_Response

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

| Field | Type | Description | Default |
|---|---|---|---|
| `status` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#Status` |   | No default |

### Source_SetRole_Response

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

\<EMPTY\>

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

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

| Field | Type | Description | Default |
|---|---|---|---|
| `status` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#Status` |   | No default |
| `wake_lease` | `https://fuchsia.dev/reference/fuchsia.power.system//https://fuchsia.dev/reference/fuchsia.power.system#LeaseToken` |   | No default |

## **ENUMS**

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

Type: `uint32`

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

General errors returned by power source protocols.

<br />

| Name | Value | Description |
|---|---|---|
| ### INTERNAL | `1` | An unexpected error occurred within the driver or service. |
| ### NOT_SUPPORTED | `2` | The requested operation or field is not supported by this hardware. |
| ### INVALID_ARGS | `3` | One or more arguments provided to the method were invalid. |
| ### ALREADY_BOUND | `4` | Source is already being watched. |

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

Type: `uint32`

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

The type of power source connected to the device.

<br />

| Name | Value | Description |
|---|---|---|
| ### AC | `1` | Standard wall-plug or DC barrel-jack power. Typically uses the base [fuchsia.hardware.power.source](https://fuchsia.dev/reference/fuchsia.hardware.power.source/)/[Source](https://fuchsia.dev/reference/fuchsia.hardware.power.source/#Source) protocol. |
| ### BATTERY | `2` | Internal or external chemical battery. See [fuchsia.hardware.power.battery](https://fuchsia.dev/reference/fuchsia.hardware.power.battery/)/[Battery](https://fuchsia.dev/reference/fuchsia.hardware.power.battery/#Battery). |
| ### USB | `3` | Power supplied over a USB connection. See [fuchsia.hardware.power.usb](https://fuchsia.dev/reference/fuchsia.hardware.power.usb/)/[UsbSource](https://fuchsia.dev/reference/fuchsia.hardware.power.usb/#UsbSource). |

## **TABLES**

### Auto

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

| Ordinal | Field | Type | Description |
|---|---|---|---|

### Disconnected

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

| Ordinal | Field | Type | Description |
|---|---|---|---|

### SinkRole

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

| Ordinal | Field | Type | Description |
|---|---|---|---|
| ### 1 | `name` | `string` | Name of the source it's drawing from. |
| ### 2 | `type` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#SourceType` | What type of source it's drawing from. |

### SourceRole

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

| Ordinal | Field | Type | Description |
|---|---|---|---|

### Spec

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

Static hardware characteristics of a power source.

<br />

| Ordinal | Field | Type | Description |
|---|---|---|---|
| ### 1 | `name` | `string` | Unique name of the source (e.g., "USB-C", "Main Battery"). |
| ### 2 | `supported_roles` | `vector<https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#Role>` | The roles this source is capable of performing. |
| ### 3 | `manufacturer` | `string` | The name of the manufacturer of this hardware. |
| ### 4 | `model_name` | `string` | The model name or number assigned by the manufacturer. |
| ### 5 | `type` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#SourceType` | The category of this power entity. |

### Status

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

Dynamic status of a power source.

<br />

| Ordinal | Field | Type | Description |
|---|---|---|---|
| ### 1 | `present` | `bool` | Whether the power entity is currently physically present. |
| ### 2 | `voltage_uv` | `uint32` | The voltage at the node, in microvolts. |
| ### 3 | `current_ua` | `int32` | The current flowing at the node, in microamps. Positive means flowing out (if Source) or in (if Sink). |
| ### 4 | `current_role` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#Role` | The role the node is currently performing. |

## **UNIONS**

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

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

The role a power node plays in the system.

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `disconnected` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#Disconnected` | The node is disconnected or isolated from the power system. |
| ### 2 | `source` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#SourceRole` | The node provides energy to the common system bus. |
| ### 3 | `sink` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#SinkRole` | The node consumes or stores energy from the common bus. |
| ### 4 | `auto` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#Auto` | The hardware automatically decides the role based on physical detection. |

<br />

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

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

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#Source_GetSpec_Response` |   |
| ### 2 | `err` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#Error` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

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

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

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#Source_GetStatus_Response` |   |
| ### 2 | `err` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#Error` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

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

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

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#Source_SetRole_Response` |   |
| ### 2 | `err` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#Error` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

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

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

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#Source_Watch_Response` |   |
| ### 2 | `err` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.power.source#Error` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

## **SERVICES**

### Service

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

| Name | Type | Transport |
|---|---|---|
| [source](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.power.source/source.fidl;l=152) | `fuchsia.hardware.power.source/Source` | Channel |

<br />