83 lines
1.5 KiB
Protocol Buffer
83 lines
1.5 KiB
Protocol Buffer
|
|
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;
|
||
|
|
}
|
||
|
|
|
||
|
|
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;
|
||
|
|
}
|
||
|
|
|