• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "nfc_vendor_adaptions.h"
16 #include "phNxpNciHal_Adaptation.h"
17 
18 #define HDF_LOG_TAG hdf_nfc_dal
19 
20 namespace OHOS {
21 namespace HDI {
22 namespace Nfc {
NfcVendorAdaptions()23 NfcVendorAdaptions::NfcVendorAdaptions() {}
24 
~NfcVendorAdaptions()25 NfcVendorAdaptions::~NfcVendorAdaptions() {}
26 
VendorOpen(nfc_stack_callback_t * p_cback,nfc_stack_data_callback_t * p_data_cback)27 int NfcVendorAdaptions::VendorOpen(nfc_stack_callback_t *p_cback,
28                                    nfc_stack_data_callback_t *p_data_cback)
29 {
30     return phNxpNciHal_open(*p_cback, *p_data_cback);
31 }
32 
VendorCoreInitialized(uint16_t core_init_rsp_len,uint8_t * p_core_init_rsp_params)33 int NfcVendorAdaptions::VendorCoreInitialized(uint16_t core_init_rsp_len,
34                                               uint8_t *p_core_init_rsp_params)
35 {
36     return phNxpNciHal_core_initialized(core_init_rsp_len, p_core_init_rsp_params);
37 }
38 
VendorWrite(uint16_t data_len,const uint8_t * p_data)39 int NfcVendorAdaptions::VendorWrite(uint16_t data_len, const uint8_t *p_data)
40 {
41     return phNxpNciHal_write(data_len, p_data);
42 }
43 
VendorPrediscover(void)44 int NfcVendorAdaptions::VendorPrediscover(void)
45 {
46     return phNxpNciHal_pre_discover();
47 }
48 
VendorClose(bool bShutdown)49 int NfcVendorAdaptions::VendorClose(bool bShutdown)
50 {
51     return phNxpNciHal_close(bShutdown);
52 }
53 
VendorControlGranted(void)54 int NfcVendorAdaptions::VendorControlGranted(void)
55 {
56     return phNxpNciHal_control_granted();
57 }
58 
VendorPowerCycle(void)59 int NfcVendorAdaptions::VendorPowerCycle(void)
60 {
61     return phNxpNciHal_power_cycle();
62 }
63 
VendorIoctl(long arg,void * p_data)64 int NfcVendorAdaptions::VendorIoctl(long arg, void *p_data)
65 {
66     return phNxpNciHal_ioctl(arg, p_data);
67 }
68 } // Nfc
69 } // HDI
70 } // OHOS