• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  * Copyright (C) 2016 Mopria Alliance, Inc.
4  * Copyright (C) 2013 Hewlett-Packard Development Company, L.P.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 #ifndef __WPRINT_STATUS_TYPES_H__
19 #define __WPRINT_STATUS_TYPES_H__
20 
21 #define PRINTER_IDLE_BIT       (1 << PRINT_STATUS_MAX_STATE)
22 #define PRINTER_IS_IDLE(X)     ((X) << PRINT_STATUS_MAX_STATE)
23 #define PRINTER_STATUS_MASK(X) ((X) & (PRINTER_IDLE_BIT - 1))
24 
25 #define BLOCKED_REASON_UNABLE_TO_CONNECT (1 << PRINT_STATUS_UNABLE_TO_CONNECT)
26 #define BLOCKED_REASONS_PRINTER_BUSY     (1 << PRINT_STATUS_BUSY)
27 #define BLOCKED_REASONS_CANCELLED        (1 << PRINT_STATUS_CANCELLED)
28 #define BLOCKED_REASON_OUT_OF_PAPER      (1 << PRINT_STATUS_OUT_OF_PAPER)
29 #define BLOCKED_REASON_OUT_OF_INK        (1 << PRINT_STATUS_OUT_OF_INK)
30 #define BLOCKED_REASON_OUT_OF_TONER      (1 << PRINT_STATUS_OUT_OF_TONER)
31 #define BLOCKED_REASON_JAMMED            (1 << PRINT_STATUS_JAMMED)
32 #define BLOCKED_REASON_DOOR_OPEN         (1 << PRINT_STATUS_DOOR_OPEN)
33 #define BLOCKED_REASON_SVC_REQUEST       (1 << PRINT_STATUS_SVC_REQUEST)
34 #define BLOCKED_REASON_LOW_ON_INK        (1 << PRINT_STATUS_LOW_ON_INK)
35 #define BLOCKED_REASON_LOW_ON_TONER      (1 << PRINT_STATUS_LOW_ON_TONER)
36 #define BLOCKED_REASON_UNKNOWN           (1 << PRINT_STATUS_UNKNOWN)
37 #define BLOCKED_REASON_BUSY              (1 << PRINT_STATUS_PRINTING)
38 #define BLOCKED_REASON_IDLE              (1 << PRINT_STATUS_IDLE)
39 #define BLOCKED_REASON_CANCELLED         (1 << PRINT_STATUS_CANCELLED)
40 #define BLOCKED_REASON_PRINT_STATUS_VERY_LOW_ON_INK (1 << PRINT_STATUS_VERY_LOW_ON_INK)
41 #define BLOCKED_REASON_PARTIAL_CANCEL    (1 << PRINT_STATUS_PARTIAL_CANCEL)
42 #define BLOCKED_REASON_BAD_CERTIFICATE   (1 << PRINT_STATUS_BAD_CERTIFICATE)
43 
44 /*
45  * Enumeration for printer statuses
46  */
47 typedef enum {
48     PRINT_STATUS_INITIALIZING,
49     PRINT_STATUS_SHUTTING_DOWN,
50     PRINT_STATUS_UNABLE_TO_CONNECT,
51 
52     PRINT_STATUS_UNKNOWN,
53     PRINT_STATUS_OFFLINE,
54 
55     PRINT_STATUS_BUSY,
56     PRINT_STATUS_CANCELLED,
57 
58     PRINT_STATUS_IDLE,
59     PRINT_STATUS_PRINTING,
60     PRINT_STATUS_JAMMED,
61     PRINT_STATUS_OUT_OF_PAPER,
62     PRINT_STATUS_OUT_OF_INK,
63     PRINT_STATUS_OUT_OF_TONER,
64     PRINT_STATUS_DOOR_OPEN,
65     PRINT_STATUS_SVC_REQUEST,
66 
67     PRINT_STATUS_LOW_ON_INK,
68     PRINT_STATUS_LOW_ON_TONER,
69 
70     PRINT_STATUS_VERY_LOW_ON_INK,
71     PRINT_STATUS_PARTIAL_CANCEL,
72     PRINT_STATUS_BAD_CERTIFICATE,
73 
74     PRINT_STATUS_MAX_STATE // Add new entries above this line.
75 } print_status_t;
76 
77 /*
78  * Structure for handling printer status
79  */
80 typedef struct printer_state_dyn_s {
81     // Printer state (idle, printing, service request, unknown)
82     print_status_t printer_status;
83 
84     // all current print status events
85     print_status_t printer_reasons[PRINT_STATUS_MAX_STATE + 1];
86 } printer_state_dyn_t;
87 
88 #endif // __WPRINT_STATUS_TYPES_H__