Skip to content

Commit

Permalink
Add get device by id function to manager.
Browse files Browse the repository at this point in the history
  • Loading branch information
saivert committed Apr 28, 2024
1 parent bb85549 commit 900cc26
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/backend/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,18 @@ impl PwvucontrolManager {
glib::Object::builder()
.build()
}

pub fn get_device_by_id(&self, id: u32) -> Option<PwDeviceObject> {
let devicemodel = self.imp().devicemodel.get().expect("devicemodel");
for device in devicemodel.iter::<PwDeviceObject>() {
if let Ok(device) = device {
if device.wpdevice().bound_id() == id {
return Some(device);
}
}
}
None
}
}

impl Default for PwvucontrolManager {
Expand Down

0 comments on commit 900cc26

Please sign in to comment.