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 AddPrinters(const std::vector<PrinterInfo> &printerInfos) override; 40 int32_t RemovePrinters(const std::vector<std::string> &printerIds) override; 41 int32_t UpdatePrinters(const std::vector<PrinterInfo> &printerInfos) override; 42 int32_t UpdatePrinterState(const std::string &printerId, uint32_t state) override; 43 int32_t UpdatePrintJobStateForNormalApp(const std::string &jobId, uint32_t state, uint32_t subState) override; 44 int32_t UpdatePrintJobStateOnlyForSystemApp(const std::string &jobId, uint32_t state, uint32_t subState) override; 45 int32_t UpdateExtensionInfo(const std::string &extensionId) override; 46 int32_t RequestPreview(const PrintJob &jobinfo, std::string &previewResult) override; 47 int32_t QueryPrinterCapability(const std::string &printerId) override; 48 int32_t On(const std::string taskId, const std::string &type, const sptr<IPrintCallback> &listener) override; 49 int32_t Off(const std::string taskId, const std::string &type) override; 50 int32_t RegisterPrinterCallback(const std::string &type, const sptr<IPrintCallback> &listener) override; 51 int32_t UnregisterPrinterCallback(const std::string &type) override; 52 int32_t RegisterExtCallback(const std::string &extensionCID, 53 const sptr<IPrintExtensionCallback> &listener) override; 54 int32_t UnregisterAllExtCallback(const std::string &extensionId) override; 55 int32_t LoadExtSuccess(const std::string &extensionId) override; 56 int32_t QueryAllPrintJob(std::vector<PrintJob> &printJobs) override; 57 int32_t QueryPrintJobById(std::string &printJobId, PrintJob &printjob) override; 58 int32_t AddPrinterToCups(const std::string &printerUri, const std::string &printerName, 59 const std::string &printerMake) override; 60 int32_t QueryPrinterCapabilityByUri(const std::string &printerUri, const std::string &printerId, 61 PrinterCapability &printerCaps) override; 62 int32_t PrintByAdapter(const std::string printJobName, const PrintAttributes &printAttributes, 63 std::string &taskId) override; 64 int32_t StartGetPrintFile(const std::string &jobId, const PrintAttributes &printAttributes, 65 const uint32_t fd) override; 66 int32_t NotifyPrintService(const std::string &jobId, const std::string &type) override; 67 int32_t AddPrinterToDiscovery(const PrinterInfo &printerInfo) override; 68 int32_t UpdatePrinterInDiscovery(const PrinterInfo &printerInfo) override; 69 int32_t RemovePrinterFromDiscovery(const std::string &printerId) override; 70 int32_t UpdatePrinterInSystem(const PrinterInfo& printerInfo) override; 71 72 int32_t QueryPrinterInfoByPrinterId(const std::string &printerId, PrinterInfo &info) override; 73 int32_t QueryAddedPrinter(std::vector<std::string> &printerNameList) override; 74 int32_t QueryPrinterProperties(const std::string &printerId, const std::vector<std::string> &keyList, 75 std::vector<std::string> &valueList) override; 76 int32_t StartNativePrintJob(PrintJob &printJob) override; 77 int32_t NotifyPrintServiceEvent(std::string &jobId, uint32_t event) override; 78 int32_t GetPrinterPreference(const std::string &printerId, std::string &printerPreference) override; 79 int32_t SetPrinterPreference(const std::string &printerId, const std::string &printerPreference) override; 80 int32_t SetDefaultPrinter(const std::string &printerId, uint32_t type) override; 81 int32_t DeletePrinterFromCups(const std::string &printerName) override; 82 int32_t DiscoverUsbPrinters(std::vector<PrinterInfo> &printers) override; 83 84 private: 85 int32_t GetResult(int retCode, MessageParcel &reply); 86 static inline BrokerDelegator<PrintServiceProxy> delegator_; 87 }; 88 } // namespace OHOS::Print 89 #endif // PRINT_SERVICE_PROXY_H 90