Enhance printing functionality with SNMP support and update dependencies

- Added SNMP configuration options to `AppConfig` for querying printer status.
- Extended `PrintInstruction` in the proto file to support additional fields for remote file URLs and raw data.
- Implemented logic in `CupsClient` to retrieve printer paper levels and page counts via SNMP.
- Updated `Cargo.toml` to include `snmp` and `reqwest` dependencies for network communication.
- Refactored `TempPdf` handling to support multiple data sources for printing.
- Improved error handling and logging for better diagnostics during print operations.
This commit is contained in:
lan
2025-12-14 22:04:27 +08:00
parent 5789a4346a
commit 3a9aaef996
12 changed files with 1515 additions and 86 deletions

View File

@@ -39,8 +39,12 @@ message Pong {
message PrintInstruction {
string request_id = 1;
bytes pdf_data = 2;
bytes pdf_data = 2; // 兼容旧字段,仍可用
PrintParams params = 3;
string url = 4; // 新:远程文件 URL
bytes raw_data = 5; // 新:任意二进制(预期 PDF
string local_path = 6; // 新:本地路径(客户端可读)
string content_type = 7; // 可选 MIME 类型,默认 application/pdf
}
message PrintParams {
@@ -78,5 +82,7 @@ message PrinterInfo {
uint32 ppm = 9;
uint32 ppm_color = 10;
repeated string reasons = 11;
int32 paper_percent = 12; // -1 或缺省表示未知
uint64 page_count = 13; // 总页数0 或缺省表示未知
}