• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 #ifndef PRINT_SERVICE_PROXY_H
17 #define PRINT_SERVICE_PROXY_H
18 
19 #include "iprint_service.h"
20 #include "iremote_proxy.h"
21 
22 namespace OHOS::Print {
23 class PrintServiceProxy : public IRemoteProxy<IPrintService> {
24 public:
25     explicit PrintServiceProxy(const sptr<IRemoteObject> &object);
26     ~PrintServiceProxy() = default;
27     DISALLOW_COPY_AND_MOVE(PrintServiceProxy);
28     virtual int32_t StartService() override;
29     int32_t StartPrint(const std::vector<std::string> &fileList,
30         const std::vector<uint32_t> &fdList, std::string &taskId) override;
31     int32_t StopPrint(const std::string &taskId) override;
32     int32_t ConnectPrinter(const std::string &printerId) override;
33     int32_t DisconnectPrinter(const std::string &printerId) override;
34     int32_t StartDiscoverPrinter(const std::vector<std::string> &extensionList) override;
35     int32_t StopDiscoverPrinter() override;
36     int32_t QueryAllExtension(std::vector<PrintExtensionInfo> &extensionInfos) override;
37     int32_t StartPrintJob(PrintJob &jobinfo) override;
38     int32_t CancelPrintJob(const std::string &jobId) override;
39     int32_t RestartPrintJob(const std::string &jobId) override;
40     int32_t AddPrinters(const std::vector<PrinterInfo> &printerInfos) override;
41     int32_t RemovePrinters(const std::vector<std::string> &printerIds) override;
42     int32_t UpdatePrinters(const std::vector<PrinterInfo> &printerInfos) override;
43     int32_t UpdatePrinterState(const std::string &printerId, uint32_t state) override;
44     int32_t UpdatePrintJobStateForNormalApp(const std::string &jobId, uint32_t state, uint32_t subState) override;
45     int32_t UpdatePrintJobStateOnlyForSystemApp(const std::string &jobId, uint32_t state, uint32_t subState) override;
46     int32_t UpdateExtensionInfo(const std::string &extensionId) override;
47     int32_t RequestPreview(const PrintJob &jobinfo, std::string &previewResult) override;
48     int32_t QueryPrinterCapability(const std::string &printerId) override;
49     int32_t On(const std::string taskId, const std::string &type, const sptr<IPrintCallback> &listener) override;
50     int32_t Off(const std::string taskId, const std::string &type) override;
51     int32_t RegisterPrinterCallback(const std::string &type, const sptr<IPrintCallback> &listener) override;
52     int32_t UnregisterPrinterCallback(const std::string &type) override;
53     int32_t RegisterExtCallback(const std::string &extensionCID,
54         const sptr<IPrintExtensionCallback> &listener) override;
55     int32_t UnregisterAllExtCallback(const std::string &extensionId) override;
56     int32_t LoadExtSuccess(const std::string &extensionId) override;
57     int32_t QueryAllActivePrintJob(std::vector<PrintJob> &printJobs) override;
58     int32_t QueryAllPrintJob(std::vector<PrintJob> &printJobs) override;
59     int32_t QueryPrintJobById(std::string &printJobId, PrintJob &printjob) override;
60     int32_t AddPrinterToCups(const std::string &printerUri, const std::string &printerName,
61         const std::string &printerMake) override;
62     int32_t QueryPrinterCapabilityByUri(const std::string &printerUri, const std::string &printerId,
63         PrinterCapability &printerCaps) override;
64     int32_t PrintByAdapter(const std::string printJobName, const PrintAttributes &printAttributes,
65         std::string &taskId) override;
66     int32_t StartGetPrintFile(const std::string &jobId, const PrintAttributes &printAttributes,
67         const uint32_t fd) override;
68     int32_t NotifyPrintService(const std::string &jobId, const std::string &type) override;
69     int32_t AddPrinterToDiscovery(const PrinterInfo &printerInfo) override;
70     int32_t UpdatePrinterInDiscovery(const PrinterInfo &printerInfo) override;
71     int32_t RemovePrinterFromDiscovery(const std::string &printerId) override;
72     int32_t UpdatePrinterInSystem(const PrinterInfo& printerInfo) override;
73 
74     int32_t QueryPrinterInfoByPrinterId(const std::string &printerId, PrinterInfo &info) override;
75     int32_t QueryAddedPrinter(std::vector<std::string> &printerNameList) override;
76     int32_t QueryPrinterProperties(const std::string &printerId, const std::vector<std::string> &keyList,
77         std::vector<std::string> &valueList) override;
78     int32_t StartNativePrintJob(PrintJob &printJob) override;
79     int32_t NotifyPrintServiceEvent(std::string &jobId, uint32_t event) override;
80     int32_t SetPrinterPreference(const std::string &printerId, const PrinterPreferences &printerPreference) override;
81     int32_t SetDefaultPrinter(const std::string &printerId, uint32_t type) override;
82     int32_t DeletePrinterFromCups(const std::string &printerName) override;
83     int32_t DiscoverUsbPrinters(std::vector<PrinterInfo> &printers) override;
84 
85 private:
86     int32_t GetResult(int retCode, MessageParcel &reply);
87     static inline BrokerDelegator<PrintServiceProxy> delegator_;
88 };
89 }  // namespace OHOS::Print
90 #endif  // PRINT_SERVICE_PROXY_H
91