• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License"),
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit BasicServicesKit
19 */
20
21import type { Callback } from './@ohos.base';
22
23/**
24 * System scan
25 *
26 * @namespace scan
27 * @syscap SystemCapability.Print.PrintFramework
28 * @since 20
29 * @arkts 1.1&1.2
30 */
31declare namespace scan {
32    /**
33     * Enumeration of scan error codes.
34     * @enum { int } ScanErrorCode
35     * @syscap SystemCapability.Print.PrintFramework
36     * @since 20
37     * @arkts 1.1&1.2
38     */
39    enum ScanErrorCode {
40        /**
41         * No permission error.
42         * @syscap SystemCapability.Print.PrintFramework
43         * @since 20
44         * @arkts 1.1&1.2
45         */
46        SCAN_ERROR_NO_PERMISSION = 201,
47
48        /**
49         * Not system application error.
50         * @syscap SystemCapability.Print.PrintFramework
51         * @since 20
52         * @arkts 1.1&1.2
53         */
54        SCAN_ERROR_NOT_SYSTEM_APPLICATION = 202,
55
56        /**
57         * Invalid parameter error.
58         * @syscap SystemCapability.Print.PrintFramework
59         * @since 20
60         * @arkts 1.1&1.2
61         */
62        SCAN_ERROR_INVALID_PARAMETER = 401,
63
64        /**
65         * Generic failure error.
66         * @syscap SystemCapability.Print.PrintFramework
67         * @since 20
68         * @arkts 1.1&1.2
69         */
70        SCAN_ERROR_GENERIC_FAILURE = 13100001,
71
72        /**
73         * RPC failure error.
74         * @syscap SystemCapability.Print.PrintFramework
75         * @since 20
76         * @arkts 1.1&1.2
77         */
78        SCAN_ERROR_RPC_FAILURE = 13100002,
79
80        /**
81         * Server failure error.
82         * @syscap SystemCapability.Print.PrintFramework
83         * @since 20
84         * @arkts 1.1&1.2
85         */
86        SCAN_ERROR_SERVER_FAILURE = 13100003,
87
88        /**
89         * Unsupported operation error.
90         * @syscap SystemCapability.Print.PrintFramework
91         * @since 20
92         * @arkts 1.1&1.2
93         */
94        SCAN_ERROR_UNSUPPORTED = 13100004,
95
96        /**
97         * Operation canceled error.
98         * @syscap SystemCapability.Print.PrintFramework
99         * @since 20
100         * @arkts 1.1&1.2
101         */
102        SCAN_ERROR_CANCELED = 13100005,
103
104        /**
105         * Device busy error.
106         * @syscap SystemCapability.Print.PrintFramework
107         * @since 20
108         * @arkts 1.1&1.2
109         */
110        SCAN_ERROR_DEVICE_BUSY = 13100006,
111
112        /**
113         * Invalid operation error.
114         * @syscap SystemCapability.Print.PrintFramework
115         * @since 20
116         * @arkts 1.1&1.2
117         */
118        SCAN_ERROR_INVALID = 13100007,
119
120        /**
121         * Paper jam error.
122         * @syscap SystemCapability.Print.PrintFramework
123         * @since 20
124         * @arkts 1.1&1.2
125         */
126        SCAN_ERROR_JAMMED = 13100008,
127
128        /**
129         * No documents error.
130         * @syscap SystemCapability.Print.PrintFramework
131         * @since 20
132         * @arkts 1.1&1.2
133         */
134        SCAN_ERROR_NO_DOCS = 13100009,
135
136        /**
137         * Cover open error.
138         * @syscap SystemCapability.Print.PrintFramework
139         * @since 20
140         * @arkts 1.1&1.2
141         */
142        SCAN_ERROR_COVER_OPEN = 13100010,
143
144        /**
145         * I/O error.
146         * @syscap SystemCapability.Print.PrintFramework
147         * @since 20
148         * @arkts 1.1&1.2
149         */
150        SCAN_ERROR_IO_ERROR = 13100011,
151
152        /**
153         * No memory error.
154         * @syscap SystemCapability.Print.PrintFramework
155         * @since 20
156         * @arkts 1.1&1.2
157         */
158        SCAN_ERROR_NO_MEMORY = 13100012,
159    }
160
161    /**
162     * Enumeration of constraint types.
163     * @enum { int } ConstraintType
164     * @syscap SystemCapability.Print.PrintFramework
165     * @since 20
166     * @arkts 1.1&1.2
167     */
168    enum ConstraintType {
169        /**
170         * No constraint.
171         * @syscap SystemCapability.Print.PrintFramework
172         * @since 20
173         * @arkts 1.1&1.2
174         */
175        SCAN_CONSTRAINT_NONE = 0,
176
177        /**
178         * Range constraint.
179         * @syscap SystemCapability.Print.PrintFramework
180         * @since 20
181         * @arkts 1.1&1.2
182         */
183        SCAN_CONSTRAINT_RANGE = 1,
184
185        /**
186         * Word list constraint.
187         * @syscap SystemCapability.Print.PrintFramework
188         * @since 20
189         * @arkts 1.1&1.2
190         */
191        SCAN_CONSTRAINT_WORD_LIST = 2,
192
193        /**
194         * String list constraint.
195         * @syscap SystemCapability.Print.PrintFramework
196         * @since 20
197         * @arkts 1.1&1.2
198         */
199        SCAN_CONSTRAINT_STRING_LIST = 3,
200    }
201
202    /**
203     * Enumeration of physical units.
204     * @enum { int } PhysicalUnit
205     * @syscap SystemCapability.Print.PrintFramework
206     * @since 20
207     * @arkts 1.1&1.2
208     */
209    enum PhysicalUnit {
210        /**
211         * No unit.
212         * @syscap SystemCapability.Print.PrintFramework
213         * @since 20
214         * @arkts 1.1&1.2
215         */
216        SCAN_UNIT_NONE = 0,
217
218        /**
219         * Pixel unit.
220         * @syscap SystemCapability.Print.PrintFramework
221         * @since 20
222         * @arkts 1.1&1.2
223         */
224        SCAN_UNIT_PIXEL = 1,
225
226        /**
227         * Bit unit.
228         * @syscap SystemCapability.Print.PrintFramework
229         * @since 20
230         * @arkts 1.1&1.2
231         */
232        SCAN_UNIT_BIT = 2,
233
234        /**
235         * Millimeter unit.
236         * @syscap SystemCapability.Print.PrintFramework
237         * @since 20
238         * @arkts 1.1&1.2
239         */
240        SCAN_UNIT_MM = 3,
241
242        /**
243         * DPI unit.
244         * @syscap SystemCapability.Print.PrintFramework
245         * @since 20
246         * @arkts 1.1&1.2
247         */
248        SCAN_UNIT_DPI = 4,
249
250        /**
251         * Percentage unit.
252         * @syscap SystemCapability.Print.PrintFramework
253         * @since 20
254         * @arkts 1.1&1.2
255         */
256        SCAN_UNIT_PERCENT = 5,
257
258        /**
259         * Microsecond unit.
260         * @syscap SystemCapability.Print.PrintFramework
261         * @since 20
262         * @arkts 1.1&1.2
263         */
264        SCAN_UNIT_MICROSECOND = 6,
265    }
266
267    /**
268     * Enumeration of option value types.
269     * @enum { int } OptionValueType
270     * @syscap SystemCapability.Print.PrintFramework
271     * @since 20
272     * @arkts 1.1&1.2
273     */
274    enum OptionValueType {
275        /**
276         * Boolean type.
277         * @syscap SystemCapability.Print.PrintFramework
278         * @since 20
279         * @arkts 1.1&1.2
280         */
281        SCAN_TYPE_BOOL = 0,
282
283        /**
284         * Integer type.
285         * @syscap SystemCapability.Print.PrintFramework
286         * @since 20
287         * @arkts 1.1&1.2
288         */
289        SCAN_TYPE_INT = 1,
290
291        /**
292         * Fixed point type.
293         * @syscap SystemCapability.Print.PrintFramework
294         * @since 20
295         * @arkts 1.1&1.2
296         */
297        SCAN_TYPE_FIXED = 2,
298
299        /**
300         * String type.
301         * @syscap SystemCapability.Print.PrintFramework
302         * @since 20
303         * @arkts 1.1&1.2
304         */
305        SCAN_TYPE_STRING = 3,
306    }
307
308    /**
309     * Enumeration of scanner sync modes.
310     * @enum { string } ScannerSyncMode
311     * @syscap SystemCapability.Print.PrintFramework
312     * @since 20
313     * @arkts 1.1&1.2
314     */
315    enum ScannerSyncMode {
316        /**
317         * Update mode.
318         * @syscap SystemCapability.Print.PrintFramework
319         * @since 20
320         * @arkts 1.1&1.2
321         */
322        UPDATE_STR = 'update',
323
324        /**
325         * Delete mode.
326         * @syscap SystemCapability.Print.PrintFramework
327         * @since 20
328         * @arkts 1.1&1.2
329         */
330        DELETE_STR = 'delete',
331    }
332
333    /**
334     * Enumeration of scanner discovery modes.
335     * @enum { string } ScannerDiscoveryMode
336     * @syscap SystemCapability.Print.PrintFramework
337     * @since 20
338     * @arkts 1.1&1.2
339     */
340    enum ScannerDiscoveryMode {
341        /**
342         * TCP discovery mode.
343         * @syscap SystemCapability.Print.PrintFramework
344         * @since 20
345         * @arkts 1.1&1.2
346         */
347        TCP_STR = 'TCP',
348
349        /**
350         * USB discovery mode.
351         * @syscap SystemCapability.Print.PrintFramework
352         * @since 20
353         * @arkts 1.1&1.2
354         */
355        USB_STR = 'USB',
356    }
357
358    /**
359     * Defines a range with minimum, maximum and quantization values.
360     * @typedef Range
361     * @syscap SystemCapability.Print.PrintFramework
362     * @since 20
363     * @arkts 1.1&1.2
364     */
365    interface Range {
366        /**
367         * Minimum value of the range.
368         * @type { int }
369         * @syscap SystemCapability.Print.PrintFramework
370         * @since 20
371         * @arkts 1.1&1.2
372         */
373        minValue: int;
374
375        /**
376         * Maximum value of the range.
377         * @type { int }
378         * @syscap SystemCapability.Print.PrintFramework
379         * @since 20
380         * @arkts 1.1&1.2
381         */
382        maxValue: int;
383
384        /**
385         * Quantization value of the range.
386         * @type { int }
387         * @syscap SystemCapability.Print.PrintFramework
388         * @since 20
389         * @arkts 1.1&1.2
390         */
391        quantValue: int;
392    }
393
394    /**
395     * Defines scanner parameters.
396     * @typedef ScannerParameter
397     * @syscap SystemCapability.Print.PrintFramework
398     * @since 20
399     * @arkts 1.1&1.2
400     */
401    interface ScannerParameter {
402        /**
403         * Name of the option.
404         * @type { string }
405         * @syscap SystemCapability.Print.PrintFramework
406         * @since 20
407         * @arkts 1.1&1.2
408         */
409        optionName: string;
410
411        /**
412         * Index of the option.
413         * @type { int }
414         * @syscap SystemCapability.Print.PrintFramework
415         * @since 20
416         * @arkts 1.1&1.2
417         */
418        optionIndex: int;
419
420        /**
421         * Title of the option.
422         * @type { string }
423         * @syscap SystemCapability.Print.PrintFramework
424         * @since 20
425         * @arkts 1.1&1.2
426         */
427        optionTitle: string;
428
429        /**
430         * Description of the option.
431         * @type { string }
432         * @syscap SystemCapability.Print.PrintFramework
433         * @since 20
434         * @arkts 1.1&1.2
435         */
436        optionDesc: string;
437
438        /**
439         * Type of the option value.
440         * @type { OptionValueType }
441         * @syscap SystemCapability.Print.PrintFramework
442         * @since 20
443         * @arkts 1.1&1.2
444         */
445        optionType: OptionValueType;
446
447        /**
448         * Physical unit of the option.
449         * @type { PhysicalUnit }
450         * @syscap SystemCapability.Print.PrintFramework
451         * @since 20
452         * @arkts 1.1&1.2
453         */
454        optionUnit: PhysicalUnit;
455
456        /**
457         * Constraint type of the option.
458         * @type { ConstraintType }
459         * @syscap SystemCapability.Print.PrintFramework
460         * @since 20
461         * @arkts 1.1&1.2
462         */
463        optionConstraintType: ConstraintType;
464
465        /**
466         * String constraints for the option.
467         * @type { ?string[] }
468         * @syscap SystemCapability.Print.PrintFramework
469         * @since 20
470         * @arkts 1.1&1.2
471         */
472        optionConstraintString?: string[];
473
474        /**
475         * Int constraints for the option.
476         * @type { ?int[] }
477         * @syscap SystemCapability.Print.PrintFramework
478         * @since 20
479         * @arkts 1.1&1.2
480         */
481        optionConstraintInt?: int[];
482
483        /**
484         * Range constraints for the option.
485         * @type { ?Range }
486         * @syscap SystemCapability.Print.PrintFramework
487         * @since 20
488         * @arkts 1.1&1.2
489         */
490        optionConstraintRange?: Range;
491    }
492
493    /**
494     * Defines scanner option values.
495     * @typedef ScannerOptionValue
496     * @syscap SystemCapability.Print.PrintFramework
497     * @since 20
498     * @arkts 1.1&1.2
499     */
500    interface ScannerOptionValue {
501        /**
502         * Type of the value.
503         * @type { OptionValueType }
504         * @syscap SystemCapability.Print.PrintFramework
505         * @since 20
506         * @arkts 1.1&1.2
507         */
508        valueType: OptionValueType;
509
510        /**
511         * Numeric value.
512         * @type { ?int }
513         * @syscap SystemCapability.Print.PrintFramework
514         * @since 20
515         * @arkts 1.1&1.2
516         */
517        numValue?: int;
518
519        /**
520         * String value.
521         * @type { ?string }
522         * @syscap SystemCapability.Print.PrintFramework
523         * @since 20
524         * @arkts 1.1&1.2
525         */
526        strValue?: string;
527
528        /**
529         * Boolean value.
530         * @type { ?boolean }
531         * @syscap SystemCapability.Print.PrintFramework
532         * @since 20
533         * @arkts 1.1&1.2
534         */
535        boolValue?: boolean;
536    }
537
538    /**
539     * Defines picture scan progress.
540     * @typedef PictureScanProgress
541     * @syscap SystemCapability.Print.PrintFramework
542     * @since 20
543     * @arkts 1.1&1.2
544     */
545    interface PictureScanProgress {
546        /**
547         * Current progress percentage.
548         * @type { int }
549         * @syscap SystemCapability.Print.PrintFramework
550         * @since 20
551         * @arkts 1.1&1.2
552         */
553        progress: int;
554
555        /**
556         * File descriptor of the scanned picture.
557         * @type { int }
558         * @syscap SystemCapability.Print.PrintFramework
559         * @since 20
560         * @arkts 1.1&1.2
561         */
562        pictureFd: int;
563
564        /**
565         * Whether this is the final progress update.
566         * @type { boolean }
567         * @syscap SystemCapability.Print.PrintFramework
568         * @since 20
569         * @arkts 1.1&1.2
570         */
571        isFinal: boolean;
572    }
573
574    /**
575     * Defines scanner device information.
576     * @typedef ScannerDevice
577     * @syscap SystemCapability.Print.PrintFramework
578     * @since 20
579     * @arkts 1.1&1.2
580     */
581    interface ScannerDevice {
582        /**
583         * Unique identifier of the scanner.
584         * @type { string }
585         * @syscap SystemCapability.Print.PrintFramework
586         * @since 20
587         * @arkts 1.1&1.2
588         */
589        scannerId: string;
590
591        /**
592         * Discovery mode of the scanner.
593         * @type { ScannerDiscoveryMode }
594         * @syscap SystemCapability.Print.PrintFramework
595         * @since 20
596         * @arkts 1.1&1.2
597         */
598        discoveryMode: ScannerDiscoveryMode;
599
600        /**
601         * Unique ID of the scanner.
602         * @type { string }
603         * @syscap SystemCapability.Print.PrintFramework
604         * @since 20
605         * @arkts 1.1&1.2
606         */
607        uniqueId: string;
608
609        /**
610         * Manufacturer of the scanner.
611         * @type { string }
612         * @syscap SystemCapability.Print.PrintFramework
613         * @since 20
614         * @arkts 1.1&1.2
615         */
616        manufacturer: string;
617
618        /**
619         * Model of the scanner.
620         * @type { string }
621         * @syscap SystemCapability.Print.PrintFramework
622         * @since 20
623         * @arkts 1.1&1.2
624         */
625        model: string;
626
627        /**
628         * Name of the scanner device.
629         * @type { string }
630         * @syscap SystemCapability.Print.PrintFramework
631         * @since 20
632         * @arkts 1.1&1.2
633         */
634        deviceName: string;
635    }
636
637    /**
638     * Defines scanner sync device information.
639     * @typedef ScannerSyncDevice
640     * @syscap SystemCapability.Print.PrintFramework
641     * @since 20
642     * @arkts 1.1&1.2
643    */
644    interface ScannerSyncDevice {
645        /**
646         * Scanner ID.
647         * @type { string }
648         * @syscap SystemCapability.Print.PrintFramework
649         * @since 20
650         * @arkts 1.1&1.2
651         */
652        scannerId: string;
653            /**
654         * Discovery mode.
655         * @type { ScannerDiscoveryMode }
656         * @syscap SystemCapability.Print.PrintFramework
657         * @since 20
658         * @arkts 1.1&1.2
659         */
660        discoveryMode: ScannerDiscoveryMode;
661
662        /**
663         * Unique ID.
664         * @type { string }
665         * @syscap SystemCapability.Print.PrintFramework
666         * @since 20
667         * @arkts 1.1&1.2
668         */
669        uniqueId: string;
670
671        /**
672         * Sync mode.
673         * @type { ScannerSyncMode }
674         * @syscap SystemCapability.Print.PrintFramework
675         * @since 20
676         * @arkts 1.1&1.2
677         */
678        syncMode: ScannerSyncMode;
679
680        /**
681         * Old scanner ID, which is valid only when syncMode is "update".
682		 * @type { ?string }
683         * @syscap SystemCapability.Print.PrintFramework
684         * @since 20
685         * @arkts 1.1&1.2
686         */
687        oldScannerId?: string;
688    }
689
690    /**
691     * Initialize the scan service.
692     * @permission ohos.permission.PRINT
693     * @returns { Promise<void> } the promise returned by the function.
694     * @throws { BusinessError } 201 - Permission denied.
695     * @syscap SystemCapability.Print.PrintFramework
696     * @since 20
697     * @arkts 1.1&1.2
698     */
699    function init(): Promise<void>;
700
701    /**
702     * Exit the scan service.
703     * @permission ohos.permission.PRINT
704     * @returns { Promise<void> } the promise returned by the function.
705     * @throws { BusinessError } 201 - Permission denied.
706     * @syscap SystemCapability.Print.PrintFramework
707     * @since 20
708     * @arkts 1.1&1.2
709     */
710    function exit(): Promise<void>;
711
712    /**
713     * Start discovering scanners.
714     * @permission ohos.permission.PRINT
715     * @returns { Promise<void> } the promise returned by the function.
716     * @throws { BusinessError } 201 - Permission denied.
717     * @syscap SystemCapability.Print.PrintFramework
718     * @since 20
719     * @arkts 1.1&1.2
720     */
721    function startScannerDiscovery(): Promise<void>;
722
723    /**
724     * Open a scanner.
725     * @permission ohos.permission.PRINT
726     * @param { string } scannerId - The ID of the scanner to open.
727     * @returns { Promise<void> } the promise returned by the function.
728     * @throws { BusinessError } 201 - Permission denied.
729     * @syscap SystemCapability.Print.PrintFramework
730     * @since 20
731     * @arkts 1.1&1.2
732     */
733    function openScanner(scannerId: string): Promise<void>;
734
735    /**
736     * Close a scanner.
737     * @permission ohos.permission.PRINT
738     * @param { string } scannerId - The ID of the scanner to close.
739     * @returns { Promise<void> } the promise returned by the function.
740     * @throws { BusinessError } 201 - Permission denied.
741     * @syscap SystemCapability.Print.PrintFramework
742     * @since 20
743     * @arkts 1.1&1.2
744     */
745    function closeScanner(scannerId: string): Promise<void>;
746
747    /**
748     * Get scanner parameters.
749     * @permission ohos.permission.PRINT
750     * @param { string } scannerId - The ID of the scanner.
751     * @returns { Promise<ScannerParameter[]> } the promise returned with scanner parameters.
752     * @throws { BusinessError } 201 - Permission denied.
753     * @syscap SystemCapability.Print.PrintFramework
754     * @since 20
755     * @arkts 1.1&1.2
756     */
757    function getScannerParameter(scannerId: string): Promise<ScannerParameter[]>;
758
759    /**
760     * Set scanner parameter.
761     * @permission ohos.permission.PRINT
762     * @param { string } scannerId - The ID of the scanner.
763     * @param { int } optionIndex - The index of the option to set.
764     * @param { ScannerOptionValue } value - The value to set.
765     * @returns { Promise<void> } the promise returned by the function.
766     * @throws { BusinessError } 201 - Permission denied.
767     * @syscap SystemCapability.Print.PrintFramework
768     * @since 20
769     * @arkts 1.1&1.2
770     */
771    function setScannerParameter(scannerId: string, optionIndex: int, value: ScannerOptionValue): Promise<void>;
772
773    /**
774     * Set scan option to auto.
775     * @permission ohos.permission.PRINT
776     * @param { string } scannerId - The ID of the scanner.
777     * @param { int } optionIndex - The index of the option to set to auto.
778     * @returns { Promise<void> } the promise returned by the function.
779     * @throws { BusinessError } 201 - Permission denied.
780     * @syscap SystemCapability.Print.PrintFramework
781     * @since 20
782     * @arkts 1.1&1.2
783     */
784    function setScanAutoOption(scannerId: string, optionIndex: int): Promise<void>;
785
786    /**
787     * Get current scanner setting.
788     * @permission ohos.permission.PRINT
789     * @param { string } scannerId - The ID of the scanner.
790     * @param { int } optionIndex - The index of the option to get.
791     * @returns { Promise<ScannerOptionValue> } the promise returned with the current setting.
792     * @throws { BusinessError } 201 - Permission denied.
793     * @syscap SystemCapability.Print.PrintFramework
794     * @since 20
795     * @arkts 1.1&1.2
796     */
797    function getScannerCurrentSetting(scannerId: string, optionIndex: int): Promise<ScannerOptionValue>;
798
799    /**
800     * Start scanning.
801     * @permission ohos.permission.PRINT
802     * @param { string } scannerId - The ID of the scanner.
803     * @param { boolean } batchMode - Whether to use batch mode.
804     * @returns { Promise<void> } the promise returned by the function.
805     * @throws { BusinessError } 201 - Permission denied.
806     * @syscap SystemCapability.Print.PrintFramework
807     * @since 20
808     * @arkts 1.1&1.2
809     */
810    function startScan(scannerId: string, batchMode: boolean): Promise<void>;
811
812    /**
813     * Cancel scanning.
814     * @permission ohos.permission.PRINT
815     * @param { string } scannerId - The ID of the scanner.
816     * @returns { Promise<void> } the promise returned by the function.
817     * @throws { BusinessError } 201 - Permission denied.
818     * @syscap SystemCapability.Print.PrintFramework
819     * @since 20
820     * @arkts 1.1&1.2
821     */
822    function cancelScan(scannerId: string): Promise<void>;
823
824    /**
825     * Get picture scan progress.
826     * @permission ohos.permission.PRINT
827     * @param { string } scannerId - The ID of the scanner.
828     * @returns { Promise<PictureScanProgress> } the promise returned with scan progress.
829     * @throws { BusinessError } 201 - Permission denied.
830     * @syscap SystemCapability.Print.PrintFramework
831     * @since 20
832     * @arkts 1.1&1.2
833     */
834    function getPictureScanProgress(scannerId: string): Promise<PictureScanProgress>;
835
836    /**
837     * Add a scanner (system API).
838     * @permission ohos.permission.MANAGE_PRINT_JOB
839     * @param { string } uniqueId - The unique ID of the scanner.
840     * @param { ScannerDiscoveryMode } discoveryMode - The discovery mode.
841     * @returns { Promise<void> } the promise returned by the function.
842     * @throws { BusinessError } 201 - Permission denied.
843     * @throws { BusinessError } 202 - Not system application.
844     * @syscap SystemCapability.Print.PrintFramework
845     * @systemapi Hide this for inner system use.
846     * @since 20
847     * @arkts 1.1&1.2
848     */
849    function addScanner(uniqueId: string, discoveryMode: ScannerDiscoveryMode): Promise<void>;
850
851    /**
852     * Delete a scanner (system API).
853     * @permission ohos.permission.MANAGE_PRINT_JOB
854     * @param { string } uniqueId - The unique ID of the scanner.
855     * @param { ScannerDiscoveryMode } discoveryMode - The discovery mode.
856     * @returns { Promise<void> } the promise returned by the function.
857     * @throws { BusinessError } 201 - Permission denied.
858     * @throws { BusinessError } 202 - Not system application.
859     * @syscap SystemCapability.Print.PrintFramework
860     * @systemapi Hide this for inner system use.
861     * @since 20
862     * @arkts 1.1&1.2
863     */
864    function deleteScanner(uniqueId: string, discoveryMode: ScannerDiscoveryMode): Promise<void>;
865
866    /**
867     * Get added scanners (system API).
868     * @permission ohos.permission.MANAGE_PRINT_JOB
869     * @returns { Promise<ScannerDevice[]> } the promise returned with scanner devices.
870     * @throws { BusinessError } 201 - Permission denied.
871     * @throws { BusinessError } 202 - Not system application.
872     * @syscap SystemCapability.Print.PrintFramework
873     * @systemapi Hide this for inner system use.
874     * @since 20
875     * @arkts 1.1&1.2
876     */
877    function getAddedScanners(): Promise<ScannerDevice[]>;
878
879    /**
880     * Register event callback for scanner device found.
881     * @permission ohos.permission.PRINT
882     * @param { 'scanDeviceFound' } type - Event type.
883     * @param { Callback<ScannerDevice> } callback - Callback for device found event.
884     * @throws { BusinessError } 201 - Permission denied.
885     * @syscap SystemCapability.Print.PrintFramework
886     * @since 20
887     * @arkts 1.1&1.2
888     */
889    function on(type: 'scanDeviceFound', callback: Callback<ScannerDevice>): void;
890
891    /**
892     * Unregister event callback for scanner device found.
893     * @permission ohos.permission.PRINT
894     * @param { 'scanDeviceFound' } type - Event type.
895     * @param { Callback<ScannerDevice> } [callback] - Optional callback to unregister.
896     * @throws { BusinessError } 201 - Permission denied.
897     * @syscap SystemCapability.Print.PrintFramework
898     * @since 20
899     * @arkts 1.1&1.2
900     */
901    function off(type: 'scanDeviceFound', callback?: Callback<ScannerDevice>): void;
902
903    /**
904     * Register event callback for scanner device sync.
905     * @permission ohos.permission.MANAGE_PRINT_JOB
906     * @param { 'scanDeviceSync' } type - Event type.
907     * @param { Callback<ScannerSyncDevice> } callback - Callback for device sync event.
908     * @throws { BusinessError } 201 - Permission denied.
909     * @syscap SystemCapability.Print.PrintFramework
910     * @since 20
911     * @arkts 1.1&1.2
912     */
913    function on(type: 'scanDeviceSync', callback: Callback<ScannerSyncDevice>): void;
914
915    /**
916     * Unregister event callback for scanner device sync.
917     * @permission ohos.permission.MANAGE_PRINT_JOB
918     * @param { 'scanDeviceSync' } type - Event type.
919     * @param { Callback<ScannerSyncDevice> } [callback] - Optional callback to unregister.
920     * @throws { BusinessError } 201 - Permission denied.
921     * @syscap SystemCapability.Print.PrintFramework
922     * @since 20
923     * @arkts 1.1&1.2
924     */
925    function off(type: 'scanDeviceSync', callback?: Callback<ScannerSyncDevice>): void;
926
927    /**
928     * Register event callback for scanner device add (system API).
929     * @permission ohos.permission.MANAGE_PRINT_JOB
930     * @param { 'scanDeviceAdd' } type - Event type.
931     * @param { Callback<ScannerDevice> } callback - Callback for device add event.
932     * @throws { BusinessError } 201 - Permission denied.
933     * @throws { BusinessError } 202 - Not system application.
934     * @syscap SystemCapability.Print.PrintFramework
935     * @systemapi Hide this for inner system use.
936     * @since 20
937     * @arkts 1.1&1.2
938     */
939    function on(type: 'scanDeviceAdd', callback: Callback<ScannerDevice>): void;
940
941    /**
942     * Unregister event callback for scanner device add (system API).
943     * @permission ohos.permission.MANAGE_PRINT_JOB
944     * @param { 'scanDeviceAdd' } type - Event type.
945     * @param { Callback<ScannerDevice> } [callback] - Optional callback to unregister.
946     * @throws { BusinessError } 201 - Permission denied.
947     * @throws { BusinessError } 202 - Not system application.
948     * @syscap SystemCapability.Print.PrintFramework
949     * @systemapi Hide this for inner system use.
950     * @since 20
951     * @arkts 1.1&1.2
952     */
953    function off(type: 'scanDeviceAdd', callback?: Callback<ScannerDevice>): void;
954
955    /**
956     * Register event callback for scanner device delete (system API).
957     * @permission ohos.permission.MANAGE_PRINT_JOB
958     * @param { 'scanDeviceDel' } type - Event type.
959     * @param { Callback<ScannerDevice> } callback - Callback for device delete event.
960     * @throws { BusinessError } 201 - Permission denied.
961     * @throws { BusinessError } 202 - Not system application.
962     * @syscap SystemCapability.Print.PrintFramework
963     * @systemapi Hide this for inner system use.
964     * @since 20
965     * @arkts 1.1&1.2
966     */
967    function on(type: 'scanDeviceDel', callback: Callback<ScannerDevice>): void;
968
969    /**
970     * Unregister event callback for scanner device delete (system API).
971     * @permission ohos.permission.MANAGE_PRINT_JOB
972     * @param { 'scanDeviceDel' } type - Event type.
973     * @param { Callback<ScannerDevice> } [callback] - Optional callback to unregister.
974     * @throws { BusinessError } 201 - Permission denied.
975     * @throws { BusinessError } 202 - Not system application.
976     * @syscap SystemCapability.Print.PrintFramework
977     * @systemapi Hide this for inner system use.
978     * @since 20
979     * @arkts 1.1&1.2
980     */
981    function off(type: 'scanDeviceDel', callback?: Callback<ScannerDevice>): void;
982}
983export default scan;