1 /******************************************************************************
2  *
3  *  Copyright (C) 2018 ST Microelectronics S.A.
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  *
18  ******************************************************************************/
19 
20 #ifndef _STNFC_HAL_API_H_
21 #define _STNFC_HAL_API_H_
22 
23 #include <aidl/android/hardware/nfc/INfc.h>
24 #include <aidl/android/hardware/nfc/NfcConfig.h>
25 #include <aidl/android/hardware/nfc/NfcEvent.h>
26 #include <aidl/android/hardware/nfc/NfcStatus.h>
27 #include <aidl/android/hardware/nfc/PresenceCheckAlgorithm.h>
28 #include <aidl/android/hardware/nfc/ProtocolDiscoveryConfig.h>
29 
30 #include "hardware_nfc.h"
31 
32 #define NFC_MODE_OFF 0
33 #define NFC_MODE_ON 1
34 #define NFC_MODE_QuickBoot 2
35 
36 using NfcConfig = aidl::android::hardware::nfc::NfcConfig;
37 using NfcEvent = aidl::android::hardware::nfc::NfcEvent;
38 using NfcStatus = aidl::android::hardware::nfc::NfcStatus;
39 using PresenceCheckAlgorithm =
40     aidl::android::hardware::nfc::PresenceCheckAlgorithm;
41 using ProtocolDiscoveryConfig =
42     aidl::android::hardware::nfc::ProtocolDiscoveryConfig;
43 
44 int StNfc_hal_open(nfc_stack_callback_t* p_cback,
45                    nfc_stack_data_callback_t* p_data_cback);
46 int StNfc_hal_write(uint16_t data_len, const uint8_t* p_data);
47 
48 int StNfc_hal_core_initialized();
49 
50 int StNfc_hal_pre_discover();
51 
52 int StNfc_hal_close(int nfc_mode);
53 
54 int StNfc_hal_control_granted();
55 
56 int StNfc_hal_power_cycle();
57 
58 void StNfc_hal_factoryReset();
59 
60 int StNfc_hal_closeForPowerOffCase();
61 
62 void StNfc_hal_getConfig(NfcConfig& config);
63 
64 void StNfc_hal_setLogging(bool enable);
65 
66 bool StNfc_hal_isLoggingEnabled();
67 
68 #endif /* _STNFC_HAL_API_H_ */
69