/* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include extern tRW_CB rw_cb; extern tNFC_CB nfc_cb; void rw_init(void); tNFC_STATUS rw_i93_select(uint8_t* p_uid); void GKI_freebuf(void*) { } void GKI_start_timer(uint8_t, int32_t, bool) { } void GKI_stop_timer(uint8_t) { } int main() { tRW_I93_CB* p_i93 = &rw_cb.tcb.i93; GKI_init(); rw_init(); uint8_t p_uid = 1; if (rw_i93_select(&p_uid) != NFC_STATUS_OK) { return EXIT_FAILURE; } tNFC_CONN_CB* p_cb = &nfc_cb.conn_cb[NFC_RF_CONN_ID]; tNFC_CONN_EVT event = NFC_DATA_CEVT; tNFC_CONN *p_data = (tNFC_CONN *) malloc(sizeof(tNFC_CONN)); if (!p_data) { return EXIT_FAILURE; } p_data->data.p_data = (NFC_HDR *) malloc(sizeof(uint8_t) * 32); if (!(p_data->data.p_data)) { free(p_data); return EXIT_FAILURE; } NFC_HDR *p_resp = (NFC_HDR*) p_data->data.p_data; p_resp->len = 0; p_resp->offset = 0; p_i93->state = RW_I93_STATE_UPDATE_NDEF; p_i93->sub_state = RW_I93_SUBSTATE_RESET_LEN; p_i93->block_size = 2 * (I93_MAX_BLOCK_LENGH + 1); p_i93->ndef_tlv_start_offset = 2 * (I93_MAX_BLOCK_LENGH) - 1; p_data->status = NFC_STATUS_OK; p_cb->p_cback(0, event, p_data); free(p_data->data.p_data); free(p_data); return EXIT_SUCCESS; }