document_scan.mojom 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright 2022 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. module crosapi.mojom;
  5. import "ui/gfx/geometry/mojom/geometry.mojom";
  6. // The enum below is exactly the same as its counterpart in
  7. // third_party/cros_system_api/dbus/lorgnette/lorgnette_service.proto
  8. // The failure mode of a scan job.
  9. [Stable, Extensible]
  10. enum ScanFailureMode {
  11. // No failure occurred.
  12. [Default] kNoFailure = 0,
  13. // An unknown or generic failure occurred.
  14. kUnknown = 1,
  15. // The device is busy.
  16. kDeviceBusy = 2,
  17. // The document feeder is jammed.
  18. kAdfJammed = 3,
  19. // The document feeder is empty.
  20. kAdfEmpty = 4,
  21. // The flatbed cover is open.
  22. kFlatbedOpen = 5,
  23. // An error occurred while communicating with the device.
  24. kIoError = 6,
  25. };
  26. // This interface is used to access scanners.
  27. [Stable, Uuid="f0c77c02-b5c1-4919-8218-3076ecad58db"]
  28. interface DocumentScan {
  29. // Returns the names of all available, de-duplicated scanners.
  30. GetScannerNames@0() => (array<string> scanner_names);
  31. // Performs a simple scan of the first page with a given scanner name. There
  32. // are no settings and the actual scanner settings will be hard coded to use
  33. // color mode.
  34. //
  35. // Returns the failure mode (which may be `kNoFailure` on success) and the
  36. // data for the first page. The callback that receives `scan_data` must check
  37. // it is non-null, in addition to checking `failure_mode`, in order to
  38. // determine if the call succeeded.
  39. //
  40. // This API is intentionally designed this way for backwards compatibility
  41. // with the documentScan.scan API that exists as of this writing.
  42. ScanFirstPage@1(string scanner_name)
  43. => (ScanFailureMode failure_mode, string? scan_data);
  44. };