nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 1 | /****************************************************************************** |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 2 | * |
| 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 | * Copyright 2018 NXP |
| 16 | * |
| 17 | ******************************************************************************/ |
| 18 | |
nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 19 | #pragma once |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 20 | #include "nfa_hci_api.h" |
| 21 | #include "nfa_hci_defs.h" |
nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 22 | #include "NfcJniUtil.h" |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 23 | #include "nfc_api.h" |
| 24 | #include "config.h" |
| 25 | #include "phNxpConfig.h" |
| 26 | #include "SyncEvent.h" |
| 27 | #include "nfa_ee_api.h" |
| 28 | #include "nfa_hci_api.h" |
| 29 | #include "nfa_hci_defs.h" |
| 30 | #include "nfa_ce_api.h" |
| 31 | #include "phNxpExtns.h" |
| 32 | #include "phNfcTypes.h" |
| 33 | |
| 34 | #define MAX_NFCEE 5 |
| 35 | #define WIRED_MODE_TRANSCEIVE_TIMEOUT 120000 |
nxpandroid | 1680a6d | 2017-01-13 19:13:14 +0530 | [diff] [blame] | 36 | #define CONNECTIVITY_PIPE_ID_UICC1 0x0A |
| 37 | #define CONNECTIVITY_PIPE_ID_UICC2 0x23 |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 38 | #define CONNECTIVITY_PIPE_ID_UICC3 0x31 |
| 39 | #define NFA_EE_TAG_HCI_HOST_ID 0xA0 /* HCI host ID */ |
| 40 | #define SMX_PIPE_ID 0x19 |
nxpandroid | 1e2a13c | 2017-04-10 18:19:00 +0530 | [diff] [blame] | 41 | |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 42 | class SecureElement { |
nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 43 | public: |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 44 | tNFA_HANDLE mActiveEeHandle; |
nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 45 | |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 46 | static const uint8_t UICC_ID = 0x02; |
| 47 | static const uint8_t UICC2_ID = 0x04; |
| 48 | static const uint8_t UICC3_ID = 0x08; |
| 49 | static const uint8_t ESE_ID = 0x01; |
| 50 | static const uint8_t DH_ID = 0x00; |
| 51 | static const uint8_t NFCC_DECIDES = 0x00; //NFCC decides |
| 52 | static const uint8_t POWER_ALWAYS_ON = 0x01; //NFCEE Power Supply always On |
| 53 | static const uint8_t COMM_LINK_ACTIVE = 0x02; //NFCC to NFCEE Communication link always active when the NFCEE is powered on. |
| 54 | static const uint8_t EVT_END_OF_APDU_TRANSFER = 0x61; |
nxpandroid | 82f7e9e | 2018-04-05 14:54:41 +0530 | [diff] [blame] | 55 | static const uint8_t NFCEE_DISABLE = 0x00; |
| 56 | static const uint8_t NFCEE_ENABLE = 0x01; |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 57 | tNFA_STATUS mPwrCmdstatus; //completion status of the power link control command |
| 58 | uint8_t mNfccPowerMode; |
| 59 | uint8_t mNewPipeId; |
nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 60 | |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 61 | bool mIsWiredModeOpen; |
Sreenivas | 426138e | 2018-04-04 14:56:08 +0530 | [diff] [blame] | 62 | uint32_t SmbTransceiveTimeOutVal;/* maximum time to wait for APDU response */ |
nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 63 | |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 64 | SyncEvent mPwrLinkCtrlEvent; |
| 65 | tNFA_HANDLE EE_HANDLE_0xF4; //handle to secure element in slot 1 |
| 66 | static const tNFA_HANDLE EE_HANDLE_0xF3 = 0x4C0;//0x401; //handle to secure element in slot 0 |
| 67 | static const tNFA_HANDLE EE_HANDLE_0xF8 = 0x481; //handle to secure element in slot 2 |
| 68 | static const tNFA_HANDLE EE_HANDLE_0xF9 = 0x482; //handle to secure element in slot 3 |
| 69 | static const tNFA_HANDLE EE_HANDLE_0xF0 = 0x400;//NFCEE handle for host |
| 70 | static const uint8_t EE_APP_HANLDE_ESE = 0xF3; |
| 71 | static const uint8_t EE_APP_HANLDE_UICC = 0xF4; |
| 72 | static const uint8_t EE_APP_HANLDE_UICC2 = 0xF8; |
| 73 | static const uint8_t EE_APP_HANLDE_UICC3 = 0xF9; |
| 74 | uint8_t muicc2_selected; /* UICC2 or UICC3 selected from config file*/ |
| 75 | /******************************************************************************* |
| 76 | ** |
| 77 | ** Function: getGenericEseId |
| 78 | ** |
| 79 | ** Description: Whether controller is routing listen-mode events to |
| 80 | ** secure elements or a pipe is connected. |
| 81 | ** |
| 82 | ** Returns: Return the generic SE id ex:- 00,01,02,04 |
| 83 | ** |
| 84 | *******************************************************************************/ |
| 85 | jint getGenericEseId(tNFA_HANDLE handle); |
nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 86 | |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 87 | jint getSETechnology(tNFA_HANDLE eeHandle); |
nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 88 | |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 89 | void getEeHandleList(tNFA_HANDLE *list, uint8_t* count); |
nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 90 | |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 91 | private: |
| 92 | static SecureElement sSecElem; |
| 93 | static const char* APP_NAME; |
| 94 | static const tNFA_HANDLE EE_HANDLE_ESE = 0x4C0; |
| 95 | static const tNFA_HANDLE EE_HANDLE_UICC = 0x480; |
| 96 | static const uint8_t NFCEE_ID_ESE = 0x01; |
| 97 | static const uint8_t NFCEE_ID_UICC = 0x02; |
| 98 | static const int MAX_NUM_EE = NFA_EE_MAX_EE_SUPPORTED; /*max number of EE's*/ |
| 99 | static const unsigned int MAX_RESPONSE_SIZE = 0x8800;//1024; //34K |
| 100 | static const uint8_t STATIC_PIPE_0x71 = 0x71; //Broadcom's proprietary static pipe |
| 101 | static const uint8_t EVT_ABORT_MAX_RSP_LEN = 40; |
| 102 | static const uint8_t EVT_ABORT = 0x11; //ETSI12 |
| 103 | static const uint8_t STATIC_PIPE_UICC = 0x20; //UICC's proprietary static pipe |
| 104 | const uint16_t ACTIVE_SE_USE_ANY = 0xFFFF; |
nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 105 | |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 106 | nfc_jni_native_data* mNativeData; |
| 107 | nfc_jni_native_data* mthreadnative; |
nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 108 | |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 109 | bool mbNewEE; |
| 110 | bool mIsInit; // whether EE is initialized |
| 111 | bool mTransceiveWaitOk; |
| 112 | bool mGetAtrRspwait; |
| 113 | bool mAbortEventWaitOk; |
| 114 | bool mIsPiping; //is a pipe connected to the controller? |
nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 115 | |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 116 | tNFA_HCI_GET_GATE_PIPE_LIST mHciCfg; |
| 117 | tNFA_STATUS mCommandStatus; //completion status of the last command |
| 118 | tNFA_HANDLE mNfaHciHandle; //NFA handle to NFA's HCI component |
| 119 | tNFA_EE_INFO mEeInfo [MAX_NUM_EE]; //actual size stored in mActualNumEe |
nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 120 | |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 121 | SyncEvent mCreatePipeEvent; |
| 122 | SyncEvent mAllocateGateEvent; |
| 123 | SyncEvent mDeallocateGateEvent; |
| 124 | SyncEvent mPipeListEvent; |
| 125 | SyncEvent mHciRegisterEvent; |
| 126 | SyncEvent mPipeOpenedEvent; |
| 127 | SyncEvent mTransceiveEvent; |
| 128 | SyncEvent mEeSetModeEvent; |
| 129 | SyncEvent mAbortEvent; |
| 130 | SyncEvent mVerInfoEvent; |
| 131 | SyncEvent mGetRegisterEvent; |
| 132 | SyncEvent mRegistryEvent; |
| 133 | SyncEvent mWiredModeHoldEvent; |
| 134 | SyncEvent mModeSetNtf; |
nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 135 | |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 136 | int mActualResponseSize; //number of bytes in the response received from secure element |
| 137 | int mAtrInfolen; |
nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 138 | |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 139 | uint8_t mNewSourceGate; |
| 140 | uint8_t mActualNumEe; // actual number of EE's reported by the stack |
| 141 | uint8_t mAidForEmptySelect[NCI_MAX_AID_LEN+1]; |
| 142 | uint8_t mDestinationGate; //destination gate of the UICC |
| 143 | uint8_t mAtrStatus; |
| 144 | uint8_t mVerInfo [3]; |
| 145 | uint8_t mAtrInfo[40]; |
| 146 | uint8_t mResponseData [MAX_RESPONSE_SIZE]; |
| 147 | uint8_t mNumEePresent; // actual number of usable EE's |
| 148 | uint8_t mCreatedPipe; |
| 149 | static uint8_t mStaticPipeProp; |
nxpandroid | ecca011 | 2018-06-06 14:41:40 +0530 | [diff] [blame] | 150 | Mutex mMutex; // protects fields below |
| 151 | bool mRfFieldIsOn; // last known RF field state |
| 152 | struct timespec mLastRfFieldToggle; // last time RF field went off |
nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 153 | |
Sreenivas | 426138e | 2018-04-04 14:56:08 +0530 | [diff] [blame] | 154 | |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 155 | struct mNfceeData |
| 156 | { |
| 157 | tNFA_HANDLE mNfceeHandle[MAX_NFCEE]; |
| 158 | tNFA_EE_STATUS mNfceeStatus[MAX_NFCEE]; |
| 159 | uint8_t mNfceePresent; |
| 160 | }; |
| 161 | mNfceeData mNfceeData_t; |
| 162 | /******************************************************************************* |
| 163 | ** |
| 164 | ** Function: SecureElement |
| 165 | ** |
| 166 | ** Description: Initialize member variables. |
| 167 | ** |
| 168 | ** Returns: None |
| 169 | ** |
| 170 | *******************************************************************************/ |
| 171 | SecureElement(); |
nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 172 | |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 173 | /******************************************************************************* |
| 174 | ** |
| 175 | ** Function: decodeBerTlvLength |
| 176 | ** |
| 177 | ** Description: Decodes BER TLV length from the data provided |
| 178 | ** data : array of data to be processed |
| 179 | ** index : offset from which to consider processing |
| 180 | ** data_length : length of data to be processed |
| 181 | ** |
| 182 | ** Returns: decoded_length |
| 183 | ** |
| 184 | *******************************************************************************/ |
| 185 | static int decodeBerTlvLength(uint8_t* data, int index, int data_length); |
nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 186 | |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 187 | /******************************************************************************* |
| 188 | ** |
| 189 | ** Function: notifyTransactionListenersOfAid |
| 190 | ** |
| 191 | ** Description: Notify the NFC service about a transaction event from |
| 192 | ** secure element. |
| 193 | ** aid: Buffer contains application ID. |
| 194 | ** aidLen: Length of application ID. |
| 195 | ** |
| 196 | ** Returns: None |
| 197 | ** |
| 198 | *******************************************************************************/ |
| 199 | void notifyTransactionListenersOfAid(const uint8_t* aidBuffer, |
| 200 | uint8_t aidBufferLen, |
| 201 | const uint8_t* dataBuffer, |
| 202 | uint32_t dataBufferLen, uint32_t evtSrc); |
nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 203 | |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 204 | /******************************************************************************* |
| 205 | ** |
| 206 | ** Function: nfaHciCallback |
| 207 | ** |
| 208 | ** Description: Receive HCI-related events from stack. |
| 209 | ** event: Event code. |
| 210 | ** eventData: Event data. |
| 211 | ** |
| 212 | ** Returns: None |
| 213 | ** |
| 214 | *******************************************************************************/ |
| 215 | static void nfaHciCallback(tNFA_HCI_EVT event, tNFA_HCI_EVT_DATA* eventData); |
nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 216 | |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 217 | public: |
nxpandroid | ecca011 | 2018-06-06 14:41:40 +0530 | [diff] [blame] | 218 | bool mActivatedInListenMode; // whether we're activated in listen mode |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 219 | /******************************************************************************* |
| 220 | ** |
| 221 | ** Function: getInstance |
| 222 | ** |
| 223 | ** Description: Get the SecureElement singleton object. |
| 224 | ** |
| 225 | ** Returns: SecureElement object. |
| 226 | ** |
| 227 | *******************************************************************************/ |
| 228 | static SecureElement& getInstance(); |
| 229 | /******************************************************************************* |
| 230 | ** |
| 231 | ** Function: initialize |
| 232 | ** |
| 233 | ** Description: Initialize all member variables. |
| 234 | ** native: Native data. |
| 235 | ** |
| 236 | ** Returns: True if ok. |
| 237 | ** |
| 238 | *******************************************************************************/ |
| 239 | bool initialize(nfc_jni_native_data* native); |
nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 240 | |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 241 | /******************************************************************************* |
| 242 | ** |
| 243 | ** Function: connectEE |
| 244 | ** |
| 245 | ** Description: Connect to the execution environment. |
| 246 | ** |
| 247 | ** Returns: True if ok. |
| 248 | ** |
| 249 | *******************************************************************************/ |
| 250 | bool connectEE (); |
| 251 | /******************************************************************************* |
| 252 | ** |
| 253 | ** Function: disconnectEE |
| 254 | ** |
| 255 | ** Description: Disconnect from the execution environment. |
| 256 | ** seID: ID of secure element. |
| 257 | ** |
| 258 | ** Returns: True if ok. |
| 259 | ** |
| 260 | *******************************************************************************/ |
| 261 | bool disconnectEE (jint seID); |
| 262 | /******************************************************************************* |
| 263 | ** |
| 264 | ** Function: transceive |
| 265 | ** |
| 266 | ** Description: Send data to the secure element; read it's response. |
| 267 | ** xmitBuffer: Data to transmit. |
| 268 | ** xmitBufferSize: Length of data. |
| 269 | ** recvBuffer: Buffer to receive response. |
| 270 | ** recvBufferMaxSize: Maximum size of buffer. |
| 271 | ** recvBufferActualSize: Actual length of response. |
| 272 | ** timeoutMillisec: timeout in millisecond. |
| 273 | ** |
| 274 | ** Returns: True if ok. |
| 275 | ** |
| 276 | *******************************************************************************/ |
| 277 | bool transceive (uint8_t* xmitBuffer, int32_t xmitBufferSize, uint8_t* recvBuffer, |
| 278 | int32_t recvBufferMaxSize, int32_t& recvBufferActualSize, int32_t timeoutMillisec); |
| 279 | /******************************************************************************* |
| 280 | ** |
| 281 | ** Function: activate |
| 282 | ** |
| 283 | ** Description: Turn on the secure element. |
| 284 | ** seID: ID of secure element; 0xF3 or 0xF4. |
| 285 | ** |
| 286 | ** Returns: True if ok. |
| 287 | ** |
| 288 | *******************************************************************************/ |
| 289 | bool activate (jint seID); |
| 290 | /******************************************************************************* |
| 291 | ** |
Ayush | 73d6891 | 2018-04-04 21:36:26 +0530 | [diff] [blame] | 292 | ** Function: getActiveSecureElementList |
| 293 | ** |
| 294 | ** Description: Get the list of handles of all execution environments. |
| 295 | ** e: Java Virtual Machine. |
| 296 | ** |
| 297 | ** Returns: List of handles of all execution environments. |
| 298 | ** |
| 299 | *******************************************************************************/ |
| 300 | jintArray getActiveSecureElementList (JNIEnv* e); |
| 301 | |
| 302 | /******************************************************************************* |
| 303 | ** |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 304 | ** Function: deactivate |
| 305 | ** |
| 306 | ** Description: Turn off the secure element. |
| 307 | ** seID: ID of secure element; 0xF3 or 0xF4. |
| 308 | ** |
| 309 | ** Returns: True if ok. |
| 310 | ** |
| 311 | *******************************************************************************/ |
| 312 | bool deactivate (jint seID); |
| 313 | /******************************************************************************* |
| 314 | ** |
| 315 | ** Function: SecElem_EeModeSet |
| 316 | ** |
| 317 | ** Description: Perform SE mode set ON/OFF based on mode type |
| 318 | ** |
| 319 | ** Returns: NFA_STATUS_OK/NFA_STATUS_FAILED. |
| 320 | ** |
| 321 | *******************************************************************************/ |
| 322 | tNFA_STATUS SecElem_EeModeSet(uint16_t handle, uint8_t mode); |
| 323 | /******************************************************************************* |
| 324 | ** |
| 325 | ** Function: getAtr |
| 326 | ** |
| 327 | ** Description: GetAtr response from the connected eSE |
| 328 | ** |
| 329 | ** Returns: Returns True if success |
| 330 | ** |
| 331 | *******************************************************************************/ |
| 332 | bool getAtr(jint seID, uint8_t* recvBuffer, int32_t *recvBufferSize); |
| 333 | /******************************************************************************* |
| 334 | ** |
| 335 | ** Function: SecElem_EeModeSet |
| 336 | ** |
| 337 | ** Description: Perform SE mode set ON/OFF based on mode type |
| 338 | ** |
| 339 | ** Returns: NFA_STATUS_OK/NFA_STATUS_FAILED. |
| 340 | ** |
| 341 | *******************************************************************************/ |
| 342 | bool SecEle_Modeset(uint8_t type); |
| 343 | /******************************************************************************* |
Suraj Uday Kotharkar | 2a0ee9c | 2018-04-27 03:48:23 +0530 | [diff] [blame^] | 344 | ** |
| 345 | ** Function: notifyRfFieldEvent |
| 346 | ** |
| 347 | ** Description: Notify the NFC service about RF field events from the stack. |
| 348 | ** isActive: Whether any secure element is activated. |
| 349 | ** |
| 350 | ** Returns: None |
| 351 | ** |
| 352 | *******************************************************************************/ |
| 353 | void notifyRfFieldEvent (bool isActive); |
| 354 | /******************************************************************************* |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 355 | ** |
| 356 | ** Function: initializeEeHandle |
| 357 | ** |
| 358 | ** Description: Set NFCEE handle. |
| 359 | ** |
| 360 | ** Returns: True if ok. |
| 361 | ** |
| 362 | *******************************************************************************/ |
| 363 | bool initializeEeHandle (); |
| 364 | /******************************************************************************* |
| 365 | ** |
| 366 | ** Function: getEseHandleFromGenericId |
| 367 | ** |
| 368 | ** Description: Whether controller is routing listen-mode events to |
| 369 | ** secure elements or a pipe is connected. |
| 370 | ** |
| 371 | ** Returns: Returns Secure element Handle ex:- 402, 4C0, 481 |
| 372 | ** |
| 373 | *******************************************************************************/ |
| 374 | tNFA_HANDLE getEseHandleFromGenericId(jint eseId); |
| 375 | /******************************************************************************* |
| 376 | ** |
| 377 | ** Function: getEeInfo |
| 378 | ** |
| 379 | ** Description: Get latest information about execution environments from stack. |
| 380 | ** |
| 381 | ** Returns: True if at least 1 EE is available. |
| 382 | ** |
| 383 | *******************************************************************************/ |
| 384 | bool getEeInfo (); |
| 385 | /******************************************************************************* |
| 386 | ** |
nxpandroid | ecca011 | 2018-06-06 14:41:40 +0530 | [diff] [blame] | 387 | ** Function: isRfFieldOn |
| 388 | ** |
| 389 | ** Description: Can be used to determine if the SE is in an RF field |
| 390 | ** |
| 391 | ** Returns: True if the SE is activated in an RF field |
| 392 | ** |
| 393 | *******************************************************************************/ |
| 394 | bool isRfFieldOn(); |
| 395 | /******************************************************************************* |
| 396 | ** |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 397 | ** Function: findEeByHandle |
| 398 | ** |
| 399 | ** Description: Find information about an execution environment. |
| 400 | ** eeHandle: Handle to execution environment. |
| 401 | ** |
| 402 | ** Returns: Information about an execution environment. |
| 403 | ** |
| 404 | *******************************************************************************/ |
| 405 | tNFA_EE_INFO *findEeByHandle (tNFA_HANDLE eeHandle); |
| 406 | /******************************************************************************* |
| 407 | ** |
Suraj Uday Kotharkar | 2a0ee9c | 2018-04-27 03:48:23 +0530 | [diff] [blame^] | 408 | ** Function: notifyListenModeState |
| 409 | ** |
| 410 | ** Description: Notify the NFC service about whether the SE was activated |
| 411 | ** in listen mode. |
| 412 | ** isActive: Whether the secure element is activated. |
| 413 | ** |
| 414 | ** Returns: None |
| 415 | ** |
| 416 | *******************************************************************************/ |
| 417 | void notifyListenModeState (bool isActivated); |
| 418 | /******************************************************************************* |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 419 | ** Function: getActiveEeHandle |
| 420 | ** |
| 421 | ** Description: Get the handle of the active execution environment. |
| 422 | ** |
| 423 | ** Returns: Handle to the execution environment. |
| 424 | ** |
| 425 | *******************************************************************************/ |
| 426 | tNFA_HANDLE getActiveEeHandle (tNFA_HANDLE eeHandle); |
nxpandroid | ecca011 | 2018-06-06 14:41:40 +0530 | [diff] [blame] | 427 | /******************************************************************************* |
| 428 | ** |
| 429 | ** Function getLastRfFiledToggleTime |
| 430 | ** |
| 431 | ** Description Provides the last RF filed toggile timer |
| 432 | ** |
| 433 | ** Returns timespec |
| 434 | ** |
| 435 | *******************************************************************************/ |
| 436 | struct timespec getLastRfFiledToggleTime(void); |
nxf24591 | dc0bc2c | 2018-02-21 17:33:08 +0530 | [diff] [blame] | 437 | /******************************************************************************* |
| 438 | ** |
| 439 | ** Function setNfccPwrConfig |
| 440 | ** |
| 441 | ** Description sends the link cntrl command to eSE with the value passed |
| 442 | ** |
| 443 | ** Returns status |
| 444 | ** |
| 445 | *******************************************************************************/ |
| 446 | tNFA_STATUS setNfccPwrConfig(uint8_t value); |
| 447 | /******************************************************************************* |
| 448 | ** |
| 449 | ** Function sendEvent |
| 450 | ** |
| 451 | ** Description sends the HCI event |
| 452 | ** |
| 453 | ** Returns status |
| 454 | ** |
| 455 | *******************************************************************************/ |
| 456 | bool sendEvent(uint8_t event); |
| 457 | /******************************************************************************* |
| 458 | ** |
| 459 | ** Function: notifyModeSet |
| 460 | ** |
| 461 | ** Description: Perform SE mode set ON/OFF based on mode type |
| 462 | ** |
| 463 | ** Returns: NFA_STATUS_OK/NFA_STATUS_FAILED. |
| 464 | ** |
| 465 | *******************************************************************************/ |
| 466 | void notifyModeSet (tNFA_HANDLE eeHandle, bool success, tNFA_EE_STATUS eeStatus); |
| 467 | /******************************************************************************* |
| 468 | ** |
| 469 | ** Function: getGateAndPipeList |
| 470 | ** |
| 471 | ** Description: Get the gate and pipe list. |
| 472 | ** |
| 473 | ** Returns: None |
| 474 | ** |
| 475 | *******************************************************************************/ |
| 476 | uint8_t getGateAndPipeList(); |
| 477 | /******************************************************************************* |
| 478 | ** |
| 479 | ** Function: finalize |
| 480 | ** |
| 481 | ** Description: Release all resources. |
| 482 | ** |
| 483 | ** Returns: None |
| 484 | ** |
| 485 | *******************************************************************************/ |
| 486 | void finalize(); |
nxpandroid | 64fd68c | 2015-09-23 16:45:15 +0530 | [diff] [blame] | 487 | }; |