From aea4e33048b69b503ceb41638baf1f9d164c305d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=98=8A=E8=8B=8F?= Date: Mon, 14 Jul 2025 16:34:10 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=89=AB=E6=8F=8F=E6=8E=A5=E5=8F=A3;=20Sig?= =?UTF-8?q?ned-off-by:liuhaosu@huawei.com?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘昊苏 --- api/@ohos.scan.d.ets | 997 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 997 insertions(+) create mode 100644 api/@ohos.scan.d.ets diff --git a/api/@ohos.scan.d.ets b/api/@ohos.scan.d.ets new file mode 100644 index 0000000000..af5ad786d4 --- /dev/null +++ b/api/@ohos.scan.d.ets @@ -0,0 +1,997 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * @kit BasicServicesKit + */ + +import type { Callback } from './@ohos.base'; + +/** + * System scan + * + * @namespace scan + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ +declare namespace scan { + /** + * Enumeration of scan error codes. + * @enum { number } ScanErrorCode + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + enum ScanErrorCode { + /** + * No permission error. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_ERROR_NO_PERMISSION = 201, + + /** + * Not system application error. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_ERROR_NO_SYSTEM_APPLICATION = 202, + + /** + * Invalid parameter error. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_ERROR_INVALID_PARAMETER = 401, + + /** + * Generic failure error. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_ERROR_GENERIC_FAILURE = 13100001, + + /** + * RPC failure error. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_ERROR_RPC_FAILURE = 13100002, + + /** + * Server failure error. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_ERROR_SERVER_FAILURE = 13100003, + + /** + * Unsupported operation error. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_ERROR_UNSUPPORTED = 13100004, + + /** + * Operation canceled error. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_ERROR_CANCELED = 13100005, + + /** + * Device busy error. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_ERROR_DEVICE_BUSY = 13100006, + + /** + * Invalid operation error. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_ERROR_INVALID = 13100007, + + /** + * Paper jam error. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_ERROR_JAMMED = 13100008, + + /** + * No documents error. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_ERROR_NO_DOCS = 13100009, + + /** + * Cover open error. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_ERROR_COVER_OPEN = 13100010, + + /** + * I/O error. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_ERROR_IO_ERROR = 13100011, + + /** + * No memory error. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_ERROR_NO_MEMORY = 13100012, + }; + + /** + * Enumeration of constraint types. + * @enum { number } ConstraintType + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + enum ConstraintType { + /** + * No constraint. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_CONSTRAINT_NONE = 0, + + /** + * Range constraint. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_CONSTRAINT_RANGE, + + /** + * Word list constraint. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_CONSTRAINT_WORD_LIST, + + /** + * String list constraint. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_CONSTRAINT_STRING_LIST, + }; + + /** + * Enumeration of physical units. + * @enum { number } PhysicalUnit + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + enum PhysicalUnit { + /** + * No unit. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_UNIT_NONE = 0, + + /** + * Pixel unit. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_UNIT_PIXEL, + + /** + * Bit unit. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_UNIT_BIT, + + /** + * Millimeter unit. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_UNIT_MM, + + /** + * DPI unit. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_UNIT_DPI, + + /** + * Percentage unit. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_UNIT_PERCENT, + + /** + * Microsecond unit. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_UNIT_MICROSECOND, + }; + + /** + * Enumeration of option value types. + * @enum { number } OptionValueType + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + enum OptionValueType { + /** + * Boolean type. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_TYPE_BOOL = 0, + + /** + * Integer type. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_TYPE_INT, + + /** + * Fixed point type. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_TYPE_FIXED, + + /** + * String type. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + SCAN_TYPE_STRING, + }; + + /** + * Enumeration of scanner sync modes. + * @enum { string } ScannerSyncMode + * @syscap SystemCapability.Print.PrintFramework + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + enum ScannerSyncMode { + /** + * Update mode. + * @syscap SystemCapability.Print.PrintFramework + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + UPDATE_STR = "update", + + /** + * Delete mode. + * @syscap SystemCapability.Print.PrintFramework + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + DELETE_STR = "delete", + }; + + /** + * Enumeration of scanner discovery modes. + * @enum { string } ScannerDiscoverMode + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + enum ScannerDiscoverMode { + /** + * TCP discovery mode. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + TCP_STR = "TCP", + + /** + * USB discovery mode. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + USB_STR = "USB", + }; + + /** + * Defines a range with minimum, maximum and quantization values. + * @typedef Range + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + interface Range { + /** + * Minimum value of the range. + * @type { number } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + minValue: number; + + /** + * Maximum value of the range. + * @type { number } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + maxValue: number; + + /** + * Quantization value of the range. + * @type { number } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + quantValue: number; + }; + + /** + * Defines scanner parameters. + * @typedef ScannerParameter + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + interface ScannerParameter { + /** + * Name of the option. + * @type { string } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + optionName: string; + + /** + * Index of the option. + * @type { number } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + optionIndex: number; + + /** + * Title of the option. + * @type { string } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + optionTitle: string; + + /** + * Description of the option. + * @type { string } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + optionDesc: string; + + /** + * Type of the option value. + * @type { OptionValueType } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + optionType: OptionValueType; + + /** + * Physical unit of the option. + * @type { PhysicalUnit } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + optionUnit: PhysicalUnit; + + /** + * Constraint type of the option. + * @type { ConstraintType } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + optionConstraintType: ConstraintType; + + /** + * String constraints for the option. + * @type { ?Array } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + optionConstraintString?: Array; + + /** + * Number constraints for the option. + * @type { ?Array } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + optionConstraintNumber?: Array; + + /** + * Range constraints for the option. + * @type { ?Range } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + optionConstraintRange?: Range; + }; + + /** + * Defines scanner option values. + * @typedef ScannerOptionValue + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + interface ScannerOptionValue { + /** + * Type of the value. + * @type { number } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + valueType: number; + + /** + * Numeric value. + * @type { ?number } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + numValue?: number; + + /** + * String value. + * @type { ?string } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + strValue?: string; + + /** + * Boolean value. + * @type { ?boolean } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + boolValue?: boolean; + }; + + /** + * Defines picture scan progress. + * @typedef PictureScanProgress + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + interface PictureScanProgress { + /** + * Current progress percentage. + * @type { number } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + progress: number; + + /** + * File descriptor of the scanned picture. + * @type { number } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + pictureFd: number; + + /** + * Whether this is the final progress update. + * @type { boolean } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + isFinal: boolean; + }; + + /** + * Defines scanner device information. + * @typedef ScannerDevice + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + interface ScannerDevice { + /** + * Unique identifier of the scanner. + * @type { string } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + scannerId: string; + + /** + * Discovery mode of the scanner. + * @type { ScannerDiscoverMode } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + discoverMode: ScannerDiscoverMode; + + /** + * Unique ID of the scanner. + * @type { string } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + uniqueId: string; + + /** + * Manufacturer of the scanner. + * @type { string } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + manufacturer: string; + + /** + * Model of the scanner. + * @type { string } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + model: string; + + /** + * Name of the scanner device. + * @type { string } + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + deviceName: string; + }; + + /** + * Defines scanner sync device information. + * @typedef ScannerSyncDevice + * @syscap SystemCapability.Print.PrintFramework + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + interface ScannerSyncDevice { + /* + * Scanner ID. + * @type { string } + * @syscap SystemCapability.Print.PrintFramework + * @systemapi + * @since 20 + * @arkts 1.2 + */ + scannerId: string; + /** + * Discovery mode. + * @type { ScannerDiscoverMode } + * @syscap SystemCapability.Print.PrintFramework + * @systemapi + * @since 20 + * @arkts 1.2 + */ + discoverMode: ScannerDiscoverMode; + + /** + * Unique ID. + * @type { string } + * @syscap SystemCapability.Print.PrintFramework + * @systemapi + * @since 20 + * @arkts 1.2 + */ + uniqueId: string; + + /** + * Sync mode. + * @type { ScannerSyncMode } + * @syscap SystemCapability.Print.PrintFramework + * @systemapi + * @since 20 + * @arkts 1.2 + */ + syncMode: ScannerSyncMode; + + /** + * Old device ID. + * @type { string } + * @syscap SystemCapability.Print.PrintFramework + * @systemapi + * @since 20 + * @arkts 1.2 + */ + oldDeviceId: string; + } + + /** + * Initialize the scan service. + * @permission ohos.permission.PRINT + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + function init(): Promise; + + /** + * Exit the scan service. + * @permission ohos.permission.PRINT + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + function exit(): Promise; + + /** + * Start discovering scanners. + * @permission ohos.permission.PRINT + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + function startScannerDiscovery(): Promise; + + /** + * Open a scanner. + * @permission ohos.permission.PRINT + * @param { string } scannerId - The ID of the scanner to open. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + function openScanner(scannerId: string): Promise; + + /** + * Close a scanner. + * @permission ohos.permission.PRINT + * @param { string } scannerId - The ID of the scanner to close. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + function closeScanner(scannerId: string): Promise; + + /** + * Get scanner parameters. + * @permission ohos.permission.PRINT + * @param { string } scannerId - The ID of the scanner. + * @returns { Promise> } the promise returned with scanner parameters. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + function getScannerParameter(scannerId: string): Promise>; + + /** + * Set scanner parameter. + * @permission ohos.permission.PRINT + * @param { string } scannerId - The ID of the scanner. + * @param { number } optionIndex - The index of the option to set. + * @param { ScannerOptionValue } value - The value to set. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + function setScannerParameter(scannerId: string, optionIndex: number, value: ScannerOptionValue): Promise; + + /** + * Set scan option to auto. + * @permission ohos.permission.PRINT + * @param { string } scannerId - The ID of the scanner. + * @param { number } optionIndex - The index of the option to set to auto. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + function setScanAutoOption(scannerId: string, optionIndex: number): Promise; + + /** + * Get current scanner setting. + * @permission ohos.permission.PRINT + * @param { string } scannerId - The ID of the scanner. + * @param { number } optionIndex - The index of the option to get. + * @returns { Promise } the promise returned with the current setting. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + function getScannerCurrentSetting(scannerId: string, optionIndex: number): Promise; + + /** + * Start scanning. + * @permission ohos.permission.PRINT + * @param { string } scannerId - The ID of the scanner. + * @param { boolean } batchMode - Whether to use batch mode. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 24300106 - Device busy. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + function startScan(scannerId: string, batchMode: boolean): Promise; + + /** + * Cancel scanning. + * @permission ohos.permission.PRINT + * @param { string } scannerId - The ID of the scanner. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + function cancelScan(scannerId: string): Promise; + + /** + * Get picture scan progress. + * @permission ohos.permission.PRINT + * @param { string } scannerId - The ID of the scanner. + * @returns { Promise } the promise returned with scan progress. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + function getPictureScanProgress(scannerId: string): Promise; + + /** + * Add a scanner (system API). + * @permission ohos.permission.MANAGE_PRINT_JOB + * @param { string } uniqueId - The unique ID of the scanner. + * @param { ScannerDiscoverMode } discoverMode - The discovery mode. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @syscap SystemCapability.Print.PrintFramework + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + function addScanner(uniqueId: string, discoverMode: ScannerDiscoverMode): Promise; + + /** + * Delete a scanner (system API). + * @permission ohos.permission.MANAGE_PRINT_JOB + * @param { string } uniqueId - The unique ID of the scanner. + * @param { ScannerDiscoverMode } discoverMode - The discovery mode. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @syscap SystemCapability.Print.PrintFramework + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + function deleteScanner(uniqueId: string, discoverMode: ScannerDiscoverMode): Promise; + + /** + * Get added scanners (system API). + * @permission ohos.permission.MANAGE_PRINT_JOB + * @returns { Promise> } the promise returned with scanner devices. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @syscap SystemCapability.Print.PrintFramework + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + function getAddedScanner(): Promise>; + + /** + * Register event callback for scanner device found. + * @permission ohos.permission.PRINT + * @param { 'scanDeviceFound' } type - Event type. + * @param { Callback } [callback] - Callback for device found event. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + function on(type: 'scanDeviceFound', callback: Callback): void; + + /** + * Unregister event callback for scanner device found. + * @permission ohos.permission.PRINT + * @param { 'scanDeviceFound' } type - Event type. + * @param { Callback } [callback] - Optional callback to unregister. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Print.PrintFramework + * @since 20 + * @arkts 1.2 + */ + function off(type: 'scanDeviceFound', callback?: Callback): void; + + /** + * Register event callback for scanner device sync (system API). + * @permission ohos.permission.MANAGE_PRINT_JOB + * @param { 'scanDeviceSync' } type - Event type. + * @param { Callback } [callback] - Callback for device sync event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @syscap SystemCapability.Print.PrintFramework + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + function on(type: 'scanDeviceSync', callback: Callback): void; + + /** + * Unregister event callback for scanner device sync (system API). + * @permission ohos.permission.MANAGE_PRINT_JOB + * @param { 'scanDeviceSync' } type - Event type. + * @param { Callback } [callback] - Optional callback to unregister. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @syscap SystemCapability.Print.PrintFramework + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + function off(type: 'scanDeviceSync', callback?: Callback): void; + + /** + * Register event callback for scanner device add (system API). + * @permission ohos.permission.MANAGE_PRINT_JOB + * @param { 'scanDeviceAdd' } type - Event type. + * @param { Callback } [callback] - Callback for device add event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @syscap SystemCapability.Print.PrintFramework + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + function on(type: 'scanDeviceAdd', callback: Callback): void; + + /** + * Unregister event callback for scanner device add (system API). + * @permission ohos.permission.MANAGE_PRINT_JOB + * @param { 'scanDeviceAdd' } type - Event type. + * @param { Callback } [callback] - Optional callback to unregister. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @syscap SystemCapability.Print.PrintFramework + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + function off(type: 'scanDeviceAdd', callback?: Callback): void; + + /** + * Register event callback for scanner device delete (system API). + * @permission ohos.permission.MANAGE_PRINT_JOB + * @param { 'scanDeviceDel' } type - Event type. + * @param { Callback } [callback] - Callback for device delete event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @syscap SystemCapability.Print.PrintFramework + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + function on(type: 'scanDeviceDel', callback: Callback): void; + + /** + * Unregister event callback for scanner device delete (system API). + * @permission ohos.permission.MANAGE_PRINT_JOB + * @param { 'scanDeviceDel' } type - Event type. + * @param { Callback } [callback] - Optional callback to unregister. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application. + * @syscap SystemCapability.Print.PrintFramework + * @systemapi Hide this for inner system use. + * @since 20 + * @arkts 1.2 + */ + function off(type: 'scanDeviceDel', callback?: Callback): void; +} +export default scan; \ No newline at end of file -- Gitee From 741af295f547ac5ea52d830dbe960b47ed3f7619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=98=8A=E8=8B=8F?= Date: Tue, 15 Jul 2025 19:45:10 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=93=E5=8D=B0extensi?= =?UTF-8?q?on=E6=8A=A5=E9=94=99;=20Signed-off-by:liuhaosu@huawei.com?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘昊苏 --- ...hos.app.ability.PrintExtensionAbility.d.ts | 4 +- api/@ohos.scan.d.ets | 997 ------------------ 2 files changed, 3 insertions(+), 998 deletions(-) delete mode 100644 api/@ohos.scan.d.ets diff --git a/api/@ohos.app.ability.PrintExtensionAbility.d.ts b/api/@ohos.app.ability.PrintExtensionAbility.d.ts index e44ce52971..70980d4a88 100644 --- a/api/@ohos.app.ability.PrintExtensionAbility.d.ts +++ b/api/@ohos.app.ability.PrintExtensionAbility.d.ts @@ -29,7 +29,7 @@ import type print from './@ohos.print'; * @since arkts {'1.1':'14','1.2':'20'} * @arkts 1.1&1.2 */ -export default class PrintExtensionAbility { +declare class PrintExtensionAbility { /** * Called once to initialize the extensionAbility. @@ -138,3 +138,5 @@ export default class PrintExtensionAbility { */ onDestroy(): void; } + +export default PrintExtensionAbility; diff --git a/api/@ohos.scan.d.ets b/api/@ohos.scan.d.ets deleted file mode 100644 index af5ad786d4..0000000000 --- a/api/@ohos.scan.d.ets +++ /dev/null @@ -1,997 +0,0 @@ -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * @kit BasicServicesKit - */ - -import type { Callback } from './@ohos.base'; - -/** - * System scan - * - * @namespace scan - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ -declare namespace scan { - /** - * Enumeration of scan error codes. - * @enum { number } ScanErrorCode - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - enum ScanErrorCode { - /** - * No permission error. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_ERROR_NO_PERMISSION = 201, - - /** - * Not system application error. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_ERROR_NO_SYSTEM_APPLICATION = 202, - - /** - * Invalid parameter error. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_ERROR_INVALID_PARAMETER = 401, - - /** - * Generic failure error. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_ERROR_GENERIC_FAILURE = 13100001, - - /** - * RPC failure error. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_ERROR_RPC_FAILURE = 13100002, - - /** - * Server failure error. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_ERROR_SERVER_FAILURE = 13100003, - - /** - * Unsupported operation error. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_ERROR_UNSUPPORTED = 13100004, - - /** - * Operation canceled error. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_ERROR_CANCELED = 13100005, - - /** - * Device busy error. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_ERROR_DEVICE_BUSY = 13100006, - - /** - * Invalid operation error. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_ERROR_INVALID = 13100007, - - /** - * Paper jam error. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_ERROR_JAMMED = 13100008, - - /** - * No documents error. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_ERROR_NO_DOCS = 13100009, - - /** - * Cover open error. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_ERROR_COVER_OPEN = 13100010, - - /** - * I/O error. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_ERROR_IO_ERROR = 13100011, - - /** - * No memory error. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_ERROR_NO_MEMORY = 13100012, - }; - - /** - * Enumeration of constraint types. - * @enum { number } ConstraintType - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - enum ConstraintType { - /** - * No constraint. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_CONSTRAINT_NONE = 0, - - /** - * Range constraint. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_CONSTRAINT_RANGE, - - /** - * Word list constraint. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_CONSTRAINT_WORD_LIST, - - /** - * String list constraint. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_CONSTRAINT_STRING_LIST, - }; - - /** - * Enumeration of physical units. - * @enum { number } PhysicalUnit - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - enum PhysicalUnit { - /** - * No unit. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_UNIT_NONE = 0, - - /** - * Pixel unit. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_UNIT_PIXEL, - - /** - * Bit unit. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_UNIT_BIT, - - /** - * Millimeter unit. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_UNIT_MM, - - /** - * DPI unit. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_UNIT_DPI, - - /** - * Percentage unit. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_UNIT_PERCENT, - - /** - * Microsecond unit. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_UNIT_MICROSECOND, - }; - - /** - * Enumeration of option value types. - * @enum { number } OptionValueType - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - enum OptionValueType { - /** - * Boolean type. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_TYPE_BOOL = 0, - - /** - * Integer type. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_TYPE_INT, - - /** - * Fixed point type. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_TYPE_FIXED, - - /** - * String type. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - SCAN_TYPE_STRING, - }; - - /** - * Enumeration of scanner sync modes. - * @enum { string } ScannerSyncMode - * @syscap SystemCapability.Print.PrintFramework - * @systemapi Hide this for inner system use. - * @since 20 - * @arkts 1.2 - */ - enum ScannerSyncMode { - /** - * Update mode. - * @syscap SystemCapability.Print.PrintFramework - * @systemapi Hide this for inner system use. - * @since 20 - * @arkts 1.2 - */ - UPDATE_STR = "update", - - /** - * Delete mode. - * @syscap SystemCapability.Print.PrintFramework - * @systemapi Hide this for inner system use. - * @since 20 - * @arkts 1.2 - */ - DELETE_STR = "delete", - }; - - /** - * Enumeration of scanner discovery modes. - * @enum { string } ScannerDiscoverMode - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - enum ScannerDiscoverMode { - /** - * TCP discovery mode. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - TCP_STR = "TCP", - - /** - * USB discovery mode. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - USB_STR = "USB", - }; - - /** - * Defines a range with minimum, maximum and quantization values. - * @typedef Range - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - interface Range { - /** - * Minimum value of the range. - * @type { number } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - minValue: number; - - /** - * Maximum value of the range. - * @type { number } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - maxValue: number; - - /** - * Quantization value of the range. - * @type { number } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - quantValue: number; - }; - - /** - * Defines scanner parameters. - * @typedef ScannerParameter - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - interface ScannerParameter { - /** - * Name of the option. - * @type { string } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - optionName: string; - - /** - * Index of the option. - * @type { number } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - optionIndex: number; - - /** - * Title of the option. - * @type { string } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - optionTitle: string; - - /** - * Description of the option. - * @type { string } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - optionDesc: string; - - /** - * Type of the option value. - * @type { OptionValueType } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - optionType: OptionValueType; - - /** - * Physical unit of the option. - * @type { PhysicalUnit } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - optionUnit: PhysicalUnit; - - /** - * Constraint type of the option. - * @type { ConstraintType } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - optionConstraintType: ConstraintType; - - /** - * String constraints for the option. - * @type { ?Array } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - optionConstraintString?: Array; - - /** - * Number constraints for the option. - * @type { ?Array } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - optionConstraintNumber?: Array; - - /** - * Range constraints for the option. - * @type { ?Range } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - optionConstraintRange?: Range; - }; - - /** - * Defines scanner option values. - * @typedef ScannerOptionValue - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - interface ScannerOptionValue { - /** - * Type of the value. - * @type { number } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - valueType: number; - - /** - * Numeric value. - * @type { ?number } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - numValue?: number; - - /** - * String value. - * @type { ?string } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - strValue?: string; - - /** - * Boolean value. - * @type { ?boolean } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - boolValue?: boolean; - }; - - /** - * Defines picture scan progress. - * @typedef PictureScanProgress - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - interface PictureScanProgress { - /** - * Current progress percentage. - * @type { number } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - progress: number; - - /** - * File descriptor of the scanned picture. - * @type { number } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - pictureFd: number; - - /** - * Whether this is the final progress update. - * @type { boolean } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - isFinal: boolean; - }; - - /** - * Defines scanner device information. - * @typedef ScannerDevice - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - interface ScannerDevice { - /** - * Unique identifier of the scanner. - * @type { string } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - scannerId: string; - - /** - * Discovery mode of the scanner. - * @type { ScannerDiscoverMode } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - discoverMode: ScannerDiscoverMode; - - /** - * Unique ID of the scanner. - * @type { string } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - uniqueId: string; - - /** - * Manufacturer of the scanner. - * @type { string } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - manufacturer: string; - - /** - * Model of the scanner. - * @type { string } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - model: string; - - /** - * Name of the scanner device. - * @type { string } - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - deviceName: string; - }; - - /** - * Defines scanner sync device information. - * @typedef ScannerSyncDevice - * @syscap SystemCapability.Print.PrintFramework - * @systemapi Hide this for inner system use. - * @since 20 - * @arkts 1.2 - */ - interface ScannerSyncDevice { - /* - * Scanner ID. - * @type { string } - * @syscap SystemCapability.Print.PrintFramework - * @systemapi - * @since 20 - * @arkts 1.2 - */ - scannerId: string; - /** - * Discovery mode. - * @type { ScannerDiscoverMode } - * @syscap SystemCapability.Print.PrintFramework - * @systemapi - * @since 20 - * @arkts 1.2 - */ - discoverMode: ScannerDiscoverMode; - - /** - * Unique ID. - * @type { string } - * @syscap SystemCapability.Print.PrintFramework - * @systemapi - * @since 20 - * @arkts 1.2 - */ - uniqueId: string; - - /** - * Sync mode. - * @type { ScannerSyncMode } - * @syscap SystemCapability.Print.PrintFramework - * @systemapi - * @since 20 - * @arkts 1.2 - */ - syncMode: ScannerSyncMode; - - /** - * Old device ID. - * @type { string } - * @syscap SystemCapability.Print.PrintFramework - * @systemapi - * @since 20 - * @arkts 1.2 - */ - oldDeviceId: string; - } - - /** - * Initialize the scan service. - * @permission ohos.permission.PRINT - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 201 - Permission denied. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - function init(): Promise; - - /** - * Exit the scan service. - * @permission ohos.permission.PRINT - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 201 - Permission denied. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - function exit(): Promise; - - /** - * Start discovering scanners. - * @permission ohos.permission.PRINT - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 201 - Permission denied. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - function startScannerDiscovery(): Promise; - - /** - * Open a scanner. - * @permission ohos.permission.PRINT - * @param { string } scannerId - The ID of the scanner to open. - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 201 - Permission denied. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - function openScanner(scannerId: string): Promise; - - /** - * Close a scanner. - * @permission ohos.permission.PRINT - * @param { string } scannerId - The ID of the scanner to close. - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 201 - Permission denied. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - function closeScanner(scannerId: string): Promise; - - /** - * Get scanner parameters. - * @permission ohos.permission.PRINT - * @param { string } scannerId - The ID of the scanner. - * @returns { Promise> } the promise returned with scanner parameters. - * @throws { BusinessError } 201 - Permission denied. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - function getScannerParameter(scannerId: string): Promise>; - - /** - * Set scanner parameter. - * @permission ohos.permission.PRINT - * @param { string } scannerId - The ID of the scanner. - * @param { number } optionIndex - The index of the option to set. - * @param { ScannerOptionValue } value - The value to set. - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 201 - Permission denied. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - function setScannerParameter(scannerId: string, optionIndex: number, value: ScannerOptionValue): Promise; - - /** - * Set scan option to auto. - * @permission ohos.permission.PRINT - * @param { string } scannerId - The ID of the scanner. - * @param { number } optionIndex - The index of the option to set to auto. - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 201 - Permission denied. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - function setScanAutoOption(scannerId: string, optionIndex: number): Promise; - - /** - * Get current scanner setting. - * @permission ohos.permission.PRINT - * @param { string } scannerId - The ID of the scanner. - * @param { number } optionIndex - The index of the option to get. - * @returns { Promise } the promise returned with the current setting. - * @throws { BusinessError } 201 - Permission denied. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - function getScannerCurrentSetting(scannerId: string, optionIndex: number): Promise; - - /** - * Start scanning. - * @permission ohos.permission.PRINT - * @param { string } scannerId - The ID of the scanner. - * @param { boolean } batchMode - Whether to use batch mode. - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 24300106 - Device busy. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - function startScan(scannerId: string, batchMode: boolean): Promise; - - /** - * Cancel scanning. - * @permission ohos.permission.PRINT - * @param { string } scannerId - The ID of the scanner. - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 201 - Permission denied. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - function cancelScan(scannerId: string): Promise; - - /** - * Get picture scan progress. - * @permission ohos.permission.PRINT - * @param { string } scannerId - The ID of the scanner. - * @returns { Promise } the promise returned with scan progress. - * @throws { BusinessError } 201 - Permission denied. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - function getPictureScanProgress(scannerId: string): Promise; - - /** - * Add a scanner (system API). - * @permission ohos.permission.MANAGE_PRINT_JOB - * @param { string } uniqueId - The unique ID of the scanner. - * @param { ScannerDiscoverMode } discoverMode - The discovery mode. - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Not system application. - * @syscap SystemCapability.Print.PrintFramework - * @systemapi Hide this for inner system use. - * @since 20 - * @arkts 1.2 - */ - function addScanner(uniqueId: string, discoverMode: ScannerDiscoverMode): Promise; - - /** - * Delete a scanner (system API). - * @permission ohos.permission.MANAGE_PRINT_JOB - * @param { string } uniqueId - The unique ID of the scanner. - * @param { ScannerDiscoverMode } discoverMode - The discovery mode. - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Not system application. - * @syscap SystemCapability.Print.PrintFramework - * @systemapi Hide this for inner system use. - * @since 20 - * @arkts 1.2 - */ - function deleteScanner(uniqueId: string, discoverMode: ScannerDiscoverMode): Promise; - - /** - * Get added scanners (system API). - * @permission ohos.permission.MANAGE_PRINT_JOB - * @returns { Promise> } the promise returned with scanner devices. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Not system application. - * @syscap SystemCapability.Print.PrintFramework - * @systemapi Hide this for inner system use. - * @since 20 - * @arkts 1.2 - */ - function getAddedScanner(): Promise>; - - /** - * Register event callback for scanner device found. - * @permission ohos.permission.PRINT - * @param { 'scanDeviceFound' } type - Event type. - * @param { Callback } [callback] - Callback for device found event. - * @throws { BusinessError } 201 - Permission denied. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - function on(type: 'scanDeviceFound', callback: Callback): void; - - /** - * Unregister event callback for scanner device found. - * @permission ohos.permission.PRINT - * @param { 'scanDeviceFound' } type - Event type. - * @param { Callback } [callback] - Optional callback to unregister. - * @throws { BusinessError } 201 - Permission denied. - * @syscap SystemCapability.Print.PrintFramework - * @since 20 - * @arkts 1.2 - */ - function off(type: 'scanDeviceFound', callback?: Callback): void; - - /** - * Register event callback for scanner device sync (system API). - * @permission ohos.permission.MANAGE_PRINT_JOB - * @param { 'scanDeviceSync' } type - Event type. - * @param { Callback } [callback] - Callback for device sync event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Not system application. - * @syscap SystemCapability.Print.PrintFramework - * @systemapi Hide this for inner system use. - * @since 20 - * @arkts 1.2 - */ - function on(type: 'scanDeviceSync', callback: Callback): void; - - /** - * Unregister event callback for scanner device sync (system API). - * @permission ohos.permission.MANAGE_PRINT_JOB - * @param { 'scanDeviceSync' } type - Event type. - * @param { Callback } [callback] - Optional callback to unregister. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Not system application. - * @syscap SystemCapability.Print.PrintFramework - * @systemapi Hide this for inner system use. - * @since 20 - * @arkts 1.2 - */ - function off(type: 'scanDeviceSync', callback?: Callback): void; - - /** - * Register event callback for scanner device add (system API). - * @permission ohos.permission.MANAGE_PRINT_JOB - * @param { 'scanDeviceAdd' } type - Event type. - * @param { Callback } [callback] - Callback for device add event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Not system application. - * @syscap SystemCapability.Print.PrintFramework - * @systemapi Hide this for inner system use. - * @since 20 - * @arkts 1.2 - */ - function on(type: 'scanDeviceAdd', callback: Callback): void; - - /** - * Unregister event callback for scanner device add (system API). - * @permission ohos.permission.MANAGE_PRINT_JOB - * @param { 'scanDeviceAdd' } type - Event type. - * @param { Callback } [callback] - Optional callback to unregister. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Not system application. - * @syscap SystemCapability.Print.PrintFramework - * @systemapi Hide this for inner system use. - * @since 20 - * @arkts 1.2 - */ - function off(type: 'scanDeviceAdd', callback?: Callback): void; - - /** - * Register event callback for scanner device delete (system API). - * @permission ohos.permission.MANAGE_PRINT_JOB - * @param { 'scanDeviceDel' } type - Event type. - * @param { Callback } [callback] - Callback for device delete event. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Not system application. - * @syscap SystemCapability.Print.PrintFramework - * @systemapi Hide this for inner system use. - * @since 20 - * @arkts 1.2 - */ - function on(type: 'scanDeviceDel', callback: Callback): void; - - /** - * Unregister event callback for scanner device delete (system API). - * @permission ohos.permission.MANAGE_PRINT_JOB - * @param { 'scanDeviceDel' } type - Event type. - * @param { Callback } [callback] - Optional callback to unregister. - * @throws { BusinessError } 201 - Permission denied. - * @throws { BusinessError } 202 - Not system application. - * @syscap SystemCapability.Print.PrintFramework - * @systemapi Hide this for inner system use. - * @since 20 - * @arkts 1.2 - */ - function off(type: 'scanDeviceDel', callback?: Callback): void; -} -export default scan; \ No newline at end of file -- Gitee From 6d2318f2aebc3990e377732ff3923bd7347fcf33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=98=8A=E8=8B=8F?= Date: Tue, 15 Jul 2025 19:53:20 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=93=E5=8D=B0extensi?= =?UTF-8?q?on=E6=8A=A5=E9=94=99;=20Signed-off-by:liuhaosu@huawei.com?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘昊苏 --- api/@ohos.app.ability.PrintExtensionAbility.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/@ohos.app.ability.PrintExtensionAbility.d.ts b/api/@ohos.app.ability.PrintExtensionAbility.d.ts index 70980d4a88..6b8b5f290f 100644 --- a/api/@ohos.app.ability.PrintExtensionAbility.d.ts +++ b/api/@ohos.app.ability.PrintExtensionAbility.d.ts @@ -18,7 +18,7 @@ * @kit BasicServicesKit */ -import type Want from './@ohos.application.Want'; +import type Want from './@ohos.app.ability.Want'; import type print from './@ohos.print'; /** -- Gitee