1 /*
2 * Copyright (C) 2021 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 <rw_int.h>
18 #include <stdlib.h>
19
20 #include "../includes/common.h"
21
22 // borrowed from rw_t3t.cc
23 #define RW_T3T_SENSF_RES_RD_OFFSET 17
24 #define RW_T3T_SENSF_RES_RD_LEN 2
25 #define DEFAULT_VALUE 0xBE
26
27 extern tRW_CB rw_cb;
28 void rw_init(void);
cback(uint8_t,tRW_DATA *)29 void cback(uint8_t, tRW_DATA *) {}
30
GKI_start_timer(uint8_t,int32_t,bool)31 void GKI_start_timer(uint8_t, int32_t, bool) {}
32
GKI_stop_timer(uint8_t)33 void GKI_stop_timer(uint8_t) {}
34
main()35 int main() {
36 tRW_T3T_CB *p_cb = &rw_cb.tcb.t3t;
37
38 GKI_init();
39 rw_init();
40 rw_cb.p_cback = &cback;
41
42 for (int n = 0; n < NCI_NFCID2_LEN; ++n) {
43 p_cb->peer_nfcid2[n] = DEFAULT_VALUE;
44 }
45
46 p_cb->num_system_codes = T3T_MAX_SYSTEM_CODES;
47 p_cb->flags = RW_T3T_FL_W4_GET_SC_POLL_RSP;
48
49 uint8_t nci_status = NCI_STATUS_OK;
50 uint8_t num_responses = 1;
51 uint8_t sensf_res_buf_size =
52 RW_T3T_SENSF_RES_RD_OFFSET + RW_T3T_SENSF_RES_RD_LEN;
53 uint8_t *p_sensf_res_buf =
54 (uint8_t *)malloc(RW_T3T_SENSF_RES_RD_OFFSET + RW_T3T_SENSF_RES_RD_LEN);
55 rw_t3t_handle_nci_poll_ntf(nci_status, num_responses, sensf_res_buf_size,
56 p_sensf_res_buf);
57
58 free(p_sensf_res_buf);
59 return EXIT_SUCCESS;
60 }
61