nfc_ee.c revision e9df6ba5a8fcccf306a80b1670b423be8fe7746a
1/****************************************************************************** 2 * 3 * Copyright (C) 2010-2012 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 "gki.h" 26#include "nfc_target.h" 27#include "bt_types.h" 28 29#if (NFC_INCLUDED == TRUE) 30#include "nfc_api.h" 31#include "nfc_int.h" 32#include "nci_hmsgs.h" 33 34 35/******************************************************************************* 36** 37** Function NFC_NfceeDiscover 38** 39** Description This function is called to enable or disable NFCEE Discovery. 40** The response from NFCC is reported by tNFC_RESPONSE_CBACK 41** as NFC_NFCEE_DISCOVER_REVT. 42** The notification from NFCC is reported by tNFC_RESPONSE_CBACK 43** as NFC_NFCEE_INFO_REVT. 44** 45** Parameters discover - 1 to enable discover, 0 to disable. 46** 47** Returns tNFC_STATUS 48** 49*******************************************************************************/ 50tNFC_STATUS NFC_NfceeDiscover (BOOLEAN discover) 51{ 52 return nci_snd_nfcee_discover ((UINT8) (discover ? NCI_DISCOVER_ACTION_ENABLE : NCI_DISCOVER_ACTION_DISABLE)); 53} 54 55/******************************************************************************* 56** 57** Function NFC_NfceeModeSet 58** 59** Description This function is called to activate or de-activate an NFCEE 60** connected to the NFCC. 61** The response from NFCC is reported by tNFC_RESPONSE_CBACK 62** as NFC_NFCEE_MODE_SET_REVT. 63** 64** Parameters nfcee_id - the NFCEE to activate or de-activate. 65** mode - NFC_MODE_ACTIVATE to activate NFCEE, 66** NFC_MODE_DEACTIVATE to de-activate. 67** 68** Returns tNFC_STATUS 69** 70*******************************************************************************/ 71tNFC_STATUS NFC_NfceeModeSet (UINT8 nfcee_id, 72 tNFC_NFCEE_MODE mode) 73{ 74 if (mode >= NCI_NUM_NFCEE_MODE) 75 { 76 NFC_TRACE_ERROR1 ("NFC_NfceeModeSet bad mode:%d", mode); 77 return NFC_STATUS_FAILED; 78 } 79 80 return nci_snd_nfcee_mode_set (nfcee_id, mode); 81} 82 83 84 85 86/******************************************************************************* 87** 88** Function NFC_SetRouting 89** 90** Description This function is called to configure the CE routing table. 91** The response from NFCC is reported by tNFC_RESPONSE_CBACK 92** as NFC_SET_ROUTING_REVT. 93** 94** Parameters 95** 96** Returns tNFC_STATUS 97** 98*******************************************************************************/ 99tNFC_STATUS NFC_SetRouting (BOOLEAN more, 100 UINT8 nfcee_id, 101 UINT8 num_tlv, 102 UINT8 tlv_size, 103 UINT8 *p_param_tlvs) 104{ 105 return nci_snd_set_routing_cmd (more, nfcee_id, num_tlv, tlv_size, p_param_tlvs); 106} 107 108/******************************************************************************* 109** 110** Function NFC_GetRouting 111** 112** Description This function is called to retrieve the CE routing table from 113** NFCC. The response from NFCC is reported by tNFC_RESPONSE_CBACK 114** as NFC_GET_ROUTING_REVT. 115** 116** Returns tNFC_STATUS 117** 118*******************************************************************************/ 119tNFC_STATUS NFC_GetRouting (void) 120{ 121 return nci_snd_get_routing_cmd (); 122} 123 124 125#endif /* NFC_INCLUDED == TRUE */ 126