use dbus_async::DBus;
use dbus_message_parser::message::Message;
use futures::{channel::mpsc::channel, stream::StreamExt};
use std::convert::TryInto;
#[tokio::main]
async fn main() {
let (dbus, _connection_handle) = DBus::session(true, true)
.await
.expect("failed to get the DBus object");
let object_path = "/object/path/test".try_into().unwrap();
let (sender, mut receiver) = channel::<Message>(1024);
if let Err(e) = dbus.add_method_call(object_path, sender) {
panic!("Cannot add path: {:?}", e);
}
while let Some(msg) = receiver.next().await {
println!("{:?}", msg);
}
}