if xoff_received { println!("Paused due to XOFF signal."); continue; } // Convert raw data to ASCII match String::from_utf8(chunk.to_vec()) { Ok(decoded_data) => { println!("Decoded ASCII data: {}", decoded_data); ascii_data.push_str(&decoded_data); } Err(_) => { println!("Received non-ASCII data: {:02X?}", chunk); // Continue storing raw bytes for further analysis } } // Stop reading if end marker (e.g., '%') is detected if chunk.contains(&b'%') { println!("End of transmission detected."); break;