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 #include "securec.h"
16 #include "iremote_broker.h"
17 #include "napi_scan_utils.h"
18 #include "scan_constant.h"
19 #include "scan_log.h"
20 #include "scanner_info.h"
21 #include "scan_service_proxy.h"
22 
23 namespace OHOS::Scan {
24 using namespace OHOS::HiviewDFX;
25 
ScanServiceProxy(const sptr<IRemoteObject> & object)26 ScanServiceProxy::ScanServiceProxy(const sptr<IRemoteObject> &object) : IRemoteProxy<IScanService>(object) {}
27 
GetResult(int32_t retCode,MessageParcel & reply)28 int32_t ScanServiceProxy::GetResult(int32_t retCode, MessageParcel &reply)
29 {
30     if (retCode != ERR_NONE) {
31         SCAN_HILOGE("rpc error code = %{public}d", retCode);
32         return E_SCAN_RPC_FAILURE;
33     }
34 
35     retCode = reply.ReadInt32();
36     SCAN_HILOGD("ScanServiceProxy end. ret = [%{public}d]", retCode);
37     return retCode;
38 }
39 
InitScan(int32_t & scanVersion)40 int32_t ScanServiceProxy::InitScan(int32_t &scanVersion)
41 {
42     SCAN_HILOGD("ScanServiceProxy InitScan start");
43     CREATE_PRC_MESSAGE;
44     auto remote = Remote();
45     if (remote == nullptr) {
46         SCAN_HILOGE("ScanServiceProxy::InitScan remote is null");
47         return E_SCAN_RPC_FAILURE;
48     }
49     int32_t ret = remote->SendRequest(CMD_INIT_SCAN, data, reply, option);
50     ret = GetResult(ret, reply);
51     if (ret != E_SCAN_NONE) {
52         SCAN_HILOGE("ScanServiceProxy InitScan failed");
53         return ret;
54     }
55     scanVersion = reply.ReadInt32();
56     SCAN_HILOGD("ScanServiceProxy InitScan end.");
57     return ret;
58 }
59 
ExitScan()60 int32_t ScanServiceProxy::ExitScan()
61 {
62     SCAN_HILOGD("ScanServiceProxy ExitScan start");
63     CREATE_PRC_MESSAGE;
64     auto remote = Remote();
65     if (remote == nullptr) {
66         SCAN_HILOGE("ScanServiceProxy::ExitScan remote is null");
67         return E_SCAN_RPC_FAILURE;
68     }
69     int32_t ret = remote->SendRequest(CMD_EXIT_SCAN, data, reply, option);
70     ret = GetResult(ret, reply);
71     if (ret != E_SCAN_NONE) {
72         SCAN_HILOGE("ScanServiceProxy ExitScan failed");
73         return ret;
74     }
75     SCAN_HILOGD("ScanServiceProxy ExitScan end");
76     return ret;
77 }
78 
GetScannerList()79 int32_t ScanServiceProxy::GetScannerList()
80 {
81     SCAN_HILOGD("ScanServiceProxy GetScannerList start");
82     CREATE_PRC_MESSAGE;
83     auto remote = Remote();
84     if (remote == nullptr) {
85         SCAN_HILOGE("ScanServiceProxy::GetScannerList remote is null");
86         return E_SCAN_RPC_FAILURE;
87     }
88     int32_t ret = remote->SendRequest(CMD_GET_SCANNER_LIST, data, reply, option);
89     ret = GetResult(ret, reply);
90     if (ret != E_SCAN_NONE) {
91         SCAN_HILOGE("ScanServiceProxy GetScannerList failed");
92         return ret;
93     }
94     SCAN_HILOGD("ScanServiceProxy GetScannerList end");
95     return ret;
96 }
97 
98 
StopDiscover()99 int32_t ScanServiceProxy::StopDiscover()
100 {
101     SCAN_HILOGD("ScanServiceProxy StopDiscover start");
102     CREATE_PRC_MESSAGE;
103     auto remote = Remote();
104     if (remote == nullptr) {
105         SCAN_HILOGE("ScanServiceProxy::StopDiscover remote is null");
106         return E_SCAN_RPC_FAILURE;
107     }
108     int32_t ret = remote->SendRequest(CMD_STOP_DISCOVER, data, reply, option);
109     ret = GetResult(ret, reply);
110     if (ret != E_SCAN_NONE) {
111         SCAN_HILOGE("ScanServiceProxy StopDiscover failed");
112         return ret;
113     }
114     SCAN_HILOGD("ScanServiceProxy StopDiscover end");
115     return ret;
116 }
117 
118 
OpenScanner(const std::string scannerId)119 int32_t ScanServiceProxy::OpenScanner(const std::string scannerId)
120 {
121     SCAN_HILOGD("ScanServiceProxy OpenScanner start");
122     CREATE_PRC_MESSAGE;
123     auto remote = Remote();
124     if (remote == nullptr) {
125         SCAN_HILOGE("ScanServiceProxy::OpenScanner remote is null");
126         return E_SCAN_RPC_FAILURE;
127     }
128     data.WriteString(scannerId);
129     int32_t ret = remote->SendRequest(CMD_OPEN_SCANNER, data, reply, option);
130     ret = GetResult(ret, reply);
131     if (ret != E_SCAN_NONE) {
132         SCAN_HILOGE("ScanServiceProxy OpenScanner failed");
133         return ret;
134     }
135     SCAN_HILOGD("ScanServiceProxy OpenScanner end");
136     return ret;
137 }
138 
CloseScanner(const std::string scannerId)139 int32_t ScanServiceProxy::CloseScanner(const std::string scannerId)
140 {
141     SCAN_HILOGD("ScanServiceProxy CloseScanner start");
142     CREATE_PRC_MESSAGE;
143     auto remote = Remote();
144     if (remote == nullptr) {
145         SCAN_HILOGE("ScanServiceProxy::CloseScanner remote is null");
146         return E_SCAN_RPC_FAILURE;
147     }
148     data.WriteString(scannerId);
149     int32_t ret = remote->SendRequest(CMD_CLOSE_SCANNER, data, reply, option);
150     ret = GetResult(ret, reply);
151     if (ret != E_SCAN_NONE) {
152         SCAN_HILOGE("ScanServiceProxy CloseScanner failed");
153         return ret;
154     }
155     SCAN_HILOGD("ScanServiceProxy CloseScanner end");
156     return ret;
157 }
158 
GetScanOptionDesc(const std::string scannerId,const int32_t optionIndex,ScanOptionDescriptor & desc)159 int32_t ScanServiceProxy::GetScanOptionDesc(const std::string scannerId, const int32_t optionIndex,
160     ScanOptionDescriptor &desc)
161 {
162     SCAN_HILOGD("ScanServiceProxy GetScanOptionDesc start");
163     CREATE_PRC_MESSAGE;
164     auto remote = Remote();
165     if (remote == nullptr) {
166         SCAN_HILOGE("ScanServiceProxy::GetScanOptionDesc remote is null");
167         return E_SCAN_RPC_FAILURE;
168     }
169     data.WriteString(scannerId);
170     data.WriteInt32(optionIndex);
171     int32_t ret = remote->SendRequest(CMD_GET_SCAN_OPTION_DESC, data, reply, option);
172     ret = GetResult(ret, reply);
173     if (ret != E_SCAN_NONE) {
174         SCAN_HILOGE("ScanServiceProxy GetScanOptionDesc failed");
175         return ret;
176     }
177     auto scanOptionDescriptor = ScanOptionDescriptor::Unmarshalling(reply);
178     desc = *scanOptionDescriptor;
179     SCAN_HILOGD("ScanServiceProxy GetScanOptionDesc end");
180     return ret;
181 }
182 
OpScanOptionValue(const std::string scannerId,const int32_t optionIndex,const ScanOptionOpType op,ScanOptionValue & value,int32_t & info)183 int32_t ScanServiceProxy::OpScanOptionValue(const std::string scannerId,
184     const int32_t optionIndex, const ScanOptionOpType op, ScanOptionValue &value, int32_t &info)
185 {
186     SCAN_HILOGD("ScanServiceProxy OpScanOptionValue start");
187     CREATE_PRC_MESSAGE;
188     auto remote = Remote();
189     if (remote == nullptr) {
190         SCAN_HILOGE("ScanServiceProxy::OpScanOptionValue remote is null");
191         return E_SCAN_RPC_FAILURE;
192     }
193     data.WriteString(scannerId);
194     data.WriteInt32(optionIndex);
195     data.WriteUint32(op);
196     value.Marshalling(data);
197     int32_t ret = remote->SendRequest(CMD_OP_SCAN_OPTION_VALUE, data, reply, option);
198     ret = GetResult(ret, reply);
199     if (ret != E_SCAN_NONE) {
200         SCAN_HILOGE("ScanServiceProxy OpScanOptionValue failed");
201         return ret;
202     }
203     auto scanOptionValue = ScanOptionValue::Unmarshalling(reply);
204     value = *scanOptionValue;
205     if (op == SCAN_ACTION_GET_VALUE) {
206         info = reply.ReadInt32();
207     }
208     SCAN_HILOGD("ScanServiceProxy OpScanOptionValue end");
209     return ret;
210 }
211 
GetScanParameters(const std::string scannerId,ScanParameters & para)212 int32_t ScanServiceProxy::GetScanParameters(const std::string scannerId, ScanParameters &para)
213 {
214     SCAN_HILOGD("ScanServiceProxy GetScanParameters start");
215     CREATE_PRC_MESSAGE;
216     auto remote = Remote();
217     if (remote == nullptr) {
218         SCAN_HILOGE("ScanServiceProxy::GetScanParameters remote is null");
219         return E_SCAN_RPC_FAILURE;
220     }
221     data.WriteString(scannerId);
222     int32_t ret = remote->SendRequest(CMD_GET_SCAN_PARAMETERS, data, reply, option);
223     ret = GetResult(ret, reply);
224     if (ret != E_SCAN_NONE) {
225         SCAN_HILOGE("ScanServiceProxy GetScanParameters failed");
226         return ret;
227     }
228     auto scanParameters = ScanParameters::Unmarshalling(reply);
229     para = *scanParameters;
230     SCAN_HILOGD("ScanServiceProxy GetScanParameters end");
231     return ret;
232 }
233 
StartScan(const std::string scannerId,const bool & batchMode)234 int32_t ScanServiceProxy::StartScan(const std::string scannerId, const bool &batchMode)
235 {
236     SCAN_HILOGD("ScanServiceProxy StartScan start");
237     CREATE_PRC_MESSAGE;
238     auto remote = Remote();
239     if (remote == nullptr) {
240         SCAN_HILOGE("ScanServiceProxy::StartScan remote is null");
241         return E_SCAN_RPC_FAILURE;
242     }
243     data.WriteString(scannerId);
244     data.WriteBool(batchMode);
245     int32_t ret = remote->SendRequest(CMD_START_SCAN, data, reply, option);
246     ret = GetResult(ret, reply);
247     if (ret != E_SCAN_NONE) {
248         SCAN_HILOGE("ScanServiceProxy StartScan failed");
249         return ret;
250     }
251     SCAN_HILOGD("ScanServiceProxy StartScan end");
252     return ret;
253 }
254 
GetSingleFrameFD(const std::string scannerId,uint32_t & size,uint32_t fd)255 int32_t ScanServiceProxy::GetSingleFrameFD(const std::string scannerId, uint32_t &size, uint32_t fd)
256 {
257     SCAN_HILOGE("ScanServiceProxy GetSingleFrameFD start");
258     CREATE_PRC_MESSAGE;
259     auto remote = Remote();
260     if (remote == nullptr) {
261         SCAN_HILOGE("ScanServiceProxy::GetSingleFrameFD remote is null");
262         return E_SCAN_RPC_FAILURE;
263     }
264     data.WriteString(scannerId);
265     data.WriteFileDescriptor(fd);
266     int32_t ret = remote->SendRequest(CMD_GET_SINGLE_FRAME_FD, data, reply, option);
267     ret = GetResult(ret, reply);
268     if (ret != E_SCAN_NONE) {
269         SCAN_HILOGE("ScanServiceProxy GetSingleFrameFD failed");
270         return ret;
271     }
272     size = reply.ReadUint32();
273     SCAN_HILOGD("ScanServiceProxy GetSingleFrameFD end");
274     return ret;
275 }
276 
CancelScan(const std::string scannerId)277 int32_t ScanServiceProxy::CancelScan(const std::string scannerId)
278 {
279     SCAN_HILOGD("ScanServiceProxy CancelScan start");
280     CREATE_PRC_MESSAGE;
281     auto remote = Remote();
282     if (remote == nullptr) {
283         SCAN_HILOGE("ScanServiceProxy::CancelScan remote is null");
284         return E_SCAN_RPC_FAILURE;
285     }
286     data.WriteString(scannerId);
287     int32_t ret = remote->SendRequest(CMD_CANCEL_SCAN, data, reply, option);
288     ret = GetResult(ret, reply);
289     if (ret != E_SCAN_NONE) {
290         SCAN_HILOGE("ScanServiceProxy CancelScan failed");
291         return ret;
292     }
293     SCAN_HILOGD("ScanServiceProxy CancelScan end");
294     return ret;
295 }
296 
SetScanIOMode(const std::string scannerId,const bool isNonBlocking)297 int32_t ScanServiceProxy::SetScanIOMode(const std::string scannerId, const bool isNonBlocking)
298 {
299     SCAN_HILOGD("ScanServiceProxy SetScanIOMode start");
300     CREATE_PRC_MESSAGE;
301     auto remote = Remote();
302     if (remote == nullptr) {
303         SCAN_HILOGE("ScanServiceProxy::SetScanIOMode remote is null");
304         return E_SCAN_RPC_FAILURE;
305     }
306     data.WriteString(scannerId);
307     data.WriteBool(isNonBlocking);
308     int32_t ret = remote->SendRequest(CMD_SET_SCAN_IO_MODE, data, reply, option);
309     ret = GetResult(ret, reply);
310     if (ret != E_SCAN_NONE) {
311         SCAN_HILOGE("ScanServiceProxy SetScanIOMode failed");
312         return ret;
313     }
314     SCAN_HILOGD("ScanServiceProxy SetScanIOMode end");
315     return ret;
316 }
317 
GetScanSelectFd(const std::string scannerId,int32_t & fd)318 int32_t ScanServiceProxy::GetScanSelectFd(const std::string scannerId, int32_t &fd)
319 {
320     SCAN_HILOGD("ScanServiceProxy GetScanSelectFd start");
321     CREATE_PRC_MESSAGE;
322     auto remote = Remote();
323     if (remote == nullptr) {
324         SCAN_HILOGE("ScanServiceProxy::GetScanSelectFd remote is null");
325         return E_SCAN_RPC_FAILURE;
326     }
327     data.WriteString(scannerId);
328     int32_t ret = remote->SendRequest(CMD_GET_SCAN_SELECT_FD, data, reply, option);
329     ret = GetResult(ret, reply);
330     if (ret != E_SCAN_NONE) {
331         SCAN_HILOGE("ScanServiceProxy GetScanSelectFd failed");
332         return ret;
333     }
334     fd = reply.ReadInt32();
335     SCAN_HILOGD("ScanServiceProxy GetScanSelectFd end");
336     return ret;
337 }
338 
On(const std::string taskId,const std::string & type,const sptr<IScanCallback> & listener)339 int32_t ScanServiceProxy::On(const std::string taskId, const std::string &type, const sptr<IScanCallback> &listener)
340 {
341     SCAN_HILOGD("ScanServiceProxy On start");
342     if (listener == nullptr) {
343         SCAN_HILOGE("listener is nullptr");
344         return E_SCAN_INVALID_PARAMETER;
345     }
346 
347     if (type.empty()) {
348         SCAN_HILOGE("ScanServiceProxy::On type is null.");
349         return E_SCAN_INVALID_PARAMETER;
350     }
351 
352     CREATE_PRC_MESSAGE;
353     data.WriteString(taskId);
354     data.WriteString(type);
355     data.WriteRemoteObject(listener->AsObject().GetRefPtr());
356 
357     auto remote = Remote();
358     if (remote == nullptr) {
359         SCAN_HILOGE("ScanServiceProxy::On remote is null");
360         return E_SCAN_RPC_FAILURE;
361     }
362 
363     int32_t ret = remote->SendRequest(CMD_ON, data, reply, option);
364     ret = GetResult(ret, reply);
365     if (ret != E_SCAN_NONE) {
366         SCAN_HILOGE("ScanServiceProxy On failed");
367         return ret;
368     }
369 
370     SCAN_HILOGD("ScanServiceProxy On end");
371     return ret;
372 }
373 
Off(const std::string taskId,const std::string & type)374 int32_t ScanServiceProxy::Off(const std::string taskId, const std::string &type)
375 {
376     SCAN_HILOGD("ScanServiceProxy::Off start");
377 
378     if (type.empty()) {
379         SCAN_HILOGE("ScanServiceProxy::Off type is null.");
380         return E_SCAN_INVALID_PARAMETER;
381     }
382 
383     CREATE_PRC_MESSAGE;
384     data.WriteString(taskId);
385     data.WriteString(type);
386 
387     auto remote = Remote();
388     if (remote == nullptr) {
389         SCAN_HILOGE("ScanServiceProxy::SetScanIOMode remote is null");
390         return E_SCAN_RPC_FAILURE;
391     }
392     int32_t ret = remote->SendRequest(CMD_OFF, data, reply, option);
393     ret = GetResult(ret, reply);
394     if (ret != E_SCAN_NONE) {
395         SCAN_HILOGE("ScanServiceProxy Off failed");
396         return ret;
397     }
398 
399     SCAN_HILOGD("ScanServiceProxy Off out");
400     return ret;
401 }
402 
GetScannerState(int32_t & scannerState)403 int32_t ScanServiceProxy::GetScannerState(int32_t &scannerState)
404 {
405     SCAN_HILOGD("ScanServiceProxy GetScannerState start");
406     CREATE_PRC_MESSAGE;
407 
408     auto remote = Remote();
409     if (remote == nullptr) {
410         SCAN_HILOGE("ScanServiceProxy::SetScanIOMode remote is null");
411         return E_SCAN_RPC_FAILURE;
412     }
413     int32_t ret = remote->SendRequest(CMD_GET_SCANNER_STATE, data, reply, option);
414     ret = GetResult(ret, reply);
415     if (ret != E_SCAN_NONE) {
416         SCAN_HILOGE("ScanServiceProxy GetScannerState failed");
417         return ret;
418     }
419     scannerState = reply.ReadInt32();
420     SCAN_HILOGD("ScanServiceProxy GetScannerState end.");
421     return ret;
422 }
423 
GetScanProgress(const std::string scannerId,ScanProgress & prog)424 int32_t ScanServiceProxy::GetScanProgress(const std::string scannerId, ScanProgress &prog)
425 {
426     SCAN_HILOGI("ScanServiceProxy GetScanProgress start");
427     CREATE_PRC_MESSAGE;
428     auto remote = Remote();
429     if (remote == nullptr) {
430         SCAN_HILOGE("ScanServiceProxy::GetScanProgress remote is null");
431         return E_SCAN_RPC_FAILURE;
432     }
433     data.WriteString(scannerId);
434     int32_t ret = remote->SendRequest(CMD_GET_SCAN_PROGRESS, data, reply, option);
435     ret = GetResult(ret, reply);
436     if (ret != E_SCAN_NONE) {
437         SCAN_HILOGE("ScanServiceProxy GetScanProgress failed");
438         return ret;
439     }
440     auto scanProgress = ScanProgress::Unmarshalling(reply);
441     if (scanProgress != nullptr) {
442         prog = *scanProgress;
443     } else {
444         SCAN_HILOGE("get scanProgress is a nullptr ptr.");
445         return E_SCAN_GENERIC_FAILURE;
446     }
447     SCAN_HILOGI("ScanServiceProxy GetScanProgress end");
448     return ret;
449 }
450 
AddScanner(const std::string & serialNumber,const std::string & discoverMode)451 int32_t ScanServiceProxy::AddScanner(const std::string& serialNumber, const std::string& discoverMode)
452 {
453     SCAN_HILOGD("ScanServiceProxy AddScanner start");
454     CREATE_PRC_MESSAGE;
455     auto remote = Remote();
456     if (remote == nullptr) {
457         SCAN_HILOGE("ScanServiceProxy::AddScanner remote is null");
458         return E_SCAN_RPC_FAILURE;
459     }
460     data.WriteString(serialNumber);
461     data.WriteString(discoverMode);
462     int32_t ret = remote->SendRequest(CMD_CONNECT_SCANNER, data, reply, option);
463     ret = GetResult(ret, reply);
464     if (ret != E_SCAN_NONE) {
465         SCAN_HILOGE("ScanServiceProxy AddScanner failed");
466         return ret;
467     }
468     SCAN_HILOGD("ScanServiceProxy AddScanner end");
469     return ret;
470 }
471 
DeleteScanner(const std::string & serialNumber,const std::string & discoverMode)472 int32_t ScanServiceProxy::DeleteScanner(const std::string& serialNumber, const std::string& discoverMode)
473 {
474     SCAN_HILOGD("ScanServiceProxy DeleteScanner start");
475     CREATE_PRC_MESSAGE;
476     auto remote = Remote();
477     if (remote == nullptr) {
478         SCAN_HILOGE("ScanServiceProxy::DeleteScanner remote is null");
479         return E_SCAN_RPC_FAILURE;
480     }
481     data.WriteString(serialNumber);
482     data.WriteString(discoverMode);
483     int32_t ret = remote->SendRequest(CMD_DISCONNECT_SCANNER, data, reply, option);
484     ret = GetResult(ret, reply);
485     if (ret != E_SCAN_NONE) {
486         SCAN_HILOGE("ScanServiceProxy DeleteScanner failed");
487         return ret;
488     }
489     SCAN_HILOGD("ScanServiceProxy DeleteScanner end");
490     return ret;
491 }
492 
GetAddedScanner(std::vector<ScanDeviceInfo> & allAddedScanner)493 int32_t ScanServiceProxy::GetAddedScanner(std::vector<ScanDeviceInfo>& allAddedScanner)
494 {
495     SCAN_HILOGD("ScanServiceProxy GetAddedScanner start");
496     CREATE_PRC_MESSAGE;
497     auto remote = Remote();
498     if (remote == nullptr) {
499         SCAN_HILOGE("ScanServiceProxy::GetAddedScanner remote is null");
500         return E_SCAN_RPC_FAILURE;
501     }
502     int32_t ret = remote->SendRequest(CMD_GET_CONNECTED_SCANNER, data, reply, option);
503     ret = GetResult(ret, reply);
504     if (ret != E_SCAN_NONE) {
505         SCAN_HILOGE("ScanServiceProxy GetAddedScanner failed");
506         return ret;
507     }
508     uint32_t len = reply.ReadUint32();
509     if (len > SCAN_MAX_COUNT) {
510         SCAN_HILOGE("len is out of range.");
511         return E_SCAN_INVALID_PARAMETER;
512     }
513     for (uint32_t i = 0; i < len; i++) {
514         auto infoPtr = ScanDeviceInfo::Unmarshalling(reply);
515         if (infoPtr == nullptr) {
516             SCAN_HILOGE("wrong scanDeviceInfo from data");
517             return E_SCAN_GENERIC_FAILURE;
518         }
519         allAddedScanner.emplace_back(*infoPtr);
520     }
521     SCAN_HILOGD("ScanServiceProxy GetAddedScanner end");
522     return ret;
523 }
524 
UpdateScannerName(const std::string & serialNumber,const std::string & discoverMode,const std::string & deviceName)525 int32_t ScanServiceProxy::UpdateScannerName(const std::string& serialNumber,
526     const std::string& discoverMode, const std::string& deviceName)
527 {
528     SCAN_HILOGD("ScanServiceProxy UpdateScannerName start");
529     CREATE_PRC_MESSAGE;
530     auto remote = Remote();
531     if (remote == nullptr) {
532         SCAN_HILOGE("ScanServiceProxy::UpdateScannerName remote is null");
533         return E_SCAN_RPC_FAILURE;
534     }
535     data.WriteString(serialNumber);
536     data.WriteString(discoverMode);
537     data.WriteString(deviceName);
538     int32_t ret = remote->SendRequest(CMD_UPDATE_SCANNER_NAME, data, reply, option);
539     ret = GetResult(ret, reply);
540     if (ret != E_SCAN_NONE) {
541         SCAN_HILOGE("ScanServiceProxy UpdateScannerName failed");
542         return ret;
543     }
544     SCAN_HILOGD("ScanServiceProxy UpdateScannerName end");
545     return ret;
546 }
547 
548 } // namespace OHOS::Scan
549