This commit is contained in:
2025-01-16 22:24:17 +01:00
parent 05b4f35d52
commit 34a23ea200
2 changed files with 7 additions and 4 deletions

View File

@@ -23,11 +23,15 @@ pub fn read_messages(mut request: curl::easy::Easy, data: &str) {
loop {
match connection.read(serial_buf.as_mut_slice()) {
Ok(t) => {
if t < 1 { continue; }
let output = String::from_utf8_lossy(&serial_buf[..t]);
if output.contains("1") {
// send curl request
let res = crate::curl::request(&mut request, &data);
println!("Response code: {}", res.unwrap());
match res {
Some(t) => println!("Response code: {t}"),
None => eprintln!("[ERROR] Something went wrong with the CURL request"),
}
}
},
Err(_) => {}