Workaround for the Error values

This commit is contained in:
beffroi 2023-04-04 16:56:27 +02:00
parent 94c22474ad
commit 355402ea08
2 changed files with 14 additions and 7 deletions

View File

@ -43,7 +43,7 @@ fn main() {
}
println!("{:?}", args);
let proj = Arc::new(Mutex::new(projector::Projector::new(
"127.0.0.1:8080",
"192.168.0.8", //"127.0.0.1:8080",
"admin1",
"panasonic",
)));
@ -64,14 +64,22 @@ fn main() {
vec![
(
3,
Box::new(move || {
proj1.lock().unwrap().shutter_on().unwrap();
Box::new(move || match proj1.lock().unwrap().shutter_off() {
Ok(_) => println!("Receiving SHUTTER OFF message"),
Err(_e) => {
println!("Error receiving SHUTTER OFF message");
"Error".to_string();
}
}),
),
(
4,
Box::new(move || {
proj2.lock().unwrap().shutter_on().unwrap();
Box::new(move || match proj2.lock().unwrap().shutter_on() {
Ok(_) => println!("Receiving SHUTTER ON message"),
Err(_e) => {
println!("Error receiving SHUTTER ON message");
"Error".to_string();
} // proj2.lock().unwrap().unwrap_or((|| {})());
}),
),
],

View File

@ -50,12 +50,11 @@ pub fn connect_loop_with_callback(
move |_timestamp, message, _| {
// Handle MIDI messages here
let (command, note, _value) = (message[0], message[1], message[2]);
println!("Received MIDI message: {:?}", message);
//println!("Received MIDI message: {:?}", message);
match (command, note) {
(144, 3..=4) => {
for (id, f) in calls.iter() {
if note == *id {
println!("match");
f();
}
let mut list = vec![];