Tizen 2.0 Release
[framework/api/nfc.git] / include / nfc.h
1 /*
2  * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 #ifndef __NFC_H__
19 #define __NFC_H__
20
21 #include <tizen.h>
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /**
28  * @file nfc.h
29  * @brief This file contains the NFC API.
30  */
31
32 #define NFC_ERROR_CLASS TIZEN_ERROR_NETWORK_CLASS | 0x200
33
34
35 /**
36  * @brief Error codes reported by the NFC API.
37  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
38  */
39 typedef enum {
40         NFC_ERROR_NONE = TIZEN_ERROR_NONE,      /**< Successful */
41         NFC_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,    /**< Out of memory */
42         NFC_ERROR_OPERATION_FAILED = NFC_ERROR_CLASS | 0x01,    /**< Operation failed*/
43         NFC_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,    /**< Invalid parameter */
44         NFC_ERROR_INVALID_NDEF_MESSAGE = NFC_ERROR_CLASS | 0x02,        /**< Invalid NDEF message */
45         NFC_ERROR_INVALID_RECORD_TYPE  = NFC_ERROR_CLASS | 0x03,        /**< Invalid record type*/
46         NFC_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT,    /**< Timeout error, no answer */
47         NFC_ERROR_DEVICE_BUSY = TIZEN_ERROR_RESOURCE_BUSY,      /**< Previous opertion is not finished still busy */
48         NFC_ERROR_NO_DEVICE = NFC_ERROR_CLASS | 0x04, /**< no device */
49         NFC_ERROR_NOT_ACTIVATED = NFC_ERROR_CLASS | 0x05, /**< NFC is not activated */
50         NFC_ERROR_NOT_SUPPORTED = NFC_ERROR_CLASS | 0x06, /**< Not supported */
51         NFC_ERROR_ALREADY_ACTIVATED = NFC_ERROR_CLASS | 0x07, /**< Already activated */
52         NFC_ERROR_ALREADY_DEACTIVATED = NFC_ERROR_CLASS | 0x08, /**< Already deactivated */
53         NFC_ERROR_READ_ONLY_NDEF = NFC_ERROR_CLASS | 0x09, /**< Read only tag */
54         NFC_ERROR_NO_SPACE_ON_NDEF = NFC_ERROR_CLASS | 0x0a, /**< No enough space on tag */
55         NFC_ERROR_NO_NDEF_MESSAGE = NFC_ERROR_CLASS | 0x0b, /**< No NDEF Message on Tag */
56         NFC_ERROR_NOT_NDEF_FORMAT = NFC_ERROR_CLASS | 0x0c, /**< Not NDEF format Tag */
57         NFC_ERROR_SECURITY_RESTRICTED = NFC_ERROR_CLASS | 0x0d /**<  Restricted by security system policy */
58 } nfc_error_e;
59
60 /**
61  * @brief Enumerations for record TNF (Type Name Format)
62  * @details It is indicate format of type field
63  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
64  */
65 typedef enum {
66         NFC_RECORD_TNF_EMPTY = 0x00,    /**< Empty */
67         NFC_RECORD_TNF_WELL_KNOWN = 0x01,       /**< RTD(Record Type Definition) type format [NFC RTD] */
68         NFC_RECORD_TNF_MIME_MEDIA= 0x02,        /**< MIME Media types in RFC 2046 [RFC 2046] */
69         NFC_RECORD_TNF_URI = 0x03,      /**< Absolute URI as defined in RFC 3986 [RFC 3986] */
70         NFC_RECORD_TNF_EXTERNAL_RTD = 0x04,     /**< NFC Forum external type [NFC RTD] */
71         NFC_RECORD_TNF_UNKNOWN = 0x05,  /**< Unknown\n The payload type is unknown */
72         NFC_RECORD_TNF_UNCHAGNED = 0x06,        /**< It means the payload is an intermediate or final chunk of a chunked NDEF Record */
73 } nfc_record_tnf_e;
74
75
76 /**
77  * @brief Enumerations for NFC encode types
78  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
79  */
80 typedef enum {
81         NFC_ENCODE_UTF_8 = 0x00,        /**< UTF-8 */
82         NFC_ENCODE_UTF_16,      /**< UTF-16 */
83 } nfc_encode_type_e;
84
85 /**
86  * @brief Enumerations for NFC tag types
87  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
88  */
89 typedef enum {
90         NFC_UNKNOWN_TARGET = 0x00U,     /**< Unknown target */
91         NFC_GENERIC_PICC,       /**< GENERIC PICC*/
92         NFC_ISO14443_A_PICC,    /**< ISO14443_A PICC */
93         NFC_ISO14443_4A_PICC,   /**< ISO14443_4A PICC */
94         NFC_ISO14443_3A_PICC,   /**< ISO14443_3A PICC */
95         NFC_MIFARE_MINI_PICC,   /**< MIFARE_MINI_PICC */
96         NFC_MIFARE_1K_PICC,     /**< MIFARE_1K_PICC */
97         NFC_MIFARE_4K_PICC,     /**< MIFARE_4K_PICC */
98         NFC_MIFARE_ULTRA_PICC,  /**< MIFARE_ULTRA_PICC */
99         NFC_MIFARE_DESFIRE_PICC,        /**< MIFARE_DESFIRE_PICC */
100         NFC_ISO14443_B_PICC,    /**< ISO14443_B PICC */
101         NFC_ISO14443_4B_PICC,   /**< ISO14443_4B PICC */
102         NFC_ISO14443_BPRIME_PICC,       /**< ISO14443_BPRIME PICC */
103         NFC_FELICA_PICC,        /**< FELICA PICC */
104         NFC_JEWEL_PICC, /**< JEWEL PICC */
105         NFC_ISO15693_PICC,      /**< ISO15693 PICC */
106         NFC_NFCIP1_TARGET,      /**< NFCIP1_TARGET */
107         NFC_NFCIP1_INITIATOR,   /**< NFCIP1_INITIATOR */
108 } nfc_tag_type_e;
109
110
111
112 /**
113  * @brief Enumerations for NFC Tag filter
114  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
115  */
116 typedef enum {
117         NFC_TAG_FILTER_ALL_DISABLE = 0x0000,    /**< All disable */
118         NFC_TAG_FILTER_ISO14443A_ENABLE = 0x0001,       /**< ISO14443A enable */
119         NFC_TAG_FILTER_ISO14443B_ENABLE = 0x0002,       /**< ISO14443B enable */
120         NFC_TAG_FILTER_ISO15693_ENABLE = 0x0004,        /**< ISO15693 enable */
121         NFC_TAG_FILTER_FELICA_ENABLE = 0x0008,  /**< FELICA enable */
122         NFC_TAG_FILTER_JEWEL_ENABLE = 0x0010,   /**< JEWEL enable */
123         NFC_TAG_FILTER_IP_ENABLE = 0x0020,      /**< IP enable */
124         NFC_TAG_FILTER_ALL_ENABLE= ~0,  /**< All enable */
125 } nfc_tag_filter_e;
126
127 /**
128  * @brief Enumerations of polling request code for FeliCa tag
129  * @ingroup CAPI_NETWORK_NFC_TAG_FELICA
130  */
131 typedef enum {
132         NFC_TAG_FELICA_POLL_NO_REQUEST = 0x00,  /**< NO REQUEST */
133         NFC_TAG_FELICA_POLL_SYSTEM_CODE_REQUEST= 0x01,  /**< SYSTEM CODE REQUEST */
134         NFC_TAG_FELICA_POLL_COMM_SPEED_REQUEST= 0x02,   /**< COMM SPEED REQUEST */
135 } nfc_tag_felica_poll_request_code_e;
136
137
138 /**
139  * @brief Enumerations for NFC discovered type
140  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
141  */
142 typedef enum {
143         NFC_DISCOVERED_TYPE_ATTACHED,   /**< Attached, discovered, activated event*/
144         NFC_DISCOVERED_TYPE_DETACHED,   /**< detached, disappeared, deactivated event*/
145 } nfc_discovered_type_e;
146
147 /**
148  * @brief Enumerations for NFC Secure Element (SIM/UICC(Universal Integrated Circuit Card)) event
149  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
150  */
151 typedef enum{
152         NFC_SE_EVENT_START_TRANSACTION, /**< This event notifies the terminal host that it shall launch an application associated to an NFC application in a UICC(Universal Integrated Circuit Card) host. */
153         NFC_SE_EVENT_END_TRANSACTION,   /**< This event notifies the terminal host that current transaction in process was ended. */
154         NFC_SE_EVENT_CONNECTIVITY, /**< It's ready signal to communicate UICC(Universal Integrated Circuit Card) with terminal host. \nUICC(Universal Integrated Circuit Card) create pipe and open the pipe chanel.\nThen it sends the signal to terminal host or host controller. */
155         NFC_SE_EVENT_FIELD_ON, /**< When the CLF(Contactless Front-end) detects a RF field, the card RF gate sends the event #NFC_SE_EVENT_FIELD_ON to the card application gate.\nWhen there are multiple open card RF gates the CLF shall send the #NFC_SE_EVENT_FIELD_ON on all open pipes to these gates.Next the CLF starts the initialization and anti-collision process as defined in ISO/IEC 14443-3 [6]*/
156         NFC_SE_EVENT_FIELD_OFF, /**< When the CLF(Contactless Front-end) detects that the RF field is off, the card RF gate shall send #NFC_SE_EVENT_FIELD_OFF to the card application gate.\nWhen there are multiple open card RF gates the CLF shall send the #NFC_SE_EVENT_FIELD_OFF to one gate only.*/
157         NFC_SE_EVENT_TRANSACTION, /**< This event  notifies , external reader trys to access secure element */
158         NFC_SE_EVENT_SE_TYPE_CHANGED /**< This event notifies, changing the emulated secure element type */
159 } nfc_se_event_e;
160
161 /**
162  * @brief Enumerations for NFC Secure Element (SIM/UICC(Universal Integrated Circuit Card)) type
163  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
164  */
165 typedef enum{
166         NFC_SE_TYPE_DISABLE = 0x00, /**< Disable card emulation */
167         NFC_SE_TYPE_ESE = 0x01, /**< SmartMX type card emulation */
168         NFC_SE_TYPE_UICC = 0x02 /**< UICC type card emulation */
169 } nfc_se_type_e;
170
171
172
173 /**
174  * @brief Enumerations for NFC AC(Alternative Carrior)
175  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
176  */
177 typedef enum {
178         NFC_AC_TYPE_BT = 0x00, /**< Bluetooth AC*/
179         NFC_AC_TYPE_WIFI, /**<Wifi AC*/
180         NFC_AC_TYPE_WIFI_DIRECT,/**<Wifi-direct AC*/
181         NFC_AC_TYPE_UNKNOWN, /* No selected preferd AC */
182 } nfc_ac_type_e ;
183
184
185
186
187 /**
188  * @brief The handle to the NDEF record
189  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
190  */
191 typedef struct ndef_record_s *nfc_ndef_record_h;
192
193 /**
194  * @brief The handle to the NDEF message
195  * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
196  */
197 typedef struct ndef_message_s *nfc_ndef_message_h;
198
199 /**
200  * @brief The handle to the NFC tag
201  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
202  */
203 typedef struct net_nfc_target_info_s *nfc_tag_h;
204
205
206 /**
207  * @brief The handle to NFC p2p target
208  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
209  */
210 typedef void* nfc_p2p_target_h;
211
212 /**
213  * @brief The default factory key.
214  * @details The key is 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
215  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
216  */
217 extern const unsigned char NFC_TAG_MIFARE_KEY_DEFAULT[6];
218
219 /**
220  * @brief The well-known key for tags formatted according to the MIFARE Application Directory (MAD) specification.
221  * @details The key is 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5
222  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
223  */
224 extern const unsigned char NFC_TAG_MIFARE_KEY_APPLICATION_DIRECTORY[6];
225
226 /**
227  * @brief The well-known key for tags formatted according to the NDEF on Mifare Classic specification.
228  * @details The key is 0xD3, 0xF7, 0xD3, 0xF7, 0xD3, 0xF7
229  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
230  */
231 extern const unsigned char NFC_TAG_MIFARE_KEY_NFC_FORUM[6];
232
233
234 /**
235  * @brief RTD(Record type definition) Type - Smart Poster type.
236  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
237  */
238 extern const unsigned char NFC_RECORD_SMART_POSTER_TYPE[2];
239
240 /**
241  * @brief  RTD(Record type definition) Type - Text type.
242  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
243  */
244 extern const unsigned char NFC_RECORD_TEXT_TYPE[1];
245 /**
246  * @brief  RTD(Record type definition) Type - URI type.
247  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
248  */
249 extern const unsigned char NFC_RECORD_URI_TYPE[1];
250 /**
251  * @brief  RTD(Record type definition) Type - Alternative Carrier type.
252  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
253  */
254 extern const unsigned char NFC_RECORD_ALTERNATIVE_CARRIER_TYPE[2];
255 /**
256  * @brief  RTD(Record type definition) Type - Handover Carrier type.
257  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
258  */
259 extern const unsigned char NFC_RECORD_HANDOVER_CARRIER_TYPE[2];
260 /**
261  * @brief  RTD(Record type definition) Type - Handover Request type.
262  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
263  */
264 extern const unsigned char NFC_RECORD_HANDOVER_REQUEST_TYPE[2];
265 /**
266  * @brief  RTD(Record type definition) Type - Handover Select type.
267  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
268  */
269 extern const unsigned char NFC_RECORD_HANDOVER_SELECT_TYPE[2];
270
271 /**
272  * @brief Called after nfc_manager_set_activation() has completed.
273  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
274  *
275  * @param [in] error The result
276  * @param [in] user_data The user data passed from the callback registration function
277  *
278  * @see nfc_manager_set_activation()
279  */
280 typedef void (* nfc_activation_completed_cb)(nfc_error_e error, void *user_data);
281
282 /**
283  * @brief Called when nfc activation state is changed.
284  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
285  *
286  * @param [in] activated The activation state
287  * @param [in] user_data The user data passed from the callback registeration function
288  *
289  * @see nfc_manager_set_activation_changed_cb()
290  */
291 typedef void (*nfc_activation_changed_cb)(bool activated , void *user_data);
292
293 /**
294  * @brief Called after nfc_manager_initialize() has completed.
295  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
296  *
297  * @param [in] error The result
298  * @param [in] user_data The user data passed from the callback registration function
299  *
300  * @see nfc_manager_initialize()
301  */
302 typedef void (* nfc_initialize_completed_cb)(nfc_error_e error, void *user_data);
303
304
305 /**
306  * @brief Called after nfc_manager_set_card_emulation_se_type() has completed.
307  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
308  *
309  * @param [in] error The result
310  * @param [in] user_data The user data passed from the callback registration function
311  *
312  * @see nfc_manager_set_card_emulation_se_type()
313  */
314 typedef void (* nfc_set_card_emulation_completed_cb)(nfc_error_e error, void *user_data);
315
316 /**
317  * @brief Called when an NFC tag appears or disappears
318  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
319  *
320  * @remarks  The tag handle does not have detail target info when an NFC tag disappeared.\n
321  *      So then do not use nfc_tag_get_keys().
322  *
323  * @param [in] type The discovered type attached or detached
324  * @param [in] tag The handle to NFC tag
325  * @param [in] user_data The user data passed from the callback registration function
326  *
327  * @see nfc_manager_set_tag_discovered_cb()
328  * @see nfc_manager_unset_tag_discovered_cb()
329  * @see nfc_manager_set_tag_filter()
330  */
331 typedef void (* nfc_tag_discovered_cb)(nfc_discovered_type_e type, nfc_tag_h tag, void *user_data);
332
333 /**
334  * @brief Called when an NDEF Message is discovered
335  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
336  *
337  * @remarks @a message will be automatically destroyed when the callback function returns. (Do not release @a message.)
338  *
339  * @param [in] message The handle to NDEF message
340  * @param [in] user_data The user data passed from the callback registration function
341  *
342  * @see nfc_manager_set_ndef_discovered_cb()
343  * @see nfc_manager_unset_ndef_discovered_cb()
344  */
345 typedef void (* nfc_ndef_discovered_cb)(nfc_ndef_message_h message, void *user_data);
346
347
348 /**
349  * @brief Called once for each tag information.
350  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
351  *
352  * @remarks @a key and value will be automatically destroyed when the callback function returns. (Do not release @a key and value.)
353  *
354  * @param[in] key The key of information
355  * @param[in] value The value of information
356  * @param[in] value_size The data size in bytes
357  * @param[in] user_data The user data passed from the foreach function
358  *
359  * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop.
360  * @pre nfc_tag_foreach_informations() invokes this callback.
361  *
362  * @see nfc_tag_foreach_informations()
363  */
364
365 typedef bool (*nfc_tag_information_cb)(const char *key, const unsigned char *value, int value_size, void *user_data);
366
367
368 /**
369  * @brief Called after nfc_tag_transceive() has completed.
370  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
371  *
372  * @remarks @a buffer will be automatically destroyed when the callback function returns. (Do not release @a buffer.)
373  *
374  * @param [in] result The result of function call
375  * @param [in] buffer   The result data
376  * @param [in] buffer_size The size of buffer in bytes
377  * @param [in] user_data The user data passed from nfc_tag_transceive()
378  *
379  * @see nfc_tag_transceive()
380  */
381 typedef void (* nfc_tag_transceive_completed_cb)(nfc_error_e result, unsigned char *buffer, int buffer_size, void *user_data);
382
383 /**
384  * @brief Called after the nfc_tag_write_ndef() has completed.
385  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
386  *
387  * @param [in] result The result of function call
388  * @param [in] user_data The user data passed from nfc_manager_initialize()
389  *
390  * @see nfc_tag_write_ndef()
391  */
392 typedef void (* nfc_tag_write_completed_cb)(nfc_error_e result, void *user_data);
393
394 /**
395  * @brief Called after the nfc_tag_read_ndef() has completed.
396  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
397  *
398  * @remarks @a message will be automatically destroyed when the callback function returns. (Do not release @a message.)
399  *
400  * @param [in] result The result of function call
401  * @param [in] message The NDEF message
402  * @param [in] user_data The user data passed from nfc_tag_read_ndef()
403  *
404  * @see nfc_tag_read_ndef()
405  */
406 typedef void (* nfc_tag_read_completed_cb)(nfc_error_e result, nfc_ndef_message_h message, void *user_data);
407
408 /**
409  * @brief   Called after the nfc_tag_format_ndef() has completed.
410  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
411  *
412  * @param [in] result The result of function call
413  * @param [in] user_data The user data passed from nfc_tag_format_ndef()
414  *
415  * @see nfc_tag_format_ndef()
416  */
417 typedef void (* nfc_tag_format_completed_cb)(nfc_error_e result, void *user_data);
418
419
420 /**
421  * @brief Called after nfc_mifare_authenticate_with_keyA() has completed
422  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
423  * @param [in] result The result of nfc_mifare_authenticate_with_keyA()
424  * @param [in] user_data The user data passed from nfc_mifare_authenticate_with_keyA()
425  * @see nfc_mifare_authenticate_with_keyA()
426  */
427 typedef void (* nfc_mifare_authenticate_with_keyA_completed_cb)(nfc_error_e result, void *user_data);
428
429 /**
430  * @brief Called after nfc_mifare_authenticate_with_keyB() has completed
431  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
432  * @param [in] result The result of function call
433  * @param [in] user_data The user data passed from nfc_mifare_authenticate_with_keyB()
434  * @see nfc_mifare_authenticate_with_keyB()
435  */
436 typedef void (* nfc_mifare_authenticate_with_keyB_completed_cb)(nfc_error_e result, void *user_data);
437
438 /**
439  * @brief Called after nfc_mifare_write_block() has completed
440  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
441  * @param [in] result The result of nfc_mifare_write_block()
442  * @param [in] user_data The user data passed from nfc_mifare_write_block()
443  * @see nfc_mifare_write_block()
444  */
445 typedef void (* nfc_mifare_write_block_completed_cb)(nfc_error_e result, void *user_data);
446
447 /**
448  * @brief Called after nfc_mifare_write_page() has completed
449  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
450  * @param [in] result The result of function call
451  * @param [in] user_data The user data passed from nfc_mifare_write_page()
452  * @see nfc_mifare_write_page()
453  */
454 typedef void (* nfc_mifare_write_page_completed_cb)(nfc_error_e result, void *user_data);
455
456 /**
457  * @brief Called after nfc_mifare_read_block() has completed
458  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
459  *
460  * @remarks @a buffer will be automatically destroyed when the callback function returns. (Do not release @a buffer.)
461  *
462  * @param [in] result The result of function call
463  * @param [in] buffer Thre read buffer
464  * @param [in] size The size of buffer in bytes
465  * @param [in] user_data The user data passed from nfc_mifare_read_block()
466  * @see nfc_mifare_read_block()
467  */
468 typedef void (* nfc_mifare_read_block_completed_cb)(nfc_error_e result, unsigned char *buffer, int bufer_size, void *user_data);
469
470 /**
471  * @brief Called after nfc_mifare_read_page() has completed
472  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
473  *
474  * @remarks @a buffer will be automatically destroyed when the callback function returns. (Do not release @a buffer.)
475  *
476  * @param [in] result The result of nfc_mifare_read_page()
477  * @param [in] buffer The read buffer
478  * @param [in] size The size of read buffer in bytes
479  * @param [in] user_data The user data passed from nfc_mifare_read_page()
480  * @see nfc_mifare_read_page()
481  */
482 typedef void (* nfc_mifare_read_page_completed_cb)(nfc_error_e result, unsigned char *buffer, int bufer_size, void *user_data);
483
484 /**
485  * @brief Called after nfc_mifare_increment() has completed
486  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
487  * @param [in] result The result of nfc_mifare_increment()
488  * @param [in] user_data The user data passed from nfc_mifare_increment()
489  * @see nfc_mifare_increment()
490  */
491 typedef void (* nfc_mifare_increment_completed_cb)(nfc_error_e result, void *user_data);
492
493 /**
494  * @brief Called after nfc_mifare_decrement() has completed
495  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
496  * @param [in] result The result of nfc_mifare_decrement()
497  * @param [in] user_data The user data passed from nfc_mifare_decrement()
498  * @see nfc_mifare_decrement()
499  */
500 typedef void (* nfc_mifare_decrement_completed_cb)(nfc_error_e result, void *user_data);
501
502 /**
503  * @brief Called after nfc_mifare_transfer() has completed
504  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
505  * @param [in] result The result of nfc_mifare_transfer()
506  * @param [in] user_data The user data passed from nfc_mifare_transfer()
507  * @see nfc_mifare_transfer()
508  */
509 typedef void (* nfc_mifare_transfer_completed_cb)(nfc_error_e result, void *user_data);
510
511 /**
512  * @brief Called after nfc_mifare_restore() has completed
513  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
514  * @param [in] result The result of nfc_mifare_restore()
515  * @param [in] user_data The user data passed from nfc_mifare_restore()
516  * @see nfc_mifare_restore()
517  */
518 typedef void (* nfc_mifare_restore_completed_cb)(nfc_error_e result, void *user_data);
519
520
521
522 /**
523  * @brief Called when NFC peer-to-peer target appeared or disappeared
524  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
525  * @param [in] type The discovered type attached or detached
526  * @param [in] target The handle to p2p target
527  * @param [in] user_data The user data passed from nfc_manager_set_p2p_target_discovered_cb()
528  *
529  * @see nfc_manager_set_p2p_target_discovered_cb()
530  * @see nfc_manager_unset_p2p_target_discovered_cb()
531  */
532 typedef void (*nfc_p2p_target_discovered_cb)(nfc_discovered_type_e type, nfc_p2p_target_h target, void *user_data);
533
534 /**
535  * @brief Called when receiving  Secure Element (SIM/UICC(Universal Integrated Circuit Card)) event.
536  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
537  * @param [in] event The Secure Element event
538  * @param [in] user_data The user data passed from nfc_manager_set_se_event_cb()
539  *
540  * @see nfc_manager_set_se_event_cb()
541  * @see nfc_manager_unset_se_event_cb()
542  */
543 typedef void (*nfc_se_event_cb)(nfc_se_event_e event , void *user_data);
544
545
546 /**
547  * @brief Called when receiving Secure Element(SIM/UICC(Universal Integrated Circuit Card)) transaction event data
548  * @remarks This event  notifies , external reader trys to access secure element.
549  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
550  * @param [in] aid Application Id, specified in ISO/IEC 7816-4
551  * @param [in] aid_size The size of aid (5~16)
552  * @param [in] param The parameter list, specified in ISO/IEC 8825-1
553  * @param [in] param The size of param (0~65535)
554  * @param [in] user_data The user data passed from nfc_manager_set_se_transaction_event_cb()
555  *
556  * @see nfc_manager_set_se_transaction_event_cb()
557  * @see nfc_manager_unset_se_transaction_event_cb()
558  */
559 typedef void (*nfc_se_transaction_event_cb)(unsigned char* aid, int aid_size , unsigned char* param, int param_size,  void *user_data);
560
561
562
563 /**
564  * @brief Called after nfc_p2p_send() has completed.
565  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
566  * @param [in] result The result of function call
567  * @param [in] user_data The user data passed from nfc_p2p_send()
568  *
569  * @see nfc_p2p_send()
570  */
571 typedef void (*nfc_p2p_send_completed_cb)(nfc_error_e result, void *user_data);
572
573
574 /**
575  * @brief Called after nfc_p2p_send() has completed.
576  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
577  *
578  * @remarks @a message will be automatically destroyed when the callback function returns. (Do not release @a message.)
579  *
580  * @param [in] target The handle to p2p target
581  * @param [in] message The recevied message
582  * @param [in] user_data The user data passed from nfc_p2p_set_recv_cb()
583  *
584  * @see nfc_p2p_set_data_received_cb()
585  * @see nfc_p2p_unset_data_received_cb()
586  */
587 typedef void (*nfc_p2p_data_recived_cb)(nfc_p2p_target_h target, nfc_ndef_message_h message, void *user_data);
588
589
590 /**
591  * @brief Called after nfc_p2p_connection_handover() has completed.
592  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
593  *
594  * @remark To use the @a ac_data outside this function, copy the @a ac_data.
595  * @remark @a ac_data could be NULL, if nfc_p2p_connection_handover failed.
596  * @remark If @a carrior is #NFC_AC_TYPE_BT, @ac_data should be converted to 'char *' type. This is bluetooth address information.
597  *
598  * @param [in] result The result of function call
599  * @param [in] carrior The type of Alternative Carrior
600  * @param [in] ac_data The connected remote device AC(Alternative Carrior) information data
601  * @param [in] ac_data_size The connected remote device AC(Alternative Carrior) information data size
602  * @param [in] user_data The user data passed from nfc_p2p_connection_handover()
603  *
604  * @see nfc_p2p_connection_handover()
605  */
606 typedef void (*nfc_p2p_connection_handover_completed_cb)(nfc_error_e result, nfc_ac_type_e carrior, void * ac_data, int ac_data_size , void *user_data);
607
608 /**
609  * @brief Gets the value that indicates whether NFC is supported.
610  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
611  *
612  * @remarks This function can executed Regardless of nfc_manager_initialize state.
613  *
614  * @return true on NFC supported,  otherwise false
615  * @see nfc_manager_set_activation()
616  */
617 bool nfc_manager_is_supported(void);
618
619 /**
620  * @brief Sets NFC Activation
621  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
622  *
623  * @param [in] activation The NFC state for setting
624  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
625  * @param [in] user_data The user data to be passed to the callback function
626  *
627  * @return 0 on success, otherwise a negative error value.
628  * @retval #NFC_ERROR_NONE Successful
629  * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
630  * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
631  * @retval #NFC_ERROR_ALREADY_ACTIVATED Already activated
632  * @retval #NFC_ERROR_ALREADY_DEACTIVATED Already deactivated
633  * @see nfc_manager_is_activated()
634  * @see nfc_activation_completed_cb()
635  */
636 int nfc_manager_set_activation(bool activation, nfc_activation_completed_cb callback, void *user_data);
637
638 /**
639  * @brief Set NFC Activation state changed callback
640  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
641  *
642  * @param [in] callback The callback function to invoke when activation state is changed.
643  * @param [in] user_data The user data to be passed to the callback function
644  *
645  * @return 0 on success, otherwise a negative error value.
646  * @retval #NFC_ERROR_NONE Successful
647  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
648  *
649  * @see nfc_activation_changed_cb()
650  * @see nfc_manager_unset_activation_changed_cb()
651  */
652 int nfc_manager_set_activation_changed_cb(nfc_activation_changed_cb callback , void *user_data);
653
654 /**
655  * @brief Unregisters the callback function.
656  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
657  *
658  * @see nfc_manager_set_activation_changed_cb()
659  * @see nfc_activation_changed_cb()
660  */
661 void nfc_manager_unset_activation_changed_cb(void);
662
663
664 /**
665  * @brief Gets NFC Activation state
666  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
667  *
668  * @remarks This function can executed Regardless of nfc_manager_initialize state.
669  *
670  * @return true on NFC activated,  otherwise false
671  * @see nfc_manager_set_activation()
672  */
673
674 bool nfc_manager_is_activated(void);
675
676 /**
677  * @brief Initializes NFC Manager.
678  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
679  * @remarks This function must be called before proceeding any other nfc functions\n
680  *      Internally it makes socket connection to NFC manager.\n
681  *      When an application crashes or exits without the deinitialization. NFC manager automatically deinitializes the process itself.\n
682  *      This function is asynchronous.
683  *
684  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
685  * @param [in] user_data The user data to be passed to the callback function
686  *
687  * @return 0 on success, otherwise a negative error value.
688  * @retval #NFC_ERROR_NONE Successful
689  * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
690  * @see nfc_manager_initialize_sync()
691  * @see nfc_manager_deinitialize()
692  */
693 int nfc_manager_initialize(nfc_initialize_completed_cb callback, void *user_data);
694
695 /**
696  * @brief Initializes NFC Manager.
697  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
698  * @remarks This function must be called before proceeding any other nfc functions\n
699  *      Internally it makes socket connection to NFC manager.\n
700  *      When an application crashes or exits without the deinitialization. NFC manager automatically deinitializes the process itself.\n
701  *      This function is synchronous.
702  *
703  * @return 0 on success, otherwise a negative error value.
704  * @retval #NFC_ERROR_NONE Successful
705  * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
706  * @see nfc_manager_initialize()
707  * @see nfc_manager_deinitialize()
708  */
709 int nfc_manager_initialize_sync();
710
711
712 /**
713  * @brief Releases all the resource of the NFC Manager and disconnecst the session between an application and NFC Manager.
714  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
715  *
716  * @return 0 on success, otherwise a negative error value.
717  * @retval #NFC_ERROR_NONE Successful
718  * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
719  * @see nfc_manager_initialize()
720  */
721 int nfc_manager_deinitialize(void);
722
723 /**
724  * @brief Registers a callback function for receiving tag discovered notification.
725  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
726  *
727  * @param [in] callback The callback function called when a tag is appeared or disappeared
728  * @param [in] user_data The user data to be passed to the callback function
729  *
730  * @return 0 on success, otherwise a negative error value.
731  * @retval #NFC_ERROR_NONE Successful
732  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
733  * @see nfc_manager_unset_tag_discovered_cb()
734  * @see nfc_tag_discovered_cb()
735  */
736 int nfc_manager_set_tag_discovered_cb(nfc_tag_discovered_cb callback, void *user_data);
737
738 /**
739  * @brief Unregisters the callback function.
740  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
741  *
742  * @see nfc_manager_set_tag_discovered_cb()
743  * @see nfc_tag_discovered_cb()
744  */
745 void nfc_manager_unset_tag_discovered_cb(void);
746
747 /**
748  * @brief Registers a callback function for receiving NDEF Message discovered notification
749  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
750  *
751  * @param [in] callback The callback function called when NDEF Message is discovered
752  * @param [in] user_data The user data to be passed to the callback function
753  *
754  * @return 0 on success, otherwise a negative error value.
755  * @retval #NFC_ERROR_NONE Successful
756  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
757  * @see nfc_manager_unset_ndef_discovered_cb()
758  * @see nfc_ndef_discovered_cb()
759  */
760 int nfc_manager_set_ndef_discovered_cb(nfc_ndef_discovered_cb callback, void *user_data);
761
762 /**
763  * @brief Unregisters the callback function.
764  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
765  *
766  * @see nfc_manager_set_ndef_discovered_cb()
767  * @see nfc_ndef_discovered_cb()
768  */
769 void nfc_manager_unset_ndef_discovered_cb(void);
770
771 /**
772  * @brief Registers a callback function for receiving NFC peer-to-peer target discovered notification.
773  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
774  *
775  * @param [in] callback The callback function called when NFC peer-to-peer target is discovered
776  * @param [in] user_data The user data to be passed to the callback function
777  *
778  * @return 0 on success, otherwise a negative error value.
779  * @retval #NFC_ERROR_NONE Successful
780  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
781  *
782  * @see nfc_manager_unset_ndef_discovered_cb()
783  * @see nfc_p2p_target_discovered_cb()
784  */
785 int nfc_manager_set_p2p_target_discovered_cb(nfc_p2p_target_discovered_cb callback, void *user_data);
786
787 /**
788  * @brief Unregisters the callback function.
789  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
790  *
791  * @see nfc_manager_set_p2p_target_discovered_cb()
792  * @see nfc_p2p_target_discovered_cb()
793  */
794 void nfc_manager_unset_p2p_target_discovered_cb(void);
795
796
797 /**
798  * @brief Registers a callback function for receiving  Secure Element (SIM/UICC(Universal Integrated Circuit Card)) event.
799  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
800  *
801  * @param [in] callback The callback function called when occurred Secure Element (SIM/UICC(Universal Integrated Circuit Card)) event.
802  * @param [in] user_data The user data to be passed to the callback function
803  *
804  * @return 0 on success, otherwise a negative error value.
805  * @retval #NFC_ERROR_NONE Successful
806  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
807  *
808  * @see nfc_se_event_cb()
809  * @see nfc_manager_unset_se_event_cb()
810  */
811
812 int nfc_manager_set_se_event_cb(nfc_se_event_cb callback, void *user_data);
813
814 /**
815  * @brief Unregisters the callback function.
816  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
817  *
818  * @see nfc_se_event_cb()
819  * @see nfc_manager_set_se_event_cb()
820  */
821 void nfc_manager_unset_se_event_cb(void);
822
823 /**
824  * @brief Registers a callback function for receiving  Secure Element (SIM/UICC(Universal Integrated Circuit Card)) transaction event(#NFC_SE_EVENT_TRANSACTION) data.
825  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
826  *
827  * @param [in] callback The callback function called when occurred SE transaction event.
828  * @param [in] user_data The user data to be passed to the callback function
829  *
830  * @return 0 on success, otherwise a negative error value.
831  * @retval #NFC_ERROR_NONE Successful
832  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
833  *
834  * @see nfc_se_transaction_event_cb()
835  * @see nfc_manager_unset_se_transaction_event_cb()
836  */
837 int nfc_manager_set_se_transaction_event_cb(nfc_se_transaction_event_cb callback, void *user_data);
838
839 /**
840  * @brief Unregisters the callback function.
841  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
842  *
843  * @see nfc_se_transaction_event_cb()
844  * @see nfc_manager_set_se_transaction_event_cb()
845  */
846 void nfc_manager_unset_se_transaction_event_cb(void);
847
848 /**
849  * @brief Gets NDEF message cached when the tag is detected or when data received from NFC peer-to-peer target.
850  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
851  *
852  * @remarks This function is used to get the ndef message that was read before launched your application.
853  * @param [out] ndef_message The cached NDEF message
854  *
855  * @return 0 on success, otherwise a negative error value.
856  * @retval #NFC_ERROR_NONE Successful
857  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
858  * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE The cached message does not exist
859  *
860  */
861 int nfc_manager_get_cached_message(nfc_ndef_message_h *ndef_message);
862
863
864 /**
865  * @brief Sets filter of target types.
866  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
867  * @remarks Bit operator OR(|) can be used in the config parameter (like  NFC_TAG_FILTER_ISO14443A_ENABLE | NFC_TAG_FILTER_ISO14443B_ENABLE)
868  *      or you may choose "NFC_TAG_ALL_ENABLE" enum value to get all result.
869  *      It prevent getting tag types from RF level.
870  *      If the client api does call this function, default is always NFC_TAG_ALL_ENABLE.
871  *
872  * @param [in] filter The filter value with bits operation #nfc_tag_filter_e
873  *
874  * @see nfc_manager_get_tag_filter()
875  * @see nfc_tag_discovered_cb()
876  */
877 void nfc_manager_set_tag_filter(int filter);
878
879 /**
880  * @brief Gets the current filter status.
881  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
882  *
883  * @remarks Bit operation OR(|) is used in return data\n
884  * The default value is NFC_TAG_FILTER_ALL_ENABLE
885  * @return The filter which is set #nfc_tag_filter_e
886  * @see nfc_manager_set_tag_filter()
887  */
888 int nfc_manager_get_tag_filter(void);
889
890 /**
891  * @brief Gets current connected tag.
892  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
893  *
894  * @param [out] tag The connected tag
895  *
896  * @return 0 on success, otherwise a negative error value.
897  * @retval #NFC_ERROR_NONE Successful
898  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
899  * @retval #NFC_ERROR_NO_DEVICE There is no connected tag
900  *
901  */
902 int nfc_manager_get_connected_tag(nfc_tag_h *tag);
903
904 /**
905  * @brief Gets current connected p2p target
906  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
907  *
908  * @param [out] target The connected target
909  *
910  * @return 0 on success, otherwise a negative error value.
911  * @retval #NFC_ERROR_NONE Successful
912  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
913  * @retval #NFC_ERROR_NO_DEVICE There is no connected target
914  *
915  */
916 int nfc_manager_get_connected_target(nfc_p2p_target_h *target);
917
918
919 /**
920  * @brief Enable or disable the system handling for tag and target discovered event
921  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
922  * @remarks In default, The system handling is enabled.
923  *
924  * @param [in] enable The state of enable
925  *
926  * @return 0 on success, otherwise a negative error value.
927  * @retval #NFC_ERROR_NONE Successful
928  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
929  *
930  * @see nfc_manager_is_system_handler_enabled()
931  */
932 int nfc_manager_set_system_handler_enable(bool enable);
933
934 /**
935  * @brief Gets the state of the system handler
936  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
937  * @remarks In default, The system handling is enabled.
938  *
939  * @return true on enabled, otherwise false.
940  *
941  * @see nfc_manager_set_system_handler_enable()
942  */
943 bool nfc_manager_is_system_handler_enabled(void);
944
945 /**
946  * @brief Sets the card emulation Secure Element type
947  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
948  * @remarks To disable card emulation mode, set NFC_SE_TYPE_DISABLE\n
949  * This API is asynchronous function, This operation is completed when NFC_SE_EVENT_SE_TYPE_CHANGED event or nfc_set_card_emulation_completed_cb was invoked.
950  *
951  * @param [in] type The type of Secure Element
952  * @param [in] callback The callback function to invoke after this function has completed\nIt can be null if notification is not required
953  * @param [in] The user data to be passed to the callback function
954  *
955  * @return 0 on success, otherwise a negative error value.
956  * @retval #NFC_ERROR_NONE Successful
957  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
958  *
959  * @see nfc_manager_get_card_emulation_se_type()
960  */
961 int nfc_manager_set_card_emulation_se_type(nfc_se_type_e type, nfc_set_card_emulation_completed_cb callback, void* user_data);
962
963 /**
964  * @brief Gets the card emulation Secure Element type
965  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
966  *
967  * @param [out] type The type of Secure Element
968  *
969  * @return 0 on success, otherwise a negative error value.
970  * @retval #NFC_ERROR_NONE Successful
971  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
972  *
973  * @see nfc_manager_set_card_emulation_se_type()
974  */
975 int nfc_manager_get_card_emulation_se_type(nfc_se_type_e* type);
976
977 /**
978  * @brief Creates a record with given parameter value.
979  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
980  *
981  * @remarks Every data buffer is deeply copied.\n
982  * Every data is a byte array(binary data).
983  *
984  * @param [out] record A handle to record
985  * @param [in] tnf The type name format
986  * @param [in] type The specified type name
987  * @param [in] type_size The byte size of type
988  * @param [in] id The record ID
989  * @param [in] id_size The byte size of ID
990  * @param [in] payload The payload of this record
991  * @param [in] payload_size The byte size of payload
992  *
993  * @return 0 on success, otherwise a negative error value.
994  * @retval #NFC_ERROR_NONE Successful
995  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
996  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
997  * @see nfc_ndef_record_create_text()
998  * @see nfc_ndef_record_create_uri()
999  * @see nfc_ndef_record_create_mime()
1000  * @see nfc_ndef_record_destroy()
1001  */
1002 int nfc_ndef_record_create(nfc_ndef_record_h *record, nfc_record_tnf_e tnf, const unsigned char *type, int type_size, const unsigned char *id, int id_size, const unsigned char *payload, int payload_size);
1003
1004
1005 /**
1006  * @brief Creates a record with text type payload
1007  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1008  *
1009  * @remarks This function does not encode the text. @a text will be assumed as that it is already encoded with encode type.\n
1010  * The text buffer will be deeply copied.\n
1011  * The record is created in this format\n
1012  * - TNF : NFC_RECORD_TNF_WELL_KNOWN\n
1013  * - type : "T"\n
1014  * - payload : encode and header information + language code + text \n
1015  * Defined in Record Type Definition Technical Specifications.
1016  *
1017  * @param [out] record A handle to record
1018  * @param [in] text The encoded text
1019  * @param [in] lang_code The language code string value followed by IANA[RFC 3066] (ex: en-US, ko-KR)
1020  * @param [in] encode The encoding type
1021  *
1022  * @return 0 on success, otherwise a negative error value.
1023  * @retval #NFC_ERROR_NONE Successful
1024  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1025  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1026  * @see nfc_ndef_record_create()
1027  * @see nfc_ndef_record_create_uri()
1028  * @see nfc_ndef_record_create_mime()
1029  * @see nfc_ndef_record_destroy()
1030  * @see nfc_ndef_record_get_text()
1031  * @see nfc_ndef_record_get_langcode()
1032  * @see nfc_ndef_record_get_encode_type()
1033  */
1034 int nfc_ndef_record_create_text(nfc_ndef_record_h *record, const char *text, const char *lang_code, nfc_encode_type_e encode);
1035
1036 /**
1037  * @brief Creates a record with URI type payload
1038  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1039  *
1040  * @remarks The uri string will be deep copied.\n
1041  * The record is created in this format\n
1042  * - TNF : NFC_RECORD_TNF_WELL_KNOWN\n
1043  * - type : "U"\n
1044  * - payload : procotol scheme + uri\n
1045  * Defined in Record Type Definition Technical Specifications.
1046  *
1047  * @param [out] record A handle to record
1048  * @param [in] protocol_scheme  The protocol scheme
1049  * @param [in] uri      The URI string that will be stored in the payload
1050  *
1051  * @return 0 on success, otherwise a negative error value.
1052  * @retval #NFC_ERROR_NONE Successful
1053  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1054  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1055  * @see nfc_ndef_record_create()
1056  * @see nfc_ndef_record_create_text()
1057  * @see nfc_ndef_record_create_mime()
1058  * @see nfc_ndef_record_destroy()
1059  * @see nfc_ndef_record_get_uri()
1060  */
1061 int nfc_ndef_record_create_uri(nfc_ndef_record_h* record, const char *uri);
1062
1063
1064 /**
1065  * @brief Creates a record with MIME type payload
1066  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1067  *
1068  * @remarks The data buffer will be deep copied.\n
1069  * The data are bytes array(binary data).\n
1070  * The mime_type string will deep copied.\n
1071  * The record is created in this format\n
1072  * - TNF : NFC_RECORD_TNF_MIME_MEDIA\n
1073  * - type : mime type\n
1074  * - payload : data\n
1075  * Defined in Record Type Definition Technical Specifications.
1076  *
1077  * @param [out] record A handle to record
1078  * @param [in] mime_type        The mime type [RFC 2046] (ex. text/plain, image/jpeg )\nThis value is stored in type field
1079  * @param [in] data     The pointer of data
1080  * @param [in] data_size        The size of data
1081  *
1082  * @return 0 on success, otherwise a negative error value.
1083  * @retval #NFC_ERROR_NONE Successful
1084  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1085  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1086  * @see nfc_ndef_record_create()
1087  * @see nfc_ndef_record_create_uri()
1088  * @see nfc_ndef_record_create_text()
1089  * @see nfc_ndef_record_destroy()
1090  * @see nfc_ndef_record_get_mime_type()
1091  */
1092 int nfc_ndef_record_create_mime(nfc_ndef_record_h* record, const char *mime_type, const unsigned char *data, int data_size);
1093
1094
1095 /**
1096  * @brief Destroys the record handle
1097  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1098  *
1099  * @param [in] record The handle to record
1100  *
1101  * @return 0 on success, otherwise a negative error value.
1102  * @retval #NFC_ERROR_NONE Successful
1103  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1104  * @see nfc_ndef_record_create()
1105  * @see nfc_ndef_record_create_text()
1106  * @see nfc_ndef_record_create_uri()
1107  * @see nfc_ndef_record_create_mime()
1108  */
1109 int nfc_ndef_record_destroy(nfc_ndef_record_h record);
1110
1111 /**
1112  * @brief Sets record ID
1113  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1114  *
1115  * @remarks The ID buffer are deep copied.
1116  *
1117  * @param [in] record The handle to record
1118  * @param [in] id The record ID
1119  * @param [in] id_size The size of ID in bytes
1120  * @return 0 on success, otherwise a negative error value.
1121  * @retval      #NFC_ERROR_NONE Successful
1122  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1123  * @see nfc_ndef_record_get_id()
1124  */
1125 int nfc_ndef_record_set_id(nfc_ndef_record_h record, unsigned char *id, int id_size);
1126
1127 /**
1128  * @brief Gets record ID
1129  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1130  *
1131  * @remarks It may return NULL pointer if the ID is not exist\n
1132  *  This function gives you  the pointer of ID that is contained by record\n
1133  *  Do not free the ID. It will be released when @a record is destroyed by nfc_ndef_record_destroy().
1134  *
1135  * @param [in] record The handle to record
1136  * @param [out] id The record ID ( do not free )
1137  * @param [out] id_size The size of ID in bytes
1138  *
1139  * @return 0 on success, otherwise a negative error value.
1140  * @retval #NFC_ERROR_NONE Successful
1141  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1142  * @see nfc_ndef_record_set_id()
1143  */
1144 int nfc_ndef_record_get_id(nfc_ndef_record_h record, unsigned char **id, int *size);
1145
1146 /**
1147  * @brief Gets record payload.
1148  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1149  *
1150  * @remarks This function gives you  the pointer of pyaload that is contained by record\n
1151  * Do not free the payload. it will be freed when @a record is destroyed by nfc_ndef_record_destroy().
1152  *
1153  * @param [in] record The handle to record
1154  * @param [out] payload The payload  ( do not free this pointer )
1155  * @param [out] size the size of payload in byte
1156  *
1157  * @return 0 on success, otherwise a negative error value.
1158  * @retval #NFC_ERROR_NONE Successful
1159  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1160  */
1161 int nfc_ndef_record_get_payload(nfc_ndef_record_h record, unsigned char ** payload, int *size);
1162
1163 /**
1164  * @brief Gets record type.
1165  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1166  *
1167  * @remarks This function gives you  the pointer of type that is contained by record.\n
1168  * Do not free the type. it will be freed when the record is freed.
1169  *
1170  * @param [in] record The handle to record
1171  * @param [out] type    The record type  ( do not free this pointer )
1172  * @param [out] size The size of type in byte
1173  *
1174  * @return 0 on success, otherwise a negative error value.
1175  * @retval #NFC_ERROR_NONE Successful
1176  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1177  */
1178 int nfc_ndef_record_get_type(nfc_ndef_record_h record, unsigned char **type, int *size);
1179
1180 /**
1181  * @brief Gets record TNF(Type Name Format) value.
1182  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1183  *
1184  * @param [in] record The handle to record
1185  * @param [out] tnf The TNF(Type Name Format) value
1186  *
1187  * @return 0 on success, otherwise a negative error value.
1188  * @retval #NFC_ERROR_NONE Successful
1189  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1190  */
1191 int nfc_ndef_record_get_tnf(nfc_ndef_record_h record, nfc_record_tnf_e *tnf);
1192
1193 /**
1194  * @brief Gets text from text record
1195  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1196  *
1197  * @remarks This function returns newly allocated string, this value must be deallocated by caller.\n
1198  * This function is valid only for text type record.\n
1199  * The text type record 's tnf is NFC_RECORD_TNF_WELL_KNOWN and it's type is "T"
1200  *
1201  * @param [in] record The handle to record
1202  * @param [out] text The text in record payload ( should be freed by caller )
1203  *
1204  * @return 0 on success, otherwise a negative error value.
1205  * @retval #NFC_ERROR_NONE Successful
1206  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1207  * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
1208  * @see nfc_ndef_record_create_text()
1209  */
1210 int nfc_ndef_record_get_text(nfc_ndef_record_h record, char **text);
1211
1212 /**
1213  * @brief Gets language code from text record
1214  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1215  * @remarks This function returns newly allocated string, this value must be deallocated by caller.\n
1216  * This function is valid only for text type record.\n
1217  * The text type record 's tnf is NFC_RECORD_TNF_WELL_KNOWN and it's type is "T"
1218  *
1219  * @param [in] record   The handle to record
1220  * @param [out] lang_code lang code ( should be freed by caller )
1221  *
1222  * @return 0 on success, otherwise a negative error value.
1223  * @retval #NFC_ERROR_NONE Successful
1224  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1225  * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
1226  * @see nfc_ndef_record_create_text()
1227  */
1228 int nfc_ndef_record_get_langcode(nfc_ndef_record_h record, char **lang_code);
1229
1230 /**
1231  * @brief Gets encoding type from text record
1232  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1233  *
1234  * @remarks  This function is valid only for text type record.\n
1235  * The text type record 's tnf is NFC_RECORD_TNF_WELL_KNOWN and it's type is "T"
1236  *
1237  * @param [in] record   The handle to record
1238  * @param [out] encode encode type #nfc_encode_type_e
1239  *
1240  * @return 0 on success, otherwise a negative error value.
1241  * @retval #NFC_ERROR_NONE Successful
1242  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1243  * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
1244  * @see nfc_ndef_record_create_text()
1245  */
1246 int nfc_ndef_record_get_encode_type(nfc_ndef_record_h record, nfc_encode_type_e *encode);
1247
1248 /**
1249  * @brief Gets URI from uri record
1250  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1251  *
1252  * @remarks The function returns newly allocated string, this value must be deallocated by caller.\n
1253  * This function is valid only for uri type record.
1254  * The uri type record 's tnf is NFC_RECORD_TNF_WELL_KNOWN and it's type is "U"
1255  *
1256  * @param [in] record   The handle to record
1257  * @param [out] uri     The uri in record payload ( should be freed by caller )
1258  *
1259  * @return 0 on success, otherwise a negative error value.
1260  * @retval #NFC_ERROR_NONE Successful
1261  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1262  * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
1263  * @see nfc_ndef_record_create_uri()
1264  */
1265 int nfc_ndef_record_get_uri(nfc_ndef_record_h record, char **uri);
1266
1267
1268 /**
1269  * @brief Gets mime type from mime type record
1270  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1271  *
1272  * @remarks The function returns newly allocated string, this value must be deallocated by caller.\n
1273  * This function is valid only for mime type record.\n
1274  * The uri type record 's tnf is NFC_RECORD_TNF_MIME_MEDIA.
1275  *
1276  * @param [in] record   The handle to record
1277  * @param [out] mime_type       The mime type in record payload ( should be freed by caller )
1278  *
1279  * @return 0 on success, otherwise a negative error value.
1280  * @retval #NFC_ERROR_NONE Successful
1281  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1282  * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
1283  * @see nfc_ndef_record_create_mime()
1284  */
1285 int nfc_ndef_record_get_mime_type(nfc_ndef_record_h record, char **mime_type);
1286
1287
1288 /**
1289  * @brief Creates NDEF message handle
1290  * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1291  *
1292  * @param [out] ndef_message A handle to NDEF message
1293  *
1294  * @return 0 on success, otherwise a negative error value.
1295  * @retval #NFC_ERROR_NONE Successful
1296  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1297  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1298  * @see nfc_ndef_message_create_from_rawdata()
1299  * @see nfc_ndef_message_destroy()
1300  *
1301  */
1302 int nfc_ndef_message_create(nfc_ndef_message_h *ndef_message);
1303
1304 /**
1305  * @brief Creates NDEF message handle from raw serial bytes.
1306  * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1307  *
1308  * @remarks It consumes the bytes array until get the ME(Message End) flag*. It returns error if the bytes array does not have ME flag.\n
1309  * *The ME flag is a 1-bit field that when set indicates the end of an NDEF message.
1310  *
1311  * @param [out] ndef_message The handle to NDEF message
1312  * @param [in] rawdata The NDEF message in form of bytes array
1313  * @param [in] rawdata_size The size of bytes array
1314  *
1315  * @return 0 on success, otherwise a negative error value.
1316  * @retval #NFC_ERROR_NONE Successful
1317  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1318  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1319  * @see nfc_ndef_message_create()
1320  * @see nfc_ndef_message_destroy()
1321  * @see nfc_ndef_message_get_rawdata()
1322  *
1323  */
1324 int nfc_ndef_message_create_from_rawdata(nfc_ndef_message_h *ndef_message, const unsigned char *rawdata, int rawdata_size);
1325
1326 /**
1327  * @brief Destroys NDEF message handle
1328  * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1329  *
1330  * @remarks This function will free all these memory including record handles.
1331  *
1332  * @param [in] ndef_message The handle to NDEF message to destroy
1333  *
1334  * @return 0 on success, otherwise a negative error value.
1335  * @retval #NFC_ERROR_NONE Successful
1336  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1337  * @see nfc_ndef_message_create()
1338  * @see nfc_ndef_message_create_from_rawdata()
1339  */
1340 int nfc_ndef_message_destroy(nfc_ndef_message_h ndef_message);
1341
1342 /**
1343  * @brief Gets the number of record in NDEF message
1344  * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1345  *
1346  * @param [in] ndef_message The handle to NDEF message
1347  * @param [out] count The number of record
1348  *
1349  * @return 0 on success, otherwise a negative error value.
1350  * @retval #NFC_ERROR_NONE Successful
1351  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1352  *
1353  */
1354 int nfc_ndef_message_get_record_count(nfc_ndef_message_h ndef_message, int *count);
1355
1356 /**
1357  * @brief Gets serial bytes array of NDEF message.
1358  * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1359  *
1360  * @remarks It gets copy of the rawdata bytes from NDEF message. @a rawdata must be released with free() by you.
1361  *
1362  * @param [in] ndef_message The handle to NDEF message
1363  * @param [out] rawdata The bytes array of rawdata
1364  * @param [out] rawdata_size The size of rawdata in byte
1365  *
1366  * @return 0 on success, otherwise a negative error value.
1367  * @retval #NFC_ERROR_NONE Successful
1368  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1369  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1370  * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE Invalid NDEF message
1371  *
1372  * @see nfc_ndef_message_create_from_rawdata()
1373  */
1374 int nfc_ndef_message_get_rawdata(nfc_ndef_message_h ndef_message, unsigned char **rawdata, int *rawdata_size);
1375
1376 /**
1377  * @brief Appends a record into NDEF message
1378  * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1379  *
1380  * @remarks Appended record is handled by frameworks. The record is released by frameworks when message is released.
1381  *
1382  * @param [in] ndef_message The handle to NDEF message
1383  * @param [in] record The record that will be appended into NDEF message
1384  *
1385  * @return 0 on success, otherwise a negative error value.
1386  * @retval #NFC_ERROR_NONE Successful
1387  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1388  * @see nfc_ndef_message_insert_record()
1389  * @see nfc_ndef_message_remove_record()
1390  */
1391 int nfc_ndef_message_append_record(nfc_ndef_message_h ndef_message, nfc_ndef_record_h record);
1392
1393 /**
1394  * @brief Inserts a record at index into NDEF message
1395  * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1396  *
1397  * @remarks Appended record is handled by frameworks. The record is released by frameworks when message is released.\n
1398  * The index value should not bigger than nfc_ndef_message_get_record_count()
1399  *
1400  * @param [in] ndef_message The handle to NDEF message
1401  * @param [in] index The index of record ( starts from 0 )
1402  * @param [in] record The record that will be appended into NDEF message
1403  *
1404  * @return 0 on success, otherwise a negative error value.
1405  * @retval #NFC_ERROR_NONE Successful
1406  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1407  * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE      Invalid NDEF message
1408  * @see nfc_ndef_message_append_record()
1409  * @see nfc_ndef_message_remove_record()
1410  */
1411 int nfc_ndef_message_insert_record(nfc_ndef_message_h ndef_message, int index, nfc_ndef_record_h record);
1412
1413 /**
1414  * @brief Removes the record that indicated by index number and this deleted record will be freed.
1415  * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1416  *
1417  * @param [in] ndef_message The handle to NDEF message
1418  * @param [in] index    The index of record ( starts from 0 )
1419  *
1420  * @return 0 on success, otherwise a negative error value.
1421  * @retval #NFC_ERROR_NONE Successful
1422  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1423  * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE      Invalid NDEF message
1424  * @see nfc_ndef_message_append_record()
1425  * @see nfc_ndef_message_insert_record()
1426  */
1427 int nfc_ndef_message_remove_record(nfc_ndef_message_h ndef_message, int index);
1428
1429 /**
1430  * @brief Gets record by index.
1431  * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1432  *
1433  * @remarks This function just return the pointer of record. if you change the record value it directly affects the NDEF message
1434  *
1435  * @param [in] ndef_message The handle to NDEF message
1436  * @param [in] index The index of record ( starts from 0 )
1437  * @param [out] record The handle to record
1438  *
1439  * @return 0 on success, otherwise a negative error value.
1440  * @retval #NFC_ERROR_NONE Successful
1441  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1442  *
1443  */
1444 int nfc_ndef_message_get_record(nfc_ndef_message_h ndef_message, int index, nfc_ndef_record_h *record);
1445
1446 /**
1447  * @brief Gets the type of NFC tag
1448  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1449  *
1450  * @param [in] tag The handle to NFC tag
1451  * @param [out] type The type of NFC tag
1452  *
1453  * @return 0 on success, otherwise a negative error value.
1454  * @retval #NFC_ERROR_NONE Successful
1455  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1456  *
1457  */
1458 int nfc_tag_get_type(nfc_tag_h tag, nfc_tag_type_e *type);
1459
1460 /**
1461  * @brief Checks whether the given NFC tag supports NDEF messages.
1462  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1463  *
1464  * @param [in] tag The handle to NFC tag
1465  * @param [out] is_supported @c true when NFC tag supports NDEF messages, otherwise @c false
1466  *
1467  * @return 0 on success, otherwise a negative error value.
1468  * @retval #NFC_ERROR_NONE Successful
1469  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1470  *
1471  * @see nfc_tag_read_ndef()
1472  */
1473 int nfc_tag_is_support_ndef(nfc_tag_h tag, bool *is_supported);
1474
1475 /**
1476  * @brief Gets the maximum NDEF message size that can be stored in NFC tag.
1477  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1478  *
1479  * @remarks This max size indicates the maximum size of NDEF message that can be stored in this detected tag.
1480  *
1481  * @param [in] tag The handle to NFC tag
1482  * @param [out] maximum_ndef_bytes_size The maximum bytes size of NDEF message that can be stored in this detected tag.
1483  *
1484  * @return 0 on success, otherwise a negative error value.
1485  * @retval #NFC_ERROR_NONE Successful
1486  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1487  *
1488  */
1489 int nfc_tag_get_maximum_ndef_size(nfc_tag_h tag, unsigned int *maximum_ndef_bytes_size);
1490
1491 /**
1492  * @brief Gets size of NDEF message that stored in the tag
1493  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1494  *
1495  * @param [in] tag The handle to NFC tag
1496  * @param [out] ndef_bytes_size The NDEF message bytes size that stored in the tag
1497  *
1498  * @return 0 on success, otherwise a negative error value.
1499  * @retval #NFC_ERROR_NONE Successful
1500  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1501  *
1502  */
1503 int nfc_tag_get_ndef_size(nfc_tag_h tag, unsigned int *ndef_bytes_size);
1504
1505
1506 /**
1507  * @brief Retrieves all tag information
1508  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1509  *
1510  * @param[in] tag The handle to NFC tag
1511  * @param[in] callback  The callback function to invoke
1512  * @param[in] user_data The user data to be passed to the callback function
1513  *
1514  * @return 0 on success, otherwise a negative error value.
1515  * @retval #NFC_ERROR_NONE Successful
1516  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1517  *
1518  */
1519 int nfc_tag_foreach_information(nfc_tag_h tag, nfc_tag_information_cb callback, void *user_data);
1520
1521
1522 /**
1523  * @brief Transceives the data of the raw format card.
1524  * @details This function is the only way to access the raw format card (not formated),
1525         each tag type requires own command to access tags. \n
1526         This function provides the low level access of tag operation and you require the knowlege of each tag technology.
1527 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1528 *
1529 * @param [in] tag The handle to NFC tag
1530 * @param [in] buffer The binary data for parameter or additional commands
1531 * @param [in] buffer_size The size of buffer in bytes
1532 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if a notification is not required
1533 * @param [in] user_data The user data to be passed to the callback funcation
1534 *
1535 * @return 0 on success, otherwise a negative error value.
1536 * @retval #NFC_ERROR_NONE Successful
1537 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1538 * @retval #NFC_ERROR_INVALID_PARAMETER  Invalid parameter
1539 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1540 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1541 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1542 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1543 *
1544 * @post It invokes nfc_tag_transceive_completed_cb() when it has completed to t
1545 * @see nfc_tag_read_ndef()
1546 * @see nfc_tag_is_support_ndef()
1547 */
1548 int nfc_tag_transceive(nfc_tag_h tag, unsigned char *buffer, int buffer_size, nfc_tag_transceive_completed_cb callback, void *user_data);
1549
1550 /**
1551  * @brief Reads NDEF formatted data from NFC tag.
1552  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1553  *
1554  * @param [in] tag The handle to NFC tag
1555  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1556  * @param [in] user_data The user data to be passed to the callback funcation
1557  *
1558  * @return 0 on success, otherwise a negative error value.
1559  * @retval #NFC_ERROR_NONE Successful
1560  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1561  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1562  * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1563  * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1564  * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1565  * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1566  * @retval #NFC_ERROR_NOT_NDEF_FORMAT Not ndef format tag
1567  *
1568  * @post It invokes nfc_tag_read_completed_cb() when it has completed to read NDEF formatted data.
1569  *
1570  * @see nfc_tag_transceive()
1571  * @see nfc_tag_is_support_ndef()
1572  * @see nfc_tag_write_ndef()
1573  */
1574 int nfc_tag_read_ndef(nfc_tag_h tag, nfc_tag_read_completed_cb callback, void *user_data);
1575
1576 /**
1577  * @brief Writes NDEF formatted data.
1578  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1579  *
1580  * @param [in] tag The handle to NFC tag
1581  * @param [in] msg The message will be write to the tag
1582  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1583  * @param [in] user_dataa The user data to be passed to the callback funcation
1584  *
1585  * @return 0 on success, otherwise a negative error value.
1586  * @retval #NFC_ERROR_NONE Successful
1587  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1588  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1589
1590  * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1591  * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1592  * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1593  * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1594  * @retval #NFC_ERROR_NOT_NDEF_FORMAT Not ndef format tag
1595  *
1596  * @post It invokes nfc_tag_write_completed_cb() when it has completed to write NDEF data.
1597  * @see nfc_tag_is_support_ndef()
1598  * @see nfc_tag_read_ndef()
1599  */
1600 int nfc_tag_write_ndef(nfc_tag_h tag, nfc_ndef_message_h msg, nfc_tag_write_completed_cb callback, void *user_data);
1601
1602 /**
1603  * @brief Formats the detected tag that can store NDEF message.
1604  * @details Some tags are required authentication. If the detected target doesn't need authentication, @a key can be NULL.
1605  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1606  *
1607  * @param [in] tag The handle to NFC tag
1608  * @param [in] key The key value that may need to format the tag
1609  * @param [in] key_size The size of key in byte
1610  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1611  * @param [in] user_data The user data to be passed to the callback funcation
1612  *
1613  * @return 0 on success, otherwise a negative error value.
1614  * @retval #NFC_ERROR_NONE Successful
1615  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1616  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1617  * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1618  * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1619  * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1620  * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1621  * @retval #NFC_ERROR_NOT_NDEF_FORMAT Not ndef format tag
1622  *
1623  * @post It invokes nfc_tag_format_completed_cb() when it has completed to format the NFC tag.
1624  *
1625  * @see nfc_tag_is_support_ndef()
1626  */
1627 int nfc_tag_format_ndef(nfc_tag_h tag, unsigned char *key, int key_size, nfc_tag_format_completed_cb callback, void *user_data);
1628
1629 /**
1630  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1631  * @brief Authenticates a sector with key A.
1632  * @remarks I/O operations(read / write / increment / decrement / transfer / restore) will be available after successful authentication.\n
1633  * This function is only available for MIFARE classic.\n
1634  *      \n
1635  *      MIFARE CLASSIC MINI \n
1636  *              => 0 ~ 4 : 5 sectors having 4 block each with block size of 16 bytes \n
1637  *      \n
1638  *      MIFARE CLASSIC 1K \n
1639  *              => 0 ~ 15 : 16 sectors having 4 block each with block size of 16 bytes \n
1640  *      \n
1641  *      MIFARE CLASSIC 4K \n
1642  *              => 0 ~ 31 : 32 sectors having 4 block each with block size of 16 bytes  \n
1643  *              => 32 ~ 39 : 8 sectors having 16 block each with block size of 16 bytes
1644  *
1645  * @param[in] tag The handle to NFC tag
1646  * @param[in] sector_index The index of sector to authenticate with key A, starting from 0
1647  * @param[in] auth_key 6-byte authentication key
1648  * @param[in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1649  * @param[in] user_data The user data to be passed to the callback funcation
1650  *
1651  * @return 0 on success, otherwise a negative error value.
1652  * @retval #NFC_ERROR_NONE Successful
1653  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1654  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1655  * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1656  * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1657  * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1658  * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1659  *
1660  * @post It invokes nfc_mifare_authenticate_with_keyA_completed_cb() when it has completed to authenticate the given sector with key A.
1661  * @see nfc_mifare_authenticate_with_keyB()
1662  * @see nfc_mifare_read_block()
1663  * @see nfc_mifare_read_page()
1664  * @see nfc_mifare_write_block()
1665  * @see nfc_mifare_write_page()
1666  * @see nfc_mifare_increment()
1667  * @see nfc_mifare_decrement()
1668 */
1669 int nfc_mifare_authenticate_with_keyA(nfc_tag_h tag, int sector_index, unsigned char *auth_key, nfc_mifare_authenticate_with_keyA_completed_cb callback, void *user_data);
1670
1671
1672 /**
1673  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1674  * @brief Authenticates a sector with key B.
1675  * @remarks I/O operations(read / write / increment / decrement / transfer / restore) will be available after successful authentication.\n
1676  * This function is only available for MIFARE classic.\n
1677  *      \n
1678  *      MIFARE CLASSIC MINI\n
1679  *              => 0 ~ 4 : 5 sector and 4 block with 16 bytes\n
1680  *      \n
1681  *      MIFARE CLASSIC 1K \n
1682  *              => 0 ~ 15 : 16 sector and 4 block with 16 bytes\n
1683  *      \n
1684  *      MIFARE CLASSIC 4K\n
1685  *              => 0 ~ 31 : 32 sector and 4 block with 16 bytes \n
1686  *              => 32 ~ 39 : 8 sector and 16 block with 16 bytes
1687  *
1688  * @param [in] tag The handle to NFC tag
1689  * @param [in] sector_index The index of sector to authenticate with key B, starting from 0
1690  * @param [in] auth_key 6-byte authentication key
1691  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1692  * @param [in] user_data The user data to be passed to the callback funcation
1693  *
1694  * @return 0 on success, otherwise a negative error value.
1695  * @retval #NFC_ERROR_NONE Successful
1696  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1697  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1698  * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1699  * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1700  * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1701  * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1702  *
1703  * @post It invokes nfc_mifare_authenticate_with_keyB_completed_cb() when it has completed to authenticate the given sector with key B.
1704  * @see nfc_mifare_authenticate_with_keyA()
1705  * @see nfc_mifare_read_block()
1706  * @see nfc_mifare_read_page()
1707  * @see nfc_mifare_write_block()
1708  * @see nfc_mifare_write_page()
1709  * @see nfc_mifare_increment()
1710  * @see nfc_mifare_decrement()
1711 */
1712 int nfc_mifare_authenticate_with_keyB(nfc_tag_h tag, int sector_index, unsigned char *auth_key, nfc_mifare_authenticate_with_keyB_completed_cb callback, void *user_data);
1713
1714
1715 /**
1716  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1717  * @brief Reads a 16-byte block.
1718  * @remarks This function is only available for MIFARE classic.
1719  *
1720  * @param [in] tag The handle to NFC tag
1721  * @param [in] block_index The block or starting page number
1722  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1723  * @param [in] user_data The user data to be passed to the callback funcation
1724  *
1725  * @return 0 on success, otherwise a negative error value.
1726  * @retval #NFC_ERROR_NONE Successful
1727  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1728  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1729  * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1730  * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1731  * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1732  * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1733  *
1734  * @post It invokes nfc_mifare_read_block_completed_cb() when it has completed to read a block.
1735  * @see nfc_mifare_read_page()
1736  * @see nfc_mifare_write_block()
1737 */
1738 int nfc_mifare_read_block(nfc_tag_h tag, int block_index, nfc_mifare_read_block_completed_cb callback, void *user_data);
1739
1740 /**
1741  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1742  * @brief Reads 4 pages(16 bytes).
1743  * @remarks This function is only available for MIFARE Ultra light.\n
1744  * The MIFARE Ultralight protocol always reads 4 pages at a time, to reduce the number of commands required to read an entire tag.
1745  *
1746  * @param [in] tag The handle to NFC tag
1747  * @param [in] page_index  The index of page to read, starting from 0
1748  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1749  * @param [in] user_data The user data to be passed to the callback funcation
1750  *
1751  *
1752  * @return 0 on success, otherwise a negative error value.
1753  * @retval #NFC_ERROR_NONE Successful
1754  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1755  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1756  * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1757  * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1758  * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1759  * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1760  *
1761  * @post It invokes nfc_mifare_read_page_completed_cb() when it has completed to read a page.
1762  * @see nfc_mifare_read_block()
1763  * @see nfc_mifare_write_page()
1764 */
1765 int nfc_mifare_read_page(nfc_tag_h tag, int page_index, nfc_mifare_read_page_completed_cb callback, void *user_data);
1766
1767 /**
1768  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1769  * @brief Writes block (16 byte) of data to the tag at a given block index.
1770  * @remarks This function is only available for MIFARE classic.
1771  *
1772  * @param [in] tag The handle to NFC tag
1773  * @param [in] block_index The index of block to read, starting from 0
1774  * @param [in] buffer 16 bytes of data to write
1775  * @param [in] buffer_size The size of buffer in bytes
1776  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1777  * @param [in] user_data The user data to be passed to the callback funcation
1778  *
1779  * @return 0 on success, otherwise a negative error value.
1780  * @retval #NFC_ERROR_NONE Successful
1781  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1782  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1783  * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized
1784  * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1785  * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1786  * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1787  * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1788  *
1789  * @post It invokes nfc_mifare_write_block_completed_cb() when it hase completed to write a block.
1790  *
1791  * @see nfc_mifare_write_page()
1792  * @see nfc_mifare_read_block()
1793 */
1794 int nfc_mifare_write_block(nfc_tag_h tag, int block_index, unsigned char *buffer, int buffer_size, nfc_mifare_write_block_completed_cb callback, void *user_data);
1795
1796 /**
1797  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1798  * @brief Writes a page (4 bytes) of data to the tag at a given page index
1799  * @remarks This function is only available for MIFARE Ultra light
1800  *
1801  * @param [in] tag The handle to NFC tag
1802  * @param [in] page_index The index of page to write, starting from 0
1803  * @param [in] buffer 4 bytes of data to write
1804  * @param [in] buffer_size The size of buffer in bytes
1805  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1806  * @param [in] user_data The user data to be passed to the callback funcation
1807  *
1808  * @return 0 on success, otherwise a negative error value.
1809  * @retval #NFC_ERROR_NONE Successful
1810  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1811  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1812  * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1813  * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1814  * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1815  * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1816  *
1817  * @post It invokes nfc_mifare_write_page_completed_cb() when it has completed to write a page.
1818  *
1819  * @see nfc_mifare_write_block()
1820  * @see nfc_mifare_read_page()
1821 */
1822 int nfc_mifare_write_page(nfc_tag_h tag, int page_index, unsigned char *buffer, int buffer_size, nfc_mifare_write_page_completed_cb callback, void *user_data);
1823
1824 /**
1825  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1826  * @brief Increases a value block, storing the result in the temporary block on the tag.
1827  * @remarks This function is only available for MIFARE classic
1828  *
1829  * @param [in] tag The handle to NFC tag
1830  * @param [in] block_index The index of block to increase, starting from 0
1831  * @param [in] value Non-negative to increment by
1832  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1833  * @param [in] user_data The user data to be passed to the callback function
1834  *
1835  * @return 0 on success, otherwise a negative error value.
1836  * @retval #NFC_ERROR_NONE Successful
1837  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1838  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1839  * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized
1840  * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1841  * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1842  * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1843  * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1844  *
1845  * @see nfc_mifare_decrement()
1846  * @see nfc_mifare_write_block()
1847 */
1848 int nfc_mifare_increment(nfc_tag_h tag, int block_index, int value, nfc_mifare_increment_completed_cb callback, void *user_data);
1849
1850 /**
1851  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1852  * @brief Decreases a value block, storing the result in the temporary block on the tag.
1853  * @remarks  This function is only available for MIFARE classic
1854  *
1855  * @param [in] tag The handle to NFC tag
1856  * @param [in] block_index The index of block to decrease, starting from 0
1857  * @param [in] value non-negative to decrement by
1858  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1859  * @param [in] user_data The user data to be passed to the callback funcation
1860  *
1861  * @return 0 on success, otherwise a negative error value.
1862  * @retval #NFC_ERROR_NONE Successful
1863  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1864  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1865  * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1866  * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1867  * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1868  * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1869  *
1870  * @see nfc_mifare_increment()
1871  * @see nfc_mifare_write_block()
1872 */
1873 int nfc_mifare_decrement(nfc_tag_h tag, int block_index, int value, nfc_mifare_decrement_completed_cb callback, void *user_data);
1874
1875 /**
1876  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1877  * @brief Copys from the temporary block to the specified block.
1878  * @remarks This function is only available for MIFARE classic
1879  *
1880  * @param [in] tag The handle to NFC tag
1881  * @param [in] block_index The index of block to copy to, starting from 0
1882  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1883  * @param [in] user_data The user data to be passed to the callback funcation
1884  *
1885  * @return 0 on success, otherwise a negative error value.
1886  * @retval #NFC_ERROR_NONE Successful
1887  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1888  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1889  * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1890  * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1891  * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1892  * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1893  *
1894  * @see nfc_mifare_restore()
1895 */
1896 int nfc_mifare_transfer(nfc_tag_h tag, int block_index, nfc_mifare_transfer_completed_cb callback, void *user_data);
1897
1898 /**
1899  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1900  * @brief Copys from a value block to the temporary block.
1901  * @remarks This function is only available for MIFARE classic
1902  *
1903  * @param [in] tag The handle to NFC tag
1904  * @param [in] block_index The index of block to copy from, starting from 0
1905  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1906  * @param [in] user_data The user data to be passed to the callback funcation
1907  *
1908  * @return 0 on success, otherwise a negative error value.
1909  * @retval #NFC_ERROR_NONE Successful
1910  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1911  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1912  * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1913  * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1914  * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1915  * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1916  *
1917  * @see nfc_mifare_transfer()
1918 */
1919 int nfc_mifare_restore(nfc_tag_h tag, int block_index, nfc_mifare_restore_completed_cb callback, void *user_data);
1920
1921
1922 /**
1923  * @brief Registers a callback function for receiving data from NFC peer-to-peer target.
1924  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
1925  *
1926  * @param [in] target The handle to peer target
1927  * @param [in] callback The callback function to invoke when an NDEF Message is discovered
1928  * @param [in] user_data The user data to be passed to the callback function
1929  *
1930  * @return 0 on success, otherwise a negative error value.
1931  * @retval #NFC_ERROR_NONE Successful
1932  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1933  *
1934  * @see nfc_p2p_unset_data_received_cb()
1935  * @see nfc_p2p_data_recived_cb()
1936  * @see nfc_p2p_target_discovered_cb()
1937  */
1938 int nfc_p2p_set_data_received_cb(nfc_p2p_target_h target, nfc_p2p_data_recived_cb callback, void *user_data);
1939
1940 /**
1941  * @brief Unregisters the callback function.
1942  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
1943  *
1944  * @param [in] target The handle to peer target
1945  *
1946  * @return 0 on success, otherwise a negative error value.
1947  * @retval #NFC_ERROR_NONE Successful
1948  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1949  *
1950  * @see nfc_p2p_set_data_received_cb()
1951  * @see nfc_p2p_data_recived_cb()
1952  * @see nfc_p2p_target_discovered_cb()
1953  */
1954 int nfc_p2p_unset_data_received_cb(nfc_p2p_target_h target);
1955
1956 /**
1957  * @brief Sends data to NFC peer-to-peer target
1958  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
1959  *
1960  * @param [in] tag The handle to NFC tag
1961  * @param [in] message The message to send
1962  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1963  * @param [in] user_data The user data to be passed to the callback funcation
1964  *
1965  * @return 0 on success, otherwise a negative error value.
1966  * @retval #NFC_ERROR_NONE Successful
1967  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1968  * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1969  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1970  * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1971  * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1972  *
1973  * @see nfc_p2p_send_completed_cb()
1974  * @see @see nfc_p2p_target_discovered_cb()
1975 */
1976 int nfc_p2p_send(nfc_p2p_target_h target, nfc_ndef_message_h message, nfc_p2p_send_completed_cb callback, void *user_data);
1977
1978
1979
1980
1981 /**
1982  * @brief NFC Connetionhandover between NFC peer-to-peer target
1983  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
1984  *
1985  * @param [in] target The handle to NFC device
1986  * @param [in] type Prepered Alternative Carrior
1987  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1988  * @param [in] user_data The user data to be passed to the callback function
1989  *
1990  * @return 0 on success, otherwise a negative error value.
1991  * @retval #NFC_ERROR_NONE Successful
1992  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1993  * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1994  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1995  * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1996  * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1997  *
1998  * @see nfc_p2p_connection_handover_completed_cb()
1999  * @see @see nfc_p2p_connection_handover_completed_cb()
2000
2001 */
2002 int nfc_p2p_connection_handover(nfc_p2p_target_h target , nfc_ac_type_e type, nfc_p2p_connection_handover_completed_cb callback, void *user_data);
2003
2004
2005
2006 /**
2007  * @brief Check available Alternative Carrior(AC) for NFC handover between NFC peer-to-peer target
2008  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
2009  *
2010  * @param [in] carrior Alternative Carrior whan to be checked whether supported or not
2011  *
2012  * @retval #true Supported
2013  * @retval #false Not Supported
2014  *
2015  * @see nfc_p2p_is_supported_ac_type()
2016  *
2017 */
2018 bool nfc_p2p_is_supported_ac_type( nfc_ac_type_e carrior);
2019
2020
2021 #ifdef __cplusplus
2022 }
2023 #endif
2024
2025
2026 #endif /* __NFC_H__ */
2027