pub enum SourceRequest {
GetSpec {
responder: SourceGetSpecResponder,
},
GetStatus {
responder: SourceGetStatusResponder,
},
SetRole {
role: Role,
responder: SourceSetRoleResponder,
},
Watch {
interest: Status,
wake_on: Status,
lease: Option<EventPair>,
responder: SourceWatchResponder,
},
#[non_exhaustive] _UnknownMethod {
ordinal: u64,
control_handle: SourceControlHandle,
method_type: MethodType,
},
}Variants§
GetSpec
Returns static hardware characteristics that do not change during operation.
Fields
responder: SourceGetSpecResponderGetStatus
Returns dynamic status of the source immediately.
Fields
responder: SourceGetStatusResponderSetRole
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.
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
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.
#[non_exhaustive]_UnknownMethod
An interaction was received which does not match any known method.
Fields
This variant is marked as non-exhaustive
control_handle: SourceControlHandlemethod_type: MethodTypeImplementations§
Source§impl SourceRequest
impl SourceRequest
pub fn into_get_spec(self) -> Option<SourceGetSpecResponder>
pub fn into_get_status(self) -> Option<SourceGetStatusResponder>
pub fn into_set_role(self) -> Option<(Role, SourceSetRoleResponder)>
pub fn into_watch( self, ) -> Option<(Status, Status, Option<EventPair>, SourceWatchResponder)>
Sourcepub fn method_name(&self) -> &'static str
pub fn method_name(&self) -> &'static str
Name of the method defined in FIDL