| <link rel="stylesheet" href="../style.css" /> |
| |
| [TOC] |
| # fuchsia.power.clientlevel |
| |
| <div class="fidl-version-div"><span class="fidl-attribute fidl-version">Added: 7</span></div> |
| |
| ## **PROTOCOLS** |
| |
| ## Connector {#Connector} |
| *Defined in [fuchsia.power.clientlevel/clientlevel.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.clientlevel/clientlevel.fidl;l=22)* |
| <p>Allows a client to connect a <a class='link' href='#Watcher'>Watcher</a> to the power level of a given |
| <a class='link' href='#ClientType'>ClientType</a>.</p> |
| |
| ### Connect {#Connector.Connect} |
| |
| <p>Connects a <a class='link' href='#Watcher'>Watcher</a> to the power level of the specified |
| <a class='link' href='#ClientType'>ClientType</a>.</p> |
| <p>A client may call this method and begin using the <a class='link' href='#Watcher'>Watcher</a> client |
| endpoint immediately.</p> |
| <p>If a power configuration does not exist for the provided <code>client_type</code>, |
| then the request will fail. On failure, both the <code>watcher</code> server |
| endpoint as well as the current <code>Connector</code> connection will be |
| terminated.</p> |
| <ul> |
| <li> |
| <p><code>client_type</code> specifies to which <a class='link' href='#ClientType'>ClientType</a> power level that |
| <code>watcher</code> should be connected. The value is valid iff a power |
| configuration exists for the provided <code>client_type</code>.</p> |
| </li> |
| <li> |
| <p><code>watcher</code> is the server endpoint of a <a class='link' href='#Watcher'>Watcher</a> channel that will be |
| connected to the <a class='link' href='#ClientType'>ClientType</a> power level.</p> |
| </li> |
| </ul> |
| |
| #### Request {#Connector.Connect_Request} |
| |
| <table> |
| <tr><th>Name</th><th>Type</th></tr> |
| <tr> |
| <td><code>client_type</code></td> |
| <td> |
| <code><a class='link' href='#ClientType'>ClientType</a></code> |
| </td> |
| </tr> |
| <tr> |
| <td><code>watcher</code></td> |
| <td> |
| <code>server_end<<a class='link' href='#Watcher'>Watcher</a>></code> |
| </td> |
| </tr> |
| </table> |
| |
| |
| ## 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)* |
| <p>Allows a client to watch for changes to the power level of a given |
| <a class='link' href='#ClientType'>ClientType</a>.</p> |
| <p>This protocol cannot be connected to the service directly. Instead, the |
| server endpoint of a <code>Watcher</code> channel must first be connected to the power |
| level of the desired <a class='link' href='#ClientType'>ClientType</a> using the <a class='link' href='#Connector.Connect'>Connector.Connect</a> method. |
| The client endpoint of a <code>Watcher</code> channel is only useful after it has been |
| connected in this way.</p> |
| |
| ### Watch {#Watcher.Watch} |
| |
| <p>Watches for changes to the power level of the connected <a class='link' href='#ClientType'>ClientType</a>.</p> |
| <p>The power level for a given <a class='link' href='#ClientType'>ClientType</a> is determined according to |
| the power configuration for that <a class='link' href='#ClientType'>ClientType</a>. See the |
| <a href="/src/power/power-manager/system_power_mode_config/README.md">README.md</a> |
| for more details.</p> |
| <p>On a given connection, the first call will return immediately with the |
| current power level for the connected <a class='link' href='#ClientType'>ClientType</a>. Subsequent <code>Watch</code> |
| requests will only return a new <code>level</code> if the power level of the |
| connected <a class='link' href='#ClientType'>ClientType</a> has changed. This follows the <a href="https://fuchsia.dev/fuchsia-src/concepts/api/fidl#hanging-get">hanging |
| get</a> |
| pattern.</p> |
| <ul> |
| <li><code>level</code> is an unsigned integer representing the power level of the |
| connected <a class='link' href='#ClientType'>ClientType</a>.</li> |
| </ul> |
| |
| #### Request {#Watcher.Watch_Request} |
| |
| <EMPTY> |
| |
| |
| #### Response {#Watcher.Watch_Response} |
| |
| <table> |
| <tr><th>Name</th><th>Type</th></tr> |
| <tr> |
| <td><code>level</code></td> |
| <td> |
| <code>uint64</code> |
| </td> |
| </tr> |
| </table> |
| |
| |
| |
| ## **ENUMS** |
| |
| ### ClientType [flexible](/fuchsia-src/reference/fidl/language/language.md#strict-vs-flexible){:.fidl-attribute} {#ClientType data-text="ClientType"} |
| Type: <code>uint32</code> |
| |
| *Defined in [fuchsia.power.clientlevel/clientlevel.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.power.clientlevel/clientlevel.fidl;l=15)* |
| <p>A value that represents the type of client using the protocol.</p> |
| <p><code>ClientType</code> is used as a parameter for:</p> |
| <ol> |
| <li><a class='link' href='#Connector.Connect'>Connector.Connect</a> to connect a <a class='link' href='#Watcher'>Watcher</a> to the power level of |
| the specified client type</li> |
| <li><a class='link' href='../fuchsia.power.systemmode/'>fuchsia.power.systemmode</a>/<a class='link' href='../fuchsia.power.systemmode/#ClientConfigurator.Get'>ClientConfigurator.Get</a> and |
| <a class='link' href='../fuchsia.power.systemmode/'>fuchsia.power.systemmode</a>/<a class='link' href='../fuchsia.power.systemmode/#ClientConfigurator.Set'>ClientConfigurator.Set</a> to update the power |
| configuration of the specified client type</li> |
| </ol> |
| |
| <table> |
| <tr><th>Name</th><th>Value</th><th>Description</th></tr> |
| <tr id="ClientType.WLAN"> |
| <td><h3 id="ClientType.WLAN" class="add-link hide-from-toc">WLAN</h3></td> |
| <td><code>1</code></td> |
| <td></td> |
| </tr> |
| </table> |
| |
| |
| |
| |
| |