pub struct DeviceSynchronousProxy { /* private fields */ }
Implementations§
Source§impl DeviceSynchronousProxy
impl DeviceSynchronousProxy
pub fn new(channel: Channel) -> Self
pub fn into_channel(self) -> Channel
Sourcepub fn wait_for_event(
&self,
deadline: MonotonicInstant,
) -> Result<DeviceEvent, Error>
pub fn wait_for_event( &self, deadline: MonotonicInstant, ) -> Result<DeviceEvent, Error>
Waits until an event arrives and returns it. It is safe for other threads to make concurrent requests while waiting for an event.
Sourcepub fn start(
&self,
id: u64,
resolution: &Resolution,
ticks: u64,
___deadline: MonotonicInstant,
) -> Result<DeviceStartResult, Error>
pub fn start( &self, id: u64, resolution: &Resolution, ticks: u64, ___deadline: MonotonicInstant, ) -> Result<DeviceStartResult, Error>
Start the timer id
to expire after ticks
.
If ticks
is 0 then the timer will expire in 0 ticks (immediately).
If the timer id
was already started, then the previous Start
is canceled and the driver
will restart the timer. Note that this may race with the expiration of the previous timer,
for instance the notification process may be already started and a new Start
call won’t
be able to stop a notification that is already in flight.
If the specified id
is invalid, then this call will return INVALID_ARGS
.
If the specified resolution
is not supported per the resolutions
provided by
GetProperties
, then this call will return INVALID_ARGS
.
If the specified ticks
is beyond the range supported for the timer as provided by
GetProperties
, then this call will return INVALID_ARGS
.
If the driver encounters an internal error, then this call will return INTERNAL_ERROR
.
Sourcepub fn stop(
&self,
id: u64,
___deadline: MonotonicInstant,
) -> Result<DeviceStopResult, Error>
pub fn stop( &self, id: u64, ___deadline: MonotonicInstant, ) -> Result<DeviceStopResult, Error>
Stops the timer id
.
Note that this may race with the expiration of the timer, for instance notification via
an event set with SetEvent
may be already in flight.
If the specified id
is invalid, then this call will return INVALID_ARGS
.
If the driver encounters an internal error, then this call will return INTERNAL_ERROR
.
Sourcepub fn get_ticks_left(
&self,
id: u64,
___deadline: MonotonicInstant,
) -> Result<DeviceGetTicksLeftResult, Error>
pub fn get_ticks_left( &self, id: u64, ___deadline: MonotonicInstant, ) -> Result<DeviceGetTicksLeftResult, Error>
Get the current time in ticks left in timer id
until expiration.
If the specified id
is invalid, then this call will return INVALID_ARGS
.
Sourcepub fn set_event(
&self,
id: u64,
event: Event,
___deadline: MonotonicInstant,
) -> Result<DeviceSetEventResult, Error>
pub fn set_event( &self, id: u64, event: Event, ___deadline: MonotonicInstant, ) -> Result<DeviceSetEventResult, Error>
Sets a Zircon Event to be notified of the timer expiration.
The timer expiration will be notified via the ZX_EVENT_SIGNALED signal.
The client is responsible for clearing the ZX_EVENT_SIGNALED signal.
Any previously event set for the specific id
is replaced. Note that this may race with
the event signaling from the expiration of a timer already started.
To guarantee that an event is delivered upon timer expiration, this method must be
called before calling Start
.
If the specified id
is invalid, then this call will return INVALID_ARGS
.
If this method is not supported for the given id
, then this call will return
NOT_SUPPORTED
.
If the driver encounters an internal error, then this call will return INTERNAL_ERROR
.
Sourcepub fn start_and_wait(
&self,
id: u64,
resolution: &Resolution,
ticks: u64,
setup_event: Event,
___deadline: MonotonicInstant,
) -> Result<DeviceStartAndWaitResult, Error>
pub fn start_and_wait( &self, id: u64, resolution: &Resolution, ticks: u64, setup_event: Event, ___deadline: MonotonicInstant, ) -> Result<DeviceStartAndWaitResult, Error>
Start the timer id
to expire after ticks
and waits until the timer expires with
support for preventing suspension via the Power Framework.
The driver will signal the setup_event
event once the timer has been setup using the
ZX_EVENT_SIGNALED signal. This allows a client to know that it is safe to allow the
system to suspend. The client is responsible for clearing this event.
The driver will not respond to this call (hang) until the timer has triggered.
Calling Stop
on the timer will abort this call and return CANCELED
. Note that this
may race with the expiration of the timer.
A driver supporting this call must be able to get a lease on a power element that keeps
the system from suspending. This lease is returned to the client via the keep_alive
LeaseToken channel field. When keep_alive
is closed, then the driver lease keeping the
system from suspending will be dropped. Hence, to guarantee that the system is not
suspended by the Power Framework a client must either keep this keep_alive
token for
as long as the system needs to not suspend, or a client must get its own lease from the
Power Framework to prevent suspension before it drops keep_alive
.
If the specified id
is invalid, then this call will return INVALID_ARGS
.
If this method is not supported for the given id
, then this call will return
NOT_SUPPORTED
.
If the driver does not have a keep_alive
token to provide to the client, then this
call will return BAD_STATE
.
If the driver encounters an internal error, then this call will return INTERNAL_ERROR
.
Sourcepub fn start_and_wait2(
&self,
id: u64,
resolution: &Resolution,
ticks: u64,
setup_keep_alive: EventPair,
___deadline: MonotonicInstant,
) -> Result<DeviceStartAndWait2Result, Error>
pub fn start_and_wait2( &self, id: u64, resolution: &Resolution, ticks: u64, setup_keep_alive: EventPair, ___deadline: MonotonicInstant, ) -> Result<DeviceStartAndWait2Result, Error>
Start timer id
and wait for it to expire after ticks
ticks.
The driver will not respond to this call (hang) until the timer has triggered.
Calling Stop
on the timer will abort this call and return CANCELED
. Note that this
may race with the expiration of the timer.
This method keeps the system awake (prevents suspension) while the timer is setup using the
mandatory passed-in setup_keep_alive
LeaseToken
.
When the timer expires this method returns a second expiration_keep_alive
LeaseToken
to prevent suspension at the time of expiration.
These keep alive wake lease tokens are provided by the Power Framework’s System Activity
Governor. A driver supporting this call must be able to get expiration_keep_alive
from
System Activity Governor.
When expiration_keep_alive
is closed, then this driver created wake lease keeping the
system from suspending at the time of the timer expiration is dropped. Hence, to guarantee
that the system is not suspended by the Power Framework a client must either keep this
expiration_keep_alive
for as long as the system needs to stay awake, or a client must
get its own wake lease from the Power Framework before it drops expiration_keep_alive
to
prevent suspension.
Errors:
- INVALID_ARGS: The specified
id
is invalid. - NOT_SUPPORTED: This method is not supported for the given
id
. - BAD_STATE: The driver is in a bad state, for instance it does not have an
expiration_keep_alive
token to provide to the client. - INTERNAL_ERROR: The driver encountered an internal error.
Sourcepub fn get_properties(
&self,
___deadline: MonotonicInstant,
) -> Result<Properties, Error>
pub fn get_properties( &self, ___deadline: MonotonicInstant, ) -> Result<Properties, Error>
Get driver properties.
Trait Implementations§
Source§impl Debug for DeviceSynchronousProxy
impl Debug for DeviceSynchronousProxy
Source§impl SynchronousProxy for DeviceSynchronousProxy
impl SynchronousProxy for DeviceSynchronousProxy
Source§type Proxy = DeviceProxy
type Proxy = DeviceProxy
Source§type Protocol = DeviceMarker
type Protocol = DeviceMarker
Proxy
controls.