[][src]Trait dbus::SignalArgs

pub trait SignalArgs: Default {
    const NAME: &'static str;
    const INTERFACE: &'static str;

    fn append(&self, i: &mut IterAppend);
fn get(&mut self, i: &mut Iter) -> Result<(), TypeMismatchError>; fn to_emit_message(&self, path: &Path) -> Message { ... }
fn from_message(m: &Message) -> Option<Self> { ... }
fn match_rule<'a>(
        sender: Option<&'a BusName>,
        path: Option<&'a Path>
    ) -> MatchRule<'a> { ... }
fn match_str(sender: Option<&BusName>, path: Option<&Path>) -> String { ... } }

Helper methods for structs representing a Signal

Example

Listen to InterfacesRemoved signal from org.bluez.obex.

use dbus::{Connection, BusType, SignalArgs};
use dbus::stdintf::org_freedesktop_dbus::ObjectManagerInterfacesRemoved as IR;

let c = Connection::get_private(BusType::Session).unwrap();
// Add a match for this signal
let mstr = IR::match_str(Some(&"org.bluez.obex".into()), None);
c.add_match(&mstr).unwrap();

// Wait for the signal to arrive.
for msg in c.incoming(1000) {
    if let Some(ir) = IR::from_message(&msg) {
        println!("Interfaces {:?} have been removed from bluez on path {}.", ir.interfaces, ir.object);
    }
}

Associated Constants

const NAME: &'static str

D-Bus name of signal

const INTERFACE: &'static str

D-Bus name of interface this signal belongs to

Loading content...

Required methods

fn append(&self, i: &mut IterAppend)

Low-level method for appending this struct to a message.

You're more likely to use one of the more high level functions.

fn get(&mut self, i: &mut Iter) -> Result<(), TypeMismatchError>

Low-level method for getting arguments from a message.

You're more likely to use one of the more high level functions.

Loading content...

Provided methods

fn to_emit_message(&self, path: &Path) -> Message

Returns a message that emits the signal.

fn from_message(m: &Message) -> Option<Self>

If the message is a signal of the correct type, return its arguments, otherwise return None.

This does not check sender and path of the message, which is likely relevant to you as well.

fn match_rule<'a>(
    sender: Option<&'a BusName>,
    path: Option<&'a Path>
) -> MatchRule<'a>

Returns a match rule matching this signal.

If sender and/or path is None, matches all senders and/or paths.

fn match_str(sender: Option<&BusName>, path: Option<&Path>) -> String

Returns a string that can be sent to Connection::add_match.

If sender and/or path is None, matches all senders and/or paths.

Loading content...

Implementors

impl SignalArgs for ObjectManagerInterfacesAdded[src]

impl SignalArgs for ObjectManagerInterfacesRemoved[src]

impl SignalArgs for PropertiesPropertiesChanged[src]

Loading content...