This commit contains autogenerated telepathy DBUS code and the output of `cargo new telepathy-delta`. It's pretty chill.
78 lines
2.5 KiB
Rust
78 lines
2.5 KiB
Rust
// This code was autogenerated with `dbus-codegen-rust --file telepathy-spec/spec/Call_Interface_Mute.xml -i org.freedesktop.Telepathy -o src/telepathy/call_interface_mute.rs`, see https://github.com/diwic/dbus-rs
|
|
use dbus;
|
|
use dbus::arg;
|
|
use dbus::tree;
|
|
|
|
pub trait Call1InterfaceMute {
|
|
fn request_muted(&self, muted: bool) -> Result<(), tree::MethodErr>;
|
|
fn local_mute_state(&self) -> Result<u32, tree::MethodErr>;
|
|
}
|
|
|
|
pub fn call1_interface_mute_server<F, T, D>(
|
|
factory: &tree::Factory<tree::MTFn<D>, D>,
|
|
data: D::Interface,
|
|
f: F,
|
|
) -> tree::Interface<tree::MTFn<D>, D>
|
|
where
|
|
D: tree::DataType,
|
|
D::Method: Default,
|
|
D::Property: Default,
|
|
D::Signal: Default,
|
|
T: Call1InterfaceMute,
|
|
F: 'static + for<'z> Fn(&'z tree::MethodInfo<tree::MTFn<D>, D>) -> &'z T,
|
|
{
|
|
let i = factory.interface("org.freedesktop.Telepathy.Call1.Interface.Mute", data);
|
|
let f = ::std::sync::Arc::new(f);
|
|
let fclone = f.clone();
|
|
let h = move |minfo: &tree::MethodInfo<tree::MTFn<D>, D>| {
|
|
let mut i = minfo.msg.iter_init();
|
|
let muted: bool = i.read()?;
|
|
let d = fclone(minfo);
|
|
d.request_muted(muted)?;
|
|
let rm = minfo.msg.method_return();
|
|
Ok(vec![rm])
|
|
};
|
|
let m = factory.method("RequestMuted", Default::default(), h);
|
|
let m = m.in_arg(("Muted", "b"));
|
|
let i = i.add_m(m);
|
|
|
|
let p = factory.property::<u32, _>("LocalMuteState", Default::default());
|
|
let p = p.access(tree::Access::Read);
|
|
let fclone = f.clone();
|
|
let p = p.on_get(move |a, pinfo| {
|
|
let minfo = pinfo.to_method_info();
|
|
let d = fclone(&minfo);
|
|
a.append(d.local_mute_state()?);
|
|
Ok(())
|
|
});
|
|
let i = i.add_p(p);
|
|
let s = factory.signal("MuteStateChanged", Default::default());
|
|
let s = s.arg(("MuteState", "u"));
|
|
let i = i.add_s(s);
|
|
i
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub struct Call1InterfaceMuteMuteStateChanged {
|
|
pub mute_state: u32,
|
|
}
|
|
|
|
impl arg::AppendAll for Call1InterfaceMuteMuteStateChanged {
|
|
fn append(&self, i: &mut arg::IterAppend) {
|
|
arg::RefArg::append(&self.mute_state, i);
|
|
}
|
|
}
|
|
|
|
impl arg::ReadAll for Call1InterfaceMuteMuteStateChanged {
|
|
fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
|
|
Ok(Call1InterfaceMuteMuteStateChanged {
|
|
mute_state: i.read()?,
|
|
})
|
|
}
|
|
}
|
|
|
|
impl dbus::message::SignalArgs for Call1InterfaceMuteMuteStateChanged {
|
|
const NAME: &'static str = "MuteStateChanged";
|
|
const INTERFACE: &'static str = "org.freedesktop.Telepathy.Call1.Interface.Mute";
|
|
}
|