Gavin Williams | fc97ff0 | 2020-03-24 17:39:18 | [diff] [blame] | 1 | // Copyright 2020 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 | |
Daniel Hosseinian | 86d0cca4 | 2020-03-26 01:25:41 | [diff] [blame] | 5 | #ifndef PRINTING_PRINTER_STATUS_H_ |
| 6 | #define PRINTING_PRINTER_STATUS_H_ |
Gavin Williams | fc97ff0 | 2020-03-24 17:39:18 | [diff] [blame] | 7 | |
| 8 | #include <cups/cups.h> |
| 9 | |
| 10 | #include <string> |
| 11 | #include <vector> |
| 12 | |
Alan Screen | 9347cae | 2021-04-27 18:11:24 | [diff] [blame] | 13 | #include "base/component_export.h" |
Gavin Williams | fc97ff0 | 2020-03-24 17:39:18 | [diff] [blame] | 14 | |
| 15 | namespace printing { |
| 16 | |
| 17 | // Represents the status of a printer containing the properties printer-state, |
| 18 | // printer-state-reasons, and printer-state-message. |
Alan Screen | 04f4dfe | 2021-04-29 07:05:25 | [diff] [blame] | 19 | struct COMPONENT_EXPORT(PRINTING_BASE) PrinterStatus { |
Gavin Williams | fc97ff0 | 2020-03-24 17:39:18 | [diff] [blame] | 20 | struct PrinterReason { |
Gavin Williams | 87f0bb7 | 2020-08-13 19:09:00 | [diff] [blame] | 21 | // This enum is used to record UMA histogram values and should not be |
| 22 | // reordered. Please keep in sync with PrinterStatusReasons in |
| 23 | // src/tools/metrics/histograms/enums.xml. |
Gavin Williams | 9e2aee05 | 2020-08-11 22:59:35 | [diff] [blame] | 24 | enum class Reason { |
Gavin Williams | 9653f48 | 2020-09-09 18:05:50 | [diff] [blame] | 25 | kUnknownReason = 0, |
| 26 | kNone = 1, |
| 27 | kMediaNeeded = 2, |
| 28 | kMediaJam = 3, |
| 29 | kMovingToPaused = 4, |
| 30 | kPaused = 5, |
| 31 | kShutdown = 6, |
| 32 | kConnectingToDevice = 7, |
| 33 | kTimedOut = 8, |
| 34 | kStopping = 9, |
| 35 | kStoppedPartly = 10, |
| 36 | kTonerLow = 11, |
| 37 | kTonerEmpty = 12, |
| 38 | kSpoolAreaFull = 13, |
| 39 | kCoverOpen = 14, |
| 40 | kInterlockOpen = 15, |
| 41 | kDoorOpen = 16, |
| 42 | kInputTrayMissing = 17, |
| 43 | kMediaLow = 18, |
| 44 | kMediaEmpty = 19, |
| 45 | kOutputTrayMissing = 20, |
| 46 | kOutputAreaAlmostFull = 21, |
| 47 | kOutputAreaFull = 22, |
| 48 | kMarkerSupplyLow = 23, |
| 49 | kMarkerSupplyEmpty = 24, |
| 50 | kMarkerWasteAlmostFull = 25, |
| 51 | kMarkerWasteFull = 26, |
| 52 | kFuserOverTemp = 27, |
| 53 | kFuserUnderTemp = 28, |
| 54 | kOpcNearEol = 29, |
| 55 | kOpcLifeOver = 30, |
| 56 | kDeveloperLow = 31, |
| 57 | kDeveloperEmpty = 32, |
| 58 | kInterpreterResourceUnavailable = 33, |
| 59 | kMaxValue = kInterpreterResourceUnavailable |
Gavin Williams | fc97ff0 | 2020-03-24 17:39:18 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | // Severity of the state-reason. |
Gavin Williams | 9e2aee05 | 2020-08-11 22:59:35 | [diff] [blame] | 63 | enum class Severity { |
Gavin Williams | 9653f48 | 2020-09-09 18:05:50 | [diff] [blame] | 64 | kUnknownSeverity = 0, |
| 65 | kReport = 1, |
| 66 | kWarning = 2, |
| 67 | kError = 3, |
Gavin Williams | 9e2aee05 | 2020-08-11 22:59:35 | [diff] [blame] | 68 | }; |
Gavin Williams | fc97ff0 | 2020-03-24 17:39:18 | [diff] [blame] | 69 | |
| 70 | Reason reason; |
| 71 | Severity severity; |
| 72 | }; |
| 73 | |
| 74 | PrinterStatus(); |
| 75 | PrinterStatus(const PrinterStatus& other); |
| 76 | ~PrinterStatus(); |
| 77 | |
| 78 | // printer-state |
| 79 | ipp_pstate_t state; |
| 80 | // printer-state-reasons |
| 81 | std::vector<PrinterReason> reasons; |
| 82 | // printer-state-message |
| 83 | std::string message; |
| 84 | }; |
| 85 | |
| 86 | } // namespace printing |
| 87 | |
Daniel Hosseinian | 86d0cca4 | 2020-03-26 01:25:41 | [diff] [blame] | 88 | #endif // PRINTING_PRINTER_STATUS_H_ |