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