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 <nfa_api.h> 21 #include <sys/types.h> 22 #include <errno.h> 23 #include <phNfcStatus.h> 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 NFCSTATUS EXTNS_Init (tNFA_DM_CBACK *p_dm_cback, 29 tNFA_CONN_CBACK *p_conn_cback); 30 void EXTNS_Close (void); 31 NFCSTATUS EXTNS_MfcInit (tNFA_ACTIVATED activationData); 32 NFCSTATUS EXTNS_MfcCheckNDef (void); 33 NFCSTATUS EXTNS_MfcReadNDef (void); 34 NFCSTATUS EXTNS_MfcPresenceCheck (void); 35 NFCSTATUS EXTNS_MfcWriteNDef (uint8_t *pBuf, uint32_t len); 36 NFCSTATUS EXTNS_MfcFormatTag (uint8_t *key, uint8_t len); 37 NFCSTATUS EXTNS_MfcDisconnect (void); 38 NFCSTATUS EXTNS_MfcActivated (void); 39 NFCSTATUS EXTNS_MfcTransceive (uint8_t *p_data, uint32_t len); 40 NFCSTATUS EXTNS_MfcRegisterNDefTypeHandler (tNFA_NDEF_CBACK *ndefHandlerCallback); 41 NFCSTATUS EXTNS_MfcCallBack (uint8_t *buf, uint32_t buflen); 42 NFCSTATUS EXTNS_MfcSetReadOnly (uint8_t *key, uint8_t len); 43 void EXTNS_SetConnectFlag (bool_t flagval); 44 bool_t EXTNS_GetConnectFlag (void); 45 void EXTNS_SetDeactivateFlag (bool_t flagval); 46 bool_t EXTNS_GetDeactivateFlag (void); 47 void EXTNS_SetCallBackFlag (bool_t flagval); 48 bool_t EXTNS_GetCallBackFlag (void); 49 NFCSTATUS EXTNS_CheckMfcResponse (uint8_t** sTransceiveData, uint32_t *sTransceiveDataLen); 50 void MfcPresenceCheckResult (NFCSTATUS status); 51 void MfcResetPresenceCheckStatus (void); 52 NFCSTATUS EXTNS_GetPresenceCheckStatus (void); 53 #ifdef __cplusplus 54 } 55 #endif 56 57 /* 58 * Events from JNI for NXP Extensions 59 */ 60 #define PH_NXPEXTNS_MIFARE_CHECK_NDEF 0x01 /* MIFARE Check Ndef */ 61 #define PH_NXPEXTNS_MIFARE_READ_NDEF 0x02 /* MIFARE Read Ndef */ 62 #define PH_NXPEXTNS_MIFARE_WRITE_NDEF 0x03 /* MIFARE Write Ndef */ 63 #define PH_NXPEXTNS_MIFARE_FORMAT_NDEF 0x04 /* MIFARE Format */ 64 #define PH_NXPEXTNS_DISCONNECT 0x05 /* Target Disconnect */ 65 #define PH_NXPEXTNS_ACTIVATED 0x06 /* Target Activated */ 66 #define PH_NXPEXTNS_MIFARE_TRANSCEIVE 0x07 /* MIFARE Raw Transceive */ 67 #define PH_NXPEXTNS_MIFARE_READ_ONLY 0x08 /* MIFARE Read Only */ 68 #define PH_NXPEXTNS_MIFARE_PRESENCE_CHECK 0x09 /* MIFARE Presence Check */ 69 #define PH_NXPEXTNS_RX_DATA 0xF1 /* Receive Data */ 70 71 #endif /* _PHNXPEXTNS_H_ */ 72