1 /**
2  * Copyright (C) 2020 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 #include <nfa_api.h>
18 #include <nfc_api.h>
19 #include <phNfcTypes.h>
20 #include <phNxpExtns.h>
21 
nfaMockDMCallback(uint8_t,tNFA_DM_CBACK_DATA *)22 static void nfaMockDMCallback(uint8_t, tNFA_DM_CBACK_DATA *) {}
nfaMockCCallback(uint8_t,tNFA_CONN_EVT_DATA *)23 static void nfaMockCCallback(uint8_t, tNFA_CONN_EVT_DATA *) {}
24 
main(void)25 int main(void) {
26   if (EXTNS_Init(nfaMockDMCallback, nfaMockCCallback) != NFCSTATUS_SUCCESS) {
27     return EXIT_FAILURE;
28   }
29   const int32_t size = 16;
30   const int32_t offset = size - 1;
31   uint8_t *p_data = static_cast<uint8_t *>(malloc(size));
32   if (p_data == nullptr) {
33     return EXIT_FAILURE;
34   }
35   p_data[offset] = 0x60;
36   EXTNS_MfcTransceive(&p_data[offset], 1);
37   free(p_data);
38   EXTNS_Close();
39   return EXIT_SUCCESS;
40 }
41