[]Struct gio::DBusProxy

pub struct DBusProxy(_, _);

DBusProxy is a base class used for proxies to access a D-Bus interface on a remote object. A DBusProxy can be constructed for both well-known and unique names.

By default, DBusProxy will cache all properties (and listen to changes) of the remote object, and proxy all signals that get emitted. This behaviour can be changed by passing suitable DBusProxyFlags when the proxy is created. If the proxy is for a well-known name, the property cache is flushed when the name owner vanishes and reloaded when a name owner appears.

The unique name owner of the proxy's name is tracked and can be read from DBusProxy:g-name-owner. Connect to the gobject::Object::notify signal to get notified of changes. Additionally, only signals and property changes emitted from the current name owner are considered and calls are always sent to the current name owner. This avoids a number of race conditions when the name is lost by one owner and claimed by another. However, if no name owner currently exists, then calls will be sent to the well-known name which may result in the message bus launching an owner (unless DBusProxyFlags::DoNotAutoStart is set).

The generic DBusProxy::g-properties-changed and DBusProxy::g-signal signals are not very convenient to work with. Therefore, the recommended way of working with proxies is to subclass DBusProxy, and have more natural properties and signals in your derived class. This [example][gdbus-example-gdbus-codegen] shows how this can easily be done using the [gdbus-codegen][gdbus-codegen] tool.

A DBusProxy instance can be used from multiple threads but note that all signals (e.g. DBusProxy::g-signal, DBusProxy::g-properties-changed and gobject::Object::notify) are emitted in the [thread-default main context][g-main-context-push-thread-default] of the thread where the instance was constructed.

An example using a proxy for a well-known name can be found in gdbus-example-watch-proxy.c

Implements

DBusProxyExt, glib::object::ObjectExt, DBusInterfaceExt

Implementations

impl DBusProxy[src]

pub fn new_for_bus_sync<P: IsA<Cancellable>>(
    bus_type: BusType,
    flags: DBusProxyFlags,
    info: Option<&DBusInterfaceInfo>,
    name: &str,
    object_path: &str,
    interface_name: &str,
    cancellable: Option<&P>
) -> Result<DBusProxy, Error>
[src]

Like DBusProxy::new_sync but takes a BusType instead of a DBusConnection.

DBusProxy is used in this [example][gdbus-wellknown-proxy].

bus_type

A BusType.

flags

Flags used when constructing the proxy.

info

A DBusInterfaceInfo specifying the minimal interface that proxy conforms to or None.

name

A bus name (well-known or unique).

object_path

An object path.

interface_name

A D-Bus interface name.

cancellable

A Cancellable or None.

Returns

A DBusProxy or None if error is set. Free with gobject::ObjectExt::unref.

pub fn new_sync<P: IsA<Cancellable>>(
    connection: &DBusConnection,
    flags: DBusProxyFlags,
    info: Option<&DBusInterfaceInfo>,
    name: Option<&str>,
    object_path: &str,
    interface_name: &str,
    cancellable: Option<&P>
) -> Result<DBusProxy, Error>
[src]

Creates a proxy for accessing interface_name on the remote object at object_path owned by name at connection and synchronously loads D-Bus properties unless the DBusProxyFlags::DoNotLoadProperties flag is used.

If the DBusProxyFlags::DoNotConnectSignals flag is not set, also sets up match rules for signals. Connect to the DBusProxy::g-signal signal to handle signals from the remote object.

If both DBusProxyFlags::DoNotLoadProperties and DBusProxyFlags::DoNotConnectSignals are set, this constructor is guaranteed to return immediately without blocking.

If name is a well-known name and the DBusProxyFlags::DoNotAutoStart and DBusProxyFlags::DoNotAutoStartAtConstruction flags aren't set and no name owner currently exists, the message bus will be requested to launch a name owner for the name.

This is a synchronous failable constructor. See DBusProxy::new and DBusProxy::new_finish for the asynchronous version.

DBusProxy is used in this [example][gdbus-wellknown-proxy].

connection

A DBusConnection.

flags

Flags used when constructing the proxy.

info

A DBusInterfaceInfo specifying the minimal interface that proxy conforms to or None.

name

A bus name (well-known or unique) or None if connection is not a message bus connection.

object_path

An object path.

interface_name

A D-Bus interface name.

cancellable

A Cancellable or None.

Returns

A DBusProxy or None if error is set. Free with gobject::ObjectExt::unref.

pub fn new<P: IsA<Cancellable>, Q: FnOnce(Result<DBusProxy, Error>) + Send + 'static>(
    connection: &DBusConnection,
    flags: DBusProxyFlags,
    info: Option<&DBusInterfaceInfo>,
    name: Option<&str>,
    object_path: &str,
    interface_name: &str,
    cancellable: Option<&P>,
    callback: Q
)
[src]

Creates a proxy for accessing interface_name on the remote object at object_path owned by name at connection and asynchronously loads D-Bus properties unless the DBusProxyFlags::DoNotLoadProperties flag is used. Connect to the DBusProxy::g-properties-changed signal to get notified about property changes.

If the DBusProxyFlags::DoNotConnectSignals flag is not set, also sets up match rules for signals. Connect to the DBusProxy::g-signal signal to handle signals from the remote object.

If both DBusProxyFlags::DoNotLoadProperties and DBusProxyFlags::DoNotConnectSignals are set, this constructor is guaranteed to complete immediately without blocking.

If name is a well-known name and the DBusProxyFlags::DoNotAutoStart and DBusProxyFlags::DoNotAutoStartAtConstruction flags aren't set and no name owner currently exists, the message bus will be requested to launch a name owner for the name.

This is a failable asynchronous constructor - when the proxy is ready, callback will be invoked and you can use DBusProxy::new_finish to get the result.

See DBusProxy::new_sync and for a synchronous version of this constructor.

DBusProxy is used in this [example][gdbus-wellknown-proxy].

connection

A DBusConnection.

flags

Flags used when constructing the proxy.

info

A DBusInterfaceInfo specifying the minimal interface that proxy conforms to or None.

name

A bus name (well-known or unique) or None if connection is not a message bus connection.

object_path

An object path.

interface_name

A D-Bus interface name.

cancellable

A Cancellable or None.

callback

Callback function to invoke when the proxy is ready.

user_data

User data to pass to callback.

pub fn new_future(
    connection: &DBusConnection,
    flags: DBusProxyFlags,
    info: Option<&DBusInterfaceInfo>,
    name: Option<&str>,
    object_path: &str,
    interface_name: &str
) -> Pin<Box_<dyn Future<Output = Result<DBusProxy, Error>> + 'static>>
[src]

pub fn new_for_bus<P: IsA<Cancellable>, Q: FnOnce(Result<DBusProxy, Error>) + Send + 'static>(
    bus_type: BusType,
    flags: DBusProxyFlags,
    info: Option<&DBusInterfaceInfo>,
    name: &str,
    object_path: &str,
    interface_name: &str,
    cancellable: Option<&P>,
    callback: Q
)
[src]

Like DBusProxy::new but takes a BusType instead of a DBusConnection.

DBusProxy is used in this [example][gdbus-wellknown-proxy].

bus_type

A BusType.

flags

Flags used when constructing the proxy.

info

A DBusInterfaceInfo specifying the minimal interface that proxy conforms to or None.

name

A bus name (well-known or unique).

object_path

An object path.

interface_name

A D-Bus interface name.

cancellable

A Cancellable or None.

callback

Callback function to invoke when the proxy is ready.

user_data

User data to pass to callback.

pub fn new_for_bus_future(
    bus_type: BusType,
    flags: DBusProxyFlags,
    info: Option<&DBusInterfaceInfo>,
    name: &str,
    object_path: &str,
    interface_name: &str
) -> Pin<Box_<dyn Future<Output = Result<DBusProxy, Error>> + 'static>>
[src]

Trait Implementations

impl Clone for DBusProxy

impl Debug for DBusProxy

impl Display for DBusProxy[src]

impl Eq for DBusProxy

impl Hash for DBusProxy

impl IsA<DBusInterface> for DBusProxy

impl Ord for DBusProxy

impl<T: ObjectType> PartialEq<T> for DBusProxy

impl<T: ObjectType> PartialOrd<T> for DBusProxy

impl StaticType for DBusProxy

Auto Trait Implementations

impl RefUnwindSafe for DBusProxy

impl !Send for DBusProxy

impl !Sync for DBusProxy

impl Unpin for DBusProxy

impl UnwindSafe for DBusProxy

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 

impl<T> Cast for T where
    T: ObjectType, 

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType, 

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.