55bca92691
Core features: - Class 1 T.30 protocol: full send/receive implementation - HDLC: DLE-stuffing, FCS strip, USR5637 bit-reversal handling - T.4 MH encoder/decoder (1728px A4 standard) - Document pipeline: PDF (Ghostscript), PNG, TIFF input - Width clamping: US Letter 1734px → 1728px fax standard - Cover page: CJK rasterization (TW/CN/JP/EN), TIFF + HTML output - OCR verification: Tesseract 5 with eng+chi_tra, CJK space-tolerant - API server (axum): health, send, jobs, cover, retry, cancel - Background worker: auto-poll queue, speed fallback, retry policy - Modem detection, pool management Real-world test results (2026-07-23): - V90 → 25153038: 4 pages, V.17 12000 bps, 2:33 ✅ - USR5637 → 25153038: 4 pages, V.17 12000 bps, 2:26 ✅ - Both faxes confirmed received on remote machine Tested: loopback (100% pixel match), multi-page, all input formats, cover pages, OCR verify, API endpoints, worker processing. 13 unit tests pass, 0 new clippy warnings.
44 lines
1.4 KiB
Rust
44 lines
1.4 KiB
Rust
use std::io::{Read, Write};
|
|
use std::time::Duration;
|
|
|
|
fn main() {
|
|
let mut port = serialport::new("/dev/cu.usbmodem00000021", 115200)
|
|
.data_bits(serialport::DataBits::Eight)
|
|
.flow_control(serialport::FlowControl::None)
|
|
.parity(serialport::Parity::None)
|
|
.stop_bits(serialport::StopBits::One)
|
|
.timeout(Duration::from_millis(5000))
|
|
.open()
|
|
.expect("Failed to open");
|
|
|
|
port.write_all(b"AT\r").unwrap();
|
|
port.flush().unwrap();
|
|
std::thread::sleep(Duration::from_millis(500));
|
|
|
|
let mut buf = vec![0u8; 1024];
|
|
match port.read(&mut buf) {
|
|
Ok(n) => println!("AT response: {:?}", String::from_utf8_lossy(&buf[..n])),
|
|
Err(e) => println!("Error: {}", e),
|
|
}
|
|
|
|
port.write_all(b"AT+FTH=?\r").unwrap();
|
|
port.flush().unwrap();
|
|
std::thread::sleep(Duration::from_millis(1000));
|
|
|
|
let mut buf = vec![0u8; 1024];
|
|
match port.read(&mut buf) {
|
|
Ok(n) => println!("AT+FTH=? response: {:?}", String::from_utf8_lossy(&buf[..n])),
|
|
Err(e) => println!("Error: {}", e),
|
|
}
|
|
|
|
port.write_all(b"AT+FTM=?\r").unwrap();
|
|
port.flush().unwrap();
|
|
std::thread::sleep(Duration::from_millis(1000));
|
|
|
|
let mut buf = vec![0u8; 1024];
|
|
match port.read(&mut buf) {
|
|
Ok(n) => println!("AT+FTM=? response: {:?}", String::from_utf8_lossy(&buf[..n])),
|
|
Err(e) => println!("Error: {}", e),
|
|
}
|
|
}
|