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 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 */
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 */
162 * @brief Enumerations for NFC Secure Element (SIM/UICC(Universal Integrated Circuit Card)) type
163 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
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 */
174 * @brief Enumerations for NFC AC(Alternative Carrior)
175 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
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 */
188 * @brief The handle to the NDEF record
189 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
191 typedef struct ndef_record_s *nfc_ndef_record_h;
194 * @brief The handle to the NDEF message
195 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
197 typedef struct ndef_message_s *nfc_ndef_message_h;
200 * @brief The handle to the NFC tag
201 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
203 typedef struct net_nfc_target_info_s *nfc_tag_h;
207 * @brief The handle to NFC p2p target
208 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
210 typedef void* nfc_p2p_target_h;
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
217 extern const unsigned char NFC_TAG_MIFARE_KEY_DEFAULT[6];
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
224 extern const unsigned char NFC_TAG_MIFARE_KEY_APPLICATION_DIRECTORY[6];
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
231 extern const unsigned char NFC_TAG_MIFARE_KEY_NFC_FORUM[6];
235 * @brief RTD(Record type definition) Type - Smart Poster type.
236 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
238 extern const unsigned char NFC_RECORD_SMART_POSTER_TYPE[2];
241 * @brief RTD(Record type definition) Type - Text type.
242 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
244 extern const unsigned char NFC_RECORD_TEXT_TYPE[1];
246 * @brief RTD(Record type definition) Type - URI type.
247 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
249 extern const unsigned char NFC_RECORD_URI_TYPE[1];
251 * @brief RTD(Record type definition) Type - Alternative Carrier type.
252 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
254 extern const unsigned char NFC_RECORD_ALTERNATIVE_CARRIER_TYPE[2];
256 * @brief RTD(Record type definition) Type - Handover Carrier type.
257 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
259 extern const unsigned char NFC_RECORD_HANDOVER_CARRIER_TYPE[2];
261 * @brief RTD(Record type definition) Type - Handover Request type.
262 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
264 extern const unsigned char NFC_RECORD_HANDOVER_REQUEST_TYPE[2];
266 * @brief RTD(Record type definition) Type - Handover Select type.
267 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
269 extern const unsigned char NFC_RECORD_HANDOVER_SELECT_TYPE[2];
272 * @brief Called after nfc_manager_set_activation() has completed.
273 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
275 * @param [in] error The result
276 * @param [in] user_data The user data passed from the callback registration function
278 * @see nfc_manager_set_activation()
280 typedef void (* nfc_activation_completed_cb)(nfc_error_e error, void *user_data);
283 * @brief Called when nfc activation state is changed.
284 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
286 * @param [in] activated The activation state
287 * @param [in] user_data The user data passed from the callback registeration function
289 * @see nfc_manager_set_activation_changed_cb()
291 typedef void (*nfc_activation_changed_cb)(bool activated , void *user_data);
294 * @brief Called after nfc_manager_initialize() has completed.
295 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
297 * @param [in] error The result
298 * @param [in] user_data The user data passed from the callback registration function
300 * @see nfc_manager_initialize()
302 typedef void (* nfc_initialize_completed_cb)(nfc_error_e error, void *user_data);
306 * @brief Called after nfc_manager_set_card_emulation_se_type() has completed.
307 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
309 * @param [in] error The result
310 * @param [in] user_data The user data passed from the callback registration function
312 * @see nfc_manager_set_card_emulation_se_type()
314 typedef void (* nfc_set_card_emulation_completed_cb)(nfc_error_e error, void *user_data);
317 * @brief Called when an NFC tag appears or disappears
318 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
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().
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
327 * @see nfc_manager_set_tag_discovered_cb()
328 * @see nfc_manager_unset_tag_discovered_cb()
329 * @see nfc_manager_set_tag_filter()
331 typedef void (* nfc_tag_discovered_cb)(nfc_discovered_type_e type, nfc_tag_h tag, void *user_data);
334 * @brief Called when an NDEF Message is discovered
335 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
337 * @remarks @a message will be automatically destroyed when the callback function returns. (Do not release @a message.)
339 * @param [in] message The handle to NDEF message
340 * @param [in] user_data The user data passed from the callback registration function
342 * @see nfc_manager_set_ndef_discovered_cb()
343 * @see nfc_manager_unset_ndef_discovered_cb()
345 typedef void (* nfc_ndef_discovered_cb)(nfc_ndef_message_h message, void *user_data);
349 * @brief Called once for each tag information.
350 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
352 * @remarks @a key and value will be automatically destroyed when the callback function returns. (Do not release @a key and value.)
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
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.
362 * @see nfc_tag_foreach_informations()
365 typedef bool (*nfc_tag_information_cb)(const char *key, const unsigned char *value, int value_size, void *user_data);
369 * @brief Called after nfc_tag_transceive() has completed.
370 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
372 * @remarks @a buffer will be automatically destroyed when the callback function returns. (Do not release @a buffer.)
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()
379 * @see nfc_tag_transceive()
381 typedef void (* nfc_tag_transceive_completed_cb)(nfc_error_e result, unsigned char *buffer, int buffer_size, void *user_data);
384 * @brief Called after the nfc_tag_write_ndef() has completed.
385 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
387 * @param [in] result The result of function call
388 * @param [in] user_data The user data passed from nfc_manager_initialize()
390 * @see nfc_tag_write_ndef()
392 typedef void (* nfc_tag_write_completed_cb)(nfc_error_e result, void *user_data);
395 * @brief Called after the nfc_tag_read_ndef() has completed.
396 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
398 * @remarks @a message will be automatically destroyed when the callback function returns. (Do not release @a message.)
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()
404 * @see nfc_tag_read_ndef()
406 typedef void (* nfc_tag_read_completed_cb)(nfc_error_e result, nfc_ndef_message_h message, void *user_data);
409 * @brief Called after the nfc_tag_format_ndef() has completed.
410 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
412 * @param [in] result The result of function call
413 * @param [in] user_data The user data passed from nfc_tag_format_ndef()
415 * @see nfc_tag_format_ndef()
417 typedef void (* nfc_tag_format_completed_cb)(nfc_error_e result, void *user_data);
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()
427 typedef void (* nfc_mifare_authenticate_with_keyA_completed_cb)(nfc_error_e result, void *user_data);
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()
436 typedef void (* nfc_mifare_authenticate_with_keyB_completed_cb)(nfc_error_e result, void *user_data);
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()
445 typedef void (* nfc_mifare_write_block_completed_cb)(nfc_error_e result, void *user_data);
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()
454 typedef void (* nfc_mifare_write_page_completed_cb)(nfc_error_e result, void *user_data);
457 * @brief Called after nfc_mifare_read_block() has completed
458 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
460 * @remarks @a buffer will be automatically destroyed when the callback function returns. (Do not release @a buffer.)
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()
468 typedef void (* nfc_mifare_read_block_completed_cb)(nfc_error_e result, unsigned char *buffer, int bufer_size, void *user_data);
471 * @brief Called after nfc_mifare_read_page() has completed
472 * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
474 * @remarks @a buffer will be automatically destroyed when the callback function returns. (Do not release @a buffer.)
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()
482 typedef void (* nfc_mifare_read_page_completed_cb)(nfc_error_e result, unsigned char *buffer, int bufer_size, void *user_data);
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()
491 typedef void (* nfc_mifare_increment_completed_cb)(nfc_error_e result, void *user_data);
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()
500 typedef void (* nfc_mifare_decrement_completed_cb)(nfc_error_e result, void *user_data);
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()
509 typedef void (* nfc_mifare_transfer_completed_cb)(nfc_error_e result, void *user_data);
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()
518 typedef void (* nfc_mifare_restore_completed_cb)(nfc_error_e result, void *user_data);
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()
529 * @see nfc_manager_set_p2p_target_discovered_cb()
530 * @see nfc_manager_unset_p2p_target_discovered_cb()
532 typedef void (*nfc_p2p_target_discovered_cb)(nfc_discovered_type_e type, nfc_p2p_target_h target, void *user_data);
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()
540 * @see nfc_manager_set_se_event_cb()
541 * @see nfc_manager_unset_se_event_cb()
543 typedef void (*nfc_se_event_cb)(nfc_se_event_e event , void *user_data);
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()
556 * @see nfc_manager_set_se_transaction_event_cb()
557 * @see nfc_manager_unset_se_transaction_event_cb()
559 typedef void (*nfc_se_transaction_event_cb)(unsigned char* aid, int aid_size , unsigned char* param, int param_size, void *user_data);
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()
569 * @see nfc_p2p_send()
571 typedef void (*nfc_p2p_send_completed_cb)(nfc_error_e result, void *user_data);
575 * @brief Called after nfc_p2p_send() has completed.
576 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
578 * @remarks @a message will be automatically destroyed when the callback function returns. (Do not release @a message.)
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()
584 * @see nfc_p2p_set_data_received_cb()
585 * @see nfc_p2p_unset_data_received_cb()
587 typedef void (*nfc_p2p_data_recived_cb)(nfc_p2p_target_h target, nfc_ndef_message_h message, void *user_data);
591 * @brief Called after nfc_p2p_connection_handover() has completed.
592 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
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.
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()
604 * @see nfc_p2p_connection_handover()
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);
609 * @brief Gets the value that indicates whether NFC is supported.
610 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
612 * @remarks This function can executed Regardless of nfc_manager_initialize state.
614 * @return true on NFC supported, otherwise false
615 * @see nfc_manager_set_activation()
617 bool nfc_manager_is_supported(void);
620 * @brief Sets NFC Activation
621 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
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
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()
636 int nfc_manager_set_activation(bool activation, nfc_activation_completed_cb callback, void *user_data);
639 * @brief Set NFC Activation state changed callback
640 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
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
645 * @return 0 on success, otherwise a negative error value.
646 * @retval #NFC_ERROR_NONE Successful
647 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
649 * @see nfc_activation_changed_cb()
650 * @see nfc_manager_unset_activation_changed_cb()
652 int nfc_manager_set_activation_changed_cb(nfc_activation_changed_cb callback , void *user_data);
655 * @brief Unregisters the callback function.
656 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
658 * @see nfc_manager_set_activation_changed_cb()
659 * @see nfc_activation_changed_cb()
661 void nfc_manager_unset_activation_changed_cb(void);
665 * @brief Gets NFC Activation state
666 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
668 * @remarks This function can executed Regardless of nfc_manager_initialize state.
670 * @return true on NFC activated, otherwise false
671 * @see nfc_manager_set_activation()
674 bool nfc_manager_is_activated(void);
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.
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
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()
693 int nfc_manager_initialize(nfc_initialize_completed_cb callback, void *user_data);
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.
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()
709 int nfc_manager_initialize_sync();
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
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()
721 int nfc_manager_deinitialize(void);
724 * @brief Registers a callback function for receiving tag discovered notification.
725 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
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
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()
736 int nfc_manager_set_tag_discovered_cb(nfc_tag_discovered_cb callback, void *user_data);
739 * @brief Unregisters the callback function.
740 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
742 * @see nfc_manager_set_tag_discovered_cb()
743 * @see nfc_tag_discovered_cb()
745 void nfc_manager_unset_tag_discovered_cb(void);
748 * @brief Registers a callback function for receiving NDEF Message discovered notification
749 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
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
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()
760 int nfc_manager_set_ndef_discovered_cb(nfc_ndef_discovered_cb callback, void *user_data);
763 * @brief Unregisters the callback function.
764 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
766 * @see nfc_manager_set_ndef_discovered_cb()
767 * @see nfc_ndef_discovered_cb()
769 void nfc_manager_unset_ndef_discovered_cb(void);
772 * @brief Registers a callback function for receiving NFC peer-to-peer target discovered notification.
773 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
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
778 * @return 0 on success, otherwise a negative error value.
779 * @retval #NFC_ERROR_NONE Successful
780 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
782 * @see nfc_manager_unset_ndef_discovered_cb()
783 * @see nfc_p2p_target_discovered_cb()
785 int nfc_manager_set_p2p_target_discovered_cb(nfc_p2p_target_discovered_cb callback, void *user_data);
788 * @brief Unregisters the callback function.
789 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
791 * @see nfc_manager_set_p2p_target_discovered_cb()
792 * @see nfc_p2p_target_discovered_cb()
794 void nfc_manager_unset_p2p_target_discovered_cb(void);
798 * @brief Registers a callback function for receiving Secure Element (SIM/UICC(Universal Integrated Circuit Card)) event.
799 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
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
804 * @return 0 on success, otherwise a negative error value.
805 * @retval #NFC_ERROR_NONE Successful
806 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
808 * @see nfc_se_event_cb()
809 * @see nfc_manager_unset_se_event_cb()
812 int nfc_manager_set_se_event_cb(nfc_se_event_cb callback, void *user_data);
815 * @brief Unregisters the callback function.
816 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
818 * @see nfc_se_event_cb()
819 * @see nfc_manager_set_se_event_cb()
821 void nfc_manager_unset_se_event_cb(void);
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
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
830 * @return 0 on success, otherwise a negative error value.
831 * @retval #NFC_ERROR_NONE Successful
832 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
834 * @see nfc_se_transaction_event_cb()
835 * @see nfc_manager_unset_se_transaction_event_cb()
837 int nfc_manager_set_se_transaction_event_cb(nfc_se_transaction_event_cb callback, void *user_data);
840 * @brief Unregisters the callback function.
841 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
843 * @see nfc_se_transaction_event_cb()
844 * @see nfc_manager_set_se_transaction_event_cb()
846 void nfc_manager_unset_se_transaction_event_cb(void);
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
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
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
861 int nfc_manager_get_cached_message(nfc_ndef_message_h *ndef_message);
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.
872 * @param [in] filter The filter value with bits operation #nfc_tag_filter_e
874 * @see nfc_manager_get_tag_filter()
875 * @see nfc_tag_discovered_cb()
877 void nfc_manager_set_tag_filter(int filter);
880 * @brief Gets the current filter status.
881 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
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()
888 int nfc_manager_get_tag_filter(void);
891 * @brief Gets current connected tag.
892 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
894 * @param [out] tag The connected tag
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
902 int nfc_manager_get_connected_tag(nfc_tag_h *tag);
905 * @brief Gets current connected p2p target
906 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
908 * @param [out] target The connected target
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
916 int nfc_manager_get_connected_target(nfc_p2p_target_h *target);
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.
924 * @param [in] enable The state of enable
926 * @return 0 on success, otherwise a negative error value.
927 * @retval #NFC_ERROR_NONE Successful
928 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
930 * @see nfc_manager_is_system_handler_enabled()
932 int nfc_manager_set_system_handler_enable(bool enable);
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.
939 * @return true on enabled, otherwise false.
941 * @see nfc_manager_set_system_handler_enable()
943 bool nfc_manager_is_system_handler_enabled(void);
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.
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
955 * @return 0 on success, otherwise a negative error value.
956 * @retval #NFC_ERROR_NONE Successful
957 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
959 * @see nfc_manager_get_card_emulation_se_type()
961 int nfc_manager_set_card_emulation_se_type(nfc_se_type_e type, nfc_set_card_emulation_completed_cb callback, void* user_data);
964 * @brief Gets the card emulation Secure Element type
965 * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
967 * @param [out] type The type of Secure Element
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_set_card_emulation_se_type()
975 int nfc_manager_get_card_emulation_se_type(nfc_se_type_e* type);
978 * @brief Creates a record with given parameter value.
979 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
981 * @remarks Every data buffer is deeply copied.\n
982 * Every data is a byte array(binary data).
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
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()
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);
1006 * @brief Creates a record with text type payload
1007 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
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
1014 * - payload : encode and header information + language code + text \n
1015 * Defined in Record Type Definition Technical Specifications.
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
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()
1034 int nfc_ndef_record_create_text(nfc_ndef_record_h *record, const char *text, const char *lang_code, nfc_encode_type_e encode);
1037 * @brief Creates a record with URI type payload
1038 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
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
1044 * - payload : procotol scheme + uri\n
1045 * Defined in Record Type Definition Technical Specifications.
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
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()
1061 int nfc_ndef_record_create_uri(nfc_ndef_record_h* record, const char *uri);
1065 * @brief Creates a record with MIME type payload
1066 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
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.
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
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()
1092 int nfc_ndef_record_create_mime(nfc_ndef_record_h* record, const char *mime_type, const unsigned char *data, int data_size);
1096 * @brief Destroys the record handle
1097 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1099 * @param [in] record The handle to record
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()
1109 int nfc_ndef_record_destroy(nfc_ndef_record_h record);
1112 * @brief Sets record ID
1113 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1115 * @remarks The ID buffer are deep copied.
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()
1125 int nfc_ndef_record_set_id(nfc_ndef_record_h record, unsigned char *id, int id_size);
1128 * @brief Gets record ID
1129 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
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().
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
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()
1144 int nfc_ndef_record_get_id(nfc_ndef_record_h record, unsigned char **id, int *size);
1147 * @brief Gets record payload.
1148 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
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().
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
1157 * @return 0 on success, otherwise a negative error value.
1158 * @retval #NFC_ERROR_NONE Successful
1159 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1161 int nfc_ndef_record_get_payload(nfc_ndef_record_h record, unsigned char ** payload, int *size);
1164 * @brief Gets record type.
1165 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
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.
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
1174 * @return 0 on success, otherwise a negative error value.
1175 * @retval #NFC_ERROR_NONE Successful
1176 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1178 int nfc_ndef_record_get_type(nfc_ndef_record_h record, unsigned char **type, int *size);
1181 * @brief Gets record TNF(Type Name Format) value.
1182 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
1184 * @param [in] record The handle to record
1185 * @param [out] tnf The TNF(Type Name Format) value
1187 * @return 0 on success, otherwise a negative error value.
1188 * @retval #NFC_ERROR_NONE Successful
1189 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1191 int nfc_ndef_record_get_tnf(nfc_ndef_record_h record, nfc_record_tnf_e *tnf);
1194 * @brief Gets text from text record
1195 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
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"
1201 * @param [in] record The handle to record
1202 * @param [out] text The text in record payload ( should be freed by caller )
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()
1210 int nfc_ndef_record_get_text(nfc_ndef_record_h record, char **text);
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"
1219 * @param [in] record The handle to record
1220 * @param [out] lang_code lang code ( should be freed by caller )
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()
1228 int nfc_ndef_record_get_langcode(nfc_ndef_record_h record, char **lang_code);
1231 * @brief Gets encoding type from text record
1232 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
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"
1237 * @param [in] record The handle to record
1238 * @param [out] encode encode type #nfc_encode_type_e
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()
1246 int nfc_ndef_record_get_encode_type(nfc_ndef_record_h record, nfc_encode_type_e *encode);
1249 * @brief Gets URI from uri record
1250 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
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"
1256 * @param [in] record The handle to record
1257 * @param [out] uri The uri in record payload ( should be freed by caller )
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()
1265 int nfc_ndef_record_get_uri(nfc_ndef_record_h record, char **uri);
1269 * @brief Gets mime type from mime type record
1270 * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
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.
1276 * @param [in] record The handle to record
1277 * @param [out] mime_type The mime type in record payload ( should be freed by caller )
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()
1285 int nfc_ndef_record_get_mime_type(nfc_ndef_record_h record, char **mime_type);
1289 * @brief Creates NDEF message handle
1290 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1292 * @param [out] ndef_message A handle to NDEF message
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()
1302 int nfc_ndef_message_create(nfc_ndef_message_h *ndef_message);
1305 * @brief Creates NDEF message handle from raw serial bytes.
1306 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
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.
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
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()
1324 int nfc_ndef_message_create_from_rawdata(nfc_ndef_message_h *ndef_message, const unsigned char *rawdata, int rawdata_size);
1327 * @brief Destroys NDEF message handle
1328 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1330 * @remarks This function will free all these memory including record handles.
1332 * @param [in] ndef_message The handle to NDEF message to destroy
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()
1340 int nfc_ndef_message_destroy(nfc_ndef_message_h ndef_message);
1343 * @brief Gets the number of record in NDEF message
1344 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1346 * @param [in] ndef_message The handle to NDEF message
1347 * @param [out] count The number of record
1349 * @return 0 on success, otherwise a negative error value.
1350 * @retval #NFC_ERROR_NONE Successful
1351 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1354 int nfc_ndef_message_get_record_count(nfc_ndef_message_h ndef_message, int *count);
1357 * @brief Gets serial bytes array of NDEF message.
1358 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1360 * @remarks It gets copy of the rawdata bytes from NDEF message. @a rawdata must be released with free() by you.
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
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
1372 * @see nfc_ndef_message_create_from_rawdata()
1374 int nfc_ndef_message_get_rawdata(nfc_ndef_message_h ndef_message, unsigned char **rawdata, int *rawdata_size);
1377 * @brief Appends a record into NDEF message
1378 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1380 * @remarks Appended record is handled by frameworks. The record is released by frameworks when message is released.
1382 * @param [in] ndef_message The handle to NDEF message
1383 * @param [in] record The record that will be appended into NDEF message
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()
1391 int nfc_ndef_message_append_record(nfc_ndef_message_h ndef_message, nfc_ndef_record_h record);
1394 * @brief Inserts a record at index into NDEF message
1395 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
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()
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
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()
1411 int nfc_ndef_message_insert_record(nfc_ndef_message_h ndef_message, int index, nfc_ndef_record_h record);
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
1417 * @param [in] ndef_message The handle to NDEF message
1418 * @param [in] index The index of record ( starts from 0 )
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()
1427 int nfc_ndef_message_remove_record(nfc_ndef_message_h ndef_message, int index);
1430 * @brief Gets record by index.
1431 * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
1433 * @remarks This function just return the pointer of record. if you change the record value it directly affects the NDEF message
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
1439 * @return 0 on success, otherwise a negative error value.
1440 * @retval #NFC_ERROR_NONE Successful
1441 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1444 int nfc_ndef_message_get_record(nfc_ndef_message_h ndef_message, int index, nfc_ndef_record_h *record);
1447 * @brief Gets the type of NFC tag
1448 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1450 * @param [in] tag The handle to NFC tag
1451 * @param [out] type The type of NFC tag
1453 * @return 0 on success, otherwise a negative error value.
1454 * @retval #NFC_ERROR_NONE Successful
1455 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1458 int nfc_tag_get_type(nfc_tag_h tag, nfc_tag_type_e *type);
1461 * @brief Checks whether the given NFC tag supports NDEF messages.
1462 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
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
1467 * @return 0 on success, otherwise a negative error value.
1468 * @retval #NFC_ERROR_NONE Successful
1469 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1471 * @see nfc_tag_read_ndef()
1473 int nfc_tag_is_support_ndef(nfc_tag_h tag, bool *is_supported);
1476 * @brief Gets the maximum NDEF message size that can be stored in NFC tag.
1477 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
1479 * @remarks This max size indicates the maximum size of NDEF message that can be stored in this detected tag.
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.
1484 * @return 0 on success, otherwise a negative error value.
1485 * @retval #NFC_ERROR_NONE Successful
1486 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1489 int nfc_tag_get_maximum_ndef_size(nfc_tag_h tag, unsigned int *maximum_ndef_bytes_size);
1492 * @brief Gets size of NDEF message that stored in the tag
1493 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
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
1498 * @return 0 on success, otherwise a negative error value.
1499 * @retval #NFC_ERROR_NONE Successful
1500 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1503 int nfc_tag_get_ndef_size(nfc_tag_h tag, unsigned int *ndef_bytes_size);
1507 * @brief Retrieves all tag information
1508 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
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
1514 * @return 0 on success, otherwise a negative error value.
1515 * @retval #NFC_ERROR_NONE Successful
1516 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1519 int nfc_tag_foreach_information(nfc_tag_h tag, nfc_tag_information_cb callback, void *user_data);
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
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
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
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()
1548 int nfc_tag_transceive(nfc_tag_h tag, unsigned char *buffer, int buffer_size, nfc_tag_transceive_completed_cb callback, void *user_data);
1551 * @brief Reads NDEF formatted data from NFC tag.
1552 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
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
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
1568 * @post It invokes nfc_tag_read_completed_cb() when it has completed to read NDEF formatted data.
1570 * @see nfc_tag_transceive()
1571 * @see nfc_tag_is_support_ndef()
1572 * @see nfc_tag_write_ndef()
1574 int nfc_tag_read_ndef(nfc_tag_h tag, nfc_tag_read_completed_cb callback, void *user_data);
1577 * @brief Writes NDEF formatted data.
1578 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
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
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
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
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()
1600 int nfc_tag_write_ndef(nfc_tag_h tag, nfc_ndef_message_h msg, nfc_tag_write_completed_cb callback, void *user_data);
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
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
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
1623 * @post It invokes nfc_tag_format_completed_cb() when it has completed to format the NFC tag.
1625 * @see nfc_tag_is_support_ndef()
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);
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
1635 * MIFARE CLASSIC MINI \n
1636 * => 0 ~ 4 : 5 sectors having 4 block each with block size of 16 bytes \n
1638 * MIFARE CLASSIC 1K \n
1639 * => 0 ~ 15 : 16 sectors having 4 block each with block size of 16 bytes \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
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
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
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()
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);
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
1678 * MIFARE CLASSIC MINI\n
1679 * => 0 ~ 4 : 5 sector and 4 block with 16 bytes\n
1681 * MIFARE CLASSIC 1K \n
1682 * => 0 ~ 15 : 16 sector and 4 block with 16 bytes\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
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
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
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()
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);
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.
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
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
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()
1738 int nfc_mifare_read_block(nfc_tag_h tag, int block_index, nfc_mifare_read_block_completed_cb callback, void *user_data);
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.
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
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_read_page_completed_cb() when it has completed to read a page.
1762 * @see nfc_mifare_read_block()
1763 * @see nfc_mifare_write_page()
1765 int nfc_mifare_read_page(nfc_tag_h tag, int page_index, nfc_mifare_read_page_completed_cb callback, void *user_data);
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.
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
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
1789 * @post It invokes nfc_mifare_write_block_completed_cb() when it hase completed to write a block.
1791 * @see nfc_mifare_write_page()
1792 * @see nfc_mifare_read_block()
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);
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
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
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
1817 * @post It invokes nfc_mifare_write_page_completed_cb() when it has completed to write a page.
1819 * @see nfc_mifare_write_block()
1820 * @see nfc_mifare_read_page()
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);
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
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
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
1845 * @see nfc_mifare_decrement()
1846 * @see nfc_mifare_write_block()
1848 int nfc_mifare_increment(nfc_tag_h tag, int block_index, int value, nfc_mifare_increment_completed_cb callback, void *user_data);
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
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
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
1870 * @see nfc_mifare_increment()
1871 * @see nfc_mifare_write_block()
1873 int nfc_mifare_decrement(nfc_tag_h tag, int block_index, int value, nfc_mifare_decrement_completed_cb callback, void *user_data);
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
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
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
1894 * @see nfc_mifare_restore()
1896 int nfc_mifare_transfer(nfc_tag_h tag, int block_index, nfc_mifare_transfer_completed_cb callback, void *user_data);
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
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
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
1917 * @see nfc_mifare_transfer()
1919 int nfc_mifare_restore(nfc_tag_h tag, int block_index, nfc_mifare_restore_completed_cb callback, void *user_data);
1923 * @brief Registers a callback function for receiving data from NFC peer-to-peer target.
1924 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
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
1930 * @return 0 on success, otherwise a negative error value.
1931 * @retval #NFC_ERROR_NONE Successful
1932 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1934 * @see nfc_p2p_unset_data_received_cb()
1935 * @see nfc_p2p_data_recived_cb()
1936 * @see nfc_p2p_target_discovered_cb()
1938 int nfc_p2p_set_data_received_cb(nfc_p2p_target_h target, nfc_p2p_data_recived_cb callback, void *user_data);
1941 * @brief Unregisters the callback function.
1942 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
1944 * @param [in] target The handle to peer target
1946 * @return 0 on success, otherwise a negative error value.
1947 * @retval #NFC_ERROR_NONE Successful
1948 * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
1950 * @see nfc_p2p_set_data_received_cb()
1951 * @see nfc_p2p_data_recived_cb()
1952 * @see nfc_p2p_target_discovered_cb()
1954 int nfc_p2p_unset_data_received_cb(nfc_p2p_target_h target);
1957 * @brief Sends data to NFC peer-to-peer target
1958 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
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
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
1973 * @see nfc_p2p_send_completed_cb()
1974 * @see @see nfc_p2p_target_discovered_cb()
1976 int nfc_p2p_send(nfc_p2p_target_h target, nfc_ndef_message_h message, nfc_p2p_send_completed_cb callback, void *user_data);
1982 * @brief NFC Connetionhandover between NFC peer-to-peer target
1983 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
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
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
1998 * @see nfc_p2p_connection_handover_completed_cb()
1999 * @see @see nfc_p2p_connection_handover_completed_cb()
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);
2007 * @brief Check available Alternative Carrior(AC) for NFC handover between NFC peer-to-peer target
2008 * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
2010 * @param [in] carrior Alternative Carrior whan to be checked whether supported or not
2012 * @retval #true Supported
2013 * @retval #false Not Supported
2015 * @see nfc_p2p_is_supported_ac_type()
2018 bool nfc_p2p_is_supported_ac_type( nfc_ac_type_e carrior);
2026 #endif /* __NFC_H__ */