Philip P. Moltmann | c0a128d | 2017-06-19 10:55:09 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | syntax = "proto3"; |
| 18 | |
| 19 | package android.service.print; |
| 20 | |
| 21 | option java_multiple_files = true; |
| 22 | option java_outer_classname = "PrintServiceProto"; |
| 23 | |
| 24 | import "frameworks/base/core/proto/android/content/component_name.proto"; |
| 25 | |
| 26 | message PrintServiceDumpProto { |
| 27 | // Each user has a separate printer state |
| 28 | repeated PrintUserStateProto userStates = 1; |
| 29 | } |
| 30 | |
| 31 | message PrintUserStateProto { |
| 32 | // Should be 0, 10, 11, 12, etc. where 0 is the owner. |
| 33 | int32 user_id = 1; |
| 34 | |
| 35 | // The installed print services |
| 36 | repeated InstalledPrintServiceProto installed_services = 2; |
| 37 | |
| 38 | // The disabled print services |
| 39 | repeated android.content.ComponentNameProto disabled_services = 3; |
| 40 | |
| 41 | // The active print services |
| 42 | repeated ActivePrintServiceProto active_services = 4; |
| 43 | |
| 44 | // The cached print jobs |
| 45 | repeated CachedPrintJobProto cached_print_jobs = 5; |
| 46 | |
| 47 | // The printer discovery sessions |
| 48 | repeated PrinterDiscoverySessionProto discovery_sessions = 6; |
| 49 | |
| 50 | // The print spooler state |
| 51 | PrintSpoolerStateProto print_spooler_state = 7; |
| 52 | } |
| 53 | |
| 54 | message PrintSpoolerStateProto { |
| 55 | // Is the print spooler destroyed? |
| 56 | bool is_destroyed = 1; |
| 57 | |
| 58 | // Is the print spooler bound? |
| 59 | bool is_bound = 2; |
| 60 | |
| 61 | // State internal to the print spooler |
| 62 | PrintSpoolerInternalStateProto internal_state = 3; |
| 63 | } |
| 64 | |
| 65 | message PrintSpoolerInternalStateProto { |
| 66 | // Print jobs |
| 67 | repeated PrintJobInfoProto print_jobs = 1; |
| 68 | |
| 69 | // Files used by these print jobs |
| 70 | repeated string print_job_files = 2; |
| 71 | |
| 72 | // Approved print services |
| 73 | repeated android.content.ComponentNameProto approved_services = 3; |
| 74 | } |
| 75 | |
| 76 | message PrinterCapabilitiesProto { |
| 77 | // Minimum margins of the printer |
| 78 | MarginsProto min_margins = 1; |
| 79 | |
| 80 | // List of supported media sizes |
| 81 | repeated MediaSizeProto media_sizes = 2; |
| 82 | |
| 83 | // List of supported resolutions |
| 84 | repeated ResolutionProto resolutions = 3; |
| 85 | |
| 86 | // List of supported color modes |
| 87 | repeated PrintAttributesProto.ColorMode color_modes = 4; |
| 88 | |
| 89 | // List of supported duplex modes |
| 90 | repeated PrintAttributesProto.DuplexMode duplex_modes = 5; |
| 91 | } |
| 92 | |
| 93 | message PrinterInfoProto { |
| 94 | // The id of the printer |
| 95 | PrinterIdProto id = 1; |
| 96 | |
| 97 | // The name of the printer |
| 98 | string name = 2; |
| 99 | |
| 100 | enum Status { |
| 101 | // unused |
| 102 | __STATUS_UNUSED = 0; |
| 103 | |
| 104 | // Printer is idle |
| 105 | STATUS_IDLE = 1; |
| 106 | |
| 107 | // Printer is busy |
| 108 | STATUS_BUSY = 2; |
| 109 | |
| 110 | // Printer is unavailable |
| 111 | STATUS_UNAVAILABLE = 3; |
| 112 | } |
| 113 | // The status of the printer |
| 114 | Status status = 3; |
| 115 | |
| 116 | // The description of the printer |
| 117 | string description = 4; |
| 118 | |
| 119 | // The capabilities of the printer |
| 120 | PrinterCapabilitiesProto capabilities = 5; |
| 121 | } |
| 122 | |
| 123 | message PrinterDiscoverySessionProto { |
| 124 | // Is this session destroyed? |
| 125 | bool is_destroyed = 1; |
| 126 | |
| 127 | // Is printer discovery in progress? |
| 128 | bool is_printer_discovery_in_progress = 2; |
| 129 | |
| 130 | // List of printer discovery observers |
| 131 | repeated string printer_discovery_observers = 3; |
| 132 | |
| 133 | // List of discovery request |
| 134 | repeated string discovery_requests = 4; |
| 135 | |
| 136 | // List of ids of printers that are have tracking requests |
| 137 | repeated PrinterIdProto tracked_printer_requests = 5; |
| 138 | |
| 139 | // List of printers found |
| 140 | repeated PrinterInfoProto printer = 6; |
| 141 | } |
| 142 | |
| 143 | message InstalledPrintServiceProto { |
| 144 | // Component name of the service |
| 145 | android.content.ComponentNameProto component_name = 1; |
| 146 | |
| 147 | // Settings activity for this service |
| 148 | string settings_activity = 2; |
| 149 | |
| 150 | // Add printers activity for this service |
| 151 | string add_printers_activity = 3; |
| 152 | |
| 153 | // Advances options activity for this service |
| 154 | string advanced_options_activity = 4; |
| 155 | } |
| 156 | |
| 157 | message PrinterIdProto { |
| 158 | // Component name of the service that reported the printer |
| 159 | android.content.ComponentNameProto service_name = 1; |
| 160 | |
| 161 | // Local id of the printer |
| 162 | string local_id = 2; |
| 163 | } |
| 164 | |
| 165 | message ActivePrintServiceProto { |
| 166 | // Component name of the service |
| 167 | android.content.ComponentNameProto component_name = 1; |
| 168 | |
| 169 | // Is the active service destroyed |
| 170 | bool is_destroyed = 2; |
| 171 | |
| 172 | // Is the active service bound |
| 173 | bool is_bound = 3; |
| 174 | |
| 175 | // Has the active service a discovery session |
| 176 | bool has_discovery_session = 4; |
| 177 | |
| 178 | // Has the active service a active print jobs |
| 179 | bool has_active_print_jobs = 5; |
| 180 | |
| 181 | // Is the active service discovering printers |
| 182 | bool is_discovering_printers = 6; |
| 183 | |
| 184 | // The tracked printers of this active service |
| 185 | repeated PrinterIdProto tracked_printers = 7; |
| 186 | } |
| 187 | |
| 188 | message MediaSizeProto { |
| 189 | // Id of this media size |
| 190 | string id = 1; |
| 191 | |
| 192 | // Label of this media size |
| 193 | string label = 2; |
| 194 | |
| 195 | // Height of the media |
| 196 | int32 height_mils = 3; |
| 197 | |
| 198 | // Width of the media |
| 199 | int32 width_mils = 4; |
| 200 | } |
| 201 | |
| 202 | message ResolutionProto { |
| 203 | // Id of this resolution |
| 204 | string id = 1; |
| 205 | |
| 206 | // Label for this resoltion |
| 207 | string label = 2; |
| 208 | |
| 209 | // Resolution in horizontal orientation |
| 210 | int32 horizontal_dpi = 3; |
| 211 | |
| 212 | // Resolution in vertical orientation |
| 213 | int32 vertical_dpi = 4; |
| 214 | } |
| 215 | |
| 216 | message MarginsProto { |
| 217 | // Space at the top |
| 218 | int32 top_mils = 1; |
| 219 | |
| 220 | // Space at the left |
| 221 | int32 left_mils = 2; |
| 222 | |
| 223 | // Space at the right |
| 224 | int32 right_mils = 3; |
| 225 | |
| 226 | // Space at the bottom |
| 227 | int32 bottom_mils = 4; |
| 228 | } |
| 229 | |
| 230 | message PrintAttributesProto { |
| 231 | // Media to use |
| 232 | ResolutionProto media_size = 1; |
| 233 | |
| 234 | // Is the media in portrait mode? |
| 235 | bool is_portrait = 2; |
| 236 | |
| 237 | // Resolution to use |
| 238 | ResolutionProto resolution = 3; |
| 239 | |
| 240 | // Margins around the document |
| 241 | MarginsProto min_margins = 4; |
| 242 | |
| 243 | enum ColorMode { |
| 244 | // unused |
| 245 | __COLOR_MODE_UNUSED = 0; |
| 246 | |
| 247 | // Use black, white, gray |
| 248 | COLOR_MODE_MONOCHROME = 1; |
| 249 | |
| 250 | // Use full color is available |
| 251 | COLOR_MODE_COLOR = 2; |
| 252 | } |
| 253 | // Color mode to use |
| 254 | ColorMode color_mode = 5; |
| 255 | |
| 256 | enum DuplexMode { |
| 257 | // unused |
| 258 | __DUPLEX_MODE_UNUSED = 0; |
| 259 | |
| 260 | // No duplex |
| 261 | DUPLEX_MODE_NONE = 1; |
| 262 | |
| 263 | // Duplex where the long edge attached |
| 264 | DUPLEX_MODE_LONG_EDGE = 2; |
| 265 | |
| 266 | // Duplex where the short edge attach |
| 267 | DUPLEX_MODE_SHORT_EDGE = 4; |
| 268 | } |
| 269 | // Duplex mode to use |
| 270 | DuplexMode duplex_mode = 6; |
| 271 | } |
| 272 | |
| 273 | message PrintDocumentInfoProto { |
| 274 | // Name of the document to print |
| 275 | string name = 1; |
| 276 | |
| 277 | // Number of pages in the doc |
| 278 | int32 page_count = 2; |
| 279 | |
| 280 | // Type of content (see PrintDocumentInfo.ContentType) |
| 281 | int32 content_type = 3; |
| 282 | |
| 283 | // The size of the the document |
| 284 | int64 data_size = 4; |
| 285 | } |
| 286 | |
| 287 | message PageRangeProto { |
| 288 | // Start of the range |
| 289 | int32 start = 1; |
| 290 | |
| 291 | // End of the range (included) |
| 292 | int32 end = 2; |
| 293 | } |
| 294 | |
| 295 | message PrintJobInfoProto { |
| 296 | // Label of the job |
| 297 | string label = 1; |
| 298 | |
| 299 | // Id of the job |
| 300 | string print_job_id = 2; |
| 301 | |
| 302 | enum State { |
| 303 | // Unknown state |
| 304 | STATE_UNKNOWN = 0; |
| 305 | |
| 306 | // The print job is being created but not yet ready to be printed |
| 307 | STATE_CREATED = 1; |
| 308 | |
| 309 | // The print jobs is created, it is ready to be printed and should be processed |
| 310 | STATE_QUEUED = 2; |
| 311 | |
| 312 | // The print job is being printed |
| 313 | STATE_STARTED = 3; |
| 314 | |
| 315 | // The print job is blocked |
| 316 | STATE_BLOCKED = 4; |
| 317 | |
| 318 | // The print job is successfully printed |
| 319 | STATE_COMPLETED = 5; |
| 320 | |
| 321 | // The print job was printing but printing failed |
| 322 | STATE_FAILED = 6; |
| 323 | |
| 324 | // The print job is canceled |
| 325 | STATE_CANCELED = 7; |
| 326 | } |
| 327 | |
| 328 | // State of the job |
| 329 | State state = 3; |
| 330 | |
| 331 | // Printer handling the job |
| 332 | PrinterIdProto printer = 4; |
| 333 | |
| 334 | // Tag assigned to the job |
| 335 | string tag = 5; |
| 336 | |
| 337 | // Time the job was created |
| 338 | int64 creation_time = 6; |
| 339 | |
| 340 | // Attributes of the job |
| 341 | PrintAttributesProto attributes = 7; |
| 342 | |
| 343 | // Document info of the job |
| 344 | PrintDocumentInfoProto document_info = 8; |
| 345 | |
| 346 | // If the job current getting canceled |
| 347 | bool is_canceling = 9; |
| 348 | |
| 349 | // The selected ranges of the job |
| 350 | repeated PageRangeProto pages = 10; |
| 351 | |
| 352 | // Does the job have any advanced options |
| 353 | bool has_advanced_options = 11; |
| 354 | |
| 355 | // Progress of the job |
| 356 | float progress = 12; |
| 357 | |
| 358 | // The current service set state |
| 359 | string status = 13; |
| 360 | } |
| 361 | |
| 362 | message CachedPrintJobProto { |
| 363 | // The id of the app the job belongs to |
| 364 | int32 app_id = 1; |
| 365 | |
| 366 | // The print job |
| 367 | PrintJobInfoProto print_job = 2; |
| 368 | } |