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_PPD_DRIVER_H 17 #define VENDOR_PPD_DRIVER_H 18 19 #include <vector> 20 #include "vendor_driver_base.h" 21 22 namespace OHOS { 23 namespace Print { 24 25 class VendorPpdDriver : public VendorDriverBase { 26 public: 27 VendorPpdDriver(); 28 ~VendorPpdDriver(); 29 bool OnQueryCapability(const std::string &printerId, int timeout) override; 30 bool OnQueryProperties(const std::string &printerId, const std::vector<std::string> &propertyKeys) override; 31 std::string GetVendorName() override; 32 33 private: 34 bool QueryPpdByPrinterId(const std::string &printerId, std::vector<std::string> &ppds); 35 bool AddPrinterToCups(const std::string &printerId, const std::string &ppdData); 36 std::shared_ptr<PrinterInfo> QueryPrinterCapabilityFromPpd(const std::string &printerId, 37 const std::string &ppdData); 38 bool UpdateCapability(std::shared_ptr<PrinterInfo> printerInfo); 39 40 private: 41 std::map<std::string, std::vector<std::string>> privatePrinterPpdMap; 42 }; 43 } // namespace Print 44 } // namespace OHOS 45 #endif // VENDOR_PPD_DRIVER_H