Crate alarms

Source
Expand description

Alarm management subsystem.

This subsystem serves the FIDL API fuchsia.time.alarms/Wake. To instantiate, you can use the following approach:

let proxy = client::connect_to_protocol::<ffhh::DeviceMarker>().map_err(
   |e| error!("error: {}", e)).expect("add proper error handling");
   let timer_loop = alarms::Handle::new(proxy);

From here, use the standard approach with [ServiceFs::new] to expose the discoverable FIDL endpoint and call:

let stream: fidl_fuchsia_time_alarms::WakeRequestStream = ... ;
alarms::serve(timer_loop, stream).await;
// ...

Of course, for everything to work well, your component will need appropriate capability routing. Refer to capability routing docs for those details.

Structs§

Loop
Represents a single alarm event processing loop.

Functions§

connect_to_hrtimer_async
Connects to the high resolution timer device driver.
get_stream_koid
Extracts a KOID from the undelrying channel of the provided [stream].
serve
Serves a single Wake API client.