Skip to content

Commit 96c9465

Browse files
committed
Basic string scanning functionality
1 parent 06f18d3 commit 96c9465

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

dbus-monitor/src/dbus_monitor.rs

+16-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,22 @@ use clap::{Parser, Subcommand};
2121

2222
fn handle_message(msg: &Message) {
2323
println!("Got message from DBus: {:?}", msg);
24-
25-
run_inputmodule_command(vec!["led-matrix", "--pattern", "all-on", "--blink-n-times", "3"]);
26-
run_inputmodule_command(vec!["led-matrix", "--brightness", "0"]);
24+
let mut iter = msg.iter_init();
25+
while let Some(arg) = iter.get_refarg() {
26+
// Extract the inner value as a string and convert it to a String
27+
if let Some(string_ref) = arg.as_str() {
28+
let string_value: String = string_ref.to_string();
29+
println!("String value: {}", string_value);
30+
31+
if string_value.contains("calendar.google.com"){
32+
run_inputmodule_command(vec!["led-matrix", "--pattern", "all-on", "--blink-n-times", "3"]);
33+
run_inputmodule_command(vec!["led-matrix", "--brightness", "0"]);
34+
}
35+
} else {
36+
println!("Not a string.");
37+
}
38+
iter.next();
39+
}
2740

2841
println!("Message handled");
2942
}

0 commit comments

Comments
 (0)