sl4f_lib/location/
emergency_provider_facade.rsuse anyhow::{Context, Error};
use fidl_fuchsia_location_position::{EmergencyProviderMarker, EmergencyProviderProxy, Position};
use fuchsia_component::client::connect_to_protocol;
#[derive(Debug)]
pub struct EmergencyProviderFacade {
provider: EmergencyProviderProxy,
}
impl EmergencyProviderFacade {
pub fn new() -> Result<EmergencyProviderFacade, Error> {
Ok(EmergencyProviderFacade { provider: connect_to_protocol::<EmergencyProviderMarker>()? })
}
pub async fn get_current(&self) -> Result<Position, Error> {
self.provider
.get_current()
.await
.context("fidl error")?
.map_err(|e| format_err!("service error: {:?}", e))
}
}