1 /*
2  * Copyright (C) 2015 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef _PHNXPEXTNS_H_
18 #define _PHNXPEXTNS_H_
19 
20 #include <errno.h>
21 #include <nfa_api.h>
22 #include <phNfcStatus.h>
23 #include <sys/types.h>
24 
25 NFCSTATUS EXTNS_Init(tNFA_DM_CBACK* p_dm_cback, tNFA_CONN_CBACK* p_conn_cback);
26 void EXTNS_Close(void);
27 NFCSTATUS EXTNS_MfcInit(tNFA_ACTIVATED& activationData);
28 NFCSTATUS EXTNS_MfcCheckNDef(void);
29 NFCSTATUS EXTNS_MfcReadNDef(void);
30 NFCSTATUS EXTNS_MfcPresenceCheck(void);
31 NFCSTATUS EXTNS_MfcWriteNDef(uint8_t* pBuf, uint32_t len);
32 NFCSTATUS EXTNS_MfcFormatTag(uint8_t* key, uint8_t len);
33 NFCSTATUS EXTNS_MfcDisconnect(void);
34 NFCSTATUS EXTNS_MfcActivated(void);
35 NFCSTATUS EXTNS_MfcTransceive(uint8_t* p_data, uint32_t len);
36 NFCSTATUS
37 EXTNS_MfcRegisterNDefTypeHandler(tNFA_NDEF_CBACK* ndefHandlerCallback);
38 NFCSTATUS EXTNS_MfcCallBack(uint8_t* buf, uint32_t buflen);
39 NFCSTATUS EXTNS_MfcSetReadOnly(uint8_t* key, uint8_t len);
40 void EXTNS_SetConnectFlag(bool_t flagval);
41 bool_t EXTNS_GetConnectFlag(void);
42 void EXTNS_SetDeactivateFlag(bool_t flagval);
43 bool_t EXTNS_GetDeactivateFlag(void);
44 void EXTNS_SetCallBackFlag(bool_t flagval);
45 bool_t EXTNS_GetCallBackFlag(void);
46 NFCSTATUS EXTNS_CheckMfcResponse(uint8_t** sTransceiveData,
47                                  uint32_t* sTransceiveDataLen);
48 void MfcPresenceCheckResult(NFCSTATUS status);
49 void MfcResetPresenceCheckStatus(void);
50 NFCSTATUS EXTNS_GetPresenceCheckStatus(void);
51 
52 /*
53  * Events from JNI for NXP Extensions
54  */
55 #define PH_NXPEXTNS_MIFARE_CHECK_NDEF 0x01     /* MIFARE Check Ndef */
56 #define PH_NXPEXTNS_MIFARE_READ_NDEF 0x02      /* MIFARE Read Ndef */
57 #define PH_NXPEXTNS_MIFARE_WRITE_NDEF 0x03     /* MIFARE Write Ndef */
58 #define PH_NXPEXTNS_MIFARE_FORMAT_NDEF 0x04    /* MIFARE Format */
59 #define PH_NXPEXTNS_DISCONNECT 0x05            /* Target Disconnect */
60 #define PH_NXPEXTNS_ACTIVATED 0x06             /* Target Activated */
61 #define PH_NXPEXTNS_MIFARE_TRANSCEIVE 0x07     /* MIFARE Raw Transceive */
62 #define PH_NXPEXTNS_MIFARE_READ_ONLY 0x08      /* MIFARE Read Only */
63 #define PH_NXPEXTNS_MIFARE_PRESENCE_CHECK 0x09 /* MIFARE Presence Check */
64 #define PH_NXPEXTNS_RX_DATA 0xF1               /* Receive Data */
65 
66 #endif /* _PHNXPEXTNS_H_ */
67