1 /* 2 * Copyright (c) 2024 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 VENDOR_IPP_EVERYWHERE_H 17 #define VENDOR_IPP_EVERYWHERE_H 18 19 #include "vendor_driver_base.h" 20 #include "operation_queue.h" 21 22 namespace OHOS { 23 namespace Print { 24 class VendorIppEveryWhere : public VendorDriverBase { 25 public: 26 VendorIppEveryWhere(); 27 ~VendorIppEveryWhere(); 28 bool Init(IPrinterVendorManager *manager) override; 29 void UnInit() override; 30 void OnCreate() override; 31 void OnDestroy() override; 32 void OnStartDiscovery() override; 33 void OnStopDiscovery() override; 34 std::string GetVendorName() override; 35 bool OnQueryCapability(const std::string &printerId, int timeout) override; 36 bool OnQueryCapabilityByIp(const std::string &printerIp, const std::string &protocol) override; 37 bool OnQueryProperties(const std::string &printerId, const std::vector<std::string> &propertyKeys) override; 38 39 private: 40 void QueryCapabilityByUri(const std::string &uri); 41 void ConnectPrinterByUri(const std::string &uri); 42 std::shared_ptr<PrinterInfo> QueryPrinterInfoByUri(const std::string &uri); 43 std::shared_ptr<PrinterInfo> ConvertCapabilityToInfo(const PrinterCapability &printerCap, 44 const std::string &printerUri); 45 void QueryPrinterStatusByUri(const std::string &uri); 46 bool UpdateCapability(std::shared_ptr<PrinterInfo> printerInfo); 47 bool ConnectPrinter(std::shared_ptr<PrinterInfo> printerInfo); 48 bool ConvertPrinterIdByUri(std::string &uri); 49 50 private: 51 OperationQueue opQueue; 52 }; 53 } // namespace Print 54 } // namespace OHOS 55 #endif // VENDOR_IPP_EVERYWHERE_H 56