1 /****************************************************************************** 2 * 3 * Copyright (C) 2010-2014 Broadcom Corporation 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ******************************************************************************/ 18 19 /****************************************************************************** 20 * 21 * This file contains functions that interface with the NFCEEs. 22 * 23 ******************************************************************************/ 24 #include <string.h> 25 #include "bt_types.h" 26 #include "gki.h" 27 #include "nfc_target.h" 28 29 #include "nci_hmsgs.h" 30 #include "nfc_api.h" 31 #include "nfc_int.h" 32 33 /******************************************************************************* 34 ** 35 ** Function NFC_NfceeDiscover 36 ** 37 ** Description This function is called to enable or disable NFCEE 38 ** Discovery. The response from NFCC is reported by 39 ** tNFC_RESPONSE_CBACK as NFC_NFCEE_DISCOVER_REVT. 40 ** The notification from NFCC is reported by 41 ** tNFC_RESPONSE_CBACK as NFC_NFCEE_INFO_REVT. 42 ** 43 ** Parameters discover - 1 to enable discover, 0 to disable. 44 ** 45 ** Returns tNFC_STATUS 46 ** 47 *******************************************************************************/ 48 tNFC_STATUS NFC_NfceeDiscover(bool discover) { 49 return nci_snd_nfcee_discover((uint8_t)( 50 discover ? NCI_DISCOVER_ACTION_ENABLE : NCI_DISCOVER_ACTION_DISABLE)); 51 } 52 53 /******************************************************************************* 54 ** 55 ** Function NFC_NfceeModeSet 56 ** 57 ** Description This function is called to activate or de-activate an NFCEE 58 ** connected to the NFCC. 59 ** The response from NFCC is reported by tNFC_RESPONSE_CBACK 60 ** as NFC_NFCEE_MODE_SET_REVT. 61 ** 62 ** Parameters nfcee_id - the NFCEE to activate or de-activate. 63 ** mode - NFC_MODE_ACTIVATE to activate NFCEE, 64 ** NFC_MODE_DEACTIVATE to de-activate. 65 ** 66 ** Returns tNFC_STATUS 67 ** 68 *******************************************************************************/ 69 tNFC_STATUS NFC_NfceeModeSet(uint8_t nfcee_id, tNFC_NFCEE_MODE mode) { 70 if (mode >= NCI_NUM_NFCEE_MODE) { 71 NFC_TRACE_ERROR1("NFC_NfceeModeSet bad mode:%d", mode); 72 return NFC_STATUS_FAILED; 73 } 74 75 return nci_snd_nfcee_mode_set(nfcee_id, mode); 76 } 77 78 /******************************************************************************* 79 ** 80 ** Function NFC_SetRouting 81 ** 82 ** Description This function is called to configure the CE routing table. 83 ** The response from NFCC is reported by tNFC_RESPONSE_CBACK 84 ** as NFC_SET_ROUTING_REVT. 85 ** 86 ** Parameters 87 ** 88 ** Returns tNFC_STATUS 89 ** 90 *******************************************************************************/ 91 tNFC_STATUS NFC_SetRouting(bool more, uint8_t num_tlv, uint8_t tlv_size, 92 uint8_t* p_param_tlvs) { 93 return nci_snd_set_routing_cmd(more, num_tlv, tlv_size, p_param_tlvs); 94 } 95 96 /******************************************************************************* 97 ** 98 ** Function NFC_GetRouting 99 ** 100 ** Description This function is called to retrieve the CE routing table 101 ** from NFCC. The response from NFCC is reported by 102 ** tNFC_RESPONSE_CBACK as NFC_GET_ROUTING_REVT. 103 ** 104 ** Returns tNFC_STATUS 105 ** 106 *******************************************************************************/ 107 tNFC_STATUS NFC_GetRouting(void) { return nci_snd_get_routing_cmd(); } 108