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 *
22 *  NFA card emulation API functions
23 *
24 ******************************************************************************/
25#ifndef NFA_CE_API_H
26#define NFA_CE_API_H
27
28#include "nfc_target.h"
29#include "nfa_api.h"
30
31/*****************************************************************************
32**  Constants and data types
33*****************************************************************************/
34
35/*****************************************************************************
36**  External Function Declarations
37*****************************************************************************/
38#ifdef __cplusplus
39extern "C"
40{
41#endif
42
43/*******************************************************************************
44**
45** Function         NFA_CeConfigureLocalTag
46**
47** Description      Configure local NDEF tag.
48**
49**                  Tag events will be notifed using the tNFA_CONN_CBACK
50**                  (registered during NFA_Enable)
51**
52**                  The NFA_CE_LOCAL_TAG_CONFIGURED_EVT reports the status of the
53**                  operation.
54**
55**                  Activation and deactivation are reported using the
56**                  NFA_ACTIVATED_EVT and NFA_DEACTIVATED_EVT events
57**
58**                  If a write-request is received to update the tag memory,
59**                  an NFA_CE_NDEF_WRITE_CPLT_EVT will notify the application, along
60**                  with a buffer containing the updated contents.
61**
62**                  To disable the local NDEF tag, set protocol_mask=0
63**
64**                  The NDEF data provided by p_ndef_data must be persistent
65**                  as long as the local NDEF tag is enabled. Also, Input parameters p_uid and
66**                  uid_len are reserved for future use.
67**
68**
69** Note:            If RF discovery is started, NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT
70**                  should happen before calling this function.
71**
72** Returns:
73**                  NFA_STATUS_OK,            if command accepted
74**                  NFA_STATUS_INVALID_PARAM,
75**                      if protocol_maks is not 0 and p_ndef_data is NULL
76**                  (or) uid_len is not 0
77**                  (or) if protocol mask is set for Type 1 or Type 2
78**
79**                  NFA_STATUS_FAILED:        otherwise
80**
81*******************************************************************************/
82NFC_API extern tNFA_STATUS NFA_CeConfigureLocalTag (tNFA_PROTOCOL_MASK protocol_mask,
83                                                    UINT8     *p_ndef_data,
84                                                    UINT16    ndef_cur_size,
85                                                    UINT16    ndef_max_size,
86                                                    BOOLEAN   read_only,
87                                                    UINT8     uid_len,
88                                                    UINT8     *p_uid);
89
90/*******************************************************************************
91**
92** Function         NFA_CeConfigureUiccListenTech
93**
94** Description      Configure listening for the UICC, using the specified
95**                  technologies.
96**
97**                  Events will be notifed using the tNFA_CONN_CBACK
98**                  (registered during NFA_Enable)
99**
100**                  The NFA_CE_UICC_LISTEN_CONFIGURED_EVT reports the status of the
101**                  operation.
102**
103**                  Activation and deactivation are reported using the
104**                  NFA_ACTIVATED_EVT and NFA_DEACTIVATED_EVT events
105**
106** Note:            If RF discovery is started, NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT
107**                  should happen before calling this function
108**
109** Returns:
110**                  NFA_STATUS_OK, if command accepted
111**                  NFA_STATUS_FAILED: otherwise
112**
113*******************************************************************************/
114NFC_API extern tNFA_STATUS NFA_CeConfigureUiccListenTech (tNFA_HANDLE          ee_handle,
115                                                          tNFA_TECHNOLOGY_MASK tech_mask);
116
117/*******************************************************************************
118**
119** Function         NFA_CeRegisterFelicaSystemCodeOnDH
120**
121** Description      Register listening callback for Felica system code
122**
123**                  The NFA_CE_REGISTERED_EVT reports the status of the
124**                  operation.
125**
126** Note:            If RF discovery is started, NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT
127**                  should happen before calling this function
128**
129** Returns:
130**                  NFA_STATUS_OK, if command accepted
131**                  NFA_STATUS_FAILED: otherwise
132**
133*******************************************************************************/
134NFC_API extern tNFA_STATUS NFA_CeRegisterFelicaSystemCodeOnDH (UINT16           system_code,
135                                                               UINT8            nfcid2[NCI_RF_F_UID_LEN],
136                                                               tNFA_CONN_CBACK  *p_conn_cback);
137
138/*******************************************************************************
139**
140** Function         NFA_CeDeregisterFelicaSystemCodeOnDH
141**
142** Description      Deregister listening callback for Felica
143**                  (previously registered using NFA_CeRegisterFelicaSystemCodeOnDH)
144**
145**                  The NFA_CE_DEREGISTERED_EVT reports the status of the
146**                  operation.
147**
148** Note:            If RF discovery is started, NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT
149**                  should happen before calling this function
150**
151** Returns          NFA_STATUS_OK if successfully initiated
152**                  NFA_STATUS_BAD_HANDLE if invalid handle
153**                  NFA_STATUS_FAILED otherwise
154**
155*******************************************************************************/
156NFC_API extern tNFA_STATUS NFA_CeDeregisterFelicaSystemCodeOnDH (tNFA_HANDLE handle);
157
158/*******************************************************************************
159**
160** Function         NFA_CeRegisterAidOnDH
161**
162** Description      Register listening callback for the specified ISODEP AID
163**
164**                  The NFA_CE_REGISTERED_EVT reports the status of the
165**                  operation.
166**
167**                  If no AID is specified (aid_len=0), then p_conn_cback will
168**                  will get notifications for any AIDs routed to the DH. This
169**                  over-rides callbacks registered for specific AIDs.
170**
171** Note:            If RF discovery is started, NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT
172**                  should happen before calling this function
173**
174** Returns:
175**                  NFA_STATUS_OK, if command accepted
176**                  NFA_STATUS_FAILED: otherwise
177**
178*******************************************************************************/
179NFC_API extern tNFA_STATUS NFA_CeRegisterAidOnDH (UINT8           aid[NFC_MAX_AID_LEN],
180                                                  UINT8           aid_len,
181                                                  tNFA_CONN_CBACK *p_conn_cback);
182
183/*******************************************************************************
184**
185** Function         NFA_CeDeregisterAidOnDH
186**
187** Description      Deregister listening callback for ISODEP AID
188**                  (previously registered using NFA_CeRegisterAidOnDH)
189**
190**                  The NFA_CE_DEREGISTERED_EVT reports the status of the
191**                  operation.
192**
193** Note:            If RF discovery is started, NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT
194**                  should happen before calling this function
195**
196** Returns          NFA_STATUS_OK if successfully initiated
197**                  NFA_STATUS_BAD_HANDLE if invalid handle
198**                  NFA_STATUS_FAILED otherwise
199**
200*******************************************************************************/
201NFC_API extern tNFA_STATUS NFA_CeDeregisterAidOnDH (tNFA_HANDLE handle);
202
203/*******************************************************************************
204**
205** Function         NFA_CeSetIsoDepListenTech
206**
207** Description      Set the technologies (NFC-A and/or NFC-B) to listen for when
208**                  NFA_CeConfigureLocalTag or NFA_CeDeregisterAidOnDH are called.
209**
210**                  By default (if this API is not called), NFA will listen
211**                  for both NFC-A and NFC-B for ISODEP.
212**
213** Note:            If listening for ISODEP on UICC, the DH listen callbacks
214**                  may still get activate notifications for ISODEP if the reader/
215**                  writer selects an AID that is not routed to the UICC (regardless
216**                  of whether A or B was disabled using NFA_CeSetIsoDepListenTech)
217**
218** Note:            If RF discovery is started, NFA_StopRfDiscovery()/NFA_RF_DISCOVERY_STOPPED_EVT
219**                  should happen before calling this function
220**
221** Returns:
222**                  NFA_STATUS_OK, if command accepted
223**                  NFA_STATUS_FAILED: otherwise
224**
225*******************************************************************************/
226NFC_API extern tNFA_STATUS NFA_CeSetIsoDepListenTech (tNFA_TECHNOLOGY_MASK tech_mask);
227
228#ifdef __cplusplus
229}
230#endif
231
232#endif /* NFA_CE_API_H */
233