syntax = "proto3"; package control.v1; service Control { rpc ControlStream(stream ClientMessage) returns (stream ServerMessage); } message ClientMessage { oneof msg { Hello hello = 1; PrintResult result = 2; Pong pong = 3; PrinterUpdate printers = 4; } } message ServerMessage { oneof msg { PrintInstruction print = 1; Ping ping = 2; } } message Hello { string client_id = 1; string version = 2; string hostname = 3; repeated PrinterInfo printers = 4; } message Ping { string nonce = 1; } message Pong { string nonce = 1; } message PrintInstruction { string request_id = 1; 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 { uint32 copies = 1; string duplex = 2; // one_sided, long_edge, short_edge string color = 3; // auto, color, monochrome string media = 4; string quality = 5; // draft, normal, high string orientation = 6; // portrait, landscape string job_name = 7; string printer = 8; } message PrintResult { string request_id = 1; bool ok = 2; string printer = 3; string message = 4; uint32 retries_used = 5; } message PrinterUpdate { repeated PrinterInfo printers = 1; } message PrinterInfo { string id = 1; string name = 2; string host = 3; string uri = 4; string state = 5; bool accepting_jobs = 6; bool color_supported = 7; uint32 active_jobs = 8; uint32 ppm = 9; uint32 ppm_color = 10; repeated string reasons = 11; int32 paper_percent = 12; // -1 或缺省表示未知 uint64 page_count = 13; // 总页数,0 或缺省表示未知 }