161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
461847f8eSopenharmony_ci * you may not use this file except in compliance with the License.
561847f8eSopenharmony_ci * You may obtain a copy of the License at
661847f8eSopenharmony_ci *
761847f8eSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
861847f8eSopenharmony_ci *
961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and
1361847f8eSopenharmony_ci * limitations under the License.
1461847f8eSopenharmony_ci */
1561847f8eSopenharmony_ci
1661847f8eSopenharmony_ci/**
1761847f8eSopenharmony_ci * @file
1861847f8eSopenharmony_ci * @kit BasicServicesKit
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ciimport type Want from './@ohos.application.Want';
2261847f8eSopenharmony_ciimport type print from './@ohos.print';
2361847f8eSopenharmony_ci
2461847f8eSopenharmony_ci/**
2561847f8eSopenharmony_ci * class of print extensionAbility.
2661847f8eSopenharmony_ci *
2761847f8eSopenharmony_ci * @syscap SystemCapability.Print.PrintFramework
2861847f8eSopenharmony_ci * @stagemodelonly
2961847f8eSopenharmony_ci * @since 13
3061847f8eSopenharmony_ci */
3161847f8eSopenharmony_ciexport default class PrintExtensionAbility {
3261847f8eSopenharmony_ci
3361847f8eSopenharmony_ci  /**
3461847f8eSopenharmony_ci   * Called once to initialize the extensionAbility.
3561847f8eSopenharmony_ci   * @param { Want } want - call print page want params.
3661847f8eSopenharmony_ci   * @syscap SystemCapability.Print.PrintFramework
3761847f8eSopenharmony_ci   * @stagemodelonly
3861847f8eSopenharmony_ci   * @since 13
3961847f8eSopenharmony_ci   */
4061847f8eSopenharmony_ci  onCreate(want: Want): void;
4161847f8eSopenharmony_ci
4261847f8eSopenharmony_ci  /**
4361847f8eSopenharmony_ci   * Called once to start to discover the printers connected with the device.
4461847f8eSopenharmony_ci   * @syscap SystemCapability.Print.PrintFramework
4561847f8eSopenharmony_ci   * @stagemodelonly
4661847f8eSopenharmony_ci   * @since 13
4761847f8eSopenharmony_ci   */
4861847f8eSopenharmony_ci  onStartDiscoverPrinter(): void;
4961847f8eSopenharmony_ci
5061847f8eSopenharmony_ci  /**
5161847f8eSopenharmony_ci   * Called once to stop discovering the printer.
5261847f8eSopenharmony_ci   * @syscap SystemCapability.Print.PrintFramework
5361847f8eSopenharmony_ci   * @stagemodelonly
5461847f8eSopenharmony_ci   * @since 13
5561847f8eSopenharmony_ci   */
5661847f8eSopenharmony_ci  onStopDiscoverPrinter(): void;
5761847f8eSopenharmony_ci
5861847f8eSopenharmony_ci  /**
5961847f8eSopenharmony_ci   * Called once to connect to the specific printer.
6061847f8eSopenharmony_ci   * @param { number } printerId - connect the printerId.
6161847f8eSopenharmony_ci   * @syscap SystemCapability.Print.PrintFramework
6261847f8eSopenharmony_ci   * @stagemodelonly
6361847f8eSopenharmony_ci   * @since 13
6461847f8eSopenharmony_ci   */
6561847f8eSopenharmony_ci  onConnectPrinter(printerId: number): void;
6661847f8eSopenharmony_ci
6761847f8eSopenharmony_ci  /**
6861847f8eSopenharmony_ci   * Called once to disconnect to the specific printer.
6961847f8eSopenharmony_ci   * @param { number } printerId - connect the printerId.
7061847f8eSopenharmony_ci   * @syscap SystemCapability.Print.PrintFramework
7161847f8eSopenharmony_ci   * @stagemodelonly
7261847f8eSopenharmony_ci   * @since 13
7361847f8eSopenharmony_ci   */
7461847f8eSopenharmony_ci  onDisconnectPrinter(printerId: number): void;
7561847f8eSopenharmony_ci
7661847f8eSopenharmony_ci  /**
7761847f8eSopenharmony_ci   * Called once to start print job.
7861847f8eSopenharmony_ci   * @param { print.PrintJob } jobInfo - Indicates the information of print job.
7961847f8eSopenharmony_ci   * @throws { BusinessError } 202 - not system application
8061847f8eSopenharmony_ci   * @syscap SystemCapability.Print.PrintFramework
8161847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
8261847f8eSopenharmony_ci   * @stagemodelonly
8361847f8eSopenharmony_ci   * @since 10
8461847f8eSopenharmony_ci   */
8561847f8eSopenharmony_ci  onStartPrintJob(jobInfo: print.PrintJob): void;
8661847f8eSopenharmony_ci
8761847f8eSopenharmony_ci  /**
8861847f8eSopenharmony_ci   * Called once to remove the print job has been started.
8961847f8eSopenharmony_ci   * @param { print.PrintJob } jobInfo - Indicates the information of print job.
9061847f8eSopenharmony_ci   * @throws { BusinessError } 202 - not system application
9161847f8eSopenharmony_ci   * @syscap SystemCapability.Print.PrintFramework
9261847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
9361847f8eSopenharmony_ci   * @stagemodelonly
9461847f8eSopenharmony_ci   * @since 10
9561847f8eSopenharmony_ci   */
9661847f8eSopenharmony_ci  onCancelPrintJob(jobInfo: print.PrintJob): void;
9761847f8eSopenharmony_ci
9861847f8eSopenharmony_ci  /**
9961847f8eSopenharmony_ci   * Called once to request the capability of the printer.
10061847f8eSopenharmony_ci   * @param { number } printerId - Indicates the information of printer.
10161847f8eSopenharmony_ci   * @returns { print.PrinterCapability } printer capability.
10261847f8eSopenharmony_ci   * @throws { BusinessError } 202 - not system application
10361847f8eSopenharmony_ci   * @syscap SystemCapability.Print.PrintFramework
10461847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
10561847f8eSopenharmony_ci   * @stagemodelonly
10661847f8eSopenharmony_ci   * @since 10
10761847f8eSopenharmony_ci   */
10861847f8eSopenharmony_ci  onRequestPrinterCapability(printerId: number): print.PrinterCapability;
10961847f8eSopenharmony_ci
11061847f8eSopenharmony_ci  /**
11161847f8eSopenharmony_ci   * Called once to request preview and send result to Print SA.
11261847f8eSopenharmony_ci   * @param {  print.PrintJob } jobInfo - Indicates the information of job.
11361847f8eSopenharmony_ci   * @returns { string} preview result.
11461847f8eSopenharmony_ci   * @throws { BusinessError } 202 - not system application
11561847f8eSopenharmony_ci   * @syscap SystemCapability.Print.PrintFramework
11661847f8eSopenharmony_ci   * @systemapi Hide this for inner system use.
11761847f8eSopenharmony_ci   * @stagemodelonly
11861847f8eSopenharmony_ci   * @since 10
11961847f8eSopenharmony_ci   */
12061847f8eSopenharmony_ci  onRequestPreview(jobInfo: print.PrintJob): string;
12161847f8eSopenharmony_ci
12261847f8eSopenharmony_ci  /**
12361847f8eSopenharmony_ci   * Called once to finalize the extensionAbility.
12461847f8eSopenharmony_ci   * @syscap SystemCapability.Print.PrintFramework
12561847f8eSopenharmony_ci   * @stagemodelonly
12661847f8eSopenharmony_ci   * @since 13
12761847f8eSopenharmony_ci   */
12861847f8eSopenharmony_ci  onDestroy(): void;
12961847f8eSopenharmony_ci}
130