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 43 /* 44 * Enumeration for printer statuses 45 */ 46 typedef enum { 47 PRINT_STATUS_INITIALIZING, 48 PRINT_STATUS_SHUTTING_DOWN, 49 PRINT_STATUS_UNABLE_TO_CONNECT, 50 51 PRINT_STATUS_UNKNOWN, 52 PRINT_STATUS_OFFLINE, 53 54 PRINT_STATUS_BUSY, 55 PRINT_STATUS_CANCELLED, 56 57 PRINT_STATUS_IDLE, 58 PRINT_STATUS_PRINTING, 59 PRINT_STATUS_JAMMED, 60 PRINT_STATUS_OUT_OF_PAPER, 61 PRINT_STATUS_OUT_OF_INK, 62 PRINT_STATUS_OUT_OF_TONER, 63 PRINT_STATUS_DOOR_OPEN, 64 PRINT_STATUS_SVC_REQUEST, 65 66 PRINT_STATUS_LOW_ON_INK, 67 PRINT_STATUS_LOW_ON_TONER, 68 69 PRINT_STATUS_VERY_LOW_ON_INK, 70 PRINT_STATUS_PARTIAL_CANCEL, 71 72 PRINT_STATUS_MAX_STATE // Add new entries above this line. 73 } print_status_t; 74 75 /* 76 * Structure for handling printer status 77 */ 78 typedef struct printer_state_dyn_s { 79 // Printer state (idle, printing, service request, unknown) 80 print_status_t printer_status; 81 82 // all current print status events 83 print_status_t printer_reasons[PRINT_STATUS_MAX_STATE + 1]; 84 } printer_state_dyn_t; 85 86 #endif // __WPRINT_STATUS_TYPES_H__