Module ashpd::desktop::location[][src]

Expand description

Query the user’s GPS location.

Examples

use ashpd::desktop::location::{Accuracy, LocationProxy};
use futures::TryFutureExt;

async fn run() -> Result<(), ashpd::Error> {
    let connection = zbus::azync::Connection::new_session().await?;
    let proxy = LocationProxy::new(&connection).await?;

    let session = proxy.create_session(None, None, Some(Accuracy::Street)).await?;

    let (_, location) = futures::try_join!(
        proxy.start(&session, Default::default()).into_future(),
        proxy.receive_location_updated().into_future()
    )?;

    println!("{}", location.accuracy());
    println!("{}", location.longitude());
    println!("{}", location.latitude());
    session.close().await?;

    Ok(())
}

Structs

Location

The response received on a location_updated signal.

LocationProxy

The interface lets sandboxed applications query basic information about the location.

Enums

Accuracy

The accuracy of the location.