mirror of
https://gitee.com/openharmony/print_print_fwk
synced 2024-11-26 18:40:40 +00:00
commit
ba4cb9c9cd
@ -418,10 +418,13 @@ bool UpdatePrinterInfoWithDiscovery(PrinterInfo &info, const Print_DiscoveryItem
|
||||
option["printerName"] = name;
|
||||
option["printerUri"] = std::string(discoveryItem->printerUri);
|
||||
option["make"] = std::string(discoveryItem->makeAndModel);
|
||||
nlohmann::json detailInfo = nlohmann::json::parse(std::string(discoveryItem->detailInfo));
|
||||
if (detailInfo != nullptr && detailInfo.contains("bsunidriver_support") &&
|
||||
detailInfo["bsunidriver_support"].is_string()) {
|
||||
option["bsunidriverSupport"] = std::string(detailInfo["bsunidriver_support"]);
|
||||
std::string detailInfoStr = std::string(discoveryItem->detailInfo);
|
||||
if (nlohmann::json::accept(detailInfoStr)) {
|
||||
nlohmann::json detailInfo = nlohmann::json::parse(detailInfoStr);
|
||||
if (!detailInfo.is_null() && detailInfo.contains("bsunidriver_support") &&
|
||||
detailInfo["bsunidriver_support"].is_string()) {
|
||||
option["bsunidriverSupport"] = detailInfo["bsunidriver_support"].get<std::string>();
|
||||
}
|
||||
}
|
||||
info.SetOption(option.dump());
|
||||
}
|
||||
|
@ -20,8 +20,6 @@
|
||||
#include "vendor_ipp_everywhere.h"
|
||||
#include "vendor_ppd_driver.h"
|
||||
#include "print_log.h"
|
||||
#include "vendor_ppd_driver.h"
|
||||
#include "print_utils.h"
|
||||
#include "print_utils.h"
|
||||
|
||||
using namespace OHOS::Print;
|
||||
@ -469,7 +467,11 @@ bool VendorManager::IsPrivatePpdDriver(const std::string &vendorName, const Prin
|
||||
PRINT_HILOGD("IsPrivatePpdDriver vendorName=%{public}s", vendorName.c_str());
|
||||
PRINT_HILOGD("IsPrivatePpdDriver printerName=%{public}s", printerInfo.GetPrinterName().c_str());
|
||||
if (vendorName == "driver.bsuni") {
|
||||
nlohmann::json option = nlohmann::json::parse(std::string(printerInfo.GetOption()));
|
||||
std::string optionStr = std::string(printerInfo.GetOption());
|
||||
if (!nlohmann::json::accept(optionStr)) {
|
||||
return false;
|
||||
}
|
||||
nlohmann::json option = nlohmann::json::parse(optionStr);
|
||||
if (option != nullptr && option.contains("bsunidriverSupport") && option["bsunidriverSupport"].is_string()) {
|
||||
PRINT_HILOGD("IsPrivatePpdDriver bsunidriverSupport=%{public}s",
|
||||
std::string(option["bsunidriverSupport"]).c_str());
|
||||
|
@ -35,10 +35,10 @@ public:
|
||||
MOCK_METHOD0(ClearConnectingPrinter, void ());
|
||||
MOCK_METHOD2(QueryPrinterCapabilityByUri, bool (const std::string &, PrinterCapability &));
|
||||
MOCK_METHOD2(QueryPrinterStatusByUri, bool (const std::string &, PrinterStatus &));
|
||||
MOCK_METHOD2(QueryDiscoveredPrinterInfoById, std::shared_ptr<PrinterInfo>(const std::string &,
|
||||
MOCK_METHOD2(QueryDiscoveredPrinterInfoById, std::shared_ptr<PrinterInfo> (const std::string &,
|
||||
const std::string &));
|
||||
MOCK_METHOD3(QueryPrinterInfoByPrinterId, int32_t(const std::string &, const std::string &, PrinterInfo &));
|
||||
MOCK_METHOD2(QueryPPDInformation, bool(const char *, std::vector<std::string> &));
|
||||
MOCK_METHOD3(QueryPrinterInfoByPrinterId, int32_t (const std::string &, const std::string &, PrinterInfo &));
|
||||
MOCK_METHOD2(QueryPPDInformation, bool (const char *, std::vector<std::string> &));
|
||||
};
|
||||
} // namespace Print
|
||||
} // namespace OHOS
|
||||
|
Loading…
Reference in New Issue
Block a user