• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "vendor_wlan_group.h"
17 #include "print_log.h"
18 #include "print_utils.h"
19 #include "file_ex.h"
20 
21 using namespace OHOS::Print;
22 namespace {
23     const std::string VENDOR_CONVERTED_PRINTERID = "uuid";
24 }
25 
VendorWlanGroup(VendorManager * vendorManager)26 VendorWlanGroup::VendorWlanGroup(VendorManager *vendorManager) : parentVendorManager(vendorManager)
27 {
28     hasGs = FileExists("/system/bin/uni_print_driver/ghostscript/bin/gs");
29 }
30 
GetVendorName()31 std::string VendorWlanGroup::GetVendorName()
32 {
33     return VENDOR_WLAN_GROUP;
34 }
35 
OnQueryCapability(const std::string & printerId,int timeout)36 bool VendorWlanGroup::OnQueryCapability(const std::string &printerId, int timeout)
37 {
38     PRINT_HILOGI("OnQueryCapability enter.");
39     if (parentVendorManager == nullptr) {
40         PRINT_HILOGE("VendorManager is null.");
41         return false;
42     }
43     printerVendorGroupList_[printerId] = VENDOR_PPD_DRIVER;
44     auto printerInfo = parentVendorManager->QueryDiscoveredPrinterInfoById(GetVendorName(), printerId);
45     if (printerInfo != nullptr && TryConnectByPpdDriver(*printerInfo)) {
46         PRINT_HILOGI("Connect by ppdDriver success.");
47         return true;
48     }
49     RemoveGroupPrinterFromVendorGroupList(printerId);
50 
51     if (IsBsunidriverSupport(printerId)) {
52         printerVendorGroupList_[printerId] = VENDOR_BSUNI_DRIVER;
53         auto bsuniDriver = parentVendorManager->FindDriverByVendorName(VENDOR_BSUNI_DRIVER);
54         auto printerInfo = parentVendorManager->QueryDiscoveredPrinterInfoById(GetVendorName(), printerId);
55         if (bsuniDriver != nullptr && printerInfo != nullptr &&
56             bsuniDriver->OnQueryCapability(ExtractPrinterIdByPrinterInfo(*printerInfo), timeout)) {
57             PRINT_HILOGI("on query capability on bsuni vendor seccess.");
58             return true;
59         }
60         RemoveGroupPrinterFromVendorGroupList(printerId);
61     } else {
62         printerVendorGroupList_[printerId] = VENDOR_IPP_EVERYWHERE;
63         auto ippEverywhereDriver = parentVendorManager->FindDriverByVendorName(VENDOR_IPP_EVERYWHERE);
64         if (ippEverywhereDriver != nullptr && ippEverywhereDriver->OnQueryCapability(printerId, 0)) {
65             PRINT_HILOGI("on query capability on ipp everywhere seccess.");
66             return true;
67         }
68         RemoveGroupPrinterFromVendorGroupList(printerId);
69     }
70     PRINT_HILOGE("no vendor can query capability.");
71     return false;
72 }
73 
OnQueryCapabilityByIp(const std::string & printerIp,const std::string & protocol)74 bool VendorWlanGroup::OnQueryCapabilityByIp(const std::string &printerIp, const std::string &protocol)
75 {
76     PRINT_HILOGI("OnQueryCapabilityByIp enter.");
77     if (parentVendorManager == nullptr) {
78         PRINT_HILOGE("VendorManager is null.");
79         return false;
80     }
81     auto bsuniDriver = parentVendorManager->FindDriverByVendorName(VENDOR_BSUNI_DRIVER);
82     printerVendorGroupList_[printerIp] = VENDOR_BSUNI_DRIVER;
83     if (bsuniDriver != nullptr && bsuniDriver->OnQueryCapabilityByIp(printerIp, protocol)) {
84         PRINT_HILOGI("on query capability by ip on bsuni vendor seccess.");
85         return true;
86     }
87     RemoveGroupPrinterFromVendorGroupList(printerIp);
88     printerVendorGroupList_[printerIp] = VENDOR_IPP_EVERYWHERE;
89     auto ippEverywhereDriver = parentVendorManager->FindDriverByVendorName(VENDOR_IPP_EVERYWHERE);
90     if (ippEverywhereDriver != nullptr && ippEverywhereDriver->OnQueryCapabilityByIp(printerIp, protocol)) {
91         PRINT_HILOGI("on query capability by ip on ipp everywhere seccess.");
92         return true;
93     }
94     RemoveGroupPrinterFromVendorGroupList(printerIp);
95     PRINT_HILOGE("no vendor can query capability by ip.");
96     return false;
97 }
98 
OnPrinterDiscovered(const std::string & vendorName,const PrinterInfo & printerInfo)99 int32_t VendorWlanGroup::OnPrinterDiscovered(const std::string &vendorName, const PrinterInfo &printerInfo)
100 {
101     if (parentVendorManager == nullptr) {
102         PRINT_HILOGE("VendorManager is null.");
103         return EXTENSION_ERROR_CALLBACK_NULL;
104     }
105     return parentVendorManager->AddPrinterToDiscovery(GetVendorName(), ConvertPrinterInfoId(printerInfo));
106 }
107 
OnUpdatePrinterToDiscovery(const std::string & vendorName,const PrinterInfo & printerInfo)108 int32_t VendorWlanGroup::OnUpdatePrinterToDiscovery(const std::string &vendorName, const PrinterInfo &printerInfo)
109 {
110     if (parentVendorManager == nullptr) {
111         PRINT_HILOGE("VendorManager is null.");
112         return EXTENSION_ERROR_CALLBACK_NULL;
113     }
114     if (CheckPrinterAddedByIp(printerInfo.GetPrinterId())) {
115         PRINT_HILOGI("OnUpdatePrinterToDiscovery PrinterAddedByIp");
116         return parentVendorManager->UpdatePrinterToDiscovery(GetVendorName(), ConvertIpPrinterName(printerInfo));
117     }
118     return parentVendorManager->UpdatePrinterToDiscovery(GetVendorName(), ConvertPrinterInfoId(printerInfo));
119 }
120 
OnPrinterRemoved(const std::string & vendorName,const std::string & printerId)121 int32_t VendorWlanGroup::OnPrinterRemoved(const std::string &vendorName, const std::string &printerId)
122 {
123     if (parentVendorManager == nullptr) {
124         PRINT_HILOGE("VendorManager is null.");
125         return EXTENSION_ERROR_CALLBACK_NULL;
126     }
127     std::string groupPrinterId = GetGroupPrinterId(printerId);
128     RemoveGroupPrinterFromVendorGroupList(printerId);
129     RemovedGroupPrinter(printerId);
130     return parentVendorManager->RemovePrinterFromDiscovery(GetVendorName(), groupPrinterId);
131 }
132 
IsConnectingPrinter(const std::string & globalPrinterIdOrIp,const std::string & uri)133 bool VendorWlanGroup::IsConnectingPrinter(const std::string &globalPrinterIdOrIp, const std::string &uri)
134 {
135     if (parentVendorManager == nullptr) {
136         PRINT_HILOGE("VendorManager is null.");
137         return false;
138     }
139     std::string printerId(VendorManager::ExtractPrinterId(globalPrinterIdOrIp));
140     std::string groupPrinterId = CheckPrinterAddedByIp(printerId) ? printerId : GetGroupPrinterId(printerId);
141     std::string globalPrinterId = GetGlobalPrinterId(groupPrinterId);
142     return parentVendorManager->IsConnectingPrinter(globalPrinterId, uri);
143 }
144 
GetConnectingMethod(const std::string & globalPrinterIdOrIp)145 ConnectMethod VendorWlanGroup::GetConnectingMethod(const std::string &globalPrinterIdOrIp)
146 {
147     if (parentVendorManager == nullptr) {
148         PRINT_HILOGE("VendorManager is null.");
149         return ID_AUTO;
150     }
151     std::string printerId(VendorManager::ExtractPrinterId(globalPrinterIdOrIp));
152     std::string groupPrinterId = CheckPrinterAddedByIp(printerId) ? printerId : GetGroupPrinterId(printerId);
153     std::string globalPrinterId = GetGlobalPrinterId(groupPrinterId);
154     return parentVendorManager->GetConnectingMethod(globalPrinterId);
155 }
156 
SetConnectingPrinter(ConnectMethod method,const std::string & globalPrinterIdOrIp)157 void VendorWlanGroup::SetConnectingPrinter(ConnectMethod method, const std::string &globalPrinterIdOrIp)
158 {
159     if (parentVendorManager == nullptr) {
160         PRINT_HILOGE("VendorManager is null.");
161         return;
162     }
163     std::string printerId(VendorManager::ExtractPrinterId(globalPrinterIdOrIp));
164     std::string groupPrinterId = CheckPrinterAddedByIp(printerId) ? printerId : GetGroupPrinterId(printerId);
165     std::string globalPrinterId = GetGlobalPrinterId(groupPrinterId);
166     parentVendorManager->SetConnectingPrinter(method, globalPrinterId);
167 }
168 
OnPrinterPpdQueried(const std::string & vendorName,const std::string & printerId,const std::string & ppdName,const std::string & ppdData)169 bool VendorWlanGroup::OnPrinterPpdQueried(const std::string &vendorName, const std::string &printerId,
170                                           const std::string &ppdName, const std::string &ppdData)
171 {
172     if (parentVendorManager == nullptr) {
173         PRINT_HILOGE("VendorManager is null.");
174         return false;
175     }
176     std::string groupPrinterId = CheckPrinterAddedByIp(printerId) ? printerId : GetGroupPrinterId(printerId);
177     return parentVendorManager->OnPrinterPpdQueried(GetVendorName(), groupPrinterId, ppdName, ppdData);
178 }
179 
180 
IsGroupDriver(const std::string & bothPrinterId)181 bool VendorWlanGroup::IsGroupDriver(const std::string &bothPrinterId)
182 {
183     if (bothPrinterId.find(VENDOR_CONVERTED_PRINTERID) != std::string::npos) {
184         PRINT_HILOGD("printerId has be converted whit uuid, is group driver!.");
185         return true;
186     }
187     std::string printerId(VendorManager::ExtractPrinterId(bothPrinterId));
188     auto iter = printerVendorGroupList_.find(printerId);
189     return (iter != printerVendorGroupList_.end() && !iter->second.empty());
190 }
191 
ConvertGroupDriver(std::string & printerId,std::string & vendorName)192 bool VendorWlanGroup::ConvertGroupDriver(std::string &printerId, std::string &vendorName)
193 {
194     printerId = VendorManager::ExtractPrinterId(printerId);
195     if (vendorName == VENDOR_BSUNI_DRIVER) {
196         printerId = GetGroupPrinterId(printerId);
197         return false;
198     }
199     auto iter = printerVendorGroupList_.find(printerId);
200     if (iter != printerVendorGroupList_.end() && !iter->second.empty()) {
201         vendorName = VENDOR_WLAN_GROUP;
202         return true;
203     }
204     return false;
205 }
206 
IsBsunidriverSupport(const std::string & groupPrinterId)207 bool VendorWlanGroup::IsBsunidriverSupport(const std::string &groupPrinterId)
208 {
209     PRINT_HILOGD("IsBsunidriverSupport enter");
210     if (parentVendorManager == nullptr) {
211         PRINT_HILOGE("VendorManager is null.");
212         return false;
213     }
214     auto printerInfo = parentVendorManager->QueryDiscoveredPrinterInfoById(GetVendorName(), groupPrinterId);
215     if (printerInfo == nullptr) {
216         return false;
217     }
218     std::string supportValue;
219     Json::Value option;
220     if (printerInfo->HasOption() && PrintJsonUtil::Parse(printerInfo->GetOption(), option)) {
221         if (PrintJsonUtil::IsMember(option, "bsunidriverSupport") && option["bsunidriverSupport"].isString()) {
222             supportValue = option["bsunidriverSupport"].asString();
223         }
224     }
225     PRINT_HILOGD("IsBsunidriverSupport bsunidriverSupport=%{public}s", supportValue.c_str());
226     if (supportValue == "true") {
227         return true;
228     } else if (supportValue == "need_gs") {
229         return hasGs;
230     } else {
231         return false;
232     }
233 }
234 
RemoveGroupPrinterFromVendorGroupList(const std::string & groupPrinterId)235 void VendorWlanGroup::RemoveGroupPrinterFromVendorGroupList(const std::string &groupPrinterId)
236 {
237     auto iter = printerVendorGroupList_.find(groupPrinterId);
238     if (iter != printerVendorGroupList_.end()) {
239         PRINT_HILOGD("remove printer from vendor group list");
240         printerVendorGroupList_.erase(groupPrinterId);
241     }
242 }
243 
QueryVendorDriverByGroupPrinterId(const std::string & groupPrinterId)244 std::string VendorWlanGroup::QueryVendorDriverByGroupPrinterId(const std::string &groupPrinterId)
245 {
246     auto iter = printerVendorGroupList_.find(groupPrinterId);
247     if (iter != printerVendorGroupList_.end()) {
248         return iter->second;
249     }
250     PRINT_HILOGE("query printer vendor driver failed");
251     return "";
252 }
253 
TryConnectByPpdDriver(const PrinterInfo & printerInfo)254 bool VendorWlanGroup::TryConnectByPpdDriver(const PrinterInfo &printerInfo)
255 {
256     if (parentVendorManager == nullptr) {
257         PRINT_HILOGW("vendorManager is null");
258         return false;
259     }
260     auto ppdDriver = parentVendorManager->FindDriverByVendorName(VENDOR_PPD_DRIVER);
261     if (ppdDriver == nullptr) {
262         PRINT_HILOGW("ppdDriver is null");
263         return false;
264     }
265     ppdDriver->OnPrinterDiscovered(GetVendorName(), printerInfo);
266     std::string printerId = printerInfo.GetPrinterId();
267     std::string ppdName;
268     if (!ppdDriver->QueryProperty(printerId, PRINTER_PROPERTY_KEY_CUPS_PPD_NAME, ppdName)) {
269         PRINT_HILOGI("no matched ppd");
270         return false;
271     }
272     if (parentVendorManager->AddPrinterToCupsWithPpd(GetVendorName(), VendorManager::ExtractPrinterId(printerId),
273         ppdName, "") != EXTENSION_ERROR_NONE) {
274         PRINT_HILOGI("AddPrinterToCupsWithPpd fail.");
275         return false;
276     }
277     PRINT_HILOGI("AddPrinterToCupsWithPpd success.");
278     return true;
279 }
280 
ConvertGroupGlobalPrinterId(const std::string & bothPrinterId)281 std::string VendorWlanGroup::ConvertGroupGlobalPrinterId(const std::string &bothPrinterId)
282 {
283     std::string printerId(VendorManager::ExtractPrinterId(bothPrinterId));
284     return PrintUtils::GetGlobalId(VendorManager::GetGlobalVendorName(GetVendorName()), printerId);
285 }
286 
GetGroupPrinterId(const std::string & printerId)287 std::string VendorWlanGroup::GetGroupPrinterId(const std::string &printerId)
288 {
289     std::lock_guard<std::mutex> lock(groupPrinterIdMapMutex);
290     auto item = groupPrinterIdMap_.find(printerId);
291     if (item != groupPrinterIdMap_.end() && !item->second.empty()) {
292         return item->second;
293     }
294     PRINT_HILOGW("groupPrinterId is not exited, use printerId");
295     return printerId;
296 }
297 
CheckPrinterAddedByIp(const std::string & printerId)298 bool VendorWlanGroup::CheckPrinterAddedByIp(const std::string &printerId)
299 {
300     if (parentVendorManager == nullptr) {
301         PRINT_HILOGE("VendorManager is null.");
302         return false;
303     }
304     ConnectMethod connectingMethod = parentVendorManager->GetConnectingMethod(printerId);
305     PRINT_HILOGI("CheckPrinterAddedByIp connectingMethod : %{public}d", connectingMethod);
306     if (connectingMethod == IP_AUTO) {
307         return true;
308     }
309     return false;
310 }
311 
UpdateGroupPrinter(const std::string & printerId,const std::string & groupPrinterId)312 void VendorWlanGroup::UpdateGroupPrinter(const std::string &printerId, const std::string &groupPrinterId)
313 {
314     std::lock_guard<std::mutex> lock(groupPrinterIdMapMutex);
315     auto retPair = groupPrinterIdMap_.try_emplace(printerId, groupPrinterId);
316     if (retPair.second) {
317         PRINT_HILOGI("add new groupPrinterId");
318         return;
319     }
320     if (retPair.first->second == groupPrinterId) {
321         PRINT_HILOGD("not need update groupPrinterId");
322         return;
323     }
324     PRINT_HILOGI("update groupPrinterId");
325     parentVendorManager->RemovePrinterFromDiscovery(GetVendorName(), retPair.first->second);
326     retPair.first->second = groupPrinterId;
327 }
328 
HasGroupPrinter(const std::string & printerId)329 bool VendorWlanGroup::HasGroupPrinter(const std::string &printerId)
330 {
331     std::lock_guard<std::mutex> lock(groupPrinterIdMapMutex);
332     auto item = groupPrinterIdMap_.find(printerId);
333     if (item != groupPrinterIdMap_.end()) {
334         return true;
335     }
336     return false;
337 }
338 
RemovedGroupPrinter(const std::string & printerId)339 void VendorWlanGroup::RemovedGroupPrinter(const std::string &printerId)
340 {
341     std::lock_guard<std::mutex> lock(groupPrinterIdMapMutex);
342     groupPrinterIdMap_.erase(printerId);
343 }
344 
ConvertPrinterInfoId(const PrinterInfo & printerInfo)345 PrinterInfo VendorWlanGroup::ConvertPrinterInfoId(const PrinterInfo &printerInfo)
346 {
347     PrinterInfo info(printerInfo);
348     if (info.HasPrinterUuid()) {
349         PRINT_HILOGD("convert printerId by uuid: %{private}s", info.GetPrinterUuid().c_str());
350         UpdateGroupPrinter(info.GetPrinterId(), info.GetPrinterUuid());
351         info.SetPrinterId(info.GetPrinterUuid());
352         return info;
353     }
354     PRINT_HILOGW("uuid is not exited, not convert printerId");
355     UpdateGroupPrinter(printerInfo.GetPrinterId(), printerInfo.GetPrinterId());
356     return printerInfo;
357 }
358 
ConvertIpPrinterName(const PrinterInfo & printerInfo)359 PrinterInfo VendorWlanGroup::ConvertIpPrinterName(const PrinterInfo &printerInfo)
360 {
361     PrinterInfo info(printerInfo);
362     PRINT_HILOGI("ConvertIpPrinterName printerId : %{private}s, printerName : %{private}s",
363         info.GetPrinterId().c_str(), info.GetPrinterName().c_str());
364     info.SetPrinterName(info.GetPrinterId());
365     return info;
366 }
367 
ExtractPrinterIdByPrinterInfo(const PrinterInfo & printerInfo)368 std::string VendorWlanGroup::ExtractPrinterIdByPrinterInfo(const PrinterInfo &printerInfo)
369 {
370     return PrintUtils::ExtractHostFromUri(printerInfo.GetUri());
371 }
372 
MonitorPrinterStatus(const std::string & groupPrinterId,bool on)373 bool VendorWlanGroup::MonitorPrinterStatus(const std::string &groupPrinterId, bool on)
374 {
375     if (parentVendorManager == nullptr) {
376         PRINT_HILOGE("VendorManager is null.");
377         return false;
378     }
379     if (!VendorDriverBase::MonitorPrinterStatus(groupPrinterId, on)) {
380         PRINT_HILOGW("MonitorPrinterStatus fail");
381         return false;
382     }
383     if (QueryVendorDriverByGroupPrinterId(groupPrinterId) == VENDOR_IPP_EVERYWHERE) {
384         auto ippEverywhereDriver = parentVendorManager->FindDriverByVendorName(VENDOR_IPP_EVERYWHERE);
385         if (ippEverywhereDriver == nullptr) {
386             PRINT_HILOGW("ippEverywhereDriver is null");
387             return false;
388         }
389         PRINT_HILOGI("start MonitorPrinterStatus by ippEverywhere");
390         return ippEverywhereDriver->MonitorPrinterStatus(groupPrinterId, on);
391     }
392     PRINT_HILOGI("start MonitorPrinterStatus by bsuni");
393     return MonitorStatusByBsuniDriver(groupPrinterId, on);
394 }
395 
MonitorStatusByBsuniDriver(const std::string & groupPrinterId,bool on)396 bool VendorWlanGroup::MonitorStatusByBsuniDriver(const std::string &groupPrinterId, bool on)
397 {
398     if (parentVendorManager == nullptr) {
399         PRINT_HILOGW("vendorManager is null");
400         return false;
401     }
402     PrinterInfo printerInfo;
403     auto ret = parentVendorManager->QueryPrinterInfoByPrinterId(GetVendorName(), groupPrinterId, printerInfo);
404     if (ret != E_PRINT_NONE) {
405         PRINT_HILOGW("get printerInfo failed.");
406         return false;
407     }
408     auto printerIp = PrintUtils::ExtractHostFromUri(printerInfo.GetUri());
409     if (printerIp.empty()) {
410         PRINT_HILOGW("printerIp empty");
411         return false;
412     }
413     if (!on) {
414         auto printerList = parentVendorManager->QueryAddedPrintersByIp(printerIp);
415         for (auto &globalPrinterId : printerList) {
416             auto vendorName = VendorManager::ExtractVendorName(VendorManager::ExtractGlobalVendorName(globalPrinterId));
417             if (vendorName != VENDOR_WLAN_GROUP) {
418                 continue;
419             }
420             auto printerId = VendorManager::ExtractPrinterId(globalPrinterId);
421             if (printerId != groupPrinterId && IsStatusMonitoring(printerId)) {
422                 PRINT_HILOGI("monitor needed by other printer: %{private}s", printerId.c_str());
423                 return false;
424             }
425         }
426     }
427     auto bsuniDriver = parentVendorManager->FindDriverByVendorName(VENDOR_BSUNI_DRIVER);
428     if (bsuniDriver == nullptr) {
429         PRINT_HILOGW("bsuniDriver is null");
430         return false;
431     }
432     return bsuniDriver->MonitorPrinterStatus(printerIp, on);
433 }
434 
OnPrinterStatusChanged(const std::string & vendorName,const std::string & printerId,const PrinterVendorStatus & status)435 bool VendorWlanGroup::OnPrinterStatusChanged(const std::string &vendorName, const std::string &printerId,
436                                              const PrinterVendorStatus &status)
437 {
438     if (parentVendorManager == nullptr) {
439         PRINT_HILOGE("VendorManager is null.");
440         return false;
441     }
442     parentVendorManager->OnPrinterStatusChanged(GetVendorName(), printerId, status);
443     std::string groupPrinterId = GetGroupPrinterId(printerId);
444     if (groupPrinterId != printerId) {
445         parentVendorManager->OnPrinterStatusChanged(GetVendorName(), groupPrinterId, status);
446     }
447     return true;
448 }
449 
OnPrinterCapabilityQueried(const std::string & vendorName,const PrinterInfo & printerInfo)450 bool VendorWlanGroup::OnPrinterCapabilityQueried(const std::string &vendorName, const PrinterInfo &printerInfo)
451 {
452     PRINT_HILOGD("OnPrinterCapabilityQueried vendorName: %{public}s", vendorName.c_str());
453     if (parentVendorManager == nullptr) {
454         PRINT_HILOGW("vendorManager is null");
455         return false;
456     }
457     std::string printerId = printerInfo.GetPrinterId();
458     std::string globalPrinterId = GetGlobalPrinterId(printerId);
459     bool connecting = IsConnectingPrinter(globalPrinterId, printerInfo.GetUri());
460     if (connecting) {
461         PRINT_HILOGD("connecting %{private}s", globalPrinterId.c_str());
462         auto method = GetConnectingMethod(printerId);
463         PRINT_HILOGI("connecting method %{public}d", static_cast<int>(method));
464         if (method == IP_AUTO) {
465             printerVendorGroupList_[printerId] = VENDOR_PPD_DRIVER;
466             if (TryConnectByPpdDriver(printerInfo)) {
467                 PRINT_HILOGI("Connect by ppdDriver success.");
468                 return true;
469             }
470             RemoveGroupPrinterFromVendorGroupList(printerId);
471             printerVendorGroupList_[printerId] = vendorName;
472         }
473         PRINT_HILOGI("query ppd propertis");
474         auto vendorDriver = parentVendorManager->FindDriverByVendorName(vendorName);
475         if (vendorDriver == nullptr) {
476             PRINT_HILOGW("vendorDriver is null");
477             return false;
478         }
479         std::vector<std::string> keyList;
480         keyList.push_back(PRINTER_PROPERTY_KEY_DEVICE_STATE);
481         keyList.push_back(PRINTER_PROPERTY_KEY_CUPS_PPD_FILE);
482         vendorDriver->OnQueryProperties(printerId, keyList);
483     }
484     return true;
485 }
486