2 * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
29 * @brief This file contains the NFC API.
32 #define NFC_ERROR_CLASS TIZEN_ERROR_NETWORK_CLASS | 0x200
36 * @brief Error codes reported by the NFC API.
37 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
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 operation 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 */
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
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 */
77 * @brief Enumerations for NFC encode types
78 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
81 NFC_ENCODE_UTF_8 = 0x00, /**< UTF-8 */
82 NFC_ENCODE_UTF_16, /**< UTF-16 */
86 * @brief Enumerations for NFC tag types
87 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
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 */
113 * @brief Enumerations for NFC Tag filter
114 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
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 */
128 * @brief Enumerations of polling request code for FeliCa tag
129 * @ingroup CAPI_NETWORK_NFC_TAG_FELICA
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;
139 * @brief Enumerations for NFC discovered type
140 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
143 NFC_DISCOVERED_TYPE_ATTACHED, /**< Attached, discovered, activated event*/
144 NFC_DISCOVERED_TYPE_DETACHED, /**< detached, disappeared, deactivated event*/
145 } nfc_discovered_type_e;
148 * @brief Enumerations for NFC Secure Element (SIM/UICC(Universal Integrated Circuit Card)) event
149 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
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_SE_CARD_EMULATION_CHANGED
163 * @brief Enumerations for NFC Secure Element (SIM/UICC(Universal Integrated Circuit Card)) type
164 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
167 NFC_SE_TYPE_DISABLE = 0x00, /**< Disable card emulation */
168 NFC_SE_TYPE_ESE = 0x01, /**< SmartMX type card emulation */
169 NFC_SE_TYPE_UICC = 0x02 /**< UICC type card emulation */
173 * * @brief Enumerations for NFC Card Emulation Mode type
174 * * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
177 NFC_SE_CARD_EMULATION_MODE_OFF = 0x00, /**< Card Emulation mode OFF */
178 NFC_SE_CARD_EMULATION_MODE_ON = 0x01, /**< Card Emulation mode ON */
179 } nfc_se_card_emulation_mode_type_e;
182 * @brief Enumerations for NFC AC(Alternative Carrier)
183 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
186 NFC_AC_TYPE_BT = 0x00, /**< Bluetooth AC*/
187 NFC_AC_TYPE_WIFI, /**<Wifi AC*/
188 NFC_AC_TYPE_WIFI_DIRECT,/**<Wifi-direct AC*/
189 NFC_AC_TYPE_UNKNOWN, /* No selected preferred AC */
196 * @brief The handle to the NDEF record
197 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
199 typedef struct _ndef_record_s *nfc_ndef_record_h;
202 * @brief The handle to the NDEF message
203 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
205 typedef struct _ndef_message_s *nfc_ndef_message_h;
208 * @brief The handle to the NFC tag
209 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
211 typedef struct _net_nfc_target_info_s *nfc_tag_h;
215 * @brief The handle to NFC p2p target
216 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
218 typedef void *nfc_p2p_target_h;
221 * @brief The default factory key.
222 * @details The key is 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
223 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
225 extern const unsigned char NFC_TAG_MIFARE_KEY_DEFAULT[6];
228 * @brief The well-known key for tags formatted according to the MIFARE Application Directory (MAD) specification.
229 * @details The key is 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5
230 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
232 extern const unsigned char NFC_TAG_MIFARE_KEY_APPLICATION_DIRECTORY[6];
235 * @brief The well-known key for tags formatted according to the NDEF on Mifare Classic specification.
236 * @details The key is 0xD3, 0xF7, 0xD3, 0xF7, 0xD3, 0xF7
237 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
239 extern const unsigned char NFC_TAG_MIFARE_KEY_NFC_FORUM[6];
243 * @brief RTD(Record type definition) Type - Smart Poster type.
244 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
246 extern const unsigned char NFC_RECORD_SMART_POSTER_TYPE[2];
249 * @brief RTD(Record type definition) Type - Text type.
250 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
252 extern const unsigned char NFC_RECORD_TEXT_TYPE[1];
254 * @brief RTD(Record type definition) Type - URI type.
255 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
257 extern const unsigned char NFC_RECORD_URI_TYPE[1];
259 * @brief RTD(Record type definition) Type - Alternative Carrier type.
260 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
262 extern const unsigned char NFC_RECORD_ALTERNATIVE_CARRIER_TYPE[2];
264 * @brief RTD(Record type definition) Type - Handover Carrier type.
265 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
267 extern const unsigned char NFC_RECORD_HANDOVER_CARRIER_TYPE[2];
269 * @brief RTD(Record type definition) Type - Handover Request type.
270 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
272 extern const unsigned char NFC_RECORD_HANDOVER_REQUEST_TYPE[2];
274 * @brief RTD(Record type definition) Type - Handover Select type.
275 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
277 extern const unsigned char NFC_RECORD_HANDOVER_SELECT_TYPE[2];
280 * @brief Called after nfc_manager_set_activation() has completed.
281 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
283 * @param [in] error The result
284 * @param [in] user_data The user data passed from the callback registration function
286 * @see nfc_manager_set_activation()
288 typedef void (* nfc_activation_completed_cb)(nfc_error_e error, void *user_data);
291 * @brief Called when nfc activation state is changed.
292 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
294 * @param [in] activated The activation state
295 * @param [in] user_data The user data passed from the callback registration function
297 * @see nfc_manager_set_activation_changed_cb()
299 typedef void (*nfc_activation_changed_cb)(bool activated , void *user_data);
302 * @brief Called after nfc_manager_initialize() has completed.
303 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
305 * @param [in] error The result
306 * @param [in] user_data The user data passed from the callback registration function
308 * @see nfc_manager_initialize()
310 typedef void (* nfc_initialize_completed_cb)(nfc_error_e error, void *user_data);
314 * @brief Called after nfc_manager_set_card_emulation_se_type() has completed.
315 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
317 * @param [in] error The result
318 * @param [in] user_data The user data passed from the callback registration function
320 * @see nfc_manager_set_card_emulation_se_type()
322 typedef void (* nfc_set_card_emulation_completed_cb)(nfc_error_e error, void *user_data);
325 * @brief Called when an NFC tag appears or disappears
326 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
328 * @remarks The tag handle does not have detail target info when an NFC tag disappeared.\n
329 * So then do not use nfc_tag_get_keys().
331 * @param [in] type The discovered type attached or detached
332 * @param [in] tag The handle to NFC tag
333 * @param [in] user_data The user data passed from the callback registration function
335 * @see nfc_manager_set_tag_discovered_cb()
336 * @see nfc_manager_unset_tag_discovered_cb()
337 * @see nfc_manager_set_tag_filter()
339 typedef void (* nfc_tag_discovered_cb)(nfc_discovered_type_e type, nfc_tag_h tag, void *user_data);
342 * @brief Called when an NDEF Message is discovered
343 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
345 * @remarks @a message will be automatically destroyed when the callback function returns. (Do not release @a message.)
347 * @param [in] message The handle to NDEF message
348 * @param [in] user_data The user data passed from the callback registration function
350 * @see nfc_manager_set_ndef_discovered_cb()
351 * @see nfc_manager_unset_ndef_discovered_cb()
353 typedef void (* nfc_ndef_discovered_cb)(nfc_ndef_message_h message, void *user_data);
357 * @brief Called once for each tag information.
358 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
360 * @remarks @a key and value will be automatically destroyed when the callback function returns. (Do not release @a key and value.)
362 * @param[in] key The key of information
363 * @param[in] value The value of information
364 * @param[in] value_size The data size in bytes
365 * @param[in] user_data The user data passed from the foreach function
367 * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop.
368 * @pre nfc_tag_foreach_informations() invokes this callback.
370 * @see nfc_tag_foreach_informations()
373 typedef bool (*nfc_tag_information_cb)(const char *key, const unsigned char *value, int value_size, void *user_data);
377 * @brief Called after nfc_tag_transceive() has completed.
378 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
380 * @remarks @a buffer will be automatically destroyed when the callback function returns. (Do not release @a buffer.)
382 * @param [in] result The result of function call
383 * @param [in] buffer The result data
384 * @param [in] buffer_size The size of buffer in bytes
385 * @param [in] user_data The user data passed from nfc_tag_transceive()
387 * @see nfc_tag_transceive()
389 typedef void (* nfc_tag_transceive_completed_cb)(nfc_error_e result, unsigned char *buffer, int buffer_size, void *user_data);
392 * @brief Called after the nfc_tag_write_ndef() has completed.
393 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
395 * @param [in] result The result of function call
396 * @param [in] user_data The user data passed from nfc_manager_initialize()
398 * @see nfc_tag_write_ndef()
400 typedef void (* nfc_tag_write_completed_cb)(nfc_error_e result, void *user_data);
403 * @brief Called after the nfc_tag_read_ndef() has completed.
404 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
406 * @remarks @a message will be automatically destroyed when the callback function returns. (Do not release @a message.)
408 * @param [in] result The result of function call
409 * @param [in] message The NDEF message
410 * @param [in] user_data The user data passed from nfc_tag_read_ndef()
412 * @see nfc_tag_read_ndef()
414 typedef void (* nfc_tag_read_completed_cb)(nfc_error_e result, nfc_ndef_message_h message, void *user_data);
417 * @brief Called after the nfc_tag_format_ndef() has completed.
418 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
420 * @param [in] result The result of function call
421 * @param [in] user_data The user data passed from nfc_tag_format_ndef()
423 * @see nfc_tag_format_ndef()
425 typedef void (* nfc_tag_format_completed_cb)(nfc_error_e result, void *user_data);
429 * @brief Called after nfc_mifare_authenticate_with_keyA() has completed
430 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
432 * @param [in] result The result of nfc_mifare_authenticate_with_keyA()
433 * @param [in] user_data The user data passed from nfc_mifare_authenticate_with_keyA()
435 * @see nfc_mifare_authenticate_with_keyA()
437 typedef void (* nfc_mifare_authenticate_with_keyA_completed_cb)(nfc_error_e result, void *user_data);
440 * @brief Called after nfc_mifare_authenticate_with_keyB() has completed
441 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
443 * @param [in] result The result of function call
444 * @param [in] user_data The user data passed from nfc_mifare_authenticate_with_keyB()
446 * @see nfc_mifare_authenticate_with_keyB()
448 typedef void (* nfc_mifare_authenticate_with_keyB_completed_cb)(nfc_error_e result, void *user_data);
451 * @brief Called after nfc_mifare_write_block() has completed
452 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
454 * @param [in] result The result of nfc_mifare_write_block()
455 * @param [in] user_data The user data passed from nfc_mifare_write_block()
457 * @see nfc_mifare_write_block()
459 typedef void (* nfc_mifare_write_block_completed_cb)(nfc_error_e result, void *user_data);
462 * @brief Called after nfc_mifare_write_page() has completed
463 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
465 * @param [in] result The result of function call
466 * @param [in] user_data The user data passed from nfc_mifare_write_page()
468 * @see nfc_mifare_write_page()
470 typedef void (* nfc_mifare_write_page_completed_cb)(nfc_error_e result, void *user_data);
473 * @brief Called after nfc_mifare_read_block() has completed
474 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
476 * @remarks @a buffer will be automatically destroyed when the callback function returns. (Do not release @a buffer.)
478 * @param [in] result The result of function call
479 * @param [in] buffer The read buffer
480 * @param [in] size The size of buffer in bytes
481 * @param [in] user_data The user data passed from nfc_mifare_read_block()
483 * @see nfc_mifare_read_block()
485 typedef void (* nfc_mifare_read_block_completed_cb)(nfc_error_e result, unsigned char *buffer, int bufer_size, void *user_data);
488 * @brief Called after nfc_mifare_read_page() has completed
489 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
491 * @remarks @a buffer will be automatically destroyed when the callback function returns. (Do not release @a buffer.)
493 * @param [in] result The result of nfc_mifare_read_page()
494 * @param [in] buffer The read buffer
495 * @param [in] size The size of read buffer in bytes
496 * @param [in] user_data The user data passed from nfc_mifare_read_page()
498 * @see nfc_mifare_read_page()
500 typedef void (* nfc_mifare_read_page_completed_cb)(nfc_error_e result, unsigned char *buffer, int bufer_size, void *user_data);
503 * @brief Called after nfc_mifare_increment() has completed
504 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
506 * @param [in] result The result of nfc_mifare_increment()
507 * @param [in] user_data The user data passed from nfc_mifare_increment()
509 * @see nfc_mifare_increment()
511 typedef void (* nfc_mifare_increment_completed_cb)(nfc_error_e result, void *user_data);
514 * @brief Called after nfc_mifare_decrement() has completed
515 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
517 * @param [in] result The result of nfc_mifare_decrement()
518 * @param [in] user_data The user data passed from nfc_mifare_decrement()
520 * @see nfc_mifare_decrement()
522 typedef void (* nfc_mifare_decrement_completed_cb)(nfc_error_e result, void *user_data);
525 * @brief Called after nfc_mifare_transfer() has completed
526 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
528 * @param [in] result The result of nfc_mifare_transfer()
529 * @param [in] user_data The user data passed from nfc_mifare_transfer()
531 * @see nfc_mifare_transfer()
533 typedef void (* nfc_mifare_transfer_completed_cb)(nfc_error_e result, void *user_data);
536 * @brief Called after nfc_mifare_restore() has completed
537 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
539 * @param [in] result The result of nfc_mifare_restore()
540 * @param [in] user_data The user data passed from nfc_mifare_restore()
542 * @see nfc_mifare_restore()
544 typedef void (* nfc_mifare_restore_completed_cb)(nfc_error_e result, void *user_data);
549 * @brief Called when NFC peer-to-peer target appeared or disappeared
550 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
552 * @param [in] type The discovered type attached or detached
553 * @param [in] target The handle to p2p target
554 * @param [in] user_data The user data passed from nfc_manager_set_p2p_target_discovered_cb()
556 * @see nfc_manager_set_p2p_target_discovered_cb()
557 * @see nfc_manager_unset_p2p_target_discovered_cb()
559 typedef void (*nfc_p2p_target_discovered_cb)(nfc_discovered_type_e type, nfc_p2p_target_h target, void *user_data);
562 * @brief Called when receiving Secure Element (SIM/UICC(Universal Integrated Circuit Card)) event.
563 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
565 * @param [in] event The Secure Element event
566 * @param [in] user_data The user data passed from nfc_manager_set_se_event_cb()
568 * @see nfc_manager_set_se_event_cb()
569 * @see nfc_manager_unset_se_event_cb()
571 typedef void (*nfc_se_event_cb)(nfc_se_event_e event , void *user_data);
575 * @brief Called when receiving Secure Element(SIM/UICC(Universal Integrated Circuit Card)) transaction event data
576 * @remarks This event notifies , external reader trys to access secure element.
577 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
579 * @param [in] se type
580 * @param [in] aid Application Id, specified in ISO/IEC 7816-4
581 * @param [in] aid_size The size of aid (5~16)
582 * @param [in] param The parameter list, specified in ISO/IEC 8825-1
583 * @param [in] param The size of param (0~65535)
584 * @param [in] user_data The user data passed from nfc_manager_set_se_transaction_event_cb()
586 * @see nfc_manager_set_se_transaction_event_cb()
587 * @see nfc_manager_unset_se_transaction_event_cb()
589 typedef void (*nfc_se_transaction_event_cb)(nfc_se_type_e se_type, unsigned char* aid, int aid_size , unsigned char* param, int param_size, void *user_data);
594 * @brief Called after nfc_p2p_send() has completed.
595 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
597 * @param [in] result The result of function call
598 * @param [in] user_data The user data passed from nfc_p2p_send()
600 * @see nfc_p2p_send()
602 typedef void (*nfc_p2p_send_completed_cb)(nfc_error_e result, void *user_data);
606 * @brief Called after nfc_p2p_send() has completed.
607 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
609 * @remarks @a message will be automatically destroyed when the callback function returns. (Do not release @a message.)
611 * @param [in] target The handle to p2p target
612 * @param [in] message The received message
613 * @param [in] user_data The user data passed from nfc_p2p_set_recv_cb()
615 * @see nfc_p2p_set_data_received_cb()
616 * @see nfc_p2p_unset_data_received_cb()
618 typedef void (*nfc_p2p_data_recived_cb)(nfc_p2p_target_h target, nfc_ndef_message_h message, void *user_data);
622 * @brief Called after nfc_p2p_connection_handover() has completed.
623 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
625 * @remark To use the @a ac_data outside this function, copy the @a ac_data.
626 * @remark @a ac_data could be NULL, if nfc_p2p_connection_handover failed.
627 * @remark If @a carrier is #NFC_AC_TYPE_BT, @ac_data should be converted to 'char *' type. This is bluetooth address information.
629 * @param [in] result The result of function call
630 * @param [in] carrier The type of Alternative Carrier
631 * @param [in] ac_data The connected remote device AC(Alternative Carrier) information data
632 * @param [in] ac_data_size The connected remote device AC(Alternative Carrier) information data size
633 * @param [in] user_data The user data passed from nfc_p2p_connection_handover()
635 * @see nfc_p2p_connection_handover()
637 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);
640 * @brief Gets the value that indicates whether NFC is supported.
641 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
643 * @remarks This function can executed Regardless of nfc_manager_initialize state.
645 * @return true on NFC supported, otherwise false
647 * @see nfc_manager_set_activation()
650 bool nfc_manager_is_supported(void);
653 * @brief Sets NFC Activation
654 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
656 * @param [in] activation The NFC state for setting
657 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
658 * @param [in] user_data The user data to be passed to the callback function
660 * @return 0 on success, otherwise a negative error value.
661 * @retval #NFC_ERROR_NONE Successful
662 * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
663 * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
664 * @retval #NFC_ERROR_ALREADY_ACTIVATED Already activated
665 * @retval #NFC_ERROR_ALREADY_DEACTIVATED Already deactivated
667 * @see nfc_manager_is_activated()
668 * @see nfc_activation_completed_cb()
670 int nfc_manager_set_activation(bool activation, nfc_activation_completed_cb callback, void *user_data);
673 * @brief Set NFC Activation state changed callback
674 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
676 * @param [in] callback The callback function to invoke when activation state is changed.
677 * @param [in] user_data The user data to be passed to the callback function
679 * @return 0 on success, otherwise a negative error value.
680 * @retval #NFC_ERROR_NONE Successful
681 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
683 * @see nfc_activation_changed_cb()
684 * @see nfc_manager_unset_activation_changed_cb()
686 int nfc_manager_set_activation_changed_cb(nfc_activation_changed_cb callback , void *user_data);
689 * @brief Unregisters the callback function.
690 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
692 * @see nfc_manager_set_activation_changed_cb()
693 * @see nfc_activation_changed_cb()
695 void nfc_manager_unset_activation_changed_cb(void);
699 * @brief Gets NFC Activation state
700 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
702 * @remarks This function can executed Regardless of nfc_manager_initialize state.
704 * @return true on NFC activated, otherwise false
706 * @see nfc_manager_set_activation()
709 bool nfc_manager_is_activated(void);
712 * @brief Initializes NFC Manager.
713 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
714 * @remarks This function must be called before proceeding any other nfc functions\n
715 * Internally it makes socket connection to NFC manager.\n
716 * When an application crashes or exits without the deinitialization. NFC manager automatically deinitializes the process itself.\n
717 * This function is asynchronous.
719 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
720 * @param [in] user_data The user data to be passed to the callback function
722 * @return 0 on success, otherwise a negative error value.
723 * @retval #NFC_ERROR_NONE Successful
724 * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
726 * @see nfc_manager_initialize_sync()
727 * @see nfc_manager_deinitialize()
729 int nfc_manager_initialize(nfc_initialize_completed_cb callback, void *user_data);
732 * @brief Initializes NFC Manager.
733 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
734 * @remarks This function must be called before proceeding any other nfc functions\n
735 * Internally it makes socket connection to NFC manager.\n
736 * When an application crashes or exits without the deinitialization. NFC manager automatically deinitializes the process itself.\n
737 * This function is synchronous.
739 * @return 0 on success, otherwise a negative error value.
740 * @retval #NFC_ERROR_NONE Successful
741 * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
743 * @see nfc_manager_initialize()
744 * @see nfc_manager_deinitialize()
746 int nfc_manager_initialize_sync();
750 * @brief Releases all the resource of the NFC Manager and disconnect the session between an application and NFC Manager.
751 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
753 * @return 0 on success, otherwise a negative error value.
754 * @retval #NFC_ERROR_NONE Successful
755 * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
757 * @see nfc_manager_initialize()
759 int nfc_manager_deinitialize(void);
762 * @brief Registers a callback function for receiving tag discovered notification.
763 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
765 * @param [in] callback The callback function called when a tag is appeared or disappeared
766 * @param [in] user_data The user data to be passed to the callback function
768 * @return 0 on success, otherwise a negative error value.
769 * @retval #NFC_ERROR_NONE Successful
770 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
772 * @see nfc_manager_unset_tag_discovered_cb()
773 * @see nfc_tag_discovered_cb()
775 int nfc_manager_set_tag_discovered_cb(nfc_tag_discovered_cb callback, void *user_data);
778 * @brief Unregisters the callback function.
779 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
781 * @see nfc_manager_set_tag_discovered_cb()
782 * @see nfc_tag_discovered_cb()
784 void nfc_manager_unset_tag_discovered_cb(void);
787 * @brief Registers a callback function for receiving NDEF Message discovered notification
788 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
790 * @param [in] callback The callback function called when NDEF Message is discovered
791 * @param [in] user_data The user data to be passed to the callback function
793 * @return 0 on success, otherwise a negative error value.
794 * @retval #NFC_ERROR_NONE Successful
795 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
797 * @see nfc_manager_unset_ndef_discovered_cb()
798 * @see nfc_ndef_discovered_cb()
800 int nfc_manager_set_ndef_discovered_cb(nfc_ndef_discovered_cb callback, void *user_data);
803 * @brief Unregisters the callback function.
804 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
806 * @see nfc_manager_set_ndef_discovered_cb()
807 * @see nfc_ndef_discovered_cb()
809 void nfc_manager_unset_ndef_discovered_cb(void);
812 * @brief Registers a callback function for receiving NFC peer-to-peer target discovered notification.
813 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
815 * @param [in] callback The callback function called when NFC peer-to-peer target is discovered
816 * @param [in] user_data The user data to be passed to the callback function
818 * @return 0 on success, otherwise a negative error value.
819 * @retval #NFC_ERROR_NONE Successful
820 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
822 * @see nfc_manager_unset_ndef_discovered_cb()
823 * @see nfc_p2p_target_discovered_cb()
825 int nfc_manager_set_p2p_target_discovered_cb(nfc_p2p_target_discovered_cb callback, void *user_data);
828 * @brief Unregisters the callback function.
829 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
831 * @see nfc_manager_set_p2p_target_discovered_cb()
832 * @see nfc_p2p_target_discovered_cb()
834 void nfc_manager_unset_p2p_target_discovered_cb(void);
838 * @brief Registers a callback function for receiving Secure Element (SIM/UICC(Universal Integrated Circuit Card)) event.
839 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
841 * @param [in] callback The callback function called when occurred Secure Element (SIM/UICC(Universal Integrated Circuit Card)) event.
842 * @param [in] user_data The user data to be passed to the callback function
844 * @return 0 on success, otherwise a negative error value.
845 * @retval #NFC_ERROR_NONE Successful
846 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
848 * @see nfc_se_event_cb()
849 * @see nfc_manager_unset_se_event_cb()
852 int nfc_manager_set_se_event_cb(nfc_se_event_cb callback, void *user_data);
855 * @brief Unregisters the callback function.
856 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
858 * @see nfc_se_event_cb()
859 * @see nfc_manager_set_se_event_cb()
861 void nfc_manager_unset_se_event_cb(void);
864 * @brief Registers a callback function for receiving Secure Element (SIM/UICC(Universal Integrated Circuit Card)) transaction event(#NFC_SE_EVENT_TRANSACTION) data.
865 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
867 * @param [in] se_type The type os secure element
868 * @param [in] callback The callback function called when occurred SE transaction event.
869 * @param [in] user_data The user data to be passed to the callback function
871 * @return 0 on success, otherwise a negative error value.
872 * @retval #NFC_ERROR_NONE Successful
873 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
875 * @see nfc_se_transaction_event_cb()
876 * @see nfc_manager_unset_se_transaction_event_cb()
878 int nfc_manager_set_se_transaction_event_cb(nfc_se_type_e se_type,
879 nfc_se_transaction_event_cb callback, void *user_data);
882 * @brief Unregisters the callback function.
883 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
885 * @param [in] se_type The type of secure element.
887 * @see nfc_se_transaction_event_cb()
888 * @see nfc_manager_set_se_transaction_event_cb()
890 void nfc_manager_unset_se_transaction_event_cb(nfc_se_type_e se_type);
893 * @brief Gets NDEF message cached when the tag is detected or when data received from NFC peer-to-peer target.
894 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
896 * @remarks This function is used to get the ndef message that was read before launched your application.
897 * @param [out] ndef_message The cached NDEF message
899 * @return 0 on success, otherwise a negative error value.
900 * @retval #NFC_ERROR_NONE Successful
901 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
902 * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE The cached message does not exist
904 int nfc_manager_get_cached_message(nfc_ndef_message_h *ndef_message);
908 * @brief Sets filter of target types.
909 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
910 * @remarks Bit operator OR(|) can be used in the configure parameter (like NFC_TAG_FILTER_ISO14443A_ENABLE | NFC_TAG_FILTER_ISO14443B_ENABLE)
911 * or you may choose "NFC_TAG_ALL_ENABLE" enum value to get all result.
912 * It prevent getting tag types from RF level.
913 * If the client api does call this function, default is always NFC_TAG_ALL_ENABLE.
915 * @param [in] filter The filter value with bits operation #nfc_tag_filter_e
917 * @see nfc_manager_get_tag_filter()
918 * @see nfc_tag_discovered_cb()
920 void nfc_manager_set_tag_filter(int filter);
923 * @brief Gets the current filter status.
924 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
926 * @remarks Bit operation OR(|) is used in return data\n
927 * The default value is NFC_TAG_FILTER_ALL_ENABLE
929 * @return The filter which is set #nfc_tag_filter_e
931 * @see nfc_manager_set_tag_filter()
933 int nfc_manager_get_tag_filter(void);
936 * @brief Gets current connected tag.
937 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
939 * @param [out] tag The connected tag
941 * @return 0 on success, otherwise a negative error value.
942 * @retval #NFC_ERROR_NONE Successful
943 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
944 * @retval #NFC_ERROR_NO_DEVICE There is no connected tag
946 int nfc_manager_get_connected_tag(nfc_tag_h *tag);
949 * @brief Gets current connected p2p target
950 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
952 * @param [out] target The connected target
954 * @return 0 on success, otherwise a negative error value.
955 * @retval #NFC_ERROR_NONE Successful
956 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
957 * @retval #NFC_ERROR_NO_DEVICE There is no connected target
959 int nfc_manager_get_connected_target(nfc_p2p_target_h *target);
963 * @brief Enable or disable the system handling for tag and target discovered event
964 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
965 * @remarks In default, The system handling is enabled.
967 * @param [in] enable The state of enable
969 * @return 0 on success, otherwise a negative error value.
970 * @retval #NFC_ERROR_NONE Successful
971 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
973 * @see nfc_manager_is_system_handler_enabled()
975 int nfc_manager_set_system_handler_enable(bool enable);
978 * @brief Gets the state of the system handler
979 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
980 * @remarks In default, The system handling is enabled.
982 * @return true on enabled, otherwise false.
984 * @see nfc_manager_set_system_handler_enable()
986 bool nfc_manager_is_system_handler_enabled(void);
989 * @brief Sets the card emulation Secure Element type
990 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
991 * @remarks To disable card emulation mode, set NFC_SE_TYPE_DISABLE\n
992 * 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.
994 * @param [in] type The type of Secure Element
995 * @param [in] callback The callback function to invoke after this function has completed\nIt can be null if notification is not required
996 * @param [in] The user data to be passed to the callback function
998 * @return 0 on success, otherwise a negative error value.
999 * @retval #NFC_ERROR_NONE Successful
1000 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1002 * @see nfc_manager_get_card_emulation_se_type()
1004 int nfc_manager_set_card_emulation_se_type(nfc_se_type_e type, nfc_set_card_emulation_completed_cb callback, void* user_data);
1007 * @brief Gets the card emulation Secure Element type
1008 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
1010 * @param [out] type The type of Secure Element
1012 * @return 0 on success, otherwise a negative error value.
1013 * @retval #NFC_ERROR_NONE Successful
1014 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1016 * @see nfc_manager_set_card_emulation_se_type()
1018 int nfc_manager_get_card_emulation_se_type(nfc_se_type_e* type);
1021 * @brief Creates a record with given parameter value.
1022 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1024 * @remarks Every data buffer is deeply copied.\n
1025 * Every data is a byte array(binary data).
1027 * @param [out] record A handle to record
1028 * @param [in] tnf The type name format
1029 * @param [in] type The specified type name
1030 * @param [in] type_size The byte size of type
1031 * @param [in] id The record ID
1032 * @param [in] id_size The byte size of ID
1033 * @param [in] payload The payload of this record
1034 * @param [in] payload_size The byte size of payload
1036 * @return 0 on success, otherwise a negative error value.
1037 * @retval #NFC_ERROR_NONE Successful
1038 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1039 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1041 * @see nfc_ndef_record_create_text()
1042 * @see nfc_ndef_record_create_uri()
1043 * @see nfc_ndef_record_create_mime()
1044 * @see nfc_ndef_record_destroy()
1046 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);
1050 * @brief Creates a record with text type payload
1051 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1053 * @remarks This function does not encode the text. @a text will be assumed as that it is already encoded with encode type.\n
1054 * The text buffer will be deeply copied.\n
1055 * The record is created in this format\n
1056 * - TNF : NFC_RECORD_TNF_WELL_KNOWN\n
1058 * - payload : encode and header information + language code + text \n
1059 * Defined in Record Type Definition Technical Specifications.
1061 * @param [out] record A handle to record
1062 * @param [in] text The encoded text
1063 * @param [in] lang_code The language code string value followed by IANA[RFC 3066] (ex: en-US, ko-KR)
1064 * @param [in] encode The encoding type
1066 * @return 0 on success, otherwise a negative error value.
1067 * @retval #NFC_ERROR_NONE Successful
1068 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1069 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1071 * @see nfc_ndef_record_create()
1072 * @see nfc_ndef_record_create_uri()
1073 * @see nfc_ndef_record_create_mime()
1074 * @see nfc_ndef_record_destroy()
1075 * @see nfc_ndef_record_get_text()
1076 * @see nfc_ndef_record_get_langcode()
1077 * @see nfc_ndef_record_get_encode_type()
1079 int nfc_ndef_record_create_text(nfc_ndef_record_h *record, const char *text, const char *lang_code, nfc_encode_type_e encode);
1082 * @brief Creates a record with URI type payload
1083 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1085 * @remarks The uri string will be deep copied.\n
1086 * The record is created in this format\n
1087 * - TNF : NFC_RECORD_TNF_WELL_KNOWN\n
1089 * - payload : protocol scheme + uri\n
1090 * Defined in Record Type Definition Technical Specifications.
1092 * @param [out] record A handle to record
1093 * @param [in] protocol_scheme The protocol scheme
1094 * @param [in] uri The URI string that will be stored in the payload
1096 * @return 0 on success, otherwise a negative error value.
1097 * @retval #NFC_ERROR_NONE Successful
1098 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1099 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1101 * @see nfc_ndef_record_create()
1102 * @see nfc_ndef_record_create_text()
1103 * @see nfc_ndef_record_create_mime()
1104 * @see nfc_ndef_record_destroy()
1105 * @see nfc_ndef_record_get_uri()
1107 int nfc_ndef_record_create_uri(nfc_ndef_record_h* record, const char *uri);
1111 * @brief Creates a record with MIME type payload
1112 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1114 * @remarks The data buffer will be deep copied.\n
1115 * The data are bytes array(binary data).\n
1116 * The mime_type string will deep copied.\n
1117 * The record is created in this format\n
1118 * - TNF : NFC_RECORD_TNF_MIME_MEDIA\n
1119 * - type : mime type\n
1120 * - payload : data\n
1121 * Defined in Record Type Definition Technical Specifications.
1123 * @param [out] record A handle to record
1124 * @param [in] mime_type The mime type [RFC 2046] (ex. text/plain, image/jpeg )\nThis value is stored in type field
1125 * @param [in] data The pointer of data
1126 * @param [in] data_size The size of data
1128 * @return 0 on success, otherwise a negative error value.
1129 * @retval #NFC_ERROR_NONE Successful
1130 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1131 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1133 * @see nfc_ndef_record_create()
1134 * @see nfc_ndef_record_create_uri()
1135 * @see nfc_ndef_record_create_text()
1136 * @see nfc_ndef_record_destroy()
1137 * @see nfc_ndef_record_get_mime_type()
1139 int nfc_ndef_record_create_mime(nfc_ndef_record_h* record, const char *mime_type, const unsigned char *data, int data_size);
1143 * @brief Destroys the record handle
1144 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1146 * @param [in] record The handle to record
1148 * @return 0 on success, otherwise a negative error value.
1149 * @retval #NFC_ERROR_NONE Successful
1150 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1152 * @see nfc_ndef_record_create()
1153 * @see nfc_ndef_record_create_text()
1154 * @see nfc_ndef_record_create_uri()
1155 * @see nfc_ndef_record_create_mime()
1157 int nfc_ndef_record_destroy(nfc_ndef_record_h record);
1160 * @brief Sets record ID
1161 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1163 * @remarks The ID buffer are deep copied.
1165 * @param [in] record The handle to record
1166 * @param [in] id The record ID
1167 * @param [in] id_size The size of ID in bytes
1169 * @return 0 on success, otherwise a negative error value.
1170 * @retval #NFC_ERROR_NONE Successful
1171 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1173 * @see nfc_ndef_record_get_id()
1175 int nfc_ndef_record_set_id(nfc_ndef_record_h record, unsigned char *id, int id_size);
1178 * @brief Gets record ID
1179 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1181 * @remarks It may return NULL pointer if the ID is not exist\n
1182 * This function gives you the pointer of ID that is contained by record\n
1183 * Do not free the ID. It will be released when @a record is destroyed by nfc_ndef_record_destroy().
1185 * @param [in] record The handle to record
1186 * @param [out] id The record ID ( do not free )
1187 * @param [out] id_size The size of ID in bytes
1189 * @return 0 on success, otherwise a negative error value.
1190 * @retval #NFC_ERROR_NONE Successful
1191 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1193 * @see nfc_ndef_record_set_id()
1195 int nfc_ndef_record_get_id(nfc_ndef_record_h record, unsigned char **id, int *size);
1198 * @brief Gets record payload.
1199 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1201 * @remarks This function gives you the pointer of payload that is contained by record\n
1202 * Do not free the payload. it will be freed when @a record is destroyed by nfc_ndef_record_destroy().
1204 * @param [in] record The handle to record
1205 * @param [out] payload The payload ( do not free this pointer )
1206 * @param [out] size the size of payload in byte
1208 * @return 0 on success, otherwise a negative error value.
1209 * @retval #NFC_ERROR_NONE Successful
1210 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1212 int nfc_ndef_record_get_payload(nfc_ndef_record_h record, unsigned char ** payload, unsigned int *size);
1215 * @brief Gets record type.
1216 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1218 * @remarks This function gives you the pointer of type that is contained by record.\n
1219 * Do not free the type. it will be freed when the record is freed.
1221 * @param [in] record The handle to record
1222 * @param [out] type The record type ( do not free this pointer )
1223 * @param [out] size The size of type in byte
1225 * @return 0 on success, otherwise a negative error value.
1226 * @retval #NFC_ERROR_NONE Successful
1227 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1229 int nfc_ndef_record_get_type(nfc_ndef_record_h record, unsigned char **type, int *size);
1232 * @brief Gets record TNF(Type Name Format) value.
1233 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1235 * @param [in] record The handle to record
1236 * @param [out] tnf The TNF(Type Name Format) value
1238 * @return 0 on success, otherwise a negative error value.
1239 * @retval #NFC_ERROR_NONE Successful
1240 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1242 int nfc_ndef_record_get_tnf(nfc_ndef_record_h record, nfc_record_tnf_e *tnf);
1245 * @brief Gets text from text record
1246 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1248 * @remarks This function returns newly allocated string, this value must be deallocated by caller.\n
1249 * This function is valid only for text type record.\n
1250 * The text type record 's tnf is NFC_RECORD_TNF_WELL_KNOWN and it's type is "T"
1252 * @param [in] record The handle to record
1253 * @param [out] text The text in record payload ( should be freed by caller )
1255 * @return 0 on success, otherwise a negative error value.
1256 * @retval #NFC_ERROR_NONE Successful
1257 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1258 * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
1260 * @see nfc_ndef_record_create_text()
1262 int nfc_ndef_record_get_text(nfc_ndef_record_h record, char **text);
1265 * @brief Gets language code from text record
1266 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1267 * @remarks This function returns newly allocated string, this value must be deallocated by caller.\n
1268 * This function is valid only for text type record.\n
1269 * The text type record 's tnf is NFC_RECORD_TNF_WELL_KNOWN and it's type is "T"
1271 * @param [in] record The handle to record
1272 * @param [out] lang_code lang code ( should be freed by caller )
1274 * @return 0 on success, otherwise a negative error value.
1275 * @retval #NFC_ERROR_NONE Successful
1276 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1277 * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
1279 * @see nfc_ndef_record_create_text()
1281 int nfc_ndef_record_get_langcode(nfc_ndef_record_h record, char **lang_code);
1284 * @brief Gets encoding type from text record
1285 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1287 * @remarks This function is valid only for text type record.\n
1288 * The text type record 's tnf is NFC_RECORD_TNF_WELL_KNOWN and it's type is "T"
1290 * @param [in] record The handle to record
1291 * @param [out] encode encode type #nfc_encode_type_e
1293 * @return 0 on success, otherwise a negative error value.
1294 * @retval #NFC_ERROR_NONE Successful
1295 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1296 * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
1298 * @see nfc_ndef_record_create_text()
1300 int nfc_ndef_record_get_encode_type(nfc_ndef_record_h record, nfc_encode_type_e *encode);
1303 * @brief Gets URI from uri record
1304 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1306 * @remarks The function returns newly allocated string, this value must be deallocated by caller.\n
1307 * This function is valid only for uri type record.
1308 * The uri type record 's tnf is NFC_RECORD_TNF_WELL_KNOWN and it's type is "U"
1310 * @param [in] record The handle to record
1311 * @param [out] uri The uri in record payload ( should be freed by caller )
1313 * @return 0 on success, otherwise a negative error value.
1314 * @retval #NFC_ERROR_NONE Successful
1315 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1316 * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
1318 * @see nfc_ndef_record_create_uri()
1320 int nfc_ndef_record_get_uri(nfc_ndef_record_h record, char **uri);
1324 * @brief Gets mime type from mime type record
1325 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1327 * @remarks The function returns newly allocated string, this value must be deallocated by caller.\n
1328 * This function is valid only for mime type record.\n
1329 * The uri type record 's tnf is NFC_RECORD_TNF_MIME_MEDIA.
1331 * @param [in] record The handle to record
1332 * @param [out] mime_type The mime type in record payload ( should be freed by caller )
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 * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
1339 * @see nfc_ndef_record_create_mime()
1341 int nfc_ndef_record_get_mime_type(nfc_ndef_record_h record, char **mime_type);
1345 * @brief Creates NDEF message handle
1346 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1348 * @param [out] ndef_message A handle to NDEF message
1350 * @return 0 on success, otherwise a negative error value.
1351 * @retval #NFC_ERROR_NONE Successful
1352 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1353 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1355 * @see nfc_ndef_message_create_from_rawdata()
1356 * @see nfc_ndef_message_destroy()
1358 int nfc_ndef_message_create(nfc_ndef_message_h *ndef_message);
1361 * @brief Creates NDEF message handle from raw serial bytes.
1362 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1364 * @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
1365 * *The ME flag is a 1-bit field that when set indicates the end of an NDEF message.
1367 * @param [out] ndef_message The handle to NDEF message
1368 * @param [in] rawdata The NDEF message in form of bytes array
1369 * @param [in] rawdata_size The size of bytes array
1371 * @return 0 on success, otherwise a negative error value.
1372 * @retval #NFC_ERROR_NONE Successful
1373 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1374 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1376 * @see nfc_ndef_message_create()
1377 * @see nfc_ndef_message_destroy()
1378 * @see nfc_ndef_message_get_rawdata()
1380 int nfc_ndef_message_create_from_rawdata(nfc_ndef_message_h *ndef_message,
1381 const unsigned char *rawdata, unsigned int rawdata_size);
1384 * @brief Destroys NDEF message handle
1385 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1387 * @remarks This function will free all these memory including record handles.
1389 * @param [in] ndef_message The handle to NDEF message to destroy
1391 * @return 0 on success, otherwise a negative error value.
1392 * @retval #NFC_ERROR_NONE Successful
1393 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1395 * @see nfc_ndef_message_create()
1396 * @see nfc_ndef_message_create_from_rawdata()
1398 int nfc_ndef_message_destroy(nfc_ndef_message_h ndef_message);
1401 * @brief Gets the number of record in NDEF message
1402 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1404 * @param [in] ndef_message The handle to NDEF message
1405 * @param [out] count The number of record
1407 * @return 0 on success, otherwise a negative error value.
1408 * @retval #NFC_ERROR_NONE Successful
1409 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1411 int nfc_ndef_message_get_record_count(nfc_ndef_message_h ndef_message, int *count);
1414 * @brief Gets serial bytes array of NDEF message.
1415 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1417 * @remarks It gets copy of the bytes array from NDEF message. @a rawdata must be released with free() by you.
1419 * @param [in] ndef_message The handle to NDEF message
1420 * @param [out] rawdata The bytes array of bytes array
1421 * @param [out] rawdata_size The size of bytes array in byte
1423 * @return 0 on success, otherwise a negative error value.
1424 * @retval #NFC_ERROR_NONE Successful
1425 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1426 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1427 * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE Invalid NDEF message
1429 * @see nfc_ndef_message_create_from_rawdata()
1431 int nfc_ndef_message_get_rawdata(nfc_ndef_message_h ndef_message,
1432 unsigned char **rawdata, unsigned int *rawdata_size);
1435 * @brief Appends a record into NDEF message
1436 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1438 * @remarks Appended record is handled by frameworks. The record is released by frameworks when message is released.
1440 * @param [in] ndef_message The handle to NDEF message
1441 * @param [in] record The record that will be appended into NDEF message
1443 * @return 0 on success, otherwise a negative error value.
1444 * @retval #NFC_ERROR_NONE Successful
1445 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1447 * @see nfc_ndef_message_insert_record()
1448 * @see nfc_ndef_message_remove_record()
1450 int nfc_ndef_message_append_record(nfc_ndef_message_h ndef_message, nfc_ndef_record_h record);
1453 * @brief Inserts a record at index into NDEF message
1454 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1456 * @remarks Appended record is handled by frameworks. The record is released by frameworks when message is released.\n
1457 * The index value should not bigger than nfc_ndef_message_get_record_count()
1459 * @param [in] ndef_message The handle to NDEF message
1460 * @param [in] index The index of record ( starts from 0 )
1461 * @param [in] record The record that will be appended into NDEF message
1463 * @return 0 on success, otherwise a negative error value.
1464 * @retval #NFC_ERROR_NONE Successful
1465 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1466 * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE Invalid NDEF message
1468 * @see nfc_ndef_message_append_record()
1469 * @see nfc_ndef_message_remove_record()
1471 int nfc_ndef_message_insert_record(nfc_ndef_message_h ndef_message, int index, nfc_ndef_record_h record);
1474 * @brief Removes the record that indicated by index number and this deleted record will be freed.
1475 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1477 * @param [in] ndef_message The handle to NDEF message
1478 * @param [in] index The index of record ( starts from 0 )
1480 * @return 0 on success, otherwise a negative error value.
1481 * @retval #NFC_ERROR_NONE Successful
1482 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1483 * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE Invalid NDEF message
1485 * @see nfc_ndef_message_append_record()
1486 * @see nfc_ndef_message_insert_record()
1488 int nfc_ndef_message_remove_record(nfc_ndef_message_h ndef_message, int index);
1491 * @brief Gets record by index.
1492 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1494 * @remarks This function just return the pointer of record. if you change the record value it directly affects the NDEF message
1496 * @param [in] ndef_message The handle to NDEF message
1497 * @param [in] index The index of record ( starts from 0 )
1498 * @param [out] record The handle to record
1500 * @return 0 on success, otherwise a negative error value.
1501 * @retval #NFC_ERROR_NONE Successful
1502 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1504 int nfc_ndef_message_get_record(nfc_ndef_message_h ndef_message, int index, nfc_ndef_record_h *record);
1507 * @brief Gets the type of NFC tag
1508 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1510 * @param [in] tag The handle to NFC tag
1511 * @param [out] type The type of NFC tag
1513 * @return 0 on success, otherwise a negative error value.
1514 * @retval #NFC_ERROR_NONE Successful
1515 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1517 int nfc_tag_get_type(nfc_tag_h tag, nfc_tag_type_e *type);
1520 * @brief Checks whether the given NFC tag supports NDEF messages.
1521 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1523 * @param [in] tag The handle to NFC tag
1524 * @param [out] is_supported @c true when NFC tag supports NDEF messages, otherwise @c false
1526 * @return 0 on success, otherwise a negative error value.
1527 * @retval #NFC_ERROR_NONE Successful
1528 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1530 * @see nfc_tag_read_ndef()
1532 int nfc_tag_is_support_ndef(nfc_tag_h tag, bool *is_supported);
1535 * @brief Gets the maximum NDEF message size that can be stored in NFC tag.
1536 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1538 * @remarks This max size indicates the maximum size of NDEF message that can be stored in this detected tag.
1540 * @param [in] tag The handle to NFC tag
1541 * @param [out] maximum_ndef_bytes_size The maximum bytes size of NDEF message that can be stored in this detected tag.
1543 * @return 0 on success, otherwise a negative error value.
1544 * @retval #NFC_ERROR_NONE Successful
1545 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1547 int nfc_tag_get_maximum_ndef_size(nfc_tag_h tag, unsigned int *maximum_ndef_bytes_size);
1550 * @brief Gets size of NDEF message that stored in the tag
1551 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1553 * @param [in] tag The handle to NFC tag
1554 * @param [out] ndef_bytes_size The NDEF message bytes size that stored in the tag
1556 * @return 0 on success, otherwise a negative error value.
1557 * @retval #NFC_ERROR_NONE Successful
1558 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1561 int nfc_tag_get_ndef_size(nfc_tag_h tag, unsigned int *ndef_bytes_size);
1565 * @brief Retrieves all tag information
1566 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1568 * @param[in] tag The handle to NFC tag
1569 * @param[in] callback The callback function to invoke
1570 * @param[in] user_data The user data to be passed to the callback function
1572 * @return 0 on success, otherwise a negative error value.
1573 * @retval #NFC_ERROR_NONE Successful
1574 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1577 int nfc_tag_foreach_information(nfc_tag_h tag, nfc_tag_information_cb callback, void *user_data);
1581 * @brief Transceives the data of the raw format card.
1582 * @details This function is the only way to access the raw format card (not formated),
1583 each tag type requires own command to access tags. \n
1584 This function provides the low level access of tag operation and you require the knowledge of each tag technology.
1585 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1587 * @param [in] tag The handle to NFC tag
1588 * @param [in] buffer The binary data for parameter or additional commands
1589 * @param [in] buffer_size The size of buffer in bytes
1590 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if a notification is not required
1591 * @param [in] user_data The user data to be passed to the callback function
1593 * @return 0 on success, otherwise a negative error value.
1594 * @retval #NFC_ERROR_NONE Successful
1595 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1596 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1597 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1598 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1599 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1600 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1602 * @post It invokes nfc_tag_transceive_completed_cb() when it has completed to t
1603 * @see nfc_tag_read_ndef()
1604 * @see nfc_tag_is_support_ndef()
1606 int nfc_tag_transceive(nfc_tag_h tag, unsigned char *buffer, int buffer_size, nfc_tag_transceive_completed_cb callback, void *user_data);
1609 * @brief Reads NDEF formatted data from NFC tag.
1610 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1612 * @param [in] tag The handle to NFC tag
1613 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1614 * @param [in] user_data The user data to be passed to the callback function
1616 * @return 0 on success, otherwise a negative error value.
1617 * @retval #NFC_ERROR_NONE Successful
1618 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1619 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1620 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1621 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1622 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1623 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1624 * @retval #NFC_ERROR_NOT_NDEF_FORMAT Not ndef format tag
1626 * @post It invokes nfc_tag_read_completed_cb() when it has completed to read NDEF formatted data.
1628 * @see nfc_tag_transceive()
1629 * @see nfc_tag_is_support_ndef()
1630 * @see nfc_tag_write_ndef()
1632 int nfc_tag_read_ndef(nfc_tag_h tag, nfc_tag_read_completed_cb callback, void *user_data);
1635 * @brief Writes NDEF formatted data.
1636 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1638 * @param [in] tag The handle to NFC tag
1639 * @param [in] msg The message will be write to the tag
1640 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1641 * @param [in] user_dataa The user data to be passed to the callback function
1643 * @return 0 on success, otherwise a negative error value.
1644 * @retval #NFC_ERROR_NONE Successful
1645 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1646 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1648 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1649 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1650 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1651 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1652 * @retval #NFC_ERROR_NOT_NDEF_FORMAT Not ndef format tag
1654 * @post It invokes nfc_tag_write_completed_cb() when it has completed to write NDEF data.
1655 * @see nfc_tag_is_support_ndef()
1656 * @see nfc_tag_read_ndef()
1658 int nfc_tag_write_ndef(nfc_tag_h tag, nfc_ndef_message_h msg, nfc_tag_write_completed_cb callback, void *user_data);
1661 * @brief Formats the detected tag that can store NDEF message.
1662 * @details Some tags are required authentication. If the detected target doesn't need authentication, @a key can be NULL.
1663 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1665 * @param [in] tag The handle to NFC tag
1666 * @param [in] key The key value that may need to format the tag
1667 * @param [in] key_size The size of key in byte
1668 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1669 * @param [in] user_data The user data to be passed to the callback function
1671 * @return 0 on success, otherwise a negative error value.
1672 * @retval #NFC_ERROR_NONE Successful
1673 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1674 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1675 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1676 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1677 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1678 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1679 * @retval #NFC_ERROR_NOT_NDEF_FORMAT Not ndef format tag
1681 * @post It invokes nfc_tag_format_completed_cb() when it has completed to format the NFC tag.
1683 * @see nfc_tag_is_support_ndef()
1685 int nfc_tag_format_ndef(nfc_tag_h tag, unsigned char *key, int key_size, nfc_tag_format_completed_cb callback, void *user_data);
1688 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1689 * @brief Authenticates a sector with key A.
1690 * @remarks I/O operations(read / write / increment / decrement / transfer / restore) will be available after successful authentication.\n
1691 * This function is only available for MIFARE classic.\n
1693 * MIFARE CLASSIC MINI \n
1694 * => 0 ~ 4 : 5 sectors having 4 block each with block size of 16 bytes \n
1696 * MIFARE CLASSIC 1K \n
1697 * => 0 ~ 15 : 16 sectors having 4 block each with block size of 16 bytes \n
1699 * MIFARE CLASSIC 4K \n
1700 * => 0 ~ 31 : 32 sectors having 4 block each with block size of 16 bytes \n
1701 * => 32 ~ 39 : 8 sectors having 16 block each with block size of 16 bytes
1703 * @param[in] tag The handle to NFC tag
1704 * @param[in] sector_index The index of sector to authenticate with key A, starting from 0
1705 * @param[in] auth_key 6-byte authentication key
1706 * @param[in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1707 * @param[in] user_data The user data to be passed to the callback function
1709 * @return 0 on success, otherwise a negative error value.
1710 * @retval #NFC_ERROR_NONE Successful
1711 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1712 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1713 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1714 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1715 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1716 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1718 * @post It invokes nfc_mifare_authenticate_with_keyA_completed_cb() when it has completed to authenticate the given sector with key A.
1719 * @see nfc_mifare_authenticate_with_keyB()
1720 * @see nfc_mifare_read_block()
1721 * @see nfc_mifare_read_page()
1722 * @see nfc_mifare_write_block()
1723 * @see nfc_mifare_write_page()
1724 * @see nfc_mifare_increment()
1725 * @see nfc_mifare_decrement()
1727 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);
1731 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1732 * @brief Authenticates a sector with key B.
1733 * @remarks I/O operations(read / write / increment / decrement / transfer / restore) will be available after successful authentication.\n
1734 * This function is only available for MIFARE classic.\n
1736 * MIFARE CLASSIC MINI\n
1737 * => 0 ~ 4 : 5 sector and 4 block with 16 bytes\n
1739 * MIFARE CLASSIC 1K \n
1740 * => 0 ~ 15 : 16 sector and 4 block with 16 bytes\n
1742 * MIFARE CLASSIC 4K\n
1743 * => 0 ~ 31 : 32 sector and 4 block with 16 bytes \n
1744 * => 32 ~ 39 : 8 sector and 16 block with 16 bytes
1746 * @param [in] tag The handle to NFC tag
1747 * @param [in] sector_index The index of sector to authenticate with key B, starting from 0
1748 * @param [in] auth_key 6-byte authentication key
1749 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1750 * @param [in] user_data The user data to be passed to the callback function
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
1761 * @post It invokes nfc_mifare_authenticate_with_keyB_completed_cb() when it has completed to authenticate the given sector with key B.
1762 * @see nfc_mifare_authenticate_with_keyA()
1763 * @see nfc_mifare_read_block()
1764 * @see nfc_mifare_read_page()
1765 * @see nfc_mifare_write_block()
1766 * @see nfc_mifare_write_page()
1767 * @see nfc_mifare_increment()
1768 * @see nfc_mifare_decrement()
1770 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);
1774 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1775 * @brief Reads a 16-byte block.
1776 * @remarks This function is only available for MIFARE classic.
1778 * @param [in] tag The handle to NFC tag
1779 * @param [in] block_index The block or starting page number
1780 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1781 * @param [in] user_data The user data to be passed to the callback function
1783 * @return 0 on success, otherwise a negative error value.
1784 * @retval #NFC_ERROR_NONE Successful
1785 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1786 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1787 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1788 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1789 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1790 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1792 * @post It invokes nfc_mifare_read_block_completed_cb() when it has completed to read a block.
1793 * @see nfc_mifare_read_page()
1794 * @see nfc_mifare_write_block()
1796 int nfc_mifare_read_block(nfc_tag_h tag, int block_index, nfc_mifare_read_block_completed_cb callback, void *user_data);
1799 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1800 * @brief Reads 4 pages(16 bytes).
1801 * @remarks This function is only available for MIFARE Ultra light.\n
1802 * The MIFARE Ultralight protocol always reads 4 pages at a time, to reduce the number of commands required to read an entire tag.
1804 * @param [in] tag The handle to NFC tag
1805 * @param [in] page_index The index of page to read, starting from 0
1806 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1807 * @param [in] user_data The user data to be passed to the callback function
1810 * @return 0 on success, otherwise a negative error value.
1811 * @retval #NFC_ERROR_NONE Successful
1812 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1813 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1814 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1815 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1816 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1817 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1819 * @post It invokes nfc_mifare_read_page_completed_cb() when it has completed to read a page.
1820 * @see nfc_mifare_read_block()
1821 * @see nfc_mifare_write_page()
1823 int nfc_mifare_read_page(nfc_tag_h tag, int page_index, nfc_mifare_read_page_completed_cb callback, void *user_data);
1826 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1827 * @brief Writes block (16 byte) of data to the tag at a given block index.
1828 * @remarks This function is only available for MIFARE classic.
1830 * @param [in] tag The handle to NFC tag
1831 * @param [in] block_index The index of block to read, starting from 0
1832 * @param [in] buffer 16 bytes of data to write
1833 * @param [in] buffer_size The size of buffer in bytes
1834 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1835 * @param [in] user_data The user data to be passed to the callback function
1837 * @return 0 on success, otherwise a negative error value.
1838 * @retval #NFC_ERROR_NONE Successful
1839 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1840 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1841 * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized
1842 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1843 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1844 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1845 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1847 * @post It invokes nfc_mifare_write_block_completed_cb() when it has completed to write a block.
1849 * @see nfc_mifare_write_page()
1850 * @see nfc_mifare_read_block()
1852 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);
1855 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1856 * @brief Writes a page (4 bytes) of data to the tag at a given page index
1857 * @remarks This function is only available for MIFARE Ultra light
1859 * @param [in] tag The handle to NFC tag
1860 * @param [in] page_index The index of page to write, starting from 0
1861 * @param [in] buffer 4 bytes of data to write
1862 * @param [in] buffer_size The size of buffer in bytes
1863 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1864 * @param [in] user_data The user data to be passed to the callback function
1866 * @return 0 on success, otherwise a negative error value.
1867 * @retval #NFC_ERROR_NONE Successful
1868 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1869 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1870 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1871 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1872 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1873 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1875 * @post It invokes nfc_mifare_write_page_completed_cb() when it has completed to write a page.
1877 * @see nfc_mifare_write_block()
1878 * @see nfc_mifare_read_page()
1880 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);
1883 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1884 * @brief Increases a value block, storing the result in the temporary block on the tag.
1885 * @remarks This function is only available for MIFARE classic
1887 * @param [in] tag The handle to NFC tag
1888 * @param [in] block_index The index of block to increase, starting from 0
1889 * @param [in] value Non-negative to increment by
1890 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1891 * @param [in] user_data The user data to be passed to the callback function
1893 * @return 0 on success, otherwise a negative error value.
1894 * @retval #NFC_ERROR_NONE Successful
1895 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1896 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1897 * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized
1898 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1899 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1900 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1901 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1903 * @see nfc_mifare_decrement()
1904 * @see nfc_mifare_write_block()
1906 int nfc_mifare_increment(nfc_tag_h tag, int block_index, int value, nfc_mifare_increment_completed_cb callback, void *user_data);
1909 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1910 * @brief Decreases a value block, storing the result in the temporary block on the tag.
1911 * @remarks This function is only available for MIFARE classic
1913 * @param [in] tag The handle to NFC tag
1914 * @param [in] block_index The index of block to decrease, starting from 0
1915 * @param [in] value non-negative to decrement by
1916 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1917 * @param [in] user_data The user data to be passed to the callback function
1919 * @return 0 on success, otherwise a negative error value.
1920 * @retval #NFC_ERROR_NONE Successful
1921 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1922 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1923 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1924 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1925 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1926 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1928 * @see nfc_mifare_increment()
1929 * @see nfc_mifare_write_block()
1931 int nfc_mifare_decrement(nfc_tag_h tag, int block_index, int value, nfc_mifare_decrement_completed_cb callback, void *user_data);
1934 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1935 * @brief Copy from the temporary block to the specified block.
1936 * @remarks This function is only available for MIFARE classic
1938 * @param [in] tag The handle to NFC tag
1939 * @param [in] block_index The index of block to copy to, starting from 0
1940 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1941 * @param [in] user_data The user data to be passed to the callback function
1943 * @return 0 on success, otherwise a negative error value.
1944 * @retval #NFC_ERROR_NONE Successful
1945 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
1946 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1947 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
1948 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
1949 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1950 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1952 * @see nfc_mifare_restore()
1954 int nfc_mifare_transfer(nfc_tag_h tag, int block_index, nfc_mifare_transfer_completed_cb callback, void *user_data);
1957 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
1958 * @brief Copy from a value block to the temporary block.
1959 * @remarks This function is only available for MIFARE classic
1961 * @param [in] tag The handle to NFC tag
1962 * @param [in] block_index The index of block to copy from, starting from 0
1963 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
1964 * @param [in] user_data The user data to be passed to the callback function
1966 * @return 0 on success, otherwise a negative error value.
1967 * @retval #NFC_ERROR_NONE Successful
1968 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
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_OPERATION_FAILED Operation failed
1972 * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
1973 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
1975 * @see nfc_mifare_transfer()
1977 int nfc_mifare_restore(nfc_tag_h tag, int block_index, nfc_mifare_restore_completed_cb callback, void *user_data);
1981 * @brief Registers a callback function for receiving data from NFC peer-to-peer target.
1982 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
1984 * @param [in] target The handle to peer target
1985 * @param [in] callback The callback function to invoke when an NDEF Message is discovered
1986 * @param [in] user_data The user data to be passed to the callback function
1988 * @return 0 on success, otherwise a negative error value.
1989 * @retval #NFC_ERROR_NONE Successful
1990 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1992 * @see nfc_p2p_unset_data_received_cb()
1993 * @see nfc_p2p_data_recived_cb()
1994 * @see nfc_p2p_target_discovered_cb()
1996 int nfc_p2p_set_data_received_cb(nfc_p2p_target_h target, nfc_p2p_data_recived_cb callback, void *user_data);
1999 * @brief Unregisters the callback function.
2000 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
2002 * @param [in] target The handle to peer target
2004 * @return 0 on success, otherwise a negative error value.
2005 * @retval #NFC_ERROR_NONE Successful
2006 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
2008 * @see nfc_p2p_set_data_received_cb()
2009 * @see nfc_p2p_data_recived_cb()
2010 * @see nfc_p2p_target_discovered_cb()
2012 int nfc_p2p_unset_data_received_cb(nfc_p2p_target_h target);
2015 * @brief Sends data to NFC peer-to-peer target
2016 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
2018 * @param [in] tag The handle to NFC tag
2019 * @param [in] message The message to send
2020 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
2021 * @param [in] user_data The user data to be passed to the callback function
2023 * @return 0 on success, otherwise a negative error value.
2024 * @retval #NFC_ERROR_NONE Successful
2025 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
2026 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
2027 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
2028 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
2029 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
2031 * @see nfc_p2p_send_completed_cb()
2032 * @see nfc_p2p_target_discovered_cb()
2034 int nfc_p2p_send(nfc_p2p_target_h target, nfc_ndef_message_h message, nfc_p2p_send_completed_cb callback, void *user_data);
2038 * @brief Sends data to NFC peer-to-peer target without permission check
2039 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
2041 * @param [in] tag The handle to NFC tag
2042 * @param [in] message The message to send
2043 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
2044 * @param [in] user_data The user data to be passed to the callback function
2046 * @return 0 on success, otherwise a negative error value.
2047 * @retval #NFC_ERROR_NONE Successful
2048 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
2049 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
2050 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
2051 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
2052 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
2054 * @see nfc_p2p_send_completed_cb()
2055 * @see nfc_p2p_target_discovered_cb()
2057 int nfc_p2p_send_no_permission(nfc_p2p_target_h target, nfc_ndef_message_h message, nfc_p2p_send_completed_cb callback, void *user_data);
2062 * @brief NFC Connection handover between NFC peer-to-peer target
2063 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
2065 * @param [in] target The handle to NFC device
2066 * @param [in] type Preferred Alternative Carrier
2067 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
2068 * @param [in] user_data The user data to be passed to the callback function
2070 * @return 0 on success, otherwise a negative error value.
2071 * @retval #NFC_ERROR_NONE Successful
2072 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
2073 * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
2074 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
2075 * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
2076 * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
2078 * @see nfc_p2p_connection_handover_completed_cb()
2080 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);
2083 * @brief Check available Alternative Carrier(AC) for NFC handover between NFC peer-to-peer target
2084 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
2086 * @param [in] carrier Alternative Carrier when to be checked whether supported or not
2088 * @retval #true Supported
2089 * @retval #false Not Supported
2091 * @see nfc_p2p_is_supported_ac_type()
2093 bool nfc_p2p_is_supported_ac_type( nfc_ac_type_e carrior);
2101 #endif /* __NFC_H__ */