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