sl4f_lib/location/
emergency_provider_facade.rs1use anyhow::{Context, Error};
6use fidl_fuchsia_location_position::{EmergencyProviderMarker, EmergencyProviderProxy, Position};
7use fuchsia_component::client::connect_to_protocol;
8
9#[derive(Debug)]
10pub struct EmergencyProviderFacade {
11 provider: EmergencyProviderProxy,
12}
13
14impl EmergencyProviderFacade {
15 pub fn new() -> Result<EmergencyProviderFacade, Error> {
16 Ok(EmergencyProviderFacade { provider: connect_to_protocol::<EmergencyProviderMarker>()? })
17 }
18
19 pub async fn get_current(&self) -> Result<Position, Error> {
21 self.provider
22 .get_current()
23 .await
24 .context("fidl error")?
25 .map_err(|e| format_err!("service error: {:?}", e))
26 }
27}