• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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 "nci_ce_impl_default.h"
17 #include "nfcc_nci_adapter.h"
18 #include "routing_manager.h"
19 
20 namespace OHOS {
21 namespace NFC {
22 namespace NCI {
SetCeHostListener(std::weak_ptr<ICeHostListener> listener)23 void NciCeImplDefault::SetCeHostListener(
24     std::weak_ptr<ICeHostListener> listener)
25 {
26     NfccNciAdapter::GetInstance().SetCeHostListener(listener);
27 }
28 
ComputeRoutingParams(int defaultPaymentType)29 bool NciCeImplDefault::ComputeRoutingParams(int defaultPaymentType)
30 {
31     return NfccNciAdapter::GetInstance().ComputeRoutingParams(defaultPaymentType);
32 }
33 
CommitRouting()34 bool NciCeImplDefault::CommitRouting()
35 {
36     bool restart = NfccNciAdapter::GetInstance().IsRfEbabled();
37     if (restart) {
38         NfccNciAdapter::GetInstance().StartRfDiscovery(false);
39     }
40     bool commitResult = NfccNciAdapter::GetInstance().CommitRouting();
41     if (restart) {
42         NfccNciAdapter::GetInstance().StartRfDiscovery(true);
43     }
44     return commitResult;
45 }
SendRawFrame(std::string & hexCmdData)46 bool NciCeImplDefault::SendRawFrame(std::string &hexCmdData)
47 {
48     return NfccNciAdapter::GetInstance().SendRawFrame(hexCmdData);
49 }
AddAidRouting(const std::string & aidStr,int route,int aidInfo,int power)50 bool NciCeImplDefault::AddAidRouting(const std::string &aidStr, int route,
51                                      int aidInfo, int power)
52 {
53     return RoutingManager::GetInstance().AddAidRouting(aidStr, route, aidInfo,
54                                                        power);
55 }
ClearAidTable()56 bool NciCeImplDefault::ClearAidTable()
57 {
58     return RoutingManager::GetInstance().ClearAidTable();
59 }
GetSimVendorBundleName()60 std::string NciCeImplDefault::GetSimVendorBundleName()
61 {
62     // please change it to the sim bundle name of your vendor
63     return "";
64 }
65 
NotifyDefaultPaymentType(int paymentType)66 void NciCeImplDefault::NotifyDefaultPaymentType(int paymentType)
67 {
68 }
69 } // namespace NCI
70 } // namespace NFC
71 } // namespace OHOS