pub struct SourceProxy { /* private fields */ }Implementations§
Source§impl SourceProxy
impl SourceProxy
Sourcepub fn new(channel: AsyncChannel) -> Self
pub fn new(channel: AsyncChannel) -> Self
Create a new Proxy for fuchsia.hardware.power.source/Source.
Sourcepub fn take_event_stream(&self) -> SourceEventStream
pub fn take_event_stream(&self) -> SourceEventStream
Get a Stream of events from the remote end of the protocol.
§Panics
Panics if the event stream was already taken.
Sourcepub fn get_spec(
&self,
) -> QueryResponseFut<SourceGetSpecResult, DefaultFuchsiaResourceDialect>
pub fn get_spec( &self, ) -> QueryResponseFut<SourceGetSpecResult, DefaultFuchsiaResourceDialect>
Returns static hardware characteristics that do not change during operation.
Sourcepub fn get_status(
&self,
) -> QueryResponseFut<SourceGetStatusResult, DefaultFuchsiaResourceDialect>
pub fn get_status( &self, ) -> QueryResponseFut<SourceGetStatusResult, DefaultFuchsiaResourceDialect>
Returns dynamic status of the source immediately.
Sourcepub fn set_role(
&self,
role: &Role,
) -> QueryResponseFut<SourceSetRoleResult, DefaultFuchsiaResourceDialect>
pub fn set_role( &self, role: &Role, ) -> QueryResponseFut<SourceSetRoleResult, DefaultFuchsiaResourceDialect>
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.
Sourcepub fn watch(
&self,
interest: &Status,
wake_on: &Status,
lease: Option<EventPair>,
) -> QueryResponseFut<(Status, Option<EventPair>), DefaultFuchsiaResourceDialect>
pub fn watch( &self, interest: &Status, wake_on: &Status, lease: Option<EventPair>, ) -> QueryResponseFut<(Status, Option<EventPair>), DefaultFuchsiaResourceDialect>
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
interestmask occurs while the system is suspended, the server MUST NOT complete theWatchcall until the system wakes for another reason (e.g., awake_onevent or external trigger). This ensures the CPU remains asleep for non-critical updates. - Wake-On Triggers: If a change in the
wake_onmask occurs, the server MUST wake the system and complete the call immediately with awake_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 ininterestchanges, the method returns.wake_on: Similar tointerest, but if a change occurs in these fields, the server will attempt to keep the system awake using the providedlease(or by returning awake_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 awake_oncondition and the server is maintaining system state.
Trait Implementations§
Source§impl Clone for SourceProxy
impl Clone for SourceProxy
Source§fn clone(&self) -> SourceProxy
fn clone(&self) -> SourceProxy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SourceProxy
impl Debug for SourceProxy
Source§impl Proxy for SourceProxy
impl Proxy for SourceProxy
Source§type Protocol = SourceMarker
type Protocol = SourceMarker
Proxy controls.Source§fn from_channel(inner: AsyncChannel) -> Self
fn from_channel(inner: AsyncChannel) -> Self
Source§fn into_channel(self) -> Result<AsyncChannel, Self>
fn into_channel(self) -> Result<AsyncChannel, Self>
Source§fn as_channel(&self) -> &AsyncChannel
fn as_channel(&self) -> &AsyncChannel
Source§fn into_client_end(self) -> Result<ClientEnd<Self::Protocol>, Self>
fn into_client_end(self) -> Result<ClientEnd<Self::Protocol>, Self>
Source§fn on_closed(&self) -> OnSignals<'_, Unowned<'_, NullableHandle>>
fn on_closed(&self) -> OnSignals<'_, Unowned<'_, NullableHandle>>
PEER_CLOSED signal.