use std::collections::HashMap;
use zbus::zvariant::{OwnedObjectPath, OwnedValue};
type ObjectsMap = HashMap<OwnedObjectPath, HashMap<String, HashMap<String, OwnedValue>>>;
#[zbus::proxy(
default_service = "org.bluez",
interface = "org.freedesktop.DBus.ObjectManager",
default_path = "/"
)]
pub trait ObjectManager {
fn get_managed_objects(&self) -> zbus::Result<ObjectsMap>;
#[zbus(signal)]
fn interfaces_added(
&self,
object_path: OwnedObjectPath,
interfaces: HashMap<String, HashMap<String, OwnedValue>>,
) -> zbus::Result<()>;
#[zbus(signal)]
fn interfaces_removed(
&self,
object_path: OwnedObjectPath,
interfaces: Vec<String>,
) -> zbus::Result<()>;
}
pub fn print_key_pairs(objects: &ObjectsMap) {
for (path, _interfaces) in objects.iter() {
println!("Object Path: {}", path);
}
}
pub fn print_avaiable_devices(objects: &ObjectsMap) {
for (path, _interfaces) in objects.iter() {
println!("Object Path: {}", path);
}
}