Skip to content

Commit

Permalink
feat(DBus): add ObjectManager instance to /org/shadowblip/Performance
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadowApex committed Dec 11, 2024
1 parent 58a21a3 commit f04b6fa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use constants::PREFIX;
use simple_logger::SimpleLogger;
use std::{error::Error, future::pending};
use zbus::fdo::ObjectManager;
use zbus::Connection;

use crate::constants::{BUS_NAME, CPU_PATH, GPU_PATH};
Expand All @@ -22,6 +24,14 @@ async fn main() -> Result<(), Box<dyn Error>> {
// Configure the connection
let connection = Connection::system().await?;

// Create an ObjectManager to signal when objects are added/removed
let object_manager = ObjectManager {};
let object_manager_path = String::from(PREFIX);
connection
.object_server()
.at(object_manager_path, object_manager)
.await?;

// Generate CPU objects to serve
connection.object_server().at(CPU_PATH, cpu).await?;
for core in cores {
Expand Down

0 comments on commit f04b6fa

Please sign in to comment.