1c36cf2e9Sopenharmony_ci/* 2c36cf2e9Sopenharmony_ci * Copyright (c) 2023-2023 Huawei Device Co., Ltd. 3c36cf2e9Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4c36cf2e9Sopenharmony_ci * you may not use this file except in compliance with the License. 5c36cf2e9Sopenharmony_ci * You may obtain a copy of the License at 6c36cf2e9Sopenharmony_ci * 7c36cf2e9Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8c36cf2e9Sopenharmony_ci * 9c36cf2e9Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10c36cf2e9Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11c36cf2e9Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12c36cf2e9Sopenharmony_ci * See the License for the specific language governing permissions and 13c36cf2e9Sopenharmony_ci * limitations under the License. 14c36cf2e9Sopenharmony_ci */ 15c36cf2e9Sopenharmony_ci 16c36cf2e9Sopenharmony_ci/** 17c36cf2e9Sopenharmony_ci * request code 18c36cf2e9Sopenharmony_ci */ 19c36cf2e9Sopenharmony_ciexport enum RequestCode { 20c36cf2e9Sopenharmony_ci START_DISCOVERY_CODE = 0, 21c36cf2e9Sopenharmony_ci STOP_DISCOVERY_CODE, 22c36cf2e9Sopenharmony_ci CONNECT_PRINTER_CODE, 23c36cf2e9Sopenharmony_ci DISCONNECT_PRINTER_CODE, 24c36cf2e9Sopenharmony_ci QUERY_PRINTER_CAPABILITY_CODE, 25c36cf2e9Sopenharmony_ci CREATE_PRINT_JOB_CODE, 26c36cf2e9Sopenharmony_ci START_PRINT_CODE, 27c36cf2e9Sopenharmony_ci CANCEL_PRINT_CODE, 28c36cf2e9Sopenharmony_ci QUERY_PRINT_EXTENSION_CODE, 29c36cf2e9Sopenharmony_ci REQUEST_PREVIEW_CODE, 30c36cf2e9Sopenharmony_ci OPEN_JOB_LIST_CODE, 31c36cf2e9Sopenharmony_ci} 32c36cf2e9Sopenharmony_ci 33c36cf2e9Sopenharmony_ciexport enum PrintErrorCode { 34c36cf2e9Sopenharmony_ci E_PRINT_NONE = 0, // no error 35c36cf2e9Sopenharmony_ci E_PRINT_NO_PERMISSION = 201, // no permission 36c36cf2e9Sopenharmony_ci E_PRINT_INVALID_PARAMETER = 401, // invalid parameter 37c36cf2e9Sopenharmony_ci E_PRINT_GENERIC_FAILURE = 13100001, // generic failure of print 38c36cf2e9Sopenharmony_ci E_PRINT_RPC_FAILURE = 13100002, // RPC failure 39c36cf2e9Sopenharmony_ci E_PRINT_SERVER_FAILURE = 13100003, // failure of print service 40c36cf2e9Sopenharmony_ci E_PRINT_INVALID_EXTENSION = 13100004, // invalid print extension 41c36cf2e9Sopenharmony_ci E_PRINT_INVALID_PRINTER = 13100005, // invalid printer 42c36cf2e9Sopenharmony_ci E_PRINT_INVALID_PRINTJOB = 13100006, // invalid print job 43c36cf2e9Sopenharmony_ci E_PRINT_FILE_IO = 13100007, // file i/o error 44c36cf2e9Sopenharmony_ci} 45c36cf2e9Sopenharmony_ci 46c36cf2e9Sopenharmony_ci 47c36cf2e9Sopenharmony_ciexport enum WindowErrorCode { 48c36cf2e9Sopenharmony_ci REPEATED_OPERATION = 1300001, // Repeated operation. 49c36cf2e9Sopenharmony_ci WINDOW_STATE_ABNORMAL = 1300002, // This window state is abnormal. 50c36cf2e9Sopenharmony_ci UNAUTHORIZED_OPERATION = 1300004 // Unauthorized operation. 51c36cf2e9Sopenharmony_ci} 52c36cf2e9Sopenharmony_ci 53c36cf2e9Sopenharmony_ciexport enum PrintRangeType { 54c36cf2e9Sopenharmony_ci ALL = 0, //全部页面 55c36cf2e9Sopenharmony_ci RANGE = 1, //范围 56c36cf2e9Sopenharmony_ci CUSTOM = 2 //自定义 57c36cf2e9Sopenharmony_ci} 58c36cf2e9Sopenharmony_ci 59c36cf2e9Sopenharmony_ciexport enum PageDirection { 60c36cf2e9Sopenharmony_ci AUTO = 0, //自适应 61c36cf2e9Sopenharmony_ci VERTICAL = 1, //竖向 62c36cf2e9Sopenharmony_ci LANDSCAPE = 2 //横向 63c36cf2e9Sopenharmony_ci} 64c36cf2e9Sopenharmony_ci 65c36cf2e9Sopenharmony_ciexport enum PrintQuality { 66c36cf2e9Sopenharmony_ci ECONOMY = 3, //经济 67c36cf2e9Sopenharmony_ci STANDARD = 4, //标准 68c36cf2e9Sopenharmony_ci BEST = 5 //最佳 69c36cf2e9Sopenharmony_ci} 70c36cf2e9Sopenharmony_ci 71c36cf2e9Sopenharmony_ciexport enum Duplex { 72c36cf2e9Sopenharmony_ci SINGLE = 0, //单面 73c36cf2e9Sopenharmony_ci LONG = 1, //双面沿长边 74c36cf2e9Sopenharmony_ci SHORT = 2 //双面沿短边 75c36cf2e9Sopenharmony_ci} 76c36cf2e9Sopenharmony_ci 77c36cf2e9Sopenharmony_ciexport enum ColorCode { 78c36cf2e9Sopenharmony_ci MONOCHROME = 0, //黑白 79c36cf2e9Sopenharmony_ci COLOR = 1 //彩色 80c36cf2e9Sopenharmony_ci} 81c36cf2e9Sopenharmony_ci 82c36cf2e9Sopenharmony_ciexport enum MediaType { 83c36cf2e9Sopenharmony_ci NORMAL = 0, //普通纸 84c36cf2e9Sopenharmony_ci PHOTO = 10 //相片纸 85c36cf2e9Sopenharmony_ci} 86c36cf2e9Sopenharmony_ci 87c36cf2e9Sopenharmony_ciexport enum MouseState { 88c36cf2e9Sopenharmony_ci NONE = 0, 89c36cf2e9Sopenharmony_ci PRESS = 1, 90c36cf2e9Sopenharmony_ci HOVER = 2, 91c36cf2e9Sopenharmony_ci} 92c36cf2e9Sopenharmony_ci 93c36cf2e9Sopenharmony_ciexport class Constants { 94c36cf2e9Sopenharmony_ci static readonly NEGATIVE_1: number = -1; 95c36cf2e9Sopenharmony_ci static readonly NUMBER_0: number = 0; 96c36cf2e9Sopenharmony_ci static readonly NUMBER_1: number = 1; 97c36cf2e9Sopenharmony_ci static readonly NUMBER_2: number = 2; 98c36cf2e9Sopenharmony_ci static readonly NUMBER_3: number = 3; 99c36cf2e9Sopenharmony_ci static readonly NUMBER_4: number = 4; 100c36cf2e9Sopenharmony_ci static readonly NUMBER_5: number = 5; 101c36cf2e9Sopenharmony_ci static readonly NUMBER_6: number = 6; 102c36cf2e9Sopenharmony_ci static readonly NUMBER_7: number = 7; 103c36cf2e9Sopenharmony_ci static readonly NUMBER_8: number = 8; 104c36cf2e9Sopenharmony_ci static readonly NUMBER_9: number = 9; 105c36cf2e9Sopenharmony_ci static readonly NUMBER_10: number = 10; 106c36cf2e9Sopenharmony_ci static readonly NUMBER_11: number = 11; 107c36cf2e9Sopenharmony_ci static readonly NUMBER_48: number = 48; 108c36cf2e9Sopenharmony_ci static readonly NUMBER_90: number = 90; 109c36cf2e9Sopenharmony_ci static readonly NUMBER_99: number = 99; 110c36cf2e9Sopenharmony_ci 111c36cf2e9Sopenharmony_ci static readonly CONNECT_COUNT: number = 40; 112c36cf2e9Sopenharmony_ci static readonly COUNTDOWN_INTERVAL: number = 1000; 113c36cf2e9Sopenharmony_ci static readonly TOAST_INTERVAL: number = 2000; 114c36cf2e9Sopenharmony_ci static readonly TOAST_BOTTOM: number = 64; 115c36cf2e9Sopenharmony_ci static readonly SHOW_TOAST_TIMEOUT: number = 200; 116c36cf2e9Sopenharmony_ci static readonly COUNTDOWN_ALARM_TO_FAIL: number = 26; 117c36cf2e9Sopenharmony_ci static readonly COUNTDOWN_TO_FAIL: number = 25; 118c36cf2e9Sopenharmony_ci static readonly CANVAS_MAX_WIDTH: number = 432; 119c36cf2e9Sopenharmony_ci static readonly CANVAS_MAX_HEIGHT: number = 302; 120c36cf2e9Sopenharmony_ci static readonly MAX_PIXELMAP: number = 33554432; 121c36cf2e9Sopenharmony_ci static readonly MAX_PAGES: number = 100; 122c36cf2e9Sopenharmony_ci static readonly MAX_CUSTOM_PRINT_RANGE_LENGTH: number = 50; 123c36cf2e9Sopenharmony_ci 124c36cf2e9Sopenharmony_ci static readonly MAIN_WINDOW_WIDTH: number = 480; 125c36cf2e9Sopenharmony_ci static readonly MAIN_WINDOW_HEIGHT: number = 853; 126c36cf2e9Sopenharmony_ci static readonly JOB_WINDOW_WIDTH: number = 394; 127c36cf2e9Sopenharmony_ci static readonly JOB_WINDOW_HEIGHT: number = 550; 128c36cf2e9Sopenharmony_ci 129c36cf2e9Sopenharmony_ci static readonly READ: number = 0o0; 130c36cf2e9Sopenharmony_ci static readonly READ_WRITE: number = 0o2; 131c36cf2e9Sopenharmony_ci static readonly CREATE: number = 0o100; 132c36cf2e9Sopenharmony_ci static readonly OPEN_SYNC1: number = 0o102; 133c36cf2e9Sopenharmony_ci static readonly OPEN_SYNC2: number = 0o640; 134c36cf2e9Sopenharmony_ci static readonly OPEN_FAIL: number = -1; 135c36cf2e9Sopenharmony_ci 136c36cf2e9Sopenharmony_ci static readonly STRING_NONE: string = ''; 137c36cf2e9Sopenharmony_ci static readonly STRING_ONE: string = '1'; 138c36cf2e9Sopenharmony_ci static readonly STRING_NEGATIVE_ONE: string = '-1'; 139c36cf2e9Sopenharmony_ci static readonly STRING_99: string = '99'; 140c36cf2e9Sopenharmony_ci 141c36cf2e9Sopenharmony_ci static readonly BUNDLE_NAME: string = 'com.ohos.spooler'; 142c36cf2e9Sopenharmony_ci static readonly MAIN_ABILITY_NAME: string = 'MainAbility'; 143c36cf2e9Sopenharmony_ci static readonly JOB_MANAGER_ABILITY_NAME: string = 'JobManagerAbility'; 144c36cf2e9Sopenharmony_ci static readonly KEEP_ALIVE_ABILITY_NAME: string = 'KeepAliveAbility'; 145c36cf2e9Sopenharmony_ci static readonly MAIN_SERVICE_DESCRIPTOR: string = 'PrintSpoolerService'; 146c36cf2e9Sopenharmony_ci static readonly KEEP_ALIVE_SERVICE_DESCRIPTOR: string = 'KeepAliveService'; 147c36cf2e9Sopenharmony_ci static readonly WANT_JOB_ID_KEY: string = 'jobId'; 148c36cf2e9Sopenharmony_ci static readonly WANT_FILE_LIST_KEY: string = 'fileList'; 149c36cf2e9Sopenharmony_ci static readonly WANT_CALLERPID_KEY: string = 'ohos.aafwk.param.callerUid'; 150c36cf2e9Sopenharmony_ci static readonly WANT_PKG_NAME_KEY: string = 'caller.pkgName'; 151c36cf2e9Sopenharmony_ci static readonly WANT_DOCUMENT_NAME_KEY: string = 'documentName'; 152c36cf2e9Sopenharmony_ci static readonly wantPrintAttributeKey = 'printAttributes'; 153c36cf2e9Sopenharmony_ci static readonly EVENT_GET_ABILITY_DATA: string = 'getAbilityData'; 154c36cf2e9Sopenharmony_ci static readonly DEFAULT_CONNECTING_PRINTER_ID: string = 'noNeedDisconnect'; 155c36cf2e9Sopenharmony_ci static readonly WINDOW_FLOAT_MODE: number = 102; 156c36cf2e9Sopenharmony_ci static readonly PRINT_JOB_NOTIFICATION_ID: number = 2000; 157c36cf2e9Sopenharmony_ci static readonly SHOW_JOB_COMPLETED_TIMEOUT: number = 3000; // 3秒 158c36cf2e9Sopenharmony_ci static readonly FILE_SEPARATOR = '/'; 159c36cf2e9Sopenharmony_ci static readonly CN_COMMA = ','; 160c36cf2e9Sopenharmony_ci static readonly EU_COMMA = ','; 161c36cf2e9Sopenharmony_ci static readonly HYPHEN = '-'; 162c36cf2e9Sopenharmony_ci static readonly DOT = '.'; 163c36cf2e9Sopenharmony_ci static readonly MDNS_PRINTER = 'mdns:'; 164c36cf2e9Sopenharmony_ci static readonly TEMP_JOB_FOLDER = 'jobs'; 165c36cf2e9Sopenharmony_ci static readonly JPEG_SUFFIX = '.jpeg'; 166c36cf2e9Sopenharmony_ci static readonly PRINT_PREVIEW_WINDOW_PREFIX: string = 'PrintPreviewWindow_'; 167c36cf2e9Sopenharmony_ci static readonly PRINT_PREVIEW_PAGE_URL: string = 'pages/PrintPage'; 168c36cf2e9Sopenharmony_ci static readonly PRIVACY_STATEMENT_PAGE_URL: string = 'pages/PrivacyStatementPage'; 169c36cf2e9Sopenharmony_ci static readonly PREVIEW_DIALOG_COUNT: string = 'PreviewDialogCount'; 170c36cf2e9Sopenharmony_ci static readonly WINDOW_ID = 'windowId'; 171c36cf2e9Sopenharmony_ci static readonly SESSION = 'session'; 172c36cf2e9Sopenharmony_ci static readonly PREVIEW_IS_VERTICAL: string = 'PreviewIsVertical'; 173c36cf2e9Sopenharmony_ci} 174c36cf2e9Sopenharmony_ci 175c36cf2e9Sopenharmony_ciexport class AppStorageKeyName { 176c36cf2e9Sopenharmony_ci static readonly JOB_QUEUE_NAME: string = 'JobQueue'; 177c36cf2e9Sopenharmony_ci static readonly PRINTER_QUEUE_NAME: string = 'PrinterQueue'; 178c36cf2e9Sopenharmony_ci static readonly PRINT_EXTENSION_LIST_NAME: string = 'PrintExtensionsList'; 179c36cf2e9Sopenharmony_ci static readonly CONFIG_LANGUAGE: string = 'configLanguage'; 180c36cf2e9Sopenharmony_ci static readonly START_PRINT_TIME: string = 'startPrintTime'; 181c36cf2e9Sopenharmony_ci static readonly INGRESS_PACKAGE: string = 'ingressPackage'; 182c36cf2e9Sopenharmony_ci static readonly APP_VERSION: string = 'appVersion'; 183c36cf2e9Sopenharmony_ci static readonly DOCUMENT_NAME: string = 'documentName'; 184c36cf2e9Sopenharmony_ci static readonly PREVIEW_PAGE_INSTANCE: string = 'PreviewPageInstance'; 185c36cf2e9Sopenharmony_ci static readonly imageSourcesName: string = 'ImageSources'; 186c36cf2e9Sopenharmony_ci} 187c36cf2e9Sopenharmony_ci 188c36cf2e9Sopenharmony_ciexport class GlobalThisStorageKey { 189c36cf2e9Sopenharmony_ci static readonly KEY_SERVICE_CONNECT_OPTIONS: string = 'ServiceConnectOptions'; 190c36cf2e9Sopenharmony_ci static readonly KEY_JOB_ID: string = 'JobId'; 191c36cf2e9Sopenharmony_ci static readonly KEY_MEDIA_SIZE_UTIL: string = 'mediaSizeUtil'; 192c36cf2e9Sopenharmony_ci static readonly KEY_PRINT_ADAPTER: string = 'printAdapter'; 193c36cf2e9Sopenharmony_ci static readonly KEY_PREFERENCES_ADAPTER: string = 'preferencesAdapter'; 194c36cf2e9Sopenharmony_ci static readonly KEY_MAIN_ABILITY_CONTEXT: string = 'mainAbilityContext'; 195c36cf2e9Sopenharmony_ci static readonly KEY_MAIN_ABILITY_WINDOW_STAGE: string = 'mainAbilityWindowStage'; 196c36cf2e9Sopenharmony_ci static readonly KEY_JOB_MANAGER_ABILITY_CONTEXT: string = 'jobManagerAbilityContext'; 197c36cf2e9Sopenharmony_ci static readonly KEY_NOTIFICATION_PRINTER_NAME: string = 'notificationPrinterName'; 198c36cf2e9Sopenharmony_ci static readonly KEY_SERVICE_FIRST_START: string = 'serviceFirstStart'; 199c36cf2e9Sopenharmony_ci static readonly KEY_PRINTER_SELECT_DIALOG_OPEN: string = 'printerSelectDialogOpen'; 200c36cf2e9Sopenharmony_ci static readonly KEY_CURRENT_PIXELMAP: string = 'currentPixelMap'; 201c36cf2e9Sopenharmony_ci static readonly KEY_XGATE_USERNAME: string = 'xGateUserName'; 202c36cf2e9Sopenharmony_ci static readonly KEY_SECURITY_GUARD: string = 'securityGuard'; 203c36cf2e9Sopenharmony_ci static readonly KEY_IMAGE_ERROR_COUNT: string = 'imageErrorCount'; 204c36cf2e9Sopenharmony_ci static readonly KEY_IMAGE_ERROR_NAME: string = 'imageErrorName'; 205c36cf2e9Sopenharmony_ci} 206c36cf2e9Sopenharmony_ci 207c36cf2e9Sopenharmony_ci// 应用内公共事件 208c36cf2e9Sopenharmony_ciexport class AppCommonEvent { 209c36cf2e9Sopenharmony_ci static readonly PRINTER_STATE_CHANGE_EVENT: number = 1000; 210c36cf2e9Sopenharmony_ci static readonly PRINTER_UPDATE_CAPABILITY_EVENT: number = 1001; 211c36cf2e9Sopenharmony_ci static readonly START_JOB_MANAGER_ABILITY_EVENT: number = 1002; 212c36cf2e9Sopenharmony_ci static readonly TERMINATE_JOB_MANAGER_ABILITY_EVENT: number = 1003; 213c36cf2e9Sopenharmony_ci static readonly PRINTER_INVALID_EVENT: number = 1004; 214c36cf2e9Sopenharmony_ci static readonly WLAN_INACTIVE_EVENT: number = 1005; 215c36cf2e9Sopenharmony_ci static readonly WLAN_ACTIVE_EVENT: number = 1006; 216c36cf2e9Sopenharmony_ci static readonly ADD_PRINTER_EVENT: number = 1007; 217c36cf2e9Sopenharmony_ci} 218c36cf2e9Sopenharmony_ci 219c36cf2e9Sopenharmony_ciexport class PreferencesKey { 220c36cf2e9Sopenharmony_ci static readonly KEY_PRIVACY_STATEMENT_PREFERENCES: string = 'AGREE_PRIVACY_STATEMENT'; 221c36cf2e9Sopenharmony_ci} 222c36cf2e9Sopenharmony_ci 223c36cf2e9Sopenharmony_ci 224